Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/HTML/QuickForm.php18
-rw-r--r--libs/HTML/QuickForm/Renderer/Array.php4
-rw-r--r--libs/HTML/QuickForm/Renderer/ArraySmarty.php4
-rw-r--r--libs/HTML/QuickForm/Renderer/Default.php2
-rw-r--r--libs/HTML/QuickForm/Renderer/ITDynamic.php2
-rw-r--r--libs/HTML/QuickForm/Renderer/ITStatic.php4
-rw-r--r--libs/HTML/QuickForm/Renderer/Object.php26
-rw-r--r--libs/HTML/QuickForm/Renderer/ObjectFlexy.php7
-rw-r--r--libs/HTML/QuickForm/Renderer/QuickHtml.php2
-rw-r--r--libs/HTML/QuickForm/Rule/Callback.php4
-rw-r--r--libs/HTML/QuickForm/Rule/Compare.php2
-rw-r--r--libs/HTML/QuickForm/Rule/Email.php4
-rw-r--r--libs/HTML/QuickForm/Rule/Range.php4
-rw-r--r--libs/HTML/QuickForm/Rule/Regex.php4
-rw-r--r--libs/HTML/QuickForm/Rule/Required.php2
-rw-r--r--libs/HTML/QuickForm/RuleRegistry.php2
-rw-r--r--libs/HTML/QuickForm/advcheckbox.php2
-rw-r--r--libs/HTML/QuickForm/autocomplete.php2
-rw-r--r--libs/HTML/QuickForm/button.php2
-rw-r--r--libs/HTML/QuickForm/checkbox.php2
-rw-r--r--libs/HTML/QuickForm/date.php6
-rw-r--r--libs/HTML/QuickForm/element.php4
-rw-r--r--libs/HTML/QuickForm/file.php2
-rw-r--r--libs/HTML/QuickForm/group.php4
-rw-r--r--libs/HTML/QuickForm/header.php2
-rw-r--r--libs/HTML/QuickForm/hidden.php2
-rw-r--r--libs/HTML/QuickForm/hiddenselect.php2
-rw-r--r--libs/HTML/QuickForm/hierselect.php6
-rw-r--r--libs/HTML/QuickForm/html.php2
-rw-r--r--libs/HTML/QuickForm/image.php2
-rw-r--r--libs/HTML/QuickForm/input.php2
-rw-r--r--libs/HTML/QuickForm/link.php2
-rw-r--r--libs/HTML/QuickForm/password.php2
-rw-r--r--libs/HTML/QuickForm/radio.php2
-rw-r--r--libs/HTML/QuickForm/reset.php2
-rw-r--r--libs/HTML/QuickForm/select.php131
-rw-r--r--libs/HTML/QuickForm/static.php2
-rw-r--r--libs/HTML/QuickForm/submit.php2
-rw-r--r--libs/HTML/QuickForm/text.php2
-rw-r--r--libs/HTML/QuickForm/textarea.php2
-rw-r--r--libs/HTML/QuickForm/xbutton.php2
-rw-r--r--libs/PclZip/pclzip.lib.php1090
-rw-r--r--libs/Smarty/Config_File.class.php2
-rw-r--r--libs/Smarty/Smarty.class.php24
-rw-r--r--libs/Smarty/Smarty_Compiler.class.php51
-rw-r--r--libs/Smarty/plugins/function.cycle.php6
-rw-r--r--libs/Smarty/plugins/function.math.php4
-rw-r--r--libs/Smarty/plugins/outputfilter.trimwhitespace.php11
-rw-r--r--libs/UserAgentParser/README11
-rw-r--r--libs/UserAgentParser/UserAgentParser.php452
-rw-r--r--libs/Zend/Auth.php12
-rw-r--r--libs/Zend/Auth/Adapter/DbTable.php57
-rw-r--r--libs/Zend/Auth/Adapter/Digest.php16
-rw-r--r--libs/Zend/Auth/Adapter/Exception.php12
-rw-r--r--libs/Zend/Auth/Adapter/Http.php38
-rw-r--r--libs/Zend/Auth/Adapter/Http/Resolver/Exception.php8
-rw-r--r--libs/Zend/Auth/Adapter/Http/Resolver/File.php20
-rw-r--r--libs/Zend/Auth/Adapter/Http/Resolver/Interface.php6
-rw-r--r--libs/Zend/Auth/Adapter/InfoCard.php12
-rw-r--r--libs/Zend/Auth/Adapter/Interface.php8
-rw-r--r--libs/Zend/Auth/Adapter/Ldap.php56
-rw-r--r--libs/Zend/Auth/Adapter/OpenId.php10
-rw-r--r--libs/Zend/Auth/Exception.php8
-rw-r--r--libs/Zend/Auth/Result.php6
-rw-r--r--libs/Zend/Auth/Storage/Exception.php12
-rw-r--r--libs/Zend/Auth/Storage/Interface.php11
-rw-r--r--libs/Zend/Auth/Storage/NonPersistent.php13
-rw-r--r--libs/Zend/Auth/Storage/Session.php14
-rw-r--r--libs/Zend/Cache.php39
-rw-r--r--libs/Zend/Cache/Backend.php82
-rw-r--r--libs/Zend/Cache/Backend/Apc.php60
-rw-r--r--libs/Zend/Cache/Backend/BlackHole.php250
-rw-r--r--libs/Zend/Cache/Backend/ExtendedInterface.php36
-rw-r--r--libs/Zend/Cache/Backend/File.php25
-rw-r--r--libs/Zend/Cache/Backend/Interface.php6
-rw-r--r--libs/Zend/Cache/Backend/Memcached.php74
-rw-r--r--libs/Zend/Cache/Backend/Sqlite.php10
-rw-r--r--libs/Zend/Cache/Backend/Static.php558
-rw-r--r--libs/Zend/Cache/Backend/Test.php162
-rw-r--r--libs/Zend/Cache/Backend/TwoLevels.php59
-rw-r--r--libs/Zend/Cache/Backend/Xcache.php12
-rw-r--r--libs/Zend/Cache/Backend/ZendPlatform.php10
-rw-r--r--libs/Zend/Cache/Backend/ZendServer.php10
-rw-r--r--libs/Zend/Cache/Backend/ZendServer/Disk.php28
-rw-r--r--libs/Zend/Cache/Backend/ZendServer/ShMem.php10
-rw-r--r--libs/Zend/Cache/Core.php139
-rw-r--r--libs/Zend/Cache/Exception.php8
-rw-r--r--libs/Zend/Cache/Frontend/Capture.php87
-rw-r--r--libs/Zend/Cache/Frontend/Class.php19
-rw-r--r--libs/Zend/Cache/Frontend/File.php110
-rw-r--r--libs/Zend/Cache/Frontend/Function.php21
-rw-r--r--libs/Zend/Cache/Frontend/Output.php8
-rw-r--r--libs/Zend/Cache/Frontend/Page.php16
-rw-r--r--libs/Zend/Cache/Manager.php286
-rw-r--r--libs/Zend/Config.php58
-rw-r--r--libs/Zend/Config/Exception.php8
-rw-r--r--libs/Zend/Config/Ini.php71
-rw-r--r--libs/Zend/Config/Writer.php24
-rw-r--r--libs/Zend/Config/Writer/Array.php103
-rw-r--r--libs/Zend/Config/Writer/FileAbstract.php134
-rw-r--r--libs/Zend/Config/Writer/Ini.php137
-rw-r--r--libs/Zend/Config/Writer/Xml.php131
-rw-r--r--libs/Zend/Config/Xml.php59
-rw-r--r--libs/Zend/Db.php20
-rw-r--r--libs/Zend/Db/Adapter/Abstract.php38
-rw-r--r--libs/Zend/Db/Adapter/Db2.php46
-rw-r--r--libs/Zend/Db/Adapter/Db2/Exception.php14
-rw-r--r--libs/Zend/Db/Adapter/Exception.php21
-rw-r--r--libs/Zend/Db/Adapter/Mysqli.php38
-rw-r--r--libs/Zend/Db/Adapter/Mysqli/Exception.php8
-rw-r--r--libs/Zend/Db/Adapter/Oracle.php40
-rw-r--r--libs/Zend/Db/Adapter/Oracle/Exception.php8
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Abstract.php46
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Ibm.php22
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Ibm/Db2.php14
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Ibm/Ids.php14
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Mssql.php90
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Mysql.php12
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Oci.php14
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Pgsql.php18
-rw-r--r--libs/Zend/Db/Adapter/Pdo/Sqlite.php22
-rw-r--r--libs/Zend/Db/Adapter/Sqlsrv.php93
-rw-r--r--libs/Zend/Db/Adapter/Sqlsrv/Exception.php10
-rw-r--r--libs/Zend/Db/Exception.php8
-rw-r--r--libs/Zend/Db/Expr.php6
-rw-r--r--libs/Zend/Db/Profiler.php31
-rw-r--r--libs/Zend/Db/Profiler/Exception.php8
-rw-r--r--libs/Zend/Db/Profiler/Firebug.php42
-rw-r--r--libs/Zend/Db/Profiler/Query.php6
-rw-r--r--libs/Zend/Db/Select.php85
-rw-r--r--libs/Zend/Db/Select/Exception.php8
-rw-r--r--libs/Zend/Db/Statement.php30
-rw-r--r--libs/Zend/Db/Statement/Db2.php28
-rw-r--r--libs/Zend/Db/Statement/Db2/Exception.php8
-rw-r--r--libs/Zend/Db/Statement/Exception.php31
-rw-r--r--libs/Zend/Db/Statement/Interface.php6
-rw-r--r--libs/Zend/Db/Statement/Mysqli.php32
-rw-r--r--libs/Zend/Db/Statement/Mysqli/Exception.php8
-rw-r--r--libs/Zend/Db/Statement/Oracle.php38
-rw-r--r--libs/Zend/Db/Statement/Oracle/Exception.php8
-rw-r--r--libs/Zend/Db/Statement/Pdo.php52
-rw-r--r--libs/Zend/Db/Statement/Pdo/Ibm.php10
-rw-r--r--libs/Zend/Db/Statement/Pdo/Oci.php30
-rw-r--r--libs/Zend/Db/Statement/Sqlsrv.php25
-rw-r--r--libs/Zend/Db/Statement/Sqlsrv/Exception.php8
-rw-r--r--libs/Zend/Db/Table.php27
-rw-r--r--libs/Zend/Db/Table/Abstract.php100
-rw-r--r--libs/Zend/Db/Table/Definition.php26
-rw-r--r--libs/Zend/Db/Table/Exception.php8
-rw-r--r--libs/Zend/Db/Table/Row.php8
-rw-r--r--libs/Zend/Db/Table/Row/Abstract.php130
-rw-r--r--libs/Zend/Db/Table/Row/Exception.php8
-rw-r--r--libs/Zend/Db/Table/Rowset.php8
-rw-r--r--libs/Zend/Db/Table/Rowset/Abstract.php20
-rw-r--r--libs/Zend/Db/Table/Rowset/Exception.php8
-rw-r--r--libs/Zend/Db/Table/Select.php14
-rw-r--r--libs/Zend/Db/Table/Select/Exception.php8
-rw-r--r--libs/Zend/Exception.php82
-rw-r--r--libs/Zend/Feed.php44
-rw-r--r--libs/Zend/Feed/Abstract.php18
-rw-r--r--libs/Zend/Feed/Atom.php18
-rw-r--r--libs/Zend/Feed/Builder.php28
-rw-r--r--libs/Zend/Feed/Builder/Entry.php10
-rw-r--r--libs/Zend/Feed/Builder/Exception.php8
-rw-r--r--libs/Zend/Feed/Builder/Header.php32
-rw-r--r--libs/Zend/Feed/Builder/Header/Itunes.php26
-rw-r--r--libs/Zend/Feed/Builder/Interface.php6
-rw-r--r--libs/Zend/Feed/Element.php40
-rw-r--r--libs/Zend/Feed/Entry/Abstract.php18
-rw-r--r--libs/Zend/Feed/Entry/Atom.php32
-rw-r--r--libs/Zend/Feed/Entry/Rss.php10
-rw-r--r--libs/Zend/Feed/Exception.php8
-rw-r--r--libs/Zend/Feed/Pubsubhubbub.php152
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/CallbackAbstract.php307
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/CallbackInterface.php68
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/Exception.php33
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/HttpResponse.php233
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php64
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/Model/Subscription.php131
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php64
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/Publisher.php417
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/Subscriber.php856
-rw-r--r--libs/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php328
-rw-r--r--libs/Zend/Feed/Reader.php173
-rw-r--r--libs/Zend/Feed/Reader/Collection.php33
-rw-r--r--libs/Zend/Feed/Reader/Collection/Author.php51
-rw-r--r--libs/Zend/Feed/Reader/Collection/Category.php57
-rw-r--r--libs/Zend/Feed/Reader/Collection/CollectionAbstract.php41
-rw-r--r--libs/Zend/Feed/Reader/Entry/Atom.php61
-rw-r--r--libs/Zend/Feed/Reader/Entry/Rss.php172
-rw-r--r--libs/Zend/Feed/Reader/EntryAbstract.php28
-rw-r--r--libs/Zend/Feed/Reader/EntryInterface.php13
-rw-r--r--libs/Zend/Feed/Reader/Extension/Atom/Entry.php291
-rw-r--r--libs/Zend/Feed/Reader/Extension/Atom/Feed.php210
-rw-r--r--libs/Zend/Feed/Reader/Extension/Content/Entry.php17
-rw-r--r--libs/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php10
-rw-r--r--libs/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php10
-rw-r--r--libs/Zend/Feed/Reader/Extension/DublinCore/Entry.php66
-rw-r--r--libs/Zend/Feed/Reader/Extension/DublinCore/Feed.php72
-rw-r--r--libs/Zend/Feed/Reader/Extension/EntryAbstract.php23
-rw-r--r--libs/Zend/Feed/Reader/Extension/FeedAbstract.php43
-rw-r--r--libs/Zend/Feed/Reader/Extension/Podcast/Entry.php10
-rw-r--r--libs/Zend/Feed/Reader/Extension/Podcast/Feed.php8
-rw-r--r--libs/Zend/Feed/Reader/Extension/Slash/Entry.php12
-rw-r--r--libs/Zend/Feed/Reader/Extension/Syndication/Feed.php22
-rw-r--r--libs/Zend/Feed/Reader/Extension/Thread/Entry.php12
-rw-r--r--libs/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php12
-rw-r--r--libs/Zend/Feed/Reader/Feed/Atom.php100
-rw-r--r--libs/Zend/Feed/Reader/Feed/Atom/Source.php102
-rw-r--r--libs/Zend/Feed/Reader/Feed/Rss.php298
-rw-r--r--libs/Zend/Feed/Reader/FeedAbstract.php83
-rw-r--r--libs/Zend/Feed/Reader/FeedInterface.php13
-rw-r--r--libs/Zend/Feed/Reader/FeedSet.php148
-rw-r--r--libs/Zend/Feed/Rss.php28
-rw-r--r--libs/Zend/Feed/Writer.php267
-rw-r--r--libs/Zend/Feed/Writer/Deleted.php202
-rw-r--r--libs/Zend/Feed/Writer/Entry.php761
-rw-r--r--libs/Zend/Feed/Writer/Exception/InvalidMethodException.php41
-rw-r--r--libs/Zend/Feed/Writer/Extension/Atom/Renderer/Feed.php123
-rw-r--r--libs/Zend/Feed/Writer/Extension/Content/Renderer/Entry.php92
-rw-r--r--libs/Zend/Feed/Writer/Extension/DublinCore/Renderer/Entry.php96
-rw-r--r--libs/Zend/Feed/Writer/Extension/DublinCore/Renderer/Feed.php96
-rw-r--r--libs/Zend/Feed/Writer/Extension/ITunes/Entry.php242
-rw-r--r--libs/Zend/Feed/Writer/Extension/ITunes/Feed.php361
-rw-r--r--libs/Zend/Feed/Writer/Extension/ITunes/Renderer/Entry.php216
-rw-r--r--libs/Zend/Feed/Writer/Extension/ITunes/Renderer/Feed.php320
-rw-r--r--libs/Zend/Feed/Writer/Extension/RendererAbstract.php179
-rw-r--r--libs/Zend/Feed/Writer/Extension/RendererInterface.php59
-rw-r--r--libs/Zend/Feed/Writer/Extension/Slash/Renderer/Entry.php91
-rw-r--r--libs/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.php145
-rw-r--r--libs/Zend/Feed/Writer/Extension/WellFormedWeb/Renderer/Entry.php96
-rw-r--r--libs/Zend/Feed/Writer/Feed.php281
-rw-r--r--libs/Zend/Feed/Writer/Feed/FeedAbstract.php805
-rw-r--r--libs/Zend/Feed/Writer/Renderer/Entry/Atom.php410
-rw-r--r--libs/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php121
-rw-r--r--libs/Zend/Feed/Writer/Renderer/Entry/Rss.php346
-rw-r--r--libs/Zend/Feed/Writer/Renderer/Feed/Atom.php130
-rw-r--r--libs/Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php427
-rw-r--r--libs/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php110
-rw-r--r--libs/Zend/Feed/Writer/Renderer/Feed/Rss.php505
-rw-r--r--libs/Zend/Feed/Writer/Renderer/RendererAbstract.php250
-rw-r--r--libs/Zend/Feed/Writer/Renderer/RendererInterface.php111
-rw-r--r--libs/Zend/Feed/Writer/Source.php33
-rw-r--r--libs/Zend/Http/Client.php208
-rw-r--r--libs/Zend/Http/Client/Adapter/Curl.php180
-rw-r--r--libs/Zend/Http/Client/Adapter/Exception.php8
-rw-r--r--libs/Zend/Http/Client/Adapter/Interface.php6
-rw-r--r--libs/Zend/Http/Client/Adapter/Proxy.php29
-rw-r--r--libs/Zend/Http/Client/Adapter/Socket.php175
-rw-r--r--libs/Zend/Http/Client/Adapter/Stream.php46
-rw-r--r--libs/Zend/Http/Client/Adapter/Test.php45
-rw-r--r--libs/Zend/Http/Client/Exception.php8
-rw-r--r--libs/Zend/Http/Cookie.php62
-rw-r--r--libs/Zend/Http/CookieJar.php22
-rw-r--r--libs/Zend/Http/Exception.php8
-rw-r--r--libs/Zend/Http/Response.php18
-rw-r--r--libs/Zend/Http/Response/Stream.php235
-rw-r--r--libs/Zend/Loader.php89
-rw-r--r--libs/Zend/Loader/Autoloader.php88
-rw-r--r--libs/Zend/Loader/Autoloader/Interface.php8
-rw-r--r--libs/Zend/Loader/Autoloader/Resource.php141
-rw-r--r--libs/Zend/Loader/Exception.php12
-rw-r--r--libs/Zend/Loader/PluginLoader.php62
-rw-r--r--libs/Zend/Loader/PluginLoader/Exception.php8
-rw-r--r--libs/Zend/Loader/PluginLoader/Interface.php12
-rw-r--r--libs/Zend/Log.php237
-rw-r--r--libs/Zend/Log/Exception.php10
-rw-r--r--libs/Zend/Log/FactoryInterface.php38
-rw-r--r--libs/Zend/Log/Filter/Abstract.php60
-rw-r--r--libs/Zend/Log/Filter/Interface.php9
-rw-r--r--libs/Zend/Log/Filter/Message.php36
-rw-r--r--libs/Zend/Log/Filter/Priority.php47
-rw-r--r--libs/Zend/Log/Filter/Suppress.php23
-rw-r--r--libs/Zend/Log/Formatter/Firebug.php12
-rw-r--r--libs/Zend/Log/Formatter/Interface.php8
-rw-r--r--libs/Zend/Log/Formatter/Simple.php12
-rw-r--r--libs/Zend/Log/Formatter/Xml.php47
-rw-r--r--libs/Zend/Log/Writer/Abstract.php36
-rw-r--r--libs/Zend/Log/Writer/Db.php42
-rw-r--r--libs/Zend/Log/Writer/Firebug.php74
-rw-r--r--libs/Zend/Log/Writer/Mail.php26
-rw-r--r--libs/Zend/Log/Writer/Mock.php24
-rw-r--r--libs/Zend/Log/Writer/Null.php25
-rw-r--r--libs/Zend/Log/Writer/Stream.php55
-rw-r--r--libs/Zend/Log/Writer/Syslog.php20
-rw-r--r--libs/Zend/Log/Writer/ZendMonitor.php111
-rw-r--r--libs/Zend/Mail.php356
-rw-r--r--libs/Zend/Mail/Exception.php8
-rw-r--r--libs/Zend/Mail/Message.php12
-rw-r--r--libs/Zend/Mail/Message/File.php12
-rw-r--r--libs/Zend/Mail/Message/Interface.php8
-rw-r--r--libs/Zend/Mail/Part.php26
-rw-r--r--libs/Zend/Mail/Part/File.php34
-rw-r--r--libs/Zend/Mail/Part/Interface.php10
-rw-r--r--libs/Zend/Mail/Protocol/Abstract.php94
-rw-r--r--libs/Zend/Mail/Protocol/Exception.php10
-rw-r--r--libs/Zend/Mail/Protocol/Imap.php33
-rw-r--r--libs/Zend/Mail/Protocol/Pop3.php29
-rw-r--r--libs/Zend/Mail/Protocol/Smtp.php30
-rw-r--r--libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php10
-rw-r--r--libs/Zend/Mail/Protocol/Smtp/Auth/Login.php10
-rw-r--r--libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php10
-rw-r--r--libs/Zend/Mail/Storage.php6
-rw-r--r--libs/Zend/Mail/Storage/Abstract.php14
-rw-r--r--libs/Zend/Mail/Storage/Exception.php10
-rw-r--r--libs/Zend/Mail/Storage/Folder.php10
-rw-r--r--libs/Zend/Mail/Storage/Folder/Interface.php8
-rw-r--r--libs/Zend/Mail/Storage/Folder/Maildir.php32
-rw-r--r--libs/Zend/Mail/Storage/Folder/Mbox.php30
-rw-r--r--libs/Zend/Mail/Storage/Imap.php64
-rw-r--r--libs/Zend/Mail/Storage/Maildir.php42
-rw-r--r--libs/Zend/Mail/Storage/Mbox.php32
-rw-r--r--libs/Zend/Mail/Storage/Pop3.php24
-rw-r--r--libs/Zend/Mail/Storage/Writable/Interface.php8
-rw-r--r--libs/Zend/Mail/Storage/Writable/Maildir.php148
-rw-r--r--libs/Zend/Mail/Transport/Abstract.php18
-rw-r--r--libs/Zend/Mail/Transport/Exception.php10
-rw-r--r--libs/Zend/Mail/Transport/Sendmail.php75
-rw-r--r--libs/Zend/Mail/Transport/Smtp.php32
-rw-r--r--libs/Zend/Mime.php6
-rw-r--r--libs/Zend/Mime/Decode.php8
-rw-r--r--libs/Zend/Mime/Exception.php8
-rw-r--r--libs/Zend/Mime/Message.php12
-rw-r--r--libs/Zend/Mime/Part.php14
-rw-r--r--libs/Zend/Registry.php22
-rw-r--r--libs/Zend/Session.php76
-rw-r--r--libs/Zend/Session/Abstract.php12
-rw-r--r--libs/Zend/Session/Exception.php8
-rw-r--r--libs/Zend/Session/Namespace.php60
-rw-r--r--libs/Zend/Session/SaveHandler/DbTable.php36
-rw-r--r--libs/Zend/Session/SaveHandler/Exception.php8
-rw-r--r--libs/Zend/Session/SaveHandler/Interface.php6
-rw-r--r--libs/Zend/Session/Validator/Abstract.php8
-rw-r--r--libs/Zend/Session/Validator/HttpUserAgent.php8
-rw-r--r--libs/Zend/Session/Validator/Interface.php6
-rw-r--r--libs/Zend/Uri.php85
-rw-r--r--libs/Zend/Uri/Exception.php8
-rw-r--r--libs/Zend/Uri/Http.php89
-rw-r--r--libs/Zend/Validate.php90
-rw-r--r--libs/Zend/Validate/Abstract.php42
-rw-r--r--libs/Zend/Validate/Alnum.php32
-rw-r--r--libs/Zend/Validate/Alpha.php30
-rw-r--r--libs/Zend/Validate/Barcode.php182
-rw-r--r--libs/Zend/Validate/Barcode/AdapterAbstract.php315
-rw-r--r--libs/Zend/Validate/Barcode/AdapterInterface.php68
-rw-r--r--libs/Zend/Validate/Barcode/Code25.php64
-rw-r--r--libs/Zend/Validate/Barcode/Code25interleaved.php64
-rw-r--r--libs/Zend/Validate/Barcode/Code39.php100
-rw-r--r--libs/Zend/Validate/Barcode/Code39ext.php58
-rw-r--r--libs/Zend/Validate/Barcode/Code93.php120
-rw-r--r--libs/Zend/Validate/Barcode/Code93ext.php58
-rw-r--r--libs/Zend/Validate/Barcode/Ean12.php52
-rw-r--r--libs/Zend/Validate/Barcode/Ean13.php88
-rw-r--r--libs/Zend/Validate/Barcode/Ean14.php52
-rw-r--r--libs/Zend/Validate/Barcode/Ean18.php52
-rw-r--r--libs/Zend/Validate/Barcode/Ean2.php58
-rw-r--r--libs/Zend/Validate/Barcode/Ean5.php58
-rw-r--r--libs/Zend/Validate/Barcode/Ean8.php69
-rw-r--r--libs/Zend/Validate/Barcode/Gtin12.php52
-rw-r--r--libs/Zend/Validate/Barcode/Gtin13.php52
-rw-r--r--libs/Zend/Validate/Barcode/Gtin14.php52
-rw-r--r--libs/Zend/Validate/Barcode/Identcode.php52
-rw-r--r--libs/Zend/Validate/Barcode/Intelligentmail.php58
-rw-r--r--libs/Zend/Validate/Barcode/Issn.php119
-rw-r--r--libs/Zend/Validate/Barcode/Itf14.php52
-rw-r--r--libs/Zend/Validate/Barcode/Leitcode.php52
-rw-r--r--libs/Zend/Validate/Barcode/Planet.php52
-rw-r--r--libs/Zend/Validate/Barcode/Postnet.php52
-rw-r--r--libs/Zend/Validate/Barcode/Royalmail.php121
-rw-r--r--libs/Zend/Validate/Barcode/Sscc.php52
-rw-r--r--libs/Zend/Validate/Barcode/UpcA.php103
-rw-r--r--libs/Zend/Validate/Barcode/Upca.php52
-rw-r--r--libs/Zend/Validate/Barcode/Upce.php69
-rw-r--r--libs/Zend/Validate/Between.php52
-rw-r--r--libs/Zend/Validate/Callback.php174
-rw-r--r--libs/Zend/Validate/Ccnum.php19
-rw-r--r--libs/Zend/Validate/CreditCard.php317
-rw-r--r--libs/Zend/Validate/Date.php63
-rw-r--r--libs/Zend/Validate/Db/Abstract.php310
-rw-r--r--libs/Zend/Validate/Db/NoRecordExists.php9
-rw-r--r--libs/Zend/Validate/Db/RecordExists.php52
-rw-r--r--libs/Zend/Validate/Digits.php18
-rw-r--r--libs/Zend/Validate/EmailAddress.php502
-rw-r--r--libs/Zend/Validate/Exception.php11
-rw-r--r--libs/Zend/Validate/File/Count.php45
-rw-r--r--libs/Zend/Validate/File/Crc32.php18
-rw-r--r--libs/Zend/Validate/File/ExcludeExtension.php14
-rw-r--r--libs/Zend/Validate/File/ExcludeMimeType.php12
-rw-r--r--libs/Zend/Validate/File/Exists.php14
-rw-r--r--libs/Zend/Validate/File/Extension.php16
-rw-r--r--libs/Zend/Validate/File/FilesSize.php31
-rw-r--r--libs/Zend/Validate/File/Hash.php24
-rw-r--r--libs/Zend/Validate/File/ImageSize.php24
-rw-r--r--libs/Zend/Validate/File/IsCompressed.php117
-rw-r--r--libs/Zend/Validate/File/IsImage.php145
-rw-r--r--libs/Zend/Validate/File/Md5.php20
-rw-r--r--libs/Zend/Validate/File/MimeType.php102
-rw-r--r--libs/Zend/Validate/File/NotExists.php10
-rw-r--r--libs/Zend/Validate/File/Sha1.php18
-rw-r--r--libs/Zend/Validate/File/Size.php27
-rw-r--r--libs/Zend/Validate/File/Upload.php30
-rw-r--r--libs/Zend/Validate/File/WordCount.php12
-rw-r--r--libs/Zend/Validate/Float.php64
-rw-r--r--libs/Zend/Validate/GreaterThan.php28
-rw-r--r--libs/Zend/Validate/Hex.php13
-rw-r--r--libs/Zend/Validate/Hostname.php208
-rw-r--r--libs/Zend/Validate/Hostname/Biz.php6
-rw-r--r--libs/Zend/Validate/Hostname/Cn.php6
-rw-r--r--libs/Zend/Validate/Hostname/Com.php6
-rw-r--r--libs/Zend/Validate/Hostname/Jp.php6
-rw-r--r--libs/Zend/Validate/Iban.php49
-rw-r--r--libs/Zend/Validate/Identical.php65
-rw-r--r--libs/Zend/Validate/InArray.php108
-rw-r--r--libs/Zend/Validate/Int.php44
-rw-r--r--libs/Zend/Validate/Interface.php23
-rw-r--r--libs/Zend/Validate/Ip.php141
-rw-r--r--libs/Zend/Validate/Isbn.php279
-rw-r--r--libs/Zend/Validate/LessThan.php27
-rw-r--r--libs/Zend/Validate/NotEmpty.php190
-rw-r--r--libs/Zend/Validate/PostCode.php210
-rw-r--r--libs/Zend/Validate/Regex.php47
-rw-r--r--libs/Zend/Validate/Sitemap/Changefreq.php20
-rw-r--r--libs/Zend/Validate/Sitemap/Lastmod.php29
-rw-r--r--libs/Zend/Validate/Sitemap/Loc.php28
-rw-r--r--libs/Zend/Validate/Sitemap/Priority.php27
-rw-r--r--libs/Zend/Validate/StringLength.php52
-rw-r--r--libs/Zend/Version.php8
-rw-r--r--libs/javascript/json2.js30
-rw-r--r--libs/jquery/fdd2div-modified.js6
-rw-r--r--libs/jquery/jquery-calendar.css190
-rw-r--r--libs/jquery/jquery-calendar.js72
-rw-r--r--libs/jquery/jquery-ui.js391
-rw-r--r--libs/jquery/jquery.bgiframe.js10
-rw-r--r--libs/jquery/jquery.blockUI.js15
-rw-r--r--libs/jquery/jquery.js165
-rw-r--r--libs/jquery/jquery.scrollTo-min.js11
-rw-r--r--libs/jquery/macFFBgHack.pngbin207 -> 0 bytes
-rw-r--r--libs/jquery/original lib/jquery-calendar.js814
-rw-r--r--libs/jquery/original lib/jquery-ui.js5586
-rw-r--r--libs/jquery/original lib/jquery.blockUI.js638
-rw-r--r--libs/jquery/original lib/jquery.js6289
-rw-r--r--libs/jquery/stop.pngbin288 -> 0 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-anim_basic_16x16.gifbin0 -> 1553 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.pngbin0 -> 180 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-bg_flat_75_ffffff_40x100.pngbin0 -> 178 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.pngbin0 -> 120 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-bg_glass_65_ffffff_1x400.pngbin0 -> 105 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-bg_glass_75_dadada_1x400.pngbin0 -> 111 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.pngbin0 -> 110 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-bg_glass_95_fef1ec_1x400.pngbin0 -> 119 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.pngbin0 -> 101 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-icons_222222_256x240.pngbin0 -> 4369 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-icons_2e83ff_256x240.pngbin0 -> 4369 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-icons_454545_256x240.pngbin0 -> 4369 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-icons_888888_256x240.pngbin0 -> 4369 bytes
-rw-r--r--libs/jquery/themes/base/images/ui-icons_cd0a0a_256x240.pngbin0 -> 4369 bytes
-rw-r--r--libs/jquery/themes/base/jquery-ui.css487
-rw-r--r--libs/jquery/thickbox-loading.gifbin5886 -> 0 bytes
-rw-r--r--libs/jquery/thickbox.css194
-rw-r--r--libs/jquery/thickbox.js319
-rw-r--r--libs/json/json.js317
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_bar.php2
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_bar_3d.php2
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_bar_filled.php2
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_bar_glass.php4
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_bar_sketch.php2
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_bar_stack.php4
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_candle.php2
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_tooltip.php2
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_y_axis_label.php74
-rw-r--r--libs/open-flash-chart/php-ofc-library/ofc_y_axis_labels.php112
-rw-r--r--libs/open-flash-chart/php-ofc-library/open-flash-chart.php84
-rw-r--r--libs/sparkline/LICENSE-BSD.txt (renamed from libs/sparkline/LICENSE)2
-rw-r--r--libs/sparkline/LICENSE-GPL.txt278
-rw-r--r--libs/sparkline/lib/Sparkline.php11
-rw-r--r--libs/sparkline/lib/Sparkline_Bar.php8
-rw-r--r--libs/sparkline/lib/Sparkline_Line.php24
-rw-r--r--libs/upgradephp/common.php137
478 files changed, 33562 insertions, 12142 deletions
diff --git a/libs/HTML/QuickForm.php b/libs/HTML/QuickForm.php
index df3fbdf079..de0318292c 100644
--- a/libs/HTML/QuickForm.php
+++ b/libs/HTML/QuickForm.php
@@ -26,11 +26,11 @@
/**
* PEAR and PEAR_Error classes, for error handling
*/
-require_once 'PEAR.php';
+require_once dirname(__FILE__) . '/../PEAR.php';
/**
* Base class for all HTML classes
*/
-require_once 'HTML/Common.php';
+require_once dirname(__FILE__) . '/Common.php';
/**
* Element types known to HTML_QuickForm
@@ -378,7 +378,7 @@ class HTML_QuickForm extends HTML_Common
*/
function registerRule($ruleName, $type, $data1, $data2 = null)
{
- include_once('HTML/QuickForm/RuleRegistry.php');
+ include_once(dirname(__FILE__) . '/QuickForm/RuleRegistry.php');
$registry =& HTML_QuickForm_RuleRegistry::singleton();
$registry->registerRule($ruleName, $type, $data1, $data2);
} // end func registerRule
@@ -593,7 +593,7 @@ class HTML_QuickForm extends HTML_Common
}
$className = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][1];
$includeFile = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][0];
- include_once($includeFile);
+ include_once(dirname(__FILE__) . '/../' . $includeFile);
$elementObject = new $className();
for ($i = 0; $i < 5; $i++) {
if (!isset($args[$i])) {
@@ -1376,7 +1376,7 @@ class HTML_QuickForm extends HTML_Common
return false;
}
// automatically register the rule if requested
- include_once 'HTML/QuickForm/RuleRegistry.php';
+ include_once dirname(__FILE__) . '/QuickForm/RuleRegistry.php';
$ruleName = false;
if (is_object($name) && is_a($name, 'html_quickform_rule')) {
$ruleName = !empty($name->name)? $name->name: strtolower(get_class($name));
@@ -1514,7 +1514,7 @@ class HTML_QuickForm extends HTML_Common
return false;
}
- include_once('HTML/QuickForm/RuleRegistry.php');
+ include_once(dirname(__FILE__) . '/QuickForm/RuleRegistry.php');
$registry = HTML_QuickForm_RuleRegistry::singleton();
foreach ($this->_rules as $target => $rules) {
@@ -1703,7 +1703,7 @@ class HTML_QuickForm extends HTML_Common
function &defaultRenderer()
{
if (!isset($GLOBALS['_HTML_QuickForm_default_renderer'])) {
- include_once('HTML/QuickForm/Renderer/Default.php');
+ include_once(dirname(__FILE__) . '/QuickForm/Renderer/Default.php');
$GLOBALS['_HTML_QuickForm_default_renderer'] = new HTML_QuickForm_Renderer_Default();
}
return $GLOBALS['_HTML_QuickForm_default_renderer'];
@@ -1748,7 +1748,7 @@ class HTML_QuickForm extends HTML_Common
return '';
}
- include_once('HTML/QuickForm/RuleRegistry.php');
+ include_once(dirname(__FILE__) . '/QuickForm/RuleRegistry.php');
$registry =& HTML_QuickForm_RuleRegistry::singleton();
$test = array();
$js_escape = array(
@@ -1860,7 +1860,7 @@ class HTML_QuickForm extends HTML_Common
*/
function toArray($collectHidden = false)
{
- include_once 'HTML/QuickForm/Renderer/Array.php';
+ include_once dirname(__FILE__) . '/QuickForm/Renderer/Array.php';
$renderer = new HTML_QuickForm_Renderer_Array($collectHidden);
$this->accept($renderer);
return $renderer->toArray();
diff --git a/libs/HTML/QuickForm/Renderer/Array.php b/libs/HTML/QuickForm/Renderer/Array.php
index 28f5893102..dfb04647f5 100644
--- a/libs/HTML/QuickForm/Renderer/Array.php
+++ b/libs/HTML/QuickForm/Renderer/Array.php
@@ -27,7 +27,7 @@
/**
* An abstract base class for QuickForm renderers
*/
-require_once 'HTML/QuickForm/Renderer.php';
+require_once dirname(__FILE__) . '/../Renderer.php';
/**
* A concrete renderer for HTML_QuickForm, makes an array of form contents
@@ -337,4 +337,4 @@ class HTML_QuickForm_Renderer_Array extends HTML_QuickForm_Renderer
}
}
}
-?> \ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm/Renderer/ArraySmarty.php b/libs/HTML/QuickForm/Renderer/ArraySmarty.php
index 89b59e7dee..d7433d0150 100644
--- a/libs/HTML/QuickForm/Renderer/ArraySmarty.php
+++ b/libs/HTML/QuickForm/Renderer/ArraySmarty.php
@@ -27,7 +27,7 @@
/**
* A concrete renderer for HTML_QuickForm, makes an array of form contents
*/
-require_once 'HTML/QuickForm/Renderer/Array.php';
+require_once dirname(__FILE__) . '/Array.php';
/**
* A static renderer for HTML_QuickForm, makes an array of form content
@@ -400,4 +400,4 @@ class HTML_QuickForm_Renderer_ArraySmarty extends HTML_QuickForm_Renderer_Array
$this->_error = $template;
} // end func setErrorTemplate
}
-?> \ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm/Renderer/Default.php b/libs/HTML/QuickForm/Renderer/Default.php
index 0801105ba8..0ec24a6454 100644
--- a/libs/HTML/QuickForm/Renderer/Default.php
+++ b/libs/HTML/QuickForm/Renderer/Default.php
@@ -26,7 +26,7 @@
/**
* An abstract base class for QuickForm renderers
*/
-require_once 'HTML/QuickForm/Renderer.php';
+require_once dirname(__FILE__) . '/../Renderer.php';
/**
* A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one
diff --git a/libs/HTML/QuickForm/Renderer/ITDynamic.php b/libs/HTML/QuickForm/Renderer/ITDynamic.php
index f554203dfa..de0dec577b 100644
--- a/libs/HTML/QuickForm/Renderer/ITDynamic.php
+++ b/libs/HTML/QuickForm/Renderer/ITDynamic.php
@@ -24,7 +24,7 @@
/**
* An abstract base class for QuickForm renderers
*/
-require_once 'HTML/QuickForm/Renderer.php';
+require_once dirname(__FILE__) . '/../Renderer.php';
/**
* A concrete renderer for HTML_QuickForm, using Integrated Templates.
diff --git a/libs/HTML/QuickForm/Renderer/ITStatic.php b/libs/HTML/QuickForm/Renderer/ITStatic.php
index 56c9d1fed2..94be06a1d5 100644
--- a/libs/HTML/QuickForm/Renderer/ITStatic.php
+++ b/libs/HTML/QuickForm/Renderer/ITStatic.php
@@ -25,7 +25,7 @@
/**
* An abstract base class for QuickForm renderers
*/
-require_once 'HTML/QuickForm/Renderer.php';
+require_once dirname(__FILE__) . '/../Renderer.php';
/**
* A static renderer for HTML_QuickForm compatible
@@ -501,4 +501,4 @@ class HTML_QuickForm_Renderer_ITStatic extends HTML_QuickForm_Renderer
return $ret;
}
} // end class HTML_QuickForm_Renderer_ITStatic
-?> \ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm/Renderer/Object.php b/libs/HTML/QuickForm/Renderer/Object.php
index eb84fd78e6..9613931835 100644
--- a/libs/HTML/QuickForm/Renderer/Object.php
+++ b/libs/HTML/QuickForm/Renderer/Object.php
@@ -24,7 +24,7 @@
/**
* An abstract base class for QuickForm renderers
*/
-require_once 'HTML/QuickForm/Renderer.php';
+require_once dirname(__FILE__) . '/../Renderer.php';
/**
* A concrete renderer for HTML_QuickForm, makes an object from form contents
@@ -138,7 +138,10 @@ class HTML_QuickForm_Renderer_Object extends HTML_QuickForm_Renderer
{
$hobj = new StdClass;
$hobj->header = $header->toHtml();
- $this->_obj->sections[$this->_sectionCount] = $hobj;
+ // $this->_obj->sections[$this->_sectionCount] = $hobj;
+ $tmp = $this->_obj->sections;
+ $tmp[$this->_sectionCount] = $hobj;
+ $this->_obj->sections = $tmp;
$this->_currentSection = $this->_sectionCount++;
}
@@ -231,11 +234,24 @@ class HTML_QuickForm_Renderer_Object extends HTML_QuickForm_Renderer
{
$name = $elObj->name;
if(is_object($this->_currentGroup) && $elObj->type != 'group') {
- $this->_currentGroup->elements[] = $elObj;
+ // $this->_currentGroup->elements[] = $elObj;
+ $tmp = $this->_currentGroup->elements;
+ $tmp[] = $elObj;
+ $this->_currentGroup->elements = $tmp;
} elseif (isset($this->_currentSection)) {
- $this->_obj->sections[$this->_currentSection]->elements[] = $elObj;
+ // $this->_obj->sections[$this->_currentSection]->elements[] = $elObj;
+ $tmpSections = $this->_obj->sections;
+ $tmpCurrentSection = $tmpSections[$this->_currentSection];
+ $tmpElements = $tmpCurrentSection->elements;
+ $tmpElements[] = $elObj;
+ $tmpCurrentSection->elements = $tmpElements;
+ $tmpSections[$this->_currentSection] = $tmpCurrentSection;
+ $this->_obj->sections = $tmpSections;
} else {
- $this->_obj->elements[] = $elObj;
+ // $this->_obj->elements[] = $elObj;
+ $tmp = $this->_obj->elements;
+ $tmp[] = $elObj;
+ $this->_obj->elements = $tmp;
}
}
diff --git a/libs/HTML/QuickForm/Renderer/ObjectFlexy.php b/libs/HTML/QuickForm/Renderer/ObjectFlexy.php
index 6a232ca04e..37d45e38d6 100644
--- a/libs/HTML/QuickForm/Renderer/ObjectFlexy.php
+++ b/libs/HTML/QuickForm/Renderer/ObjectFlexy.php
@@ -24,7 +24,7 @@
/**
* A concrete renderer for HTML_QuickForm, makes an object from form contents
*/
-require_once 'HTML/QuickForm/Renderer/Object.php';
+require_once dirname(__FILE__) . '/Object.php';
/**
* QuickForm renderer for Flexy template engine, static version.
@@ -116,7 +116,10 @@ class HTML_QuickForm_Renderer_ObjectFlexy extends HTML_QuickForm_Renderer_Object
if($name = $header->getName()) {
$this->_obj->header->$name = $header->toHtml();
} else {
- $this->_obj->header[$this->_sectionCount] = $header->toHtml();
+ // $this->_obj->header[$this->_sectionCount] = $header->toHtml();
+ $tmp = $this->_obj->header;
+ $tmp[$this->_sectionCount] = $header->toHtml();
+ $this->_obj->header = $tmp;
}
$this->_currentSection = $this->_sectionCount++;
} // end func renderHeader
diff --git a/libs/HTML/QuickForm/Renderer/QuickHtml.php b/libs/HTML/QuickForm/Renderer/QuickHtml.php
index ca067daa70..f71d3c109b 100644
--- a/libs/HTML/QuickForm/Renderer/QuickHtml.php
+++ b/libs/HTML/QuickForm/Renderer/QuickHtml.php
@@ -24,7 +24,7 @@
/**
* A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one
*/
-require_once 'HTML/QuickForm/Renderer/Default.php';
+require_once dirname(__FILE__) . '/Default.php';
/**
* A renderer that makes it quick and easy to create customized forms.
diff --git a/libs/HTML/QuickForm/Rule/Callback.php b/libs/HTML/QuickForm/Rule/Callback.php
index d6e9eab35e..8796dedaa0 100644
--- a/libs/HTML/QuickForm/Rule/Callback.php
+++ b/libs/HTML/QuickForm/Rule/Callback.php
@@ -24,7 +24,7 @@
/**
* Abstract base class for QuickForm validation rules
*/
-require_once 'HTML/QuickForm/Rule.php';
+require_once dirname(__FILE__) . '/../Rule.php';
/**
* Validates values using callback functions or methods
@@ -121,4 +121,4 @@ class HTML_QuickForm_Rule_Callback extends HTML_QuickForm_Rule
} // end func getValidationScript
} // end class HTML_QuickForm_Rule_Callback
-?> \ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm/Rule/Compare.php b/libs/HTML/QuickForm/Rule/Compare.php
index df4f86b795..6eeda4b65e 100644
--- a/libs/HTML/QuickForm/Rule/Compare.php
+++ b/libs/HTML/QuickForm/Rule/Compare.php
@@ -24,7 +24,7 @@
/**
* Abstract base class for QuickForm validation rules
*/
-require_once 'HTML/QuickForm/Rule.php';
+require_once dirname(__FILE__) . '/../Rule.php';
/**
* Rule to compare two form fields
diff --git a/libs/HTML/QuickForm/Rule/Email.php b/libs/HTML/QuickForm/Rule/Email.php
index 6f79653378..d9fc49ec62 100644
--- a/libs/HTML/QuickForm/Rule/Email.php
+++ b/libs/HTML/QuickForm/Rule/Email.php
@@ -24,7 +24,7 @@
/**
* Abstract base class for QuickForm validation rules
*/
-require_once 'HTML/QuickForm/Rule.php';
+require_once dirname(__FILE__) . '/../Rule.php';
/**
* Email validation rule
@@ -70,4 +70,4 @@ class HTML_QuickForm_Rule_Email extends HTML_QuickForm_Rule
} // end func getValidationScript
} // end class HTML_QuickForm_Rule_Email
-?> \ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm/Rule/Range.php b/libs/HTML/QuickForm/Rule/Range.php
index 97a8806dc6..e466e3d120 100644
--- a/libs/HTML/QuickForm/Rule/Range.php
+++ b/libs/HTML/QuickForm/Rule/Range.php
@@ -24,7 +24,7 @@
/**
* Abstract base class for QuickForm validation rules
*/
-require_once 'HTML/QuickForm/Rule.php';
+require_once dirname(__FILE__) . '/../Rule.php';
/**
* Checks that the length of value is within range
@@ -72,4 +72,4 @@ class HTML_QuickForm_Rule_Range extends HTML_QuickForm_Rule
} // end func getValidationScript
} // end class HTML_QuickForm_Rule_Range
-?> \ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm/Rule/Regex.php b/libs/HTML/QuickForm/Rule/Regex.php
index f496a3fb1c..a43aea22dc 100644
--- a/libs/HTML/QuickForm/Rule/Regex.php
+++ b/libs/HTML/QuickForm/Rule/Regex.php
@@ -24,7 +24,7 @@
/**
* Abstract base class for QuickForm validation rules
*/
-require_once 'HTML/QuickForm/Rule.php';
+require_once dirname(__FILE__) . '/../Rule.php';
/**
* Validates values using regular expressions
@@ -104,4 +104,4 @@ class HTML_QuickForm_Rule_Regex extends HTML_QuickForm_Rule
} // end func getValidationScript
} // end class HTML_QuickForm_Rule_Regex
-?> \ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm/Rule/Required.php b/libs/HTML/QuickForm/Rule/Required.php
index 28ccc604ac..e73af090b0 100644
--- a/libs/HTML/QuickForm/Rule/Required.php
+++ b/libs/HTML/QuickForm/Rule/Required.php
@@ -24,7 +24,7 @@
/**
* Abstract base class for QuickForm validation rules
*/
-require_once 'HTML/QuickForm/Rule.php';
+require_once dirname(__FILE__) . '/../Rule.php';
/**
* Required elements validation
diff --git a/libs/HTML/QuickForm/RuleRegistry.php b/libs/HTML/QuickForm/RuleRegistry.php
index 89e98144e6..c257fc328d 100644
--- a/libs/HTML/QuickForm/RuleRegistry.php
+++ b/libs/HTML/QuickForm/RuleRegistry.php
@@ -123,7 +123,7 @@ class HTML_QuickForm_RuleRegistry
if (!isset($this->_rules[$class])) {
if (!empty($path)) {
- include_once($path);
+ include_once(dirname(__FILE__) . '/../../' . $path);
}
$this->_rules[$class] = new $class();
}
diff --git a/libs/HTML/QuickForm/advcheckbox.php b/libs/HTML/QuickForm/advcheckbox.php
index 9951e79885..fada1e70ae 100644
--- a/libs/HTML/QuickForm/advcheckbox.php
+++ b/libs/HTML/QuickForm/advcheckbox.php
@@ -25,7 +25,7 @@
/**
* HTML class for a checkbox type field
*/
-require_once 'HTML/QuickForm/checkbox.php';
+require_once dirname(__FILE__) . '/checkbox.php';
/**
* HTML class for an advanced checkbox type field
diff --git a/libs/HTML/QuickForm/autocomplete.php b/libs/HTML/QuickForm/autocomplete.php
index 57d1e4311c..0275ceafb1 100644
--- a/libs/HTML/QuickForm/autocomplete.php
+++ b/libs/HTML/QuickForm/autocomplete.php
@@ -24,7 +24,7 @@
/**
* HTML class for a text field
*/
-require_once 'HTML/QuickForm/text.php';
+require_once dirname(__FILE__) . '/text.php';
/**
* HTML class for an autocomplete element
diff --git a/libs/HTML/QuickForm/button.php b/libs/HTML/QuickForm/button.php
index cae1888c18..d0ee0157f3 100644
--- a/libs/HTML/QuickForm/button.php
+++ b/libs/HTML/QuickForm/button.php
@@ -25,7 +25,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for an <input type="button" /> elements
diff --git a/libs/HTML/QuickForm/checkbox.php b/libs/HTML/QuickForm/checkbox.php
index 4cf1de238f..5bfc361a17 100644
--- a/libs/HTML/QuickForm/checkbox.php
+++ b/libs/HTML/QuickForm/checkbox.php
@@ -26,7 +26,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for a checkbox type field
diff --git a/libs/HTML/QuickForm/date.php b/libs/HTML/QuickForm/date.php
index 5fe3320aba..60811ab347 100644
--- a/libs/HTML/QuickForm/date.php
+++ b/libs/HTML/QuickForm/date.php
@@ -24,11 +24,11 @@
/**
* Class for a group of form elements
*/
-require_once 'HTML/QuickForm/group.php';
+require_once dirname(__FILE__) . '/group.php';
/**
* Class for <select></select> elements
*/
-require_once 'HTML/QuickForm/select.php';
+require_once dirname(__FILE__) . '/select.php';
/**
* Class for a group of elements used to input dates (and times).
@@ -494,7 +494,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
function toHtml()
{
- include_once('HTML/QuickForm/Renderer/Default.php');
+ include_once(dirname(__FILE__) . '/Renderer/Default.php');
$renderer = new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
parent::accept($renderer);
diff --git a/libs/HTML/QuickForm/element.php b/libs/HTML/QuickForm/element.php
index 3a5e2b97a6..93761f2740 100644
--- a/libs/HTML/QuickForm/element.php
+++ b/libs/HTML/QuickForm/element.php
@@ -26,7 +26,7 @@
/**
* Base class for all HTML classes
*/
-require_once 'HTML/Common.php';
+require_once dirname(__FILE__) . '/../Common.php';
/**
* Base class for form elements
@@ -491,4 +491,4 @@ class HTML_QuickForm_element extends HTML_Common
// }}}
} // end class HTML_QuickForm_element
-?> \ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm/file.php b/libs/HTML/QuickForm/file.php
index afdf585962..f271cc5a72 100644
--- a/libs/HTML/QuickForm/file.php
+++ b/libs/HTML/QuickForm/file.php
@@ -26,7 +26,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
// register file-related rules
if (class_exists('HTML_QuickForm')) {
diff --git a/libs/HTML/QuickForm/group.php b/libs/HTML/QuickForm/group.php
index 6a538ea8f5..9ecda4958d 100644
--- a/libs/HTML/QuickForm/group.php
+++ b/libs/HTML/QuickForm/group.php
@@ -26,7 +26,7 @@
/**
* Base class for form elements
*/
-require_once 'HTML/QuickForm/element.php';
+require_once dirname(__FILE__) . '/element.php';
/**
* HTML class for a form element group
@@ -298,7 +298,7 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
*/
function toHtml()
{
- include_once('HTML/QuickForm/Renderer/Default.php');
+ include_once(dirname(__FILE__) . '/Renderer/Default.php');
$renderer = new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
$this->accept($renderer);
diff --git a/libs/HTML/QuickForm/header.php b/libs/HTML/QuickForm/header.php
index b1bd222003..49b5679fb9 100644
--- a/libs/HTML/QuickForm/header.php
+++ b/libs/HTML/QuickForm/header.php
@@ -24,7 +24,7 @@
/**
* HTML class for static data
*/
-require_once 'HTML/QuickForm/static.php';
+require_once dirname(__FILE__) . '/static.php';
/**
* A pseudo-element used for adding headers to form
diff --git a/libs/HTML/QuickForm/hidden.php b/libs/HTML/QuickForm/hidden.php
index e0bb7e1d1f..bd77c36ad5 100644
--- a/libs/HTML/QuickForm/hidden.php
+++ b/libs/HTML/QuickForm/hidden.php
@@ -25,7 +25,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for a hidden type element
diff --git a/libs/HTML/QuickForm/hiddenselect.php b/libs/HTML/QuickForm/hiddenselect.php
index 0c16e96494..56212db090 100644
--- a/libs/HTML/QuickForm/hiddenselect.php
+++ b/libs/HTML/QuickForm/hiddenselect.php
@@ -24,7 +24,7 @@
/**
* Class for <select></select> elements
*/
-require_once 'HTML/QuickForm/select.php';
+require_once dirname(__FILE__) . '/select.php';
/**
* Hidden select pseudo-element
diff --git a/libs/HTML/QuickForm/hierselect.php b/libs/HTML/QuickForm/hierselect.php
index fa92cc64a4..5889cca2d0 100644
--- a/libs/HTML/QuickForm/hierselect.php
+++ b/libs/HTML/QuickForm/hierselect.php
@@ -26,11 +26,11 @@
/**
* Class for a group of form elements
*/
-require_once 'HTML/QuickForm/group.php';
+require_once dirname(__FILE__) . '/group.php';
/**
* Class for <select></select> elements
*/
-require_once 'HTML/QuickForm/select.php';
+require_once dirname(__FILE__) . '/select.php';
/**
* Hierarchical select element
@@ -461,7 +461,7 @@ JAVASCRIPT;
$this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " .
$this->_convertArrayToJavascript($values, false) . ";\n";
}
- include_once('HTML/QuickForm/Renderer/Default.php');
+ include_once(dirname(__FILE__) . '/Renderer/Default.php');
$renderer = new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
parent::accept($renderer);
diff --git a/libs/HTML/QuickForm/html.php b/libs/HTML/QuickForm/html.php
index 7310f5f150..6cba2dabb2 100644
--- a/libs/HTML/QuickForm/html.php
+++ b/libs/HTML/QuickForm/html.php
@@ -24,7 +24,7 @@
/**
* HTML class for static data
*/
-require_once 'HTML/QuickForm/static.php';
+require_once dirname(__FILE__) . '/static.php';
/**
* A pseudo-element used for adding raw HTML to form
diff --git a/libs/HTML/QuickForm/image.php b/libs/HTML/QuickForm/image.php
index 52190ec446..d63169aa2b 100644
--- a/libs/HTML/QuickForm/image.php
+++ b/libs/HTML/QuickForm/image.php
@@ -25,7 +25,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for an <input type="image" /> element
diff --git a/libs/HTML/QuickForm/input.php b/libs/HTML/QuickForm/input.php
index 354f050f45..01407e0e63 100644
--- a/libs/HTML/QuickForm/input.php
+++ b/libs/HTML/QuickForm/input.php
@@ -25,7 +25,7 @@
/**
* Base class for form elements
*/
-require_once 'HTML/QuickForm/element.php';
+require_once dirname(__FILE__) . '/element.php';
/**
* Base class for <input /> form elements
diff --git a/libs/HTML/QuickForm/link.php b/libs/HTML/QuickForm/link.php
index d5d3d46c1f..7ae6638828 100644
--- a/libs/HTML/QuickForm/link.php
+++ b/libs/HTML/QuickForm/link.php
@@ -25,7 +25,7 @@
/**
* HTML class for static data
*/
-require_once 'HTML/QuickForm/static.php';
+require_once dirname(__FILE__) . '/static.php';
/**
* HTML class for a link type field
diff --git a/libs/HTML/QuickForm/password.php b/libs/HTML/QuickForm/password.php
index 7c6b3902d3..214b362202 100644
--- a/libs/HTML/QuickForm/password.php
+++ b/libs/HTML/QuickForm/password.php
@@ -25,7 +25,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for a password type field
diff --git a/libs/HTML/QuickForm/radio.php b/libs/HTML/QuickForm/radio.php
index c9d340fcbb..6f8af6e2f1 100644
--- a/libs/HTML/QuickForm/radio.php
+++ b/libs/HTML/QuickForm/radio.php
@@ -25,7 +25,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for a radio type element
diff --git a/libs/HTML/QuickForm/reset.php b/libs/HTML/QuickForm/reset.php
index bf2cbef908..41f8368b9a 100644
--- a/libs/HTML/QuickForm/reset.php
+++ b/libs/HTML/QuickForm/reset.php
@@ -25,7 +25,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for a reset type element
diff --git a/libs/HTML/QuickForm/select.php b/libs/HTML/QuickForm/select.php
index 1708fcadb6..7a94ce8bed 100644
--- a/libs/HTML/QuickForm/select.php
+++ b/libs/HTML/QuickForm/select.php
@@ -26,7 +26,7 @@
/**
* Base class for form elements
*/
-require_once 'HTML/QuickForm/element.php';
+require_once dirname(__FILE__) . '/element.php';
/**
* Class to dynamically create an HTML SELECT
@@ -299,8 +299,27 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
* @access public
* @return void
*/
- function addOption($text, $value, $attributes=null)
- {
+
+ // CLY - modification to allow optgroups
+ // function addOption($text, $value, $attributes=null)
+ function addOption($text, $value, $attributes=null, &$optGroup=null) {
+ // if text is an array, start an optgroup
+ if (is_array($text)) {
+ if (is_array($optGroup)) {
+ $optGroup[$value]['options'] = array();
+ $optGroup =& $optGroup[$value]['options'];
+ }
+ else {
+ $this->_options[$value]['options'] = array();
+ $optGroup =& $this->_options[$value]['options'];
+ };
+ foreach($text as $key=>$val) {
+ $this->addOption($val, $key, null, $optGroup);
+ }
+ // done all the options in the optgroup
+ return;
+ }
+ // end mod
if (null === $attributes) {
$attributes = array('value' => (string)$value);
} else {
@@ -316,7 +335,33 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
}
$this->_updateAttrArray($attributes, array('value' => (string)$value));
}
- $this->_options[] = array('text' => $text, 'attr' => $attributes);
+ // CLY - modification to allow optgroups
+ // if $optGroup is an array, add the option to it
+ if (is_array($optGroup)) {
+ $optGroup[$text]['attr'] = $attributes;
+ }
+ // if $optGroup is a string, add the option to the option group
+ // used if directly adding an option to an optgroup
+ elseif (is_string($optGroup)) {
+ $optGroups = explode($optGroup, ',');
+ $target =& $this->_options;
+ foreach($optGroups as $group) {
+ // create the option group if it does not exist
+ if (empty($target[$group]['options'])) {
+ $target[$group]['options'] = array();
+ }
+ $target =& $target[$group]['options'];
+ }
+ // foreach
+ // add the option
+ $target[$text]['attr'] = $attributes;
+ }
+ // else if there are attributes, add them to the option
+ elseif (is_array($attributes)) {
+ $this->_options[$text]['attr'] = $attributes;
+ }
+ // $this->_options[] = array('text' => $text, 'attr' => $attributes);
+ // end mod
} // end func addOption
// }}}
@@ -402,7 +447,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
{
if (is_string($conn)) {
- require_once('DB.php');
+ require_once(dirname(__FILE__) . '/../../DB.php');
$dbConn = &DB::connect($conn, true);
if (DB::isError($dbConn)) {
return $dbConn;
@@ -493,7 +538,11 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
}
$strHtml .= $tabs . '<select' . $attrString . ">\n";
- $strValues = is_array($this->_values)? array_map('strval', $this->_values): array();
+ // CLY - modified to allow optgroups
+ foreach ($this->_options as $text=>$option) {
+ $strHtml .= $tabs . $this->_optionToHtml($text, $option);
+ }
+ /* $strValues = is_array($this->_values)? array_map('strval', $this->_values): array();
foreach ($this->_options as $option) {
if (!empty($strValues) && in_array($option['attr']['value'], $strValues, true)) {
$option['attr']['selected'] = 'selected';
@@ -501,7 +550,8 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
$strHtml .= $tabs . "\t<option" . $this->_getAttrString($option['attr']) . '>' .
$option['text'] . "</option>\n";
}
-
+ */
+ // end mod
return $strHtml . $tabs . '</select>';
}
} //end func toHtml
@@ -509,6 +559,40 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
// }}}
// {{{ getFrozenHtml()
+// CLY - new function to allow optgroups
+ /**
+ * Returns an OPTION in HTML
+ *
+ * This function is called recursively to support optgroups
+ *
+ * @param string $text Display text for the option
+ * @param array $option The option
+ * @since ??
+ * @access private
+ * @return string
+ */
+ // Creates the HTML for an option
+ function _optionToHtml($text, $option)
+ {
+ $tabs = $this->_getTabs();
+ // if an option has options it's an optgroup
+ if (isset($option['options'])) {
+ $strHtml = $tabs . "<optgroup label=\"$text\">\n";
+ foreach($option['options'] as $txt=>$opt) {
+ $strHtml .= $tabs . $this->_optionToHtml($txt, $opt);
+ }
+ $strHtml .= $tabs . "</optgroup>\n";
+ return($strHtml);
+ }
+ // else it's an option
+ else {
+ if (is_array($this->_values) && in_array((string)$option['attr']['value'], $this->_values)) {
+ $this->_updateAttrArray($option['attr'], array('selected' => 'selected'));
+ }
+ return("\t<option" . $this->_getAttrString($option['attr']) . ">$text</option>\n");
+ }
+ }
+
/**
* Returns the value of field without HTML tags
*
@@ -568,12 +652,17 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
if (is_array($value) && !empty($this->_options)) {
$cleanValue = null;
foreach ($value as $v) {
- for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
- if (0 == strcmp($v, $this->_options[$i]['attr']['value'])) {
- $cleanValue[] = $v;
- break;
- }
- }
+ // CLY - modified to allow optgroups
+ if ($this->_isInOptGroup($v, $this->_options)) {
+ $cleanValue[] = $v;
+ }
+// for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
+// if (0 == strcmp($v, $this->_options[$i]['attr']['value'])) {
+// $cleanValue[] = $v;
+// break;
+// }
+// }
+ // end mod
}
} else {
$cleanValue = $value;
@@ -608,6 +697,22 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
return parent::onQuickFormEvent($event, $arg, $caller);
}
}
+
+ function _isInOptGroup($v, $opts) {
+ $isInOptGroup = false;
+ foreach ($opts as $opt) {
+ if (isset($opt['options'])) {
+ $isInOptGroup = $this->_isInOptGroup($v, $opt['options']);
+ }
+ else {
+ if ($v == $opt['attr']['value']) {
+ $isInOptGroup = true;
+ }
+ }
+ if ($isInOptGroup) break;
+ }
+ return $isInOptGroup;
+ }
// }}}
} //end class HTML_QuickForm_select
diff --git a/libs/HTML/QuickForm/static.php b/libs/HTML/QuickForm/static.php
index f5ce3cdca2..ef388cc456 100644
--- a/libs/HTML/QuickForm/static.php
+++ b/libs/HTML/QuickForm/static.php
@@ -24,7 +24,7 @@
/**
* Base class for form elements
*/
-require_once 'HTML/QuickForm/element.php';
+require_once dirname(__FILE__) . '/element.php';
/**
* HTML class for static data
diff --git a/libs/HTML/QuickForm/submit.php b/libs/HTML/QuickForm/submit.php
index a9fa99d65b..25a98e8a26 100644
--- a/libs/HTML/QuickForm/submit.php
+++ b/libs/HTML/QuickForm/submit.php
@@ -25,7 +25,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for a submit type element
diff --git a/libs/HTML/QuickForm/text.php b/libs/HTML/QuickForm/text.php
index 8d99735850..3240c41d5f 100644
--- a/libs/HTML/QuickForm/text.php
+++ b/libs/HTML/QuickForm/text.php
@@ -25,7 +25,7 @@
/**
* Base class for <input /> form elements
*/
-require_once 'HTML/QuickForm/input.php';
+require_once dirname(__FILE__) . '/input.php';
/**
* HTML class for a text field
diff --git a/libs/HTML/QuickForm/textarea.php b/libs/HTML/QuickForm/textarea.php
index a675e973bf..7aaac4c6ad 100644
--- a/libs/HTML/QuickForm/textarea.php
+++ b/libs/HTML/QuickForm/textarea.php
@@ -25,7 +25,7 @@
/**
* Base class for form elements
*/
-require_once 'HTML/QuickForm/element.php';
+require_once dirname(__FILE__) . '/element.php';
/**
* HTML class for a textarea type field
diff --git a/libs/HTML/QuickForm/xbutton.php b/libs/HTML/QuickForm/xbutton.php
index c795fa53bc..98524cca89 100644
--- a/libs/HTML/QuickForm/xbutton.php
+++ b/libs/HTML/QuickForm/xbutton.php
@@ -24,7 +24,7 @@
/**
* Base class for form elements
*/
-require_once 'HTML/QuickForm/element.php';
+require_once dirname(__FILE__) . '/element.php';
/**
* Class for HTML 4.0 <button> element
diff --git a/libs/PclZip/pclzip.lib.php b/libs/PclZip/pclzip.lib.php
index d4e00f573a..686aaa9f63 100644
--- a/libs/PclZip/pclzip.lib.php
+++ b/libs/PclZip/pclzip.lib.php
@@ -1,8 +1,8 @@
<?php
// --------------------------------------------------------------------------------
-// PhpConcept Library - Zip Module 2.8
+// PhpConcept Library - Zip Module 2.8.2
// --------------------------------------------------------------------------------
-// License GNU/LGPL - Vincent Blavet - March 2006
+// License GNU/LGPL - Vincent Blavet - August 2009
// http://www.phpconcept.net
// --------------------------------------------------------------------------------
//
@@ -22,14 +22,14 @@
// The use of this software is at the risk of the user.
//
// --------------------------------------------------------------------------------
-// $Id$
+// $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $
// --------------------------------------------------------------------------------
// ----- Constants
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
}
-
+
// ----- File list separator
// In version 1.x of PclZip, the separator for file list is a space
// (which is not a very smart choice, specifically for windows paths !).
@@ -68,7 +68,7 @@
// ----- Optional threshold ratio for use of temporary files
// Pclzip sense the size of the file to add/extract and decide to
- // use or not temporary file. The algorythm is looking for
+ // use or not temporary file. The algorythm is looking for
// memory_limit of PHP and apply a ratio.
// threshold = memory_limit * ratio.
// Recommended values are under 0.5. Default 0.47.
@@ -83,7 +83,7 @@
// --------------------------------------------------------------------------------
// ----- Global variables
- $g_pclzip_version = "2.8";
+ $g_pclzip_version = "2.8.2";
// ----- Error codes
// -1 : Unable to open file in binary write mode
@@ -152,7 +152,7 @@
define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
-
+
// ----- File description attributes
define( 'PCLZIP_ATT_FILE_NAME', 79001 );
define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
@@ -198,7 +198,7 @@
// ----- Internal error handling
var $error_code = 1;
var $error_string = '';
-
+
// ----- Current status of the magic_quotes_runtime
// This value store the php configuration for magic_quotes
// The class can then disable the magic_quotes and reset it after
@@ -214,12 +214,10 @@
// --------------------------------------------------------------------------------
function PclZip($p_zipname)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");
// ----- Tests the zlib
if (!function_exists('gzopen'))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");
die('Abort '.basename(__FILE__).' : Missing zlib extensions');
}
@@ -229,7 +227,6 @@
$this->magic_quotes_status = -1;
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);
return;
}
// --------------------------------------------------------------------------------
@@ -273,7 +270,6 @@
// --------------------------------------------------------------------------------
function create($p_filelist)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::create', "filelist='$p_filelist', ...");
$v_result=1;
// ----- Reset the error handler
@@ -285,7 +281,6 @@
// ----- Look for variable options arguments
$v_size = func_num_args();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
// ----- Look for arguments
if ($v_size > 1) {
@@ -298,7 +293,6 @@
// ----- Look for first arg
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
// ----- Parse the options
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
@@ -315,7 +309,6 @@
//, PCLZIP_OPT_CRYPT => 'optional'
));
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
}
@@ -324,7 +317,6 @@
// Here we need to support the first historic synopsis of the
// method.
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
// ----- Get the first argument
$v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
@@ -336,12 +328,11 @@
else if ($v_size > 2) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
"Invalid number / type of arguments");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return 0;
}
}
}
-
+
// ----- Look for default option values
$this->privOptionDefaultThreshold($v_options);
@@ -350,16 +341,16 @@
$v_att_list = array();
$v_filedescr_list = array();
$p_result_list = array();
-
+
// ----- Look if the $p_filelist is really an array
if (is_array($p_filelist)) {
-
+
// ----- Look if the first element is also an array
// This will mean that this is a file description entry
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
$v_att_list = $p_filelist;
}
-
+
// ----- The list is a list of string names
else {
$v_string_list = $p_filelist;
@@ -375,10 +366,9 @@
// ----- Invalid variable type for $p_filelist
else {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
-
+
// ----- Reformat the string list
if (sizeof($v_string_list) != 0) {
foreach ($v_string_list as $v_string) {
@@ -386,11 +376,10 @@
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Ignore an empty filename");
}
}
}
-
+
// ----- For each file in the list check the attributes
$v_supported_attributes
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
@@ -406,7 +395,6 @@
$v_options,
$v_supported_attributes);
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
}
@@ -414,19 +402,16 @@
// ----- Expand the filelist (expand directories)
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
// ----- Call the create fct
$v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
return $p_result_list;
}
// --------------------------------------------------------------------------------
@@ -468,7 +453,6 @@
// --------------------------------------------------------------------------------
function add($p_filelist)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::add', "filelist='$p_filelist', ...");
$v_result=1;
// ----- Reset the error handler
@@ -480,7 +464,6 @@
// ----- Look for variable options arguments
$v_size = func_num_args();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
// ----- Look for arguments
if ($v_size > 1) {
@@ -493,7 +476,6 @@
// ----- Look for first arg
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
// ----- Parse the options
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
@@ -512,7 +494,6 @@
//, PCLZIP_OPT_CRYPT => 'optional'
));
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
}
@@ -521,7 +502,6 @@
// Here we need to support the first historic synopsis of the
// method.
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
// ----- Get the first argument
$v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
@@ -535,7 +515,6 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return 0;
}
}
@@ -549,16 +528,16 @@
$v_att_list = array();
$v_filedescr_list = array();
$p_result_list = array();
-
+
// ----- Look if the $p_filelist is really an array
if (is_array($p_filelist)) {
-
+
// ----- Look if the first element is also an array
// This will mean that this is a file description entry
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
$v_att_list = $p_filelist;
}
-
+
// ----- The list is a list of string names
else {
$v_string_list = $p_filelist;
@@ -574,17 +553,16 @@
// ----- Invalid variable type for $p_filelist
else {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
-
+
// ----- Reformat the string list
if (sizeof($v_string_list) != 0) {
foreach ($v_string_list as $v_string) {
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
}
}
-
+
// ----- For each file in the list check the attributes
$v_supported_attributes
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
@@ -600,7 +578,6 @@
$v_options,
$v_supported_attributes);
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
}
@@ -608,19 +585,16 @@
// ----- Expand the filelist (expand directories)
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
// ----- Call the create fct
$v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
return $p_result_list;
}
// --------------------------------------------------------------------------------
@@ -668,7 +642,6 @@
// --------------------------------------------------------------------------------
function listContent()
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::listContent', "");
$v_result=1;
// ----- Reset the error handler
@@ -676,7 +649,6 @@
// ----- Check archive
if (!$this->privCheckFormat()) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return(0);
}
@@ -685,12 +657,10 @@
if (($v_result = $this->privList($p_list)) != 1)
{
unset($p_list);
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
return(0);
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
return $p_list;
}
// --------------------------------------------------------------------------------
@@ -729,7 +699,6 @@
// --------------------------------------------------------------------------------
function extract()
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extract", "");
$v_result=1;
// ----- Reset the error handler
@@ -737,7 +706,6 @@
// ----- Check archive
if (!$this->privCheckFormat()) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return(0);
}
@@ -750,7 +718,6 @@
// ----- Look for variable options arguments
$v_size = func_num_args();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
// ----- Default values for option
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
@@ -762,7 +729,6 @@
// ----- Look for first arg
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
// ----- Parse the options
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
@@ -787,7 +753,6 @@
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
));
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
@@ -814,7 +779,6 @@
// Here we need to support the first historic synopsis of the
// method.
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
// ----- Get the first argument
$v_path = $v_arg_list[0];
@@ -828,7 +792,6 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
return 0;
}
}
@@ -838,7 +801,6 @@
$this->privOptionDefaultThreshold($v_options);
// ----- Trace
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
// ----- Call the extracting fct
$p_list = array();
@@ -846,12 +808,10 @@
$v_remove_all_path, $v_options);
if ($v_result < 1) {
unset($p_list);
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
return(0);
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
return $p_list;
}
// --------------------------------------------------------------------------------
@@ -896,7 +856,6 @@
//function extractByIndex($p_index, options...)
function extractByIndex($p_index)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extractByIndex", "index='$p_index', ...");
$v_result=1;
// ----- Reset the error handler
@@ -904,7 +863,6 @@
// ----- Check archive
if (!$this->privCheckFormat()) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return(0);
}
@@ -917,7 +875,6 @@
// ----- Look for variable options arguments
$v_size = func_num_args();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
// ----- Default values for option
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
@@ -933,7 +890,6 @@
// ----- Look for first arg
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
// ----- Parse the options
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
@@ -953,7 +909,6 @@
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
));
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
@@ -976,10 +931,8 @@
}
if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING set.");
}
}
@@ -987,7 +940,6 @@
// Here we need to support the first historic synopsis of the
// method.
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
// ----- Get the first argument
$v_path = $v_arg_list[0];
@@ -1001,14 +953,12 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return 0;
}
}
}
// ----- Trace
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "index='$p_index', path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
// ----- Trick
// Here I want to reuse extractByRule(), so I need to parse the $p_index
@@ -1018,7 +968,6 @@
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
array (PCLZIP_OPT_BY_INDEX => 'optional' ));
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
$v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
@@ -1028,12 +977,10 @@
// ----- Call the extracting fct
if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
return(0);
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
return $p_list;
}
// --------------------------------------------------------------------------------
@@ -1049,7 +996,7 @@
// Options :
// PCLZIP_OPT_BY_INDEX :
// PCLZIP_OPT_BY_NAME :
- // PCLZIP_OPT_BY_EREG :
+ // PCLZIP_OPT_BY_EREG :
// PCLZIP_OPT_BY_PREG :
// Return Values :
// 0 on failure,
@@ -1058,7 +1005,6 @@
// --------------------------------------------------------------------------------
function delete()
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");
$v_result=1;
// ----- Reset the error handler
@@ -1066,7 +1012,6 @@
// ----- Check archive
if (!$this->privCheckFormat()) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return(0);
}
@@ -1075,7 +1020,6 @@
// ----- Look for variable options arguments
$v_size = func_num_args();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
// ----- Look for arguments
if ($v_size > 0) {
@@ -1089,7 +1033,6 @@
PCLZIP_OPT_BY_PREG => 'optional',
PCLZIP_OPT_BY_INDEX => 'optional' ));
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
}
@@ -1102,7 +1045,6 @@
if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
$this->privSwapBackMagicQuotes();
unset($v_list);
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
return(0);
}
@@ -1110,7 +1052,6 @@
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);
return $v_list;
}
// --------------------------------------------------------------------------------
@@ -1123,12 +1064,10 @@
// --------------------------------------------------------------------------------
function deleteByIndex($p_index)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
-
+
$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
return $p_list;
}
// --------------------------------------------------------------------------------
@@ -1149,7 +1088,6 @@
// --------------------------------------------------------------------------------
function properties()
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::properties", "");
// ----- Reset the error handler
$this->privErrorReset();
@@ -1160,7 +1098,6 @@
// ----- Check archive
if (!$this->privCheckFormat()) {
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return(0);
}
@@ -1174,16 +1111,14 @@
if (@is_file($this->zipname))
{
// ----- Open the zip file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
{
$this->privSwapBackMagicQuotes();
-
+
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), 0);
return 0;
}
@@ -1192,7 +1127,6 @@
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
{
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
@@ -1209,7 +1143,6 @@
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
return $v_prop;
}
// --------------------------------------------------------------------------------
@@ -1228,7 +1161,6 @@
// --------------------------------------------------------------------------------
function duplicate($p_archive)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::duplicate", "");
$v_result = 1;
// ----- Reset the error handler
@@ -1237,7 +1169,6 @@
// ----- Look if the $p_archive is a PclZip object
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid PclZip object '".$p_archive->zipname."'");
// ----- Duplicate the archive
$v_result = $this->privDuplicate($p_archive->zipname);
@@ -1246,7 +1177,6 @@
// ----- Look if the $p_archive is a string (so a filename)
else if (is_string($p_archive))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$p_archive'");
// ----- Check that $p_archive is a valid zip file
// TBC : Should also check the archive format
@@ -1270,7 +1200,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -1291,7 +1220,6 @@
// --------------------------------------------------------------------------------
function merge($p_archive_to_add)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::merge", "");
$v_result = 1;
// ----- Reset the error handler
@@ -1299,14 +1227,12 @@
// ----- Check archive
if (!$this->privCheckFormat()) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return(0);
}
// ----- Look if the $p_archive_to_add is a PclZip object
if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid PclZip object");
// ----- Merge the archive
$v_result = $this->privMerge($p_archive_to_add);
@@ -1315,7 +1241,6 @@
// ----- Look if the $p_archive_to_add is a string (so a filename)
else if (is_string($p_archive_to_add))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");
// ----- Create a temporary archive
$v_object_archive = new PclZip($p_archive_to_add);
@@ -1333,7 +1258,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -1448,7 +1372,6 @@
// --------------------------------------------------------------------------------
function privCheckFormat($p_level=0)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFormat", "");
$v_result = true;
// ----- Reset the file system cache
@@ -1461,7 +1384,6 @@
if (!is_file($this->zipname)) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
return(false);
}
@@ -1469,7 +1391,6 @@
if (!is_readable($this->zipname)) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
return(false);
}
@@ -1483,7 +1404,6 @@
// TBC
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -1505,13 +1425,11 @@
// --------------------------------------------------------------------------------
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
$v_result=1;
-
+
// ----- Read the options
$i=0;
while ($i<$p_size) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");
// ----- Check if the option is supported
if (!isset($v_requested_options[$p_options_list[$i]])) {
@@ -1519,7 +1437,6 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -1535,13 +1452,11 @@
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
break;
@@ -1549,28 +1464,24 @@
// ----- Check the number of parameters
if (($i+1) >= $p_size) {
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
-
+
// ----- Check for incompatible options
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
-
+
// ----- Check the value
$v_value = $p_options_list[$i+1];
if ((!is_integer($v_value)) || ($v_value<0)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value (and convert it in bytes)
$v_result_list[$p_options_list[$i]] = $v_value*1048576;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
break;
@@ -1578,30 +1489,25 @@
// ----- Check for incompatible options
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
-
+
$v_result_list[$p_options_list[$i]] = true;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
break;
case PCLZIP_OPT_TEMP_FILE_OFF :
// ----- Check for incompatible options
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Check for incompatible options
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
-
+
$v_result_list[$p_options_list[$i]] = true;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
break;
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
@@ -1611,7 +1517,6 @@
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -1619,11 +1524,9 @@
if ( is_string($p_options_list[$i+1])
&& ($p_options_list[$i+1] != '')) {
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." set with an empty value is ignored.");
}
break;
@@ -1635,7 +1538,6 @@
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -1651,15 +1553,16 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
break;
// ----- Look for options that request an EREG or PREG expression
case PCLZIP_OPT_BY_EREG :
+ // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG
+ // to PCLZIP_OPT_BY_PREG
+ $p_options_list[$i] = PCLZIP_OPT_BY_PREG;
case PCLZIP_OPT_BY_PREG :
//case PCLZIP_OPT_CRYPT :
// ----- Check the number of parameters
@@ -1668,7 +1571,6 @@
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -1681,10 +1583,8 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
break;
@@ -1701,7 +1601,6 @@
."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -1717,10 +1616,8 @@
."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
break;
@@ -1732,14 +1629,12 @@
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value
$v_work_list = array();
if (is_string($p_options_list[$i+1])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$p_options_list[$i+1]."'");
// ----- Remove spaces
$p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
@@ -1748,11 +1643,9 @@
$v_work_list = explode(",", $p_options_list[$i+1]);
}
else if (is_integer($p_options_list[$i+1])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$p_options_list[$i+1]."'");
$v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
}
else if (is_array($p_options_list[$i+1])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");
$v_work_list = $p_options_list[$i+1];
}
else {
@@ -1760,10 +1653,9 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
-
+
// ----- Reduce the index list
// each index item in the list must be a couple with a start and
// an end value : [0,3], [5-5], [8-10], ...
@@ -1774,10 +1666,10 @@
// ----- Explode the item
$v_item_list = explode("-", $v_work_list[$j]);
$v_size_item_list = sizeof($v_item_list);
-
+
// ----- TBC : Here we might check that each item is a
// real integer ...
-
+
// ----- Look for single value
if ($v_size_item_list == 1) {
// ----- Set the option value
@@ -1794,15 +1686,12 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extracted index item = [".$v_result_list[$p_options_list[$i]][$j]['start'].",".$v_result_list[$p_options_list[$i]][$j]['end']."]");
// ----- Look for list sort
if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");
$v_sort_flag=true;
// ----- TBC : An automatic sort should be writen ...
@@ -1810,16 +1699,14 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
}
-
+
// ----- Sort the items
if ($v_sort_flag) {
// TBC : To Be Completed
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");
}
// ----- Next option
@@ -1834,7 +1721,6 @@
case PCLZIP_OPT_REPLACE_NEWER :
case PCLZIP_OPT_STOP_ON_ERROR :
$v_result_list[$p_options_list[$i]] = true;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
break;
// ----- Look for options that request an octal value
@@ -1845,13 +1731,11 @@
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
break;
@@ -1872,13 +1756,11 @@
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value
$v_function_name = $p_options_list[$i+1];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".PclZipUtilOptionText($p_options_list[$i])." = '".$v_function_name."'");
// ----- Check that the value is a valid existing function
if (!function_exists($v_function_name)) {
@@ -1886,7 +1768,6 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -1902,7 +1783,6 @@
.$p_options_list[$i]."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -1915,28 +1795,24 @@
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
// ----- Look for mandatory option
if ($v_requested_options[$key] == 'mandatory') {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
// ----- Look if present
if (!isset($v_result_list[$key])) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
}
}
-
+
// ----- Look for default values
if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Calculate auto threshold");
-
+
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -1949,21 +1825,18 @@
// --------------------------------------------------------------------------------
function privOptionDefaultThreshold(&$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOptionDefaultThreshold", "");
$v_result=1;
-
+
if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|| isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
-
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Create an auto-threshold for use of temporay files");
+
// ----- Get 'memory_limit' configuration value
$v_memory_limit = ini_get('memory_limit');
$v_memory_limit = trim($v_memory_limit);
$last = strtolower(substr($v_memory_limit, -1));
-
+
if($last == 'g')
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
$v_memory_limit = $v_memory_limit*1073741824;
@@ -1972,20 +1845,16 @@
$v_memory_limit = $v_memory_limit*1048576;
if($last == 'k')
$v_memory_limit = $v_memory_limit*1024;
-
+
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
-
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Threshold value is : ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]." bytes");
+
// ----- Sanity check : No threshold if value lower than 1M
if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Unset the threshold (value ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD].") because under 1Mo sanity check)");
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
}
-
+
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2000,19 +1869,17 @@
// --------------------------------------------------------------------------------
function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
$v_result=1;
-
+
// ----- For each file in the list check the attributes
foreach ($p_file_list as $v_key => $v_value) {
-
+
// ----- Check if the option is supported
if (!isset($v_requested_options[$v_key])) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -2021,16 +1888,13 @@
case PCLZIP_ATT_FILE_NAME :
if (!is_string($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
-
+
if ($p_filedescr['filename'] == '') {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -2039,16 +1903,13 @@
case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
if (!is_string($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
$p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
if ($p_filedescr['new_short_name'] == '') {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
break;
@@ -2056,16 +1917,13 @@
case PCLZIP_ATT_FILE_NEW_FULL_NAME :
if (!is_string($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
$p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
if ($p_filedescr['new_full_name'] == '') {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
break;
@@ -2074,28 +1932,23 @@
case PCLZIP_ATT_FILE_COMMENT :
if (!is_string($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
$p_filedescr['comment'] = $v_value;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
break;
case PCLZIP_ATT_FILE_MTIME :
if (!is_integer($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
$p_filedescr['mtime'] = $v_value;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
break;
case PCLZIP_ATT_FILE_CONTENT :
$p_filedescr['content'] = $v_value;
- ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
break;
default :
@@ -2104,7 +1957,6 @@
"Unknown parameter '".$v_key."'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -2113,22 +1965,19 @@
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
// ----- Look for mandatory option
if ($v_requested_options[$key] == 'mandatory') {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
// ----- Look if present
if (!isset($p_file_list[$key])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
}
}
-
+
// end foreach
}
-
+
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2140,7 +1989,7 @@
// or a string to be added as file. For any other type of files (link, other)
// just ignore the item.
// Then prepare the information that will be stored for that file.
- // When its a folder, expand the folder with all the files that are in that
+ // When its a folder, expand the folder with all the files that are in that
// folder (recursively).
// Parameters :
// Return Values :
@@ -2149,70 +1998,59 @@
// --------------------------------------------------------------------------------
function privFileDescrExpand(&$p_filedescr_list, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
$v_result=1;
-
+
// ----- Create a result list
$v_result_list = array();
-
+
// ----- Look each entry
for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for file ".$i.".");
-
+
// ----- Get filedescr
$v_descr = $p_filedescr_list[$i];
-
+
// ----- Reduce the filename
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
$v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
$v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
-
+
// ----- Look for real file or folder
if (file_exists($v_descr['filename'])) {
if (@is_file($v_descr['filename'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
$v_descr['type'] = 'file';
}
else if (@is_dir($v_descr['filename'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
$v_descr['type'] = 'folder';
}
else if (@is_link($v_descr['filename'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
// skip
continue;
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
// skip
continue;
}
}
-
+
// ----- Look for string added as file
else if (isset($v_descr['content'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a string added as a file");
$v_descr['type'] = 'virtual_file';
}
-
+
// ----- Missing file
else {
// ----- Error log
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exist");
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
-
+
// ----- Calculate the stored filename
$this->privCalculateStoredFilename($v_descr, $p_options);
-
+
// ----- Add the descriptor in result list
$v_result_list[sizeof($v_result_list)] = $v_descr;
-
+
// ----- Look for folder
if ($v_descr['type'] == 'folder') {
// ----- List of items in folder
@@ -2220,20 +2058,20 @@
$v_dirlist_nb = 0;
if ($v_folder_handler = @opendir($v_descr['filename'])) {
while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for '".$v_item_handler."' in the directory");
// ----- Skip '.' and '..'
if (($v_item_handler == '.') || ($v_item_handler == '..')) {
continue;
}
-
+
// ----- Compose the full filename
$v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
-
+
// ----- Look for different stored filename
// Because the name of the folder was changed, the name of the
// files/sub-folders also change
- if ($v_descr['stored_filename'] != $v_descr['filename']) {
+ if (($v_descr['stored_filename'] != $v_descr['filename'])
+ && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
if ($v_descr['stored_filename'] != '') {
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
}
@@ -2241,44 +2079,38 @@
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
}
}
-
+
$v_dirlist_nb++;
}
-
+
@closedir($v_folder_handler);
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
// TBC : unable to open folder in read mode
}
-
+
// ----- Expand each element of the list
if ($v_dirlist_nb != 0) {
// ----- Expand
if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
-
+
// ----- Concat the resulting list
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
$v_result_list = array_merge($v_result_list, $v_dirlist_descr);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "merged result list is size '".sizeof($v_result_list)."'");
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
}
-
+
// ----- Free local array
unset($v_dirlist_descr);
}
}
-
+
// ----- Get the result list
$p_filedescr_list = $v_result_list;
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2291,10 +2123,9 @@
// --------------------------------------------------------------------------------
function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
$v_result=1;
$v_list_detail = array();
-
+
// ----- Magic quotes trick
$this->privDisableMagicQuotes();
@@ -2302,7 +2133,6 @@
if (($v_result = $this->privOpenFd('wb')) != 1)
{
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -2316,7 +2146,6 @@
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2329,34 +2158,29 @@
// --------------------------------------------------------------------------------
function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list");
$v_result=1;
$v_list_detail = array();
// ----- Look if the archive exists or is empty
if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");
// ----- Do a create
$v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Magic quotes trick
$this->privDisableMagicQuotes();
// ----- Open the zip file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($v_result=$this->privOpenFd('rb')) != 1)
{
// ----- Magic quotes trick
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -2366,20 +2190,16 @@
{
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Go to beginning of File
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
@rewind($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
// ----- Creates a temporay file
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
// ----- Open the temporary file in write mode
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
{
$this->privCloseFd();
@@ -2388,7 +2208,6 @@
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -2398,7 +2217,6 @@
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = fread($this->zip_fd, $v_read_size);
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
@@ -2421,20 +2239,17 @@
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Store the offset of the central dir
$v_offset = @ftell($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
// ----- Copy the block of file headers from the old archive
$v_size = $v_central_dir['size'];
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = @fread($v_zip_temp_fd, $v_read_size);
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
@@ -2452,7 +2267,6 @@
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
$v_count++;
@@ -2485,7 +2299,6 @@
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -2513,7 +2326,6 @@
PclZipUtilRename($v_zip_temp_name, $this->zipname);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2525,7 +2337,6 @@
// --------------------------------------------------------------------------------
function privOpenFd($p_mode)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOpenFd", 'mode='.$p_mode);
$v_result=1;
// ----- Look if already open
@@ -2535,24 +2346,20 @@
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Open the zip file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');
if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
{
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2564,7 +2371,6 @@
// --------------------------------------------------------------------------------
function privCloseFd()
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCloseFd", "");
$v_result=1;
if ($this->zip_fd != 0)
@@ -2572,7 +2378,6 @@
$this->zip_fd = 0;
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2593,7 +2398,6 @@
// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list");
$v_result=1;
// ----- Add the files
@@ -2601,7 +2405,6 @@
if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
{
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -2615,7 +2418,6 @@
if ($v_header_list[$i]['status'] == 'ok') {
if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
$v_count++;
@@ -2641,12 +2443,10 @@
unset($v_header_list);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2655,42 +2455,36 @@
// Function : privAddFileList()
// Description :
// Parameters :
- // $p_filedescr_list : An array containing the file description
+ // $p_filedescr_list : An array containing the file description
// or directory names to add in the zip
// $p_result_list : list of added files with their properties (specially the status field)
// Return Values :
// --------------------------------------------------------------------------------
function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "filedescr_list");
$v_result=1;
$v_header = array();
// ----- Recuperate the current number of elt in list
$v_nb = sizeof($p_result_list);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");
// ----- Loop on the files
for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
// ----- Format the filename
$p_filedescr_list[$j]['filename']
= PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
-
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
+
// ----- Skip empty file names
// TBC : Can this be possible ? not checked in DescrParseAtt ?
if ($p_filedescr_list[$j]['filename'] == "") {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
continue;
}
// ----- Check the filename
if ( ($p_filedescr_list[$j]['type'] != 'virtual_file')
&& (!file_exists($p_filedescr_list[$j]['filename']))) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -2709,7 +2503,6 @@
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
$p_options);
if ($v_result != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -2717,10 +2510,8 @@
$p_result_list[$v_nb++] = $v_header;
}
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -2733,9 +2524,8 @@
// --------------------------------------------------------------------------------
function privAddFile($p_filedescr, &$p_header, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
$v_result=1;
-
+
// ----- Working variable
$p_filename = $p_filedescr['filename'];
@@ -2745,19 +2535,16 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
-
- // ----- Look for a stored different filename
+
+ // ----- Look for a stored different filename
/* TBC : Removed
if (isset($p_filedescr['stored_filename'])) {
$v_stored_filename = $p_filedescr['stored_filename'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');
}
else {
$v_stored_filename = $p_filedescr['stored_filename'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
}
*/
@@ -2786,30 +2573,27 @@
$p_header['external'] = 0x00000000;
$p_header['size'] = filesize($p_filename);
}
-
+
// ----- Look for regular folder
else if ($p_filedescr['type']=='folder') {
$p_header['external'] = 0x00000010;
$p_header['mtime'] = filemtime($p_filename);
$p_header['size'] = filesize($p_filename);
}
-
+
// ----- Look for virtual file
else if ($p_filedescr['type'] == 'virtual_file') {
$p_header['external'] = 0x00000000;
$p_header['size'] = strlen($p_filedescr['content']);
}
-
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
+
// ----- Look for filetime
if (isset($p_filedescr['mtime'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Overload mtime value with :'".$p_filedescr['mtime']."'");
$p_header['mtime'] = $p_filedescr['mtime'];
}
else if ($p_filedescr['type'] == 'virtual_file') {
$p_header['mtime'] = time();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Virtual file : use current time '".$p_header['mtime']."' for mtime value.");
}
else {
$p_header['mtime'] = filemtime($p_filename);
@@ -2827,7 +2611,6 @@
// ----- Look for pre-add callback
if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");
// ----- Generate a local information
$v_local_header = array();
@@ -2836,7 +2619,8 @@
// ----- Call the callback
// Here I do not use call_user_func() because I need to send a reference to the
// header.
- eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
+// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header);
if ($v_result == 0) {
// ----- Change the file status
$p_header['status'] = "skipped";
@@ -2847,7 +2631,6 @@
// Only some fields can be modified
if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
$p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$p_header['stored_filename']."'");
}
}
@@ -2855,7 +2638,7 @@
if ($p_header['stored_filename'] == "") {
$p_header['status'] = "filtered";
}
-
+
// ----- Check the path length
if (strlen($p_header['stored_filename']) > 0xFF) {
$p_header['status'] = 'filename_too_long';
@@ -2867,7 +2650,7 @@
// ----- Look for a file
if ($p_filedescr['type'] == 'file') {
// ----- Look for using temporary file to zip
- if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
+ if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
@@ -2876,57 +2659,45 @@
return $v_result;
}
}
-
+
// ----- Use "in memory" zip algo
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"In memory compression.");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory peak : ".memory_get_peak_usage(TRUE)." bytes");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
// ----- Open the source file
if (($v_file = @fopen($p_filename, "rb")) == 0) {
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Read the file content
$v_content = @fread($v_file, $p_header['size']);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after reading file : ".memory_get_usage(TRUE)." bytes");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after reading file : ".memory_get_peak_usage(TRUE)." bytes");
// ----- Close the file
@fclose($v_file);
// ----- Calculate the CRC
$p_header['crc'] = @crc32($v_content);
-
+
// ----- Look for no compression
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
// ----- Set header parameters
$p_header['compressed_size'] = $p_header['size'];
$p_header['compression'] = 0;
}
-
+
// ----- Look for normal compression
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
// ----- Compress the content
$v_content = @gzdeflate($v_content);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after gzdeflate : ".memory_get_usage(TRUE)." bytes");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after gzdeflate : ".memory_get_peak_usage(TRUE)." bytes");
// ----- Set header parameters
$p_header['compressed_size'] = strlen($v_content);
$p_header['compression'] = 8;
}
-
+
// ----- Call the header generation
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
@fclose($v_file);
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -2939,24 +2710,21 @@
// ----- Look for a virtual file (a file from string)
else if ($p_filedescr['type'] == 'virtual_file') {
-
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Add by string");
+
$v_content = $p_filedescr['content'];
// ----- Calculate the CRC
$p_header['crc'] = @crc32($v_content);
-
+
// ----- Look for no compression
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
// ----- Set header parameters
$p_header['compressed_size'] = $p_header['size'];
$p_header['compression'] = 0;
}
-
+
// ----- Look for normal compression
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
// ----- Compress the content
$v_content = @gzdeflate($v_content);
@@ -2964,11 +2732,10 @@
$p_header['compressed_size'] = strlen($v_content);
$p_header['compression'] = 8;
}
-
+
// ----- Call the header generation
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
@fclose($v_file);
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -2978,7 +2745,6 @@
// ----- Look for a directory
else if ($p_filedescr['type'] == 'folder') {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
// ----- Look for directory last '/'
if (@substr($p_header['stored_filename'], -1) != '/') {
$p_header['stored_filename'] .= '/';
@@ -2992,7 +2758,6 @@
// ----- Call the header generation
if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
{
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
}
@@ -3000,7 +2765,6 @@
// ----- Look for post-add callback
if (isset($p_options[PCLZIP_CB_POST_ADD])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the extraction");
// ----- Generate a local information
$v_local_header = array();
@@ -3009,7 +2773,8 @@
// ----- Call the callback
// Here I do not use call_user_func() because I need to send a reference to the
// header.
- eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
+// eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header);
if ($v_result == 0) {
// ----- Ignored
$v_result = 1;
@@ -3020,7 +2785,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3033,18 +2797,15 @@
// --------------------------------------------------------------------------------
function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileUsingTempFile", "filename='".$p_filedescr['filename']."'");
$v_result=PCLZIP_ERR_NO_ERROR;
-
+
// ----- Working variable
$p_filename = $p_filedescr['filename'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
// ----- Open the source file
if (($v_file = @fopen($p_filename, "rb")) == 0) {
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -3053,7 +2814,6 @@
if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
fclose($v_file);
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -3061,7 +2821,6 @@
$v_size = filesize($p_filename);
while ($v_size != 0) {
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read ".$v_read_size." bytes");
$v_buffer = @fread($v_file, $v_read_size);
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
@gzputs($v_file_compressed, $v_buffer, $v_read_size);
@@ -3073,17 +2832,14 @@
@gzclose($v_file_compressed);
// ----- Check the minimum file size
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "gzip file size ".filesize($v_gzip_temp_name));
if (filesize($v_gzip_temp_name) < 18) {
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes');
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Extract the compressed attributes
if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -3092,28 +2848,17 @@
$v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data);
// ----- Check some parameters
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[id1]='.bin2hex($v_data_header['id1']));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[id2]='.bin2hex($v_data_header['id2']));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[cm]='.bin2hex($v_data_header['cm']));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[flag]='.bin2hex($v_data_header['flag']));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[mtime]='.$v_data_header['mtime']);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[xfl]='.bin2hex($v_data_header['xfl']));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[os]='.bin2hex($v_data_header['os']));
$v_data_header['os'] = bin2hex($v_data_header['os']);
// ----- Read the gzip file footer
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position after header ".ftell($v_file_compressed));
@fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position at beginning of footer ".ftell($v_file_compressed));
$v_binary_data = @fread($v_file_compressed, 8);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position after footer ".ftell($v_file_compressed));
$v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
// ----- Set the attributes
$p_header['compression'] = ord($v_data_header['cm']);
//$p_header['mtime'] = $v_data_header['mtime'];
$p_header['crc'] = $v_data_footer['crc'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Compressed size ".(filesize($v_gzip_temp_name)-18));
$p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
// ----- Close the file
@@ -3121,7 +2866,6 @@
// ----- Call the header generation
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -3129,19 +2873,15 @@
if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
{
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
fseek($v_file_compressed, 10);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position before reading compressed data ".ftell($v_file_compressed));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, ' '.$p_header['compressed_size'].' bytes to read');
$v_size = $p_header['compressed_size'];
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read ".$v_read_size." bytes");
$v_buffer = @fread($v_file_compressed, $v_read_size);
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
@@ -3153,9 +2893,8 @@
// ----- Unlink the temporary file
@unlink($v_gzip_temp_name);
-
+
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3170,9 +2909,8 @@
// --------------------------------------------------------------------------------
function privCalculateStoredFilename(&$p_filedescr, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
$v_result=1;
-
+
// ----- Working variables
$p_filename = $p_filedescr['filename'];
if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
@@ -3187,7 +2925,6 @@
else {
$p_remove_dir = '';
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Remove path ='".$p_remove_dir."'");
if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
$p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
}
@@ -3195,13 +2932,13 @@
$p_remove_all_dir = 0;
}
+
// ----- Look for full name change
if (isset($p_filedescr['new_full_name'])) {
// ----- Remove drive letter if any
$v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
}
-
+
// ----- Look for path and/or short name change
else {
@@ -3214,7 +2951,6 @@
$v_dir = $v_path_info['dirname'].'/';
}
$v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$p_filename."' for '".$v_stored_filename."'");
}
else {
// ----- Calculate the stored filename
@@ -3224,17 +2960,15 @@
// ----- Look for all path to remove
if ($p_remove_all_dir) {
$v_stored_filename = basename($p_filename);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$p_filename."' for '".$v_stored_filename."'");
}
// ----- Look for partial path remove
else if ($p_remove_dir != "") {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Partial path to remove");
if (substr($p_remove_dir, -1) != '/')
$p_remove_dir .= "/";
if ( (substr($p_filename, 0, 2) == "./")
|| (substr($p_remove_dir, 0, 2) == "./")) {
-
+
if ( (substr($p_filename, 0, 2) == "./")
&& (substr($p_remove_dir, 0, 2) != "./")) {
$p_remove_dir = "./".$p_remove_dir;
@@ -3250,37 +2984,31 @@
if ($v_compare > 0) {
if ($v_compare == 2) {
$v_stored_filename = "";
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$v_stored_filename'");
$v_stored_filename = substr($v_stored_filename,
strlen($p_remove_dir));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v_stored_filename'");
}
}
}
-
+
// ----- Remove drive letter if any
$v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
-
+
// ----- Look for path to add
if ($p_add_dir != "") {
if (substr($p_add_dir, -1) == "/")
$v_stored_filename = $p_add_dir.$v_stored_filename;
else
$v_stored_filename = $p_add_dir."/".$v_stored_filename;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
}
}
// ----- Filename (reduce the path of stored name)
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
$p_filedescr['stored_filename'] = $v_stored_filename;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
-
+
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3293,15 +3021,12 @@
// --------------------------------------------------------------------------------
function privWriteFileHeader(&$p_header)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
$v_result=1;
// ----- Store the offset position of the file
$p_header['offset'] = ftell($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$p_header['offset']);
// ----- Transform UNIX mtime to DOS format mdate/mtime
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
$v_date = getdate($p_header['mtime']);
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
@@ -3329,7 +3054,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3342,21 +3066,17 @@
// --------------------------------------------------------------------------------
function privWriteCentralFileHeader(&$p_header)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
$v_result=1;
// TBC
//for(reset($p_header); $key = key($p_header); next($p_header)) {
- // //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);
//}
// ----- Transform UNIX mtime to DOS format mdate/mtime
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
$v_date = getdate($p_header['mtime']);
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment size : \''.$p_header['comment_len'].'\'');
// ----- Packed data
$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
@@ -3387,7 +3107,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3400,7 +3119,6 @@
// --------------------------------------------------------------------------------
function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');
$v_result=1;
// ----- Packed data
@@ -3418,7 +3136,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3431,24 +3148,21 @@
// --------------------------------------------------------------------------------
function privList(&$p_list)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privList", "list");
$v_result=1;
// ----- Magic quotes trick
$this->privDisableMagicQuotes();
// ----- Open the zip file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
{
// ----- Magic quotes trick
$this->privSwapBackMagicQuotes();
-
+
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -3457,15 +3171,11 @@
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
{
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Go to beginning of Central Dir
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v_central_dir['offset']."'");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
@rewind($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
if (@fseek($this->zip_fd, $v_central_dir['offset']))
{
$this->privSwapBackMagicQuotes();
@@ -3474,10 +3184,8 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
// ----- Read each entry
for ($i=0; $i<$v_central_dir['entries']; $i++)
@@ -3486,7 +3194,6 @@
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
{
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
$v_header['index'] = $i;
@@ -3503,7 +3210,6 @@
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3529,7 +3235,6 @@
// --------------------------------------------------------------------------------
function privConvertHeader2FileInfo($p_header, &$p_info)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");
$v_result=1;
// ----- Get the interesting attributes
@@ -3547,7 +3252,6 @@
$p_info['crc'] = $p_header['crc'];
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3570,7 +3274,6 @@
// --------------------------------------------------------------------------------
function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
$v_result=1;
// ----- Magic quotes trick
@@ -3589,9 +3292,7 @@
// ----- Look for the path end '/'
while (substr($p_path, -1) == "/")
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'");
$p_path = substr($p_path, 0, strlen($p_path)-1);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]");
}
}
@@ -3603,11 +3304,9 @@
$p_remove_path_size = strlen($p_remove_path);
// ----- Open the zip file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($v_result = $this->privOpenFd('rb')) != 1)
{
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -3619,7 +3318,6 @@
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -3630,12 +3328,9 @@
$j_start = 0;
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$i'");
// ----- Read next Central dir entry
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");
@rewind($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");
if (@fseek($this->zip_fd, $v_pos_entry))
{
// ----- Close the zip file
@@ -3646,10 +3341,8 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");
// ----- Read the file header
$v_header = array();
@@ -3659,7 +3352,6 @@
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -3675,49 +3367,43 @@
// ----- Look for extract by name rule
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
// ----- Look if the filename is in the list
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
// ----- Look for a directory
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
// ----- Look if the directory is in the filename path
if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
&& (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
$v_extract = true;
}
}
// ----- Look for a filename
elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
$v_extract = true;
}
}
}
// ----- Look for extract by ereg rule
+ // ereg() is deprecated with PHP 5.3
+ /*
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
$v_extract = true;
}
}
+ */
// ----- Look for extract by preg rule
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
$v_extract = true;
}
}
@@ -3725,23 +3411,18 @@
// ----- Look for extract by index rule
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
-
+
// ----- Look if the index is in the list
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
$v_extract = true;
}
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
$j_start = $j+1;
}
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
break;
}
}
@@ -3749,7 +3430,6 @@
// ----- Look for no rule, which means extract all the archive
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");
$v_extract = true;
}
@@ -3757,35 +3437,30 @@
if ( ($v_extract)
&& ( ($v_header['compression'] != 8)
&& ($v_header['compression'] != 0))) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v_header['compression'].")");
$v_header['status'] = 'unsupported_compression';
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
$this->privSwapBackMagicQuotes();
-
+
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
"Filename '".$v_header['stored_filename']."' is "
."compressed by an unsupported compression "
."method (".$v_header['compression'].") ");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
-
+
// ----- Check encrypted files
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
$v_header['status'] = 'unsupported_encryption';
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
$this->privSwapBackMagicQuotes();
@@ -3794,35 +3469,29 @@
." filename '".$v_header['stored_filename']
."'");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
// ----- Look for real extraction
if (($v_extract) && ($v_header['status'] != 'ok')) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");
$v_result = $this->privConvertHeader2FileInfo($v_header,
$p_file_list[$v_nb_extracted++]);
if ($v_result != 1) {
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
$v_extract = false;
}
-
+
// ----- Look for real extraction
if ($v_extract)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v_header['filename']."', index '$i'");
// ----- Go to the file position
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
@rewind($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
if (@fseek($this->zip_fd, $v_header['offset']))
{
// ----- Close the zip file
@@ -3834,20 +3503,19 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
// ----- Look for extraction as string
if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
+ $v_string = '';
+
// ----- Extracting the file
- $v_result1 = $this->privExtractFileAsString($v_header, $v_string);
+ $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options);
if ($v_result1 < 1) {
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
return $v_result1;
}
@@ -3858,7 +3526,6 @@
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -3867,7 +3534,7 @@
// ----- Next extracted file
$v_nb_extracted++;
-
+
// ----- Look for user callback abort
if ($v_result1 == 2) {
break;
@@ -3881,7 +3548,6 @@
if ($v_result1 < 1) {
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
return $v_result1;
}
@@ -3889,7 +3555,6 @@
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -3908,7 +3573,6 @@
if ($v_result1 < 1) {
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
return $v_result1;
}
@@ -3919,7 +3583,6 @@
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -3936,7 +3599,6 @@
$this->privSwapBackMagicQuotes();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -3952,18 +3614,15 @@
// --------------------------------------------------------------------------------
function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
$v_result=1;
// ----- Read the file header
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
{
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
// ----- Check that the file header is coherent with $p_entry info
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
@@ -3974,15 +3633,12 @@
if ($p_remove_all_path == true) {
// ----- Look for folder entry that not need to be extracted
if (($p_entry['external']&0x00000010)==0x00000010) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The entry is a folder : need to be filtered");
$p_entry['status'] = "filtered";
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");
// ----- Get the basename of the path
$p_entry['filename'] = basename($p_entry['filename']);
}
@@ -3990,28 +3646,23 @@
// ----- Look for path to remove
else if ($p_remove_path != "")
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");
if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$p_entry['filename']."'");
// ----- Change the file status
$p_entry['status'] = "filtered";
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
$p_remove_path_size = strlen($p_remove_path);
if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");
// ----- Remove the path
$p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$p_entry['filename']."'");
}
}
@@ -4019,28 +3670,24 @@
if ($p_path != '') {
$p_entry['filename'] = $p_path."/".$p_entry['filename'];
}
-
+
// ----- Check a base_dir_restriction
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
$v_inclusion
= PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
- $p_entry['filename']);
+ $p_entry['filename']);
if ($v_inclusion == 0) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
"Filename '".$p_entry['filename']."' is "
."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
// ----- Look for pre-extract callback
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
// ----- Generate a local information
$v_local_header = array();
@@ -4049,16 +3696,16 @@
// ----- Call the callback
// Here I do not use call_user_func() because I need to send a reference to the
// header.
- eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
if ($v_result == 0) {
// ----- Change the file status
$p_entry['status'] = "skipped";
$v_result = 1;
}
-
+
// ----- Look for abort result
if ($v_result == 2) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
// ----- This status is internal and will be changed in 'skipped'
$p_entry['status'] = "aborted";
$v_result = PCLZIP_ERR_USER_ABORTED;
@@ -4067,10 +3714,8 @@
// ----- Update the informations
// Only some fields can be modified
$p_entry['filename'] = $v_local_header['filename'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
// ----- Look if extraction should be done
if ($p_entry['status'] == 'ok') {
@@ -4078,35 +3723,30 @@
// ----- Look for specific actions while the file exist
if (file_exists($p_entry['filename']))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_entry['filename']."' already exists");
// ----- Look if file is a directory
if (is_dir($p_entry['filename']))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is a directory");
// ----- Change the file status
$p_entry['status'] = "already_a_directory";
-
+
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
// For historical reason first PclZip implementation does not stop
// when this kind of error occurs.
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
"Filename '".$p_entry['filename']."' is "
."already used by an existing directory");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
// ----- Look if file is write protected
else if (!is_writeable($p_entry['filename']))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is write protected");
// ----- Change the file status
$p_entry['status'] = "write_protected";
@@ -4116,13 +3756,11 @@
// when this kind of error occurs.
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
"Filename '".$p_entry['filename']."' exists "
."and is write protected");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
@@ -4130,14 +3768,11 @@
// ----- Look if the extracted file is older
else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is newer (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
// ----- Change the file status
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
$p_entry['status'] = "newer_exist";
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
@@ -4145,19 +3780,16 @@
// when this kind of error occurs.
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
"Newer version of '".$p_entry['filename']."' exists "
."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
}
}
@@ -4171,13 +3803,11 @@
$v_dir_to_check = dirname($p_entry['filename']);
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
-
+
// ----- Change the file status
$p_entry['status'] = "path_creation_fail";
-
+
// ----- Return
- ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
//return $v_result;
$v_result = 1;
}
@@ -4192,35 +3822,30 @@
{
// ----- Look for not compressed file
if ($p_entry['compression'] == 0) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
// ----- Opening destination file
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
// ----- Change the file status
$p_entry['status'] = "write_error";
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$p_entry['size']."' bytes");
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
$v_size = $p_entry['compressed_size'];
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v_read_size bytes");
$v_buffer = @fread($this->zip_fd, $v_read_size);
/* Try to speed up the code
$v_binary_data = pack('a'.$v_read_size, $v_buffer);
@fwrite($v_dest_file, $v_binary_data, $v_read_size);
*/
- @fwrite($v_dest_file, $v_buffer, $v_read_size);
+ @fwrite($v_dest_file, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
}
@@ -4228,24 +3853,21 @@
fclose($v_dest_file);
// ----- Change the file mtime
- touch($p_entry['filename'], $p_entry['mtime']);
-
+ @touch($p_entry['filename'], $p_entry['mtime']);
+
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$p_entry['compression'].")");
// ----- TBC
// Need to be finished
if (($p_entry['flag'] & 1) == 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.');
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Look for using temporary file to unzip
- if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
+ if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
@@ -4254,47 +3876,42 @@
return $v_result;
}
}
-
+
// ----- Look for extract in memory
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
-
+
// ----- Read the compressed file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
-
+
// ----- Decompress the file
$v_file_content = @gzinflate($v_buffer);
unset($v_buffer);
if ($v_file_content === FALSE) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
-
+
// ----- Change the file status
// TBC
$p_entry['status'] = "error";
-
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+
return $v_result;
}
-
+
// ----- Opening destination file
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
-
+
// ----- Change the file status
$p_entry['status'] = "write_error";
-
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+
return $v_result;
}
-
+
// ----- Write the uncompressed data
@fwrite($v_dest_file, $v_file_content, $p_entry['size']);
unset($v_file_content);
-
+
// ----- Closing the destination file
@fclose($v_dest_file);
-
+
}
// ----- Change the file mtime
@@ -4303,24 +3920,21 @@
// ----- Look for chmod option
if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");
// ----- Change the mode of the file
@chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
}
}
- // ----- Change abort status
- if ($p_entry['status'] == "aborted") {
- $p_entry['status'] = "skipped";
- }
-
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
+ $p_entry['status'] = "skipped";
+ }
+
// ----- Look for post-extract callback
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
// ----- Generate a local information
$v_local_header = array();
@@ -4329,17 +3943,16 @@
// ----- Call the callback
// Here I do not use call_user_func() because I need to send a reference to the
// header.
- eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
// ----- Look for abort result
if ($v_result == 2) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
$v_result = PCLZIP_ERR_USER_ABORTED;
}
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -4352,19 +3965,16 @@
// --------------------------------------------------------------------------------
function privExtractFileUsingTempFile(&$p_entry, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileUsingTempFile', "filename='".$p_entry['filename']."'");
$v_result=1;
-
+
// ----- Creates a temporary file
$v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
fclose($v_file);
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Start extraction of '".$p_entry['filename']."'");
// ----- Write gz file format header
$v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
@@ -4372,11 +3982,9 @@
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
$v_size = $p_entry['compressed_size'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Compressed Size :".$v_size."");
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v_read_size." bytes");
$v_buffer = @fread($this->zip_fd, $v_read_size);
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
@fwrite($v_dest_file, $v_buffer, $v_read_size);
@@ -4392,9 +4000,7 @@
// ----- Opening destination file
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
$p_entry['status'] = "write_error";
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -4403,19 +4009,14 @@
@fclose($v_dest_file);
$p_entry['status'] = "read_error";
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File size is '.filesize($v_gzip_temp_name));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
$v_size = $p_entry['size'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size :".$v_size."");
while ($v_size != 0) {
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v_read_size." bytes");
$v_buffer = @gzread($v_src_file, $v_read_size);
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
@fwrite($v_dest_file, $v_buffer, $v_read_size);
@@ -4426,9 +4027,8 @@
// ----- Delete the temporary file
@unlink($v_gzip_temp_name);
-
+
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -4441,16 +4041,13 @@
// --------------------------------------------------------------------------------
function privExtractFileInOutput(&$p_entry, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileInOutput', "");
$v_result=1;
// ----- Read the file header
if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
// ----- Check that the file header is coherent with $p_entry info
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
@@ -4459,7 +4056,6 @@
// ----- Look for pre-extract callback
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
// ----- Generate a local information
$v_local_header = array();
@@ -4468,7 +4064,8 @@
// ----- Call the callback
// Here I do not use call_user_func() because I need to send a reference to the
// header.
- eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
if ($v_result == 0) {
// ----- Change the file status
$p_entry['status'] = "skipped";
@@ -4477,7 +4074,6 @@
// ----- Look for abort result
if ($v_result == 2) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
// ----- This status is internal and will be changed in 'skipped'
$p_entry['status'] = "aborted";
$v_result = PCLZIP_ERR_USER_ABORTED;
@@ -4486,11 +4082,9 @@
// ----- Update the informations
// Only some fields can be modified
$p_entry['filename'] = $v_local_header['filename'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
}
// ----- Trace
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
// ----- Look if extraction should be done
if ($p_entry['status'] == 'ok') {
@@ -4499,8 +4093,6 @@
if (!(($p_entry['external']&0x00000010)==0x00000010)) {
// ----- Look for not compressed file
if ($p_entry['compressed_size'] == $p_entry['size']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
// ----- Read the file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@@ -4510,12 +4102,10 @@
unset($v_buffer);
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$p_entry['size']."' bytes");
// ----- Read the compressed file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
-
+
// ----- Decompress the file
$v_file_content = gzinflate($v_buffer);
unset($v_buffer);
@@ -4524,7 +4114,6 @@
echo $v_file_content;
unset($v_file_content);
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
}
}
@@ -4535,7 +4124,6 @@
// ----- Look for post-extract callback
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
// ----- Generate a local information
$v_local_header = array();
@@ -4544,16 +4132,15 @@
// ----- Call the callback
// Here I do not use call_user_func() because I need to send a reference to the
// header.
- eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
// ----- Look for abort result
if ($v_result == 2) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
$v_result = PCLZIP_ERR_USER_ABORTED;
}
}
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -4564,9 +4151,8 @@
// Parameters :
// Return Values :
// --------------------------------------------------------------------------------
- function privExtractFileAsString(&$p_entry, &$p_string)
+ function privExtractFileAsString(&$p_entry, &$p_string, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileAsString', "p_entry['filename']='".$p_entry['filename']."'");
$v_result=1;
// ----- Read the file header
@@ -4574,52 +4160,110 @@
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
{
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
// ----- Check that the file header is coherent with $p_entry info
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
// TBC
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$p_entry['filename']."', size '$v_header[size]'");
+ // ----- Look for pre-extract callback
+ if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
- // ----- Do the extraction (if not a folder)
- if (!(($p_entry['external']&0x00000010)==0x00000010))
- {
- // ----- Look for not compressed file
-// if ($p_entry['compressed_size'] == $p_entry['size'])
- if ($p_entry['compression'] == 0) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
-
- // ----- Reading the file
- $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
+ if ($v_result == 0) {
+ // ----- Change the file status
+ $p_entry['status'] = "skipped";
+ $v_result = 1;
}
- else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (compression method '".$p_entry['compression']."')");
-
- // ----- Reading the file
- $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
-
- // ----- Decompress the file
- if (($p_string = @gzinflate($v_data)) === FALSE) {
- // TBC
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ // ----- This status is internal and will be changed in 'skipped'
+ $p_entry['status'] = "aborted";
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+
+ // ----- Update the informations
+ // Only some fields can be modified
+ $p_entry['filename'] = $v_local_header['filename'];
+ }
+
+
+ // ----- Look if extraction should be done
+ if ($p_entry['status'] == 'ok') {
+
+ // ----- Do the extraction (if not a folder)
+ if (!(($p_entry['external']&0x00000010)==0x00000010)) {
+ // ----- Look for not compressed file
+ // if ($p_entry['compressed_size'] == $p_entry['size'])
+ if ($p_entry['compression'] == 0) {
+
+ // ----- Reading the file
+ $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
+ }
+ else {
+
+ // ----- Reading the file
+ $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+ // ----- Decompress the file
+ if (($p_string = @gzinflate($v_data)) === FALSE) {
+ // TBC
+ }
}
+
+ // ----- Trace
+ }
+ else {
+ // TBC : error : can not extract a folder in a string
}
- // ----- Trace
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
}
- else {
- // TBC : error : can not extract a folder in a string
+
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
+ $p_entry['status'] = "skipped";
+ }
+
+ // ----- Look for post-extract callback
+ elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Swap the content to header
+ $v_local_header['content'] = $p_string;
+ $p_string = '';
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
+
+ // ----- Swap back the content to header
+ $p_string = $v_local_header['content'];
+ unset($v_local_header['content']);
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -4632,25 +4276,20 @@
// --------------------------------------------------------------------------------
function privReadFileHeader(&$p_header)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadFileHeader", "");
$v_result=1;
// ----- Read the 4 bytes signature
$v_binary_data = @fread($this->zip_fd, 4);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
$v_data = unpack('Vid', $v_binary_data);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
// ----- Check signature
if ($v_data['id'] != 0x04034b50)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -4662,53 +4301,36 @@
{
$p_header['filename'] = "";
$p_header['status'] = "invalid_header";
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Extract the values
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v_binary_data."'");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v_binary_data)."'");
$v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
// ----- Get filename
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v_data['filename_len']);
$p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$p_header['filename'].'\'');
// ----- Get extra_fields
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v_data['extra_len']);
if ($v_data['extra_len'] != 0) {
$p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
}
else {
$p_header['extra'] = '';
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($p_header['extra']).'\'');
// ----- Extract properties
$p_header['version_extracted'] = $v_data['version'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$p_header['version_extracted'].') \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
$p_header['compression'] = $v_data['compression'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$p_header['compression'].'\'');
$p_header['size'] = $v_data['size'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_header['size'].'\'');
$p_header['compressed_size'] = $v_data['compressed_size'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
$p_header['crc'] = $v_data['crc'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
$p_header['flag'] = $v_data['flag'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag bit 11 (from right) : \''.($p_header['flag']&0x0400).'\'');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag bit 11 (from left) : \''.($p_header['flag']&0x0020).'\'');
$p_header['filename_len'] = $v_data['filename_len'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');
// ----- Recuperate date in UNIX format
$p_header['mdate'] = $v_data['mdate'];
@@ -4728,17 +4350,14 @@
// ----- Get UNIX date format
$p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
}
else
{
$p_header['mtime'] = time();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
}
// TBC
//for(reset($v_data); $key = key($v_data); next($v_data)) {
- // //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v_data[$key]);
//}
// ----- Set the stored filename
@@ -4748,7 +4367,6 @@
$p_header['status'] = "ok";
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -4761,25 +4379,20 @@
// --------------------------------------------------------------------------------
function privReadCentralFileHeader(&$p_header)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadCentralFileHeader", "");
$v_result=1;
// ----- Read the 4 bytes signature
$v_binary_data = @fread($this->zip_fd, 4);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
$v_data = unpack('Vid', $v_binary_data);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
// ----- Check signature
if ($v_data['id'] != 0x02014b50)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -4791,53 +4404,36 @@
{
$p_header['filename'] = "";
$p_header['status'] = "invalid_header";
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Extract the values
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v_binary_data."'");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v_binary_data)."'");
$p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
// ----- Get filename
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$p_header['filename_len']);
if ($p_header['filename_len'] != 0)
$p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
else
$p_header['filename'] = '';
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$p_header['filename'].'\'');
// ----- Get extra
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$p_header['extra_len']);
if ($p_header['extra_len'] != 0)
$p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
else
$p_header['extra'] = '';
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$p_header['extra'].'\'');
// ----- Get comment
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$p_header['comment_len']);
if ($p_header['comment_len'] != 0)
$p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
else
$p_header['comment'] = '';
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$p_header['comment'].'\'');
// ----- Extract properties
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$p_header['size'].'\'');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$p_header['flag'].'\'');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');
// ----- Recuperate date in UNIX format
//if ($p_header['mdate'] && $p_header['mtime'])
@@ -4857,12 +4453,10 @@
// ----- Get UNIX date format
$p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
}
else
{
$p_header['mtime'] = time();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
}
// ----- Set the stored filename
@@ -4872,18 +4466,13 @@
$p_header['status'] = 'ok';
// ----- Look if it is a directory
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "External (Hex) : '".sprintf("Ox%04X", $p_header['external'])."' (".(($p_header['external']&0x00000010)==0x00000010?'is a folder':'is a file').')');
if (substr($p_header['filename'], -1) == '/') {
//$p_header['external'] = 0x41FF0010;
$p_header['external'] = 0x00000010;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $p_header['external']).'\'');
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$p_header['filename'].'\'');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -4898,44 +4487,31 @@
// --------------------------------------------------------------------------------
function privCheckFileHeaders(&$p_local_header, &$p_central_header)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
$v_result=1;
// ----- Check the static values
// TBC
if ($p_local_header['filename'] != $p_central_header['filename']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
}
if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
}
if ($p_local_header['flag'] != $p_central_header['flag']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
}
if ($p_local_header['compression'] != $p_central_header['compression']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
}
if ($p_local_header['mtime'] != $p_central_header['mtime']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
}
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
}
-
+
// ----- Look for flag bit 3
if (($p_local_header['flag'] & 8) == 8) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
$p_local_header['size'] = $p_central_header['size'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
$p_local_header['compressed_size'] = $p_central_header['compressed_size'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
$p_local_header['crc'] = $p_central_header['crc'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -4948,21 +4524,17 @@
// --------------------------------------------------------------------------------
function privReadEndCentralDir(&$p_central_dir)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadEndCentralDir", "");
$v_result=1;
// ----- Go to the end of the zip file
$v_size = filesize($this->zipname);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v_size");
@fseek($this->zip_fd, $v_size);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
if (@ftell($this->zip_fd) != $v_size)
{
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -4970,28 +4542,22 @@
// in this case the end of central dir is at 22 bytes of the file end
$v_found = 0;
if ($v_size > 26) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');
@fseek($this->zip_fd, $v_size-22);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');
if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
{
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Read for bytes
$v_binary_data = @fread($this->zip_fd, 4);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
$v_data = @unpack('Vid', $v_binary_data);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
// ----- Check signature
if ($v_data['id'] == 0x06054b50) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");
$v_found = 1;
}
@@ -5000,7 +4566,6 @@
// ----- Go back to the maximum possible size of the Central Dir End Record
if (!$v_found) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');
$v_maximum_size = 65557; // 0xFFFF + 22;
if ($v_maximum_size > $v_size)
$v_maximum_size = $v_size;
@@ -5011,10 +4576,8 @@
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');
// ----- Read byte per byte in order to find the signature
$v_pos = ftell($this->zip_fd);
@@ -5025,12 +4588,14 @@
$v_byte = @fread($this->zip_fd, 1);
// ----- Add the byte
- $v_bytes = ($v_bytes << 8) | Ord($v_byte);
+ //$v_bytes = ($v_bytes << 8) | Ord($v_byte);
+ // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
+ // Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
+ $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
// ----- Compare the bytes
if ($v_bytes == 0x504b0506)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
$v_pos++;
break;
}
@@ -5041,13 +4606,11 @@
// ----- Look if not found end of central dir
if ($v_pos == $v_size)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
@@ -5058,25 +4621,19 @@
// ----- Look for invalid block size
if (strlen($v_binary_data) != 18)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Extract the values
- ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v_binary_data."'");
- ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");
$v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
// ----- Check the global size
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v_data['comment_size']);
if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");
// ----- Removed in release 2.2 see readme file
// The check of the file size is a little too strict.
@@ -5089,40 +4646,29 @@
.' Some trailing bytes exists after the archive.');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
// ----- Get comment
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment size : \''.$v_data['comment_size'].'\'');
if ($v_data['comment_size'] != 0) {
$p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
}
else
$p_central_dir['comment'] = '';
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');
$p_central_dir['entries'] = $v_data['entries'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$p_central_dir['entries'].'\'');
$p_central_dir['disk_entries'] = $v_data['disk_entries'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$p_central_dir['disk_entries'].'\'');
$p_central_dir['offset'] = $v_data['offset'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$p_central_dir['offset'].'\'');
$p_central_dir['size'] = $v_data['size'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$p_central_dir['size'].'\'');
$p_central_dir['disk'] = $v_data['disk'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$p_central_dir['disk'].'\'');
$p_central_dir['disk_start'] = $v_data['disk_start'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$p_central_dir['disk_start'].'\'');
// TBC
//for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
- // //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$p_central_dir[$key]);
//}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -5135,16 +4681,13 @@
// --------------------------------------------------------------------------------
function privDeleteByRule(&$p_result_list, &$p_options)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", "");
$v_result=1;
$v_list_detail = array();
// ----- Open the zip file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($v_result=$this->privOpenFd('rb')) != 1)
{
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -5153,21 +4696,16 @@
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
{
$this->privCloseFd();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Go to beginning of File
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
@rewind($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
// ----- Scan all the files
// ----- Start at beginning of Central Dir
$v_pos_entry = $v_central_dir['offset'];
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
@rewind($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
if (@fseek($this->zip_fd, $v_pos_entry))
{
// ----- Close the zip file
@@ -5177,17 +4715,14 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
// ----- Read each entry
$v_header_list = array();
$j_start = 0;
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')");
// ----- Read the file header
$v_header_list[$v_nb_extracted] = array();
@@ -5196,11 +4731,9 @@
// ----- Close the zip file
$this->privCloseFd();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'");
// ----- Store the index
$v_header_list[$v_nb_extracted]['index'] = $i;
@@ -5211,54 +4744,47 @@
// ----- Look for extract by name rule
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
// ----- Look if the filename is in the list
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
// ----- Look for a directory
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
// ----- Look if the directory is in the filename path
if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
&& (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
$v_found = true;
}
elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
&& ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");
$v_found = true;
}
}
// ----- Look for a filename
elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
$v_found = true;
}
}
}
// ----- Look for extract by ereg rule
+ // ereg() is deprecated with PHP 5.3
+ /*
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
$v_found = true;
}
}
+ */
// ----- Look for extract by preg rule
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
$v_found = true;
}
}
@@ -5266,41 +4792,33 @@
// ----- Look for extract by index rule
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
// ----- Look if the index is in the list
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
$v_found = true;
}
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
$j_start = $j+1;
}
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
break;
}
}
}
else {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file");
$v_found = true;
}
// ----- Look for deletion
if ($v_found)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted");
unset($v_header_list[$v_nb_extracted]);
}
else
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted");
$v_nb_extracted++;
}
}
@@ -5315,24 +4833,18 @@
$v_temp_zip = new PclZip($v_zip_temp_name);
// ----- Open the temporary zip file in write mode
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");
if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
$this->privCloseFd();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Look which file need to be kept
for ($i=0; $i<sizeof($v_header_list); $i++) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");
// ----- Calculate the position of the header
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
@rewind($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
// ----- Close the zip file
$this->privCloseFd();
@@ -5343,10 +4855,8 @@
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
// ----- Read the file header
$v_local_header = array();
@@ -5357,10 +4867,9 @@
@unlink($v_zip_temp_name);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
-
+
// ----- Check that local file header is same as central file header
if ($this->privCheckFileHeaders($v_local_header,
$v_header_list[$i]) != 1) {
@@ -5376,10 +4885,8 @@
@unlink($v_zip_temp_name);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");
// ----- Read/write the data block
if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
@@ -5389,27 +4896,22 @@
@unlink($v_zip_temp_name);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
}
// ----- Store the offset of the central dir
$v_offset = @ftell($v_temp_zip->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");
// ----- Re-Create the Central Dir files header
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
for ($i=0; $i<sizeof($v_header_list); $i++) {
// ----- Create the file header
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
$v_temp_zip->privCloseFd();
$this->privCloseFd();
@unlink($v_zip_temp_name);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -5417,7 +4919,6 @@
$v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");
// ----- Zip file comment
$v_comment = '';
@@ -5437,7 +4938,6 @@
@unlink($v_zip_temp_name);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -5453,22 +4953,20 @@
// TBC : I should test the result ...
//@rename($v_zip_temp_name, $this->zipname);
PclZipUtilRename($v_zip_temp_name, $this->zipname);
-
+
// ----- Destroy the temporary archive
unset($v_temp_zip);
}
-
+
// ----- Remove every files : reset the file
else if ($v_central_dir['entries'] != 0) {
$this->privCloseFd();
if (($v_result = $this->privOpenFd('wb')) != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -5476,7 +4974,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -5496,25 +4993,21 @@
{
$v_result = 1;
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");
// ----- Remove the final '/'
if (($p_is_dir) && (substr($p_dir, -1)=='/'))
{
$p_dir = substr($p_dir, 0, strlen($p_dir)-1);
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");
// ----- Check the directory availability
if ((is_dir($p_dir)) || ($p_dir == ""))
{
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
return 1;
}
// ----- Extract parent directory
$p_parent_dir = dirname($p_dir);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");
// ----- Just a check
if ($p_parent_dir != $p_dir)
@@ -5524,26 +5017,22 @@
{
if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
{
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
}
}
// ----- Create the directory
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
if (!@mkdir($p_dir, 0777))
{
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -5557,41 +5046,34 @@
// --------------------------------------------------------------------------------
function privMerge(&$p_archive_to_add)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");
$v_result=1;
// ----- Look if the archive_to_add exists
if (!is_file($p_archive_to_add->zipname))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");
// ----- Nothing to merge, so merge is a success
$v_result = 1;
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Look if the archive exists
if (!is_file($this->zipname))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");
// ----- Do a duplicate
$v_result = $this->privDuplicate($p_archive_to_add->zipname);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Open the zip file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($v_result=$this->privOpenFd('rb')) != 1)
{
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -5600,23 +5082,18 @@
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
{
$this->privCloseFd();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Go to beginning of File
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
@rewind($this->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
// ----- Open the archive_to_add file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");
if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
{
$this->privCloseFd();
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -5627,20 +5104,16 @@
$this->privCloseFd();
$p_archive_to_add->privCloseFd();
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Go to beginning of File
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
@rewind($p_archive_to_add->zip_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
// ----- Creates a temporay file
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
// ----- Open the temporary file in write mode
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
{
$this->privCloseFd();
@@ -5649,7 +5122,6 @@
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -5659,7 +5131,6 @@
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = fread($this->zip_fd, $v_read_size);
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
@@ -5670,7 +5141,6 @@
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
@@ -5678,14 +5148,12 @@
// ----- Store the offset of the central dir
$v_offset = @ftell($v_zip_temp_fd);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
// ----- Copy the block of file headers from the old archive
$v_size = $v_central_dir['size'];
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = @fread($this->zip_fd, $v_read_size);
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
@@ -5696,7 +5164,6 @@
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
@@ -5727,7 +5194,6 @@
unset($v_header_list);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
@@ -5753,7 +5219,6 @@
PclZipUtilRename($v_zip_temp_name, $this->zipname);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -5766,33 +5231,27 @@
// --------------------------------------------------------------------------------
function privDuplicate($p_archive_filename)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDuplicate", "archive_filename='$p_archive_filename'");
$v_result=1;
// ----- Look if the $p_archive_filename exists
if (!is_file($p_archive_filename))
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");
// ----- Nothing to duplicate, so duplicate is a success.
$v_result = 1;
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Open the zip file
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($v_result=$this->privOpenFd('wb')) != 1)
{
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Open the temporary file in write mode
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
{
$this->privCloseFd();
@@ -5800,7 +5259,6 @@
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
@@ -5810,7 +5268,6 @@
while ($v_size != 0)
{
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v_read_size bytes");
$v_buffer = fread($v_zip_temp_fd, $v_read_size);
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
@@ -5823,7 +5280,6 @@
@fclose($v_zip_temp_fd);
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -5870,36 +5326,28 @@
// --------------------------------------------------------------------------------
function privDisableMagicQuotes()
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDisableMagicQuotes', "");
$v_result=1;
// ----- Look if function exists
if ( (!function_exists("get_magic_quotes_runtime"))
|| (!function_exists("set_magic_quotes_runtime"))) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Look if already done
if ($this->magic_quotes_status != -1) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote already disabled");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Get and memorize the magic_quote value
$this->magic_quotes_status = @get_magic_quotes_runtime();
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'");
// ----- Disable magic_quotes
if ($this->magic_quotes_status == 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Disable magic_quotes");
@set_magic_quotes_runtime(0);
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -5912,32 +5360,25 @@
// --------------------------------------------------------------------------------
function privSwapBackMagicQuotes()
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privSwapBackMagicQuotes', "");
$v_result=1;
// ----- Look if function exists
if ( (!function_exists("get_magic_quotes_runtime"))
|| (!function_exists("set_magic_quotes_runtime"))) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Look if something to do
if ($this->magic_quotes_status != -1) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified");
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Swap back magic_quotes
if ($this->magic_quotes_status == 1) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes");
@set_magic_quotes_runtime($this->magic_quotes_status);
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -5954,7 +5395,6 @@
// --------------------------------------------------------------------------------
function PclZipUtilPathReduction($p_dir)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathReduction", "dir='$p_dir'");
$v_result = "";
// ----- Look for not empty path
@@ -5981,7 +5421,6 @@
// ----- It is an invalid path, so the path is not modified
// TBC
$v_result = $p_dir;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid path is unchanged");
$v_skip = 0;
}
}
@@ -6005,7 +5444,7 @@
}
}
}
-
+
// ----- Look for skip
if ($v_skip > 0) {
while ($v_skip > 0) {
@@ -6016,7 +5455,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -6038,19 +5476,16 @@
// --------------------------------------------------------------------------------
function PclZipUtilPathInclusion($p_dir, $p_path)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
$v_result = 1;
-
+
// ----- Look for path beginning by ./
if ( ($p_dir == '.')
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
$p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_dir '".$p_dir."'");
}
if ( ($p_path == '.')
|| ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
$p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_path '".$p_path."'");
}
// ----- Explode dir and path by directory separator
@@ -6063,7 +5498,6 @@
$i = 0;
$j = 0;
while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");
// ----- Look for empty dir (path reduction)
if ($v_list_dir[$i] == '') {
@@ -6077,7 +5511,6 @@
// ----- Compare the items
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($i,$j) are different");
$v_result = 0;
}
@@ -6088,11 +5521,9 @@
// ----- Look if everything seems to be the same
if ($v_result) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");
// ----- Skip all the empty items
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Looking on dir($i)='".($i < $v_list_dir_size?$v_list_dir[$i]:'')."' and path($j)='".($j < $v_list_path_size?$v_list_path[$j]:'')."'");
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
// ----- There are exactly the same
@@ -6105,7 +5536,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -6123,30 +5553,23 @@
// --------------------------------------------------------------------------------
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");
$v_result = 1;
if ($p_mode==0)
{
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));
while ($p_size != 0)
{
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = @fread($p_src, $v_read_size);
@fwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size;
}
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));
}
else if ($p_mode==1)
{
while ($p_size != 0)
{
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = @gzread($p_src, $v_read_size);
@fwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size;
@@ -6157,7 +5580,6 @@
while ($p_size != 0)
{
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = @fread($p_src, $v_read_size);
@gzwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size;
@@ -6168,7 +5590,6 @@
while ($p_size != 0)
{
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
$v_buffer = @gzread($p_src, $v_read_size);
@gzwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size;
@@ -6176,7 +5597,6 @@
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -6195,26 +5615,21 @@
// --------------------------------------------------------------------------------
function PclZipUtilRename($p_src, $p_dest)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");
$v_result = 1;
// ----- Try to rename the files
if (!@rename($p_src, $p_dest)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");
// ----- Try to copy & unlink the src
if (!@copy($p_src, $p_dest)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
$v_result = 0;
}
else if (!@unlink($p_src)) {
- //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
$v_result = 0;
}
}
// ----- Return
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
@@ -6230,8 +5645,7 @@
// --------------------------------------------------------------------------------
function PclZipUtilOptionText($p_option)
{
- //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
-
+
$v_list = get_defined_constants();
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
$v_prefix = substr($v_key, 0, 10);
@@ -6239,14 +5653,12 @@
|| ($v_prefix == 'PCLZIP_CB_')
|| ($v_prefix == 'PCLZIP_ATT'))
&& ($v_list[$v_key] == $p_option)) {
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
return $v_key;
}
}
-
+
$v_result = 'Unknown';
- //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// --------------------------------------------------------------------------------
diff --git a/libs/Smarty/Config_File.class.php b/libs/Smarty/Config_File.class.php
index 232db70043..ae0c3be315 100644
--- a/libs/Smarty/Config_File.class.php
+++ b/libs/Smarty/Config_File.class.php
@@ -22,7 +22,7 @@
* smarty-discussion-subscribe@googlegroups.com
*
* @link http://www.smarty.net/
- * @version 2.6.25
+ * @version 2.6.26
* @copyright Copyright: 2001-2005 New Digital Group, Inc.
* @author Andrei Zmievski <andrei@php.net>
* @access public
diff --git a/libs/Smarty/Smarty.class.php b/libs/Smarty/Smarty.class.php
index ea9a70de09..a3e2ed8a0f 100644
--- a/libs/Smarty/Smarty.class.php
+++ b/libs/Smarty/Smarty.class.php
@@ -27,7 +27,7 @@
* @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net>
* @package Smarty
- * @version 2.6.25
+ * @version 2.6.26
*/
/* $Id$ */
@@ -465,7 +465,7 @@ class Smarty
*
* @var string
*/
- var $_version = '2.6.25';
+ var $_version = '2.6.26';
/**
* current template inclusion depth
@@ -562,14 +562,6 @@ class Smarty
*/
var $_cache_including = false;
- /**
- * array of super globals internally
- *
- * @var array
- */
- var $_supers = array();
-
-
/**#@-*/
/**
* The class constructor.
@@ -578,18 +570,6 @@ class Smarty
{
$this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
: @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
-
- $this->_supers['get'] = $this->request_use_auto_globals ? $_GET : $GLOBALS['HTTP_GET_VARS'];
- $this->_supers['post'] = $this->request_use_auto_globals ? $_POST : $GLOBALS['HTTP_POST_VARS'];
- $this->_supers['server'] = $this->request_use_auto_globals ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
- if(isset($_SESSION))
- $this->_supers['session'] = $this->request_use_auto_globals ? $_SESSION : $GLOBALS['HTTP_SESSION_VARS'];
- else
- $this->_supers['session'] = array();
- $this->_supers['request'] = $this->request_use_auto_globals ? $_REQUEST : $GLOBALS['HTTP_REQUEST_VARS'];
- $this->_supers['cookies'] = $this->request_use_auto_globals ? $_COOKIE : $GLOBALS['HTTP_COOKIE_VARS'];
- $this->_supers['env'] = $this->request_use_auto_globals ? $_ENV : $GLOBALS['HTTP_ENV_VARS'];
-
}
/**
diff --git a/libs/Smarty/Smarty_Compiler.class.php b/libs/Smarty/Smarty_Compiler.class.php
index 2a1fb8630a..f6a278d4a4 100644
--- a/libs/Smarty/Smarty_Compiler.class.php
+++ b/libs/Smarty/Smarty_Compiler.class.php
@@ -21,7 +21,7 @@
* @link http://smarty.php.net/
* @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net>
- * @version 2.6.25
+ * @version 2.6.26
* @copyright 2001-2005 New Digital Group, Inc.
* @package Smarty
*/
@@ -2047,27 +2047,57 @@ class Smarty_Compiler extends Smarty {
break;
case 'get':
- $compiled_ref = "\$this->_supers['get']";
+ if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
+ $this->_syntax_error("(secure mode) super global access not permitted",
+ E_USER_WARNING, __FILE__, __LINE__);
+ return;
+ }
+ $compiled_ref = "\$_GET";
break;
case 'post':
- $compiled_ref = "\$this->_supers['post']";
+ if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
+ $this->_syntax_error("(secure mode) super global access not permitted",
+ E_USER_WARNING, __FILE__, __LINE__);
+ return;
+ }
+ $compiled_ref = "\$_POST";
break;
case 'cookies':
- $compiled_ref = "\$this->_supers['cookies']";
+ if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
+ $this->_syntax_error("(secure mode) super global access not permitted",
+ E_USER_WARNING, __FILE__, __LINE__);
+ return;
+ }
+ $compiled_ref = "\$_COOKIE";
break;
case 'env':
- $compiled_ref = "\$this->_supers['env']";
+ if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
+ $this->_syntax_error("(secure mode) super global access not permitted",
+ E_USER_WARNING, __FILE__, __LINE__);
+ return;
+ }
+ $compiled_ref = "\$_ENV";
break;
case 'server':
- $compiled_ref = "\$this->_supers['server']";
+ if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
+ $this->_syntax_error("(secure mode) super global access not permitted",
+ E_USER_WARNING, __FILE__, __LINE__);
+ return;
+ }
+ $compiled_ref = "\$_SERVER";
break;
case 'session':
- $compiled_ref = "\$this->_supers['session']";
+ if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
+ $this->_syntax_error("(secure mode) super global access not permitted",
+ E_USER_WARNING, __FILE__, __LINE__);
+ return;
+ }
+ $compiled_ref = "\$_SESSION";
break;
/*
@@ -2075,8 +2105,13 @@ class Smarty_Compiler extends Smarty {
* compiler.
*/
case 'request':
+ if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
+ $this->_syntax_error("(secure mode) super global access not permitted",
+ E_USER_WARNING, __FILE__, __LINE__);
+ return;
+ }
if ($this->request_use_auto_globals) {
- $compiled_ref = "\$this->_supers['request']";
+ $compiled_ref = "\$_REQUEST";
break;
} else {
$this->_init_smarty_vars = true;
diff --git a/libs/Smarty/plugins/function.cycle.php b/libs/Smarty/plugins/function.cycle.php
index fe78bb87da..80378b7f96 100644
--- a/libs/Smarty/plugins/function.cycle.php
+++ b/libs/Smarty/plugins/function.cycle.php
@@ -63,7 +63,11 @@ function smarty_function_cycle($params, &$smarty)
$cycle_vars[$name]['values'] = $params['values'];
}
- $cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ',';
+ if (isset($params['delimiter'])) {
+ $cycle_vars[$name]['delimiter'] = $params['delimiter'];
+ } elseif (!isset($cycle_vars[$name]['delimiter'])) {
+ $cycle_vars[$name]['delimiter'] = ',';
+ }
if(is_array($cycle_vars[$name]['values'])) {
$cycle_array = $cycle_vars[$name]['values'];
diff --git a/libs/Smarty/plugins/function.math.php b/libs/Smarty/plugins/function.math.php
index bb78dac22c..6575e06001 100644
--- a/libs/Smarty/plugins/function.math.php
+++ b/libs/Smarty/plugins/function.math.php
@@ -37,7 +37,7 @@ function smarty_function_math($params, &$smarty)
}
// match all vars in equation, make sure all are passed
- preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
+ preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
@@ -82,4 +82,4 @@ function smarty_function_math($params, &$smarty)
/* vim: set expandtab: */
-?>
+?> \ No newline at end of file
diff --git a/libs/Smarty/plugins/outputfilter.trimwhitespace.php b/libs/Smarty/plugins/outputfilter.trimwhitespace.php
index 739fa39b02..f39acd0df1 100644
--- a/libs/Smarty/plugins/outputfilter.trimwhitespace.php
+++ b/libs/Smarty/plugins/outputfilter.trimwhitespace.php
@@ -62,6 +62,14 @@ function smarty_outputfilter_trimwhitespace($source, &$smarty)
}
function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$subject) {
+ // 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');
+ }
+
$_len = strlen($search_str);
$_pos = 0;
for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)
@@ -70,6 +78,9 @@ function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$sub
else
break;
+ if (isset($mbIntEnc)) {
+ mb_internal_encoding($mbIntEnc);
+ }
}
?>
diff --git a/libs/UserAgentParser/README b/libs/UserAgentParser/README
index 9e3686ed5b..3e831ca981 100644
--- a/libs/UserAgentParser/README
+++ b/libs/UserAgentParser/README
@@ -5,15 +5,16 @@ UserAgentParser is NOT designed to parse bots user agent strings;
UserAgentParser will only be accurate when parsing user agents
coming from Javascript Enabled browsers!
-UserAgentParser is designed for simplicity and will accuratly detect
-most used web browsers, is regularly updated to detect newly OS and browsers.
+UserAgentParser is designed for simplicity, to accurately detect the
+most used web browsers, and be regularly updated to detect new OS and browsers.
Potential limitations:
-- it does NOT detect sub sub versions, ie. the "5" in 1.4.5 ; this is design decision to simplify the version number
-- it does NOT properly detect search engine, bots, etc. user agents, it's designed to detect browsers with javascript enabled.
+- it does NOT detect sub sub versions, ie. the "5" in 1.4.5; this is a design decision to simplify the version number
+- it does NOT detect search engine, bots, etc. user agents; it's designed to detect browsers with javascript enabled
+- it does NOT detect nested UA strings caused by some browser add-ons
Feature request:
- it could have the notion of operating system "types", ie "Windows".
It currently only has "Windows XP", "Windows Vista", etc.
-Feedback, patches: hello@piwik.org \ No newline at end of file
+Feedback, patches: hello@piwik.org
diff --git a/libs/UserAgentParser/UserAgentParser.php b/libs/UserAgentParser/UserAgentParser.php
index 4aa70356e2..a1c081f9fe 100644
--- a/libs/UserAgentParser/UserAgentParser.php
+++ b/libs/UserAgentParser/UserAgentParser.php
@@ -29,91 +29,213 @@ class UserAgentParser
// browser regex => browser ID
// if there are aliases, the common name should be last
static protected $browsers = array(
- 'opera' => 'OP',
- 'msie' => 'IE',
- 'microsoft internet explorer' => 'IE',
- 'internet explorer' => 'IE',
- 'netscape6' => 'NS',
- 'netscape' => 'NS',
- 'galeon' => 'GA',
- 'minefield' => 'FF',
- 'namoroka' => 'FF',
- 'shiretoko' => 'FF',
- 'bonecho' => 'FF',
- 'granparidiso' => 'FF',
- 'mozilla firebird' => 'FB',
- 'firebird' => 'FB',
- 'firefox' => 'FF',
- 'phoenix' => 'PX',
- 'seamonkey' => 'SM',
- 'camino' => 'CA',
- 'safari' => 'SF',
- 'chrome' => 'CH',
- 'k-meleon' => 'KM',
- 'mozilla' => 'MO',
- 'konqueror' => 'KO',
- 'blackberry' => 'BB',
- 'icab' => 'IC',
- 'lynx' => 'LX',
- 'links' => 'LI',
- 'ncsa mosaic' => 'MC',
- 'amaya' => 'AM',
- 'omniweb' => 'OW',
- 'hotjava' => 'HJ',
- 'browsex' => 'BX',
- 'amigavoyager' => 'AV',
- 'amiga-aweb' => 'AW',
- 'ibrowse' => 'IB',
- 'arora' => 'AR',
- 'iron' => 'IR',
- );
+ 'abrowse' => 'AB',
+ 'amaya' => 'AM',
+ 'amigavoyager' => 'AV',
+ 'amiga-aweb' => 'AW',
+ 'android' => 'AN',
+ 'arora' => 'AR',
+ 'beonex' => 'BE',
+ 'blackberry' => 'BB',
+ 'browsex' => 'BX',
+
+ // Camino (and earlier incarnation)
+ 'chimera' => 'CA',
+ 'camino' => 'CA',
+
+ 'cheshire' => 'CS',
+
+ // Chrome, Chromium, and ChromePlus
+ 'chrome' => 'CH',
+
+ 'cometbird' => 'CO',
+ 'dillo' => 'DI',
+ 'elinks' => 'EL',
+ 'epiphany' => 'EP',
+ 'fennec' => 'FE',
+
+ // Firefox (in its many incarnations and rebranded versions)
+ 'phoenix' => 'PX',
+ 'mozilla firebird' => 'FB',
+ 'firebird' => 'FB',
+ 'bonecho' => 'FF',
+ 'minefield' => 'FF',
+ 'namoroka' => 'FF',
+ 'shiretoko' => 'FF',
+ 'granparadiso' => 'FF',
+ 'iceweasel' => 'FF',
+ 'icecat' => 'FF',
+ 'firefox' => 'FF',
+
+ 'flock' => 'FL',
+ 'fluid' => 'FD',
+ 'galeon' => 'GA',
+ 'google earth' => 'GE',
+ 'hana' => 'HA',
+ 'hotjava' => 'HJ',
+ 'ibrowse' => 'IB',
+ 'icab' => 'IC',
+
+ // IE (including shells: Acoo, AOL, Avant, Crazy Browser, Green Browser, KKMAN, Maxathon)
+ 'msie' => 'IE',
+ 'microsoft internet explorer' => 'IE',
+ 'internet explorer' => 'IE',
+
+ 'iron' => 'IR',
+ 'kapiko' => 'KP',
+ 'kazehakase' => 'KZ',
+ 'k-meleon' => 'KM',
+ 'konqueror' => 'KO',
+ 'links' => 'LI',
+ 'lynx' => 'LX',
+ 'midori' => 'MI',
+
+ // SeaMonkey (formerly Mozilla Suite) (and rebranded versions)
+ 'mozilla' => 'MO',
+ 'gnuzilla' => 'SM',
+ 'iceape' => 'SM',
+ 'seamonkey' => 'SM',
+
+ // NCSA Mosaic (and incarnations)
+ 'mosaic' => 'MC',
+ 'ncsa mosaic' => 'MC',
+
+ // Netscape Navigator
+ 'navigator' => 'NS',
+ 'netscape6' => 'NS',
+ 'netscape' => 'NS',
+
+ 'omniweb' => 'OW',
+
+ // Opera
+ 'nitro) opera' => 'OP',
+ 'opera' => 'OP',
+
+ // Safari
+ 'safari' => 'SF',
+
+ 'webos' => 'WO',
+ 'webpro' => 'WP',
+ );
+
+ // browser family (by layout engine)
+ static protected $browserType = array(
+ 'ie' => array('IE'),
+ 'gecko' => array('NS', 'PX', 'FF', 'FB', 'CA', 'GA', 'KM', 'MO', 'SM', 'CO', 'FE', 'KP', 'KZ'),
+ 'khtml' => array('KO'),
+ 'webkit' => array('SF', 'CH', 'OW', 'AR', 'EP', 'FL', 'WO', 'AN', 'AB', 'IR', 'CS', 'FD', 'HA', 'MI', 'GE'),
+ 'opera' => array('OP'),
+ );
+
+ // WebKit version numbers to Apple Safari version numbers (if Version/X.Y.Z not present)
+ static protected $safariVersions = array(
+ '533.16' => array('5', '0'),
+ '533.4' => array('4', '1'),
+ '526.11.2' => array('4', '0'),
+ '525.26' => array('3', '2'),
+ '525.13' => array('3', '1'),
+ '522.11' => array('3', '0'),
+ '412' => array('2', '0'),
+ '312' => array('1', '3'),
+ '125' => array('1', '1'),
+ '85' => array('1', '0'),
+ '73' => array('0', '9'),
+ '48' => array('0', '8'),
+ );
+
+ // OmniWeb build numbers to OmniWeb version numbers (if Version/X.Y.Z not present)
+ static protected $omniWebVersions = array(
+ '622.10' => array('5', '10'),
+ '622.8' => array('5', '9'),
+ '622.3' => array('5', '8'),
+ '621' => array('5', '7'),
+ '613' => array('5', '6'),
+ '607' => array('5', '5'),
+ '563.34' => array('5', '1'),
+ '558.36' => array('5', '0'),
+ '496' => array('4', '5'),
+ );
// OS regex => OS ID
static protected $operatingSystems = array(
- 'iPod' => 'IPD',
- 'iPhone' => 'IPH',
- 'Nintendo Wii' => 'WII',
- 'PlayStation Portable' => 'PSP',
- 'PlayStation 3' => 'PS3',
- 'Android' => 'AND',
- 'PalmOS' => 'POS',
- 'Palm OS' => 'POS',
- 'BlackBerry' => 'BLB',
- 'Windows NT 6.1' => 'WI7',
- 'Windows 7' => 'WI7',
- 'Windows NT 6.0' => 'WVI',
- 'Windows Vista' => 'WVI',
- 'Windows NT 5.2' => 'WS3',
- 'Windows Server 2003' => 'WS3',
- 'Windows NT 5.1' => 'WXP',
- 'Windows XP' => 'WXP',
- 'Win98' => 'W98',
- 'Windows 98' => 'W98',
- 'Windows NT 5.0' => 'W2K',
- 'Windows 2000' => 'W2K',
- 'Windows NT 4.0' => 'WNT',
- 'WinNT' => 'WNT',
- 'Windows NT' => 'WNT',
- 'Win 9x 4.90' => 'WME',
- 'Windows ME' => 'WME',
- 'Win32' => 'W95',
- 'Win95' => 'W95',
- 'Windows 95' => 'W95',
- 'Mac_PowerPC' => 'MAC',
- 'Mac PPC' => 'MAC',
- 'PPC' => 'MAC',
- 'Mac PowerPC' => 'MAC',
- 'Mac OS' => 'MAC',
- 'Linux' => 'LIN',
- 'SunOS' => 'SOS',
- 'FreeBSD' => 'BSD',
- 'AIX' => 'AIX',
- 'IRIX' => 'IRI',
- 'HP-UX' => 'HPX',
- 'OS/2' => 'OS2',
- 'NetBSD' => 'NBS',
+ 'Android' => 'AND',
+ 'Linux' => 'LIN',
+
+ 'CYGWIN_NT-6.1' => 'WI7',
+ 'Windows NT 6.1' => 'WI7',
+ 'Windows 7' => 'WI7',
+ 'CYGWIN_NT-6.0' => 'WVI',
+ 'Windows NT 6.0' => 'WVI',
+ 'Windows Vista' => 'WVI',
+ 'CYGWIN_NT-5.2' => 'WS3',
+ 'Windows NT 5.2' => 'WS3',
+ 'Windows Server 2003 / XP x64' => 'WS3',
+ 'CYGWIN_NT-5.1' => 'WXP',
+ 'Windows NT 5.1' => 'WXP',
+ 'Windows XP' => 'WXP',
+ 'CYGWIN_NT-5.0' => 'W2K',
+ 'Windows NT 5.0' => 'W2K',
+ 'Windows 2000' => 'W2K',
+ 'CYGWIN_NT-4.0' => 'WNT',
+ 'Windows NT 4.0' => 'WNT',
+ 'WinNT' => 'WNT',
+ 'Windows NT' => 'WNT',
+ 'CYGWIN_ME-4.90' => 'WME',
+ 'Win 9x 4.90' => 'WME',
+ 'Windows ME' => 'WME',
+ 'CYGWIN_98-4.10' => 'W98',
+ 'Win98' => 'W98',
+ 'Windows 98' => 'W98',
+ 'CYGWIN_95-4.0' => 'W95',
+ 'Win32' => 'W95',
+ 'Win95' => 'W95',
+ 'Windows 95' => 'W95',
+
+ 'iPod' => 'IPD',
+ 'iPad' => 'IPA',
+ 'iPhone' => 'IPH',
+// 'iOS' => 'IOS',
+ 'Darwin' => 'MAC',
+ 'Macintosh' => 'MAC',
+ 'Power Macintosh' => 'MAC',
+ 'Mac_PowerPC' => 'MAC',
+ 'Mac PPC' => 'MAC',
+ 'PPC' => 'MAC',
+ 'Mac PowerPC' => 'MAC',
+ 'Mac OS' => 'MAC',
+
+ 'webOS' => 'WOS',
+ 'Palm webOS' => 'WOS',
+ 'PalmOS' => 'POS',
+ 'Palm OS' => 'POS',
+
+ 'BlackBerry' => 'BLB',
+
+ 'SunOS' => 'SOS',
+ 'AIX' => 'AIX',
+ 'HP-UX' => 'HPX',
+
+ 'FreeBSD' => 'BSD',
+ 'NetBSD' => 'NBS',
+ 'OpenBSD' => 'OBS',
+ 'DragonFly' => 'DFB',
+ 'Syllable' => 'SYL',
+
+ 'Nintendo Wii' => 'WII',
+ 'Nitro' => 'NDS',
+ 'Nintendo DS ' => 'NDS',
+ 'Nintendo DSi' => 'DSI',
+ 'PlayStation Portable' => 'PSP',
+ 'PlayStation 3' => 'PS3',
+
+ 'IRIX' => 'IRI',
+ 'OSF1' => 'T64',
+ 'OS/2' => 'OS2',
+ 'BEOS' => 'BEO',
+ 'Amiga' => 'AMI',
+ 'AmigaOS' => 'AMI',
);
-
+
static protected $browserIdToName;
static protected $browserIdToShortName;
static protected $operatingSystemsIdToName;
@@ -154,10 +276,12 @@ class UserAgentParser
*
* @param string $userAgent
* @return array false if the browser is "unknown", or
- * array( 'name' => '', // 2 letters ID, eg. FF
+ * array( 'id' => '', // 2 letters ID, eg. FF
+ * 'name' => '', // 2 letters ID, eg. FF
+ * 'short_name' => '', // 2 letters ID, eg. FF
* 'major_number' => '', // 2 in firefox 2.0.12
* 'minor_number' => '', // 0 in firefox 2.0.12
- * 'version' => '' // major_number.minor_number
+ * 'version' => '', // major_number.minor_number
* );
* @see self::$browsers for the list of OS
*/
@@ -172,31 +296,52 @@ class UserAgentParser
'major_number' => '',
'minor_number' => '',
'version' => '',
- );
+ );
+
+ $browsers = self::$browsers;
- $browser = implode('|', array_keys(self::$browsers));
+ // derivative browsers often clone the base browser's useragent
+ unset($browsers['firefox']);
+ unset($browsers['mozilla']);
+ unset($browsers['safari']);
+
+ $browsersPattern = str_replace(')', '\)', implode('|', array_keys($browsers)));
$results = array();
- // added fixes for Mozilla Suite and Chrome/Iron detection
- if (preg_match_all("/(mozilla)[\/\sa-z;.0-9-(]+rv:([0-9]+)([.0-9a-z]+)\) gecko\/[0-9]{8}$/i", $userAgent, $results)
- || preg_match_all("/(chrome|iron)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results)
- || preg_match_all("/($browser)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results)
+ // Misbehaving IE add-ons
+ $userAgent = preg_replace('/[; ]Mozilla\/[0-9.]+ \([^)]+\)/', '', $userAgent);
+
+ if (preg_match_all("/($browsersPattern)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results)
+ || preg_match_all("/(firefox|safari)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results)
+ || preg_match_all("/^(mozilla)\/([0-9]+)([\.0-9a-z-]+)?(?: \[[a-z]{2}\])? (?:\([^)]*\))$/i", $userAgent, $results)
+ || preg_match_all("/^(mozilla)\/[0-9]+(?:[\.0-9a-z-]+)?\s\(.* rv:([0-9]+)([.0-9a-z]+)\) gecko(\/[0-9]{8}|$)(?:.*)/i", $userAgent, $results)
)
{
- $count = count($results[0])-1;
+ // browser code (usually the first match)
+ $count = 0;
+ $info['id'] = self::$browsers[strtolower($results[1][0])];
- // browser code
- $info['id'] = self::$browsers[strtolower($results[1][$count])];
- $info['name'] = self::getBrowserNameFromId($info['id']);
- $info['short_name'] = self::getBrowserShortNameFromId($info['id']);
+ // sometimes there's a better match at the end
+ if(($info['id'] == 'IE' || $info['id'] == 'LX') && (count($results[0]) > 1)) {
+ $count = count($results[0]) - 1;
+ $info['id'] = self::$browsers[strtolower($results[1][$count])];
+ }
+
+ // Netscape fix
+ if($info['id'] == 'MO' && $count == 0) {
+ if(strpos($userAgent, 'PlayStation Portable') !== false) return false;
+ if(count($results) == 4) {
+ $info['id'] = 'NS';
+ }
+ }
- // Opera 10 fix
- if($info['id'] == 'OP' && preg_match_all("/(version)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $newResults)) {
+ // Version/X.Y.Z override
+ if(preg_match_all("/(version)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $newResults)) {
$results = $newResults;
$count = count($results[0])-1;
}
-
+
// major version number (1 in mozilla 1.7)
$info['major_number'] = $results[2][$count];
@@ -218,7 +363,39 @@ class UserAgentParser
else {
$info['minor_number'] = '0';
}
- $info['version'] = $info['major_number'] . "." . $info['minor_number'];
+ $info['version'] = $info['major_number'] . '.' . $info['minor_number'];
+
+ // Safari fix
+ if($info['id'] == 'SF') {
+ foreach(self::$safariVersions as $buildVersion => $productVersion) {
+ if(version_compare($info['version'], $buildVersion) >= 0) {
+ $info['major_number'] = $productVersion[0];
+ $info['minor_number'] = $productVersion[1];
+ $info['version'] = $productVersion[0] . '.' . $productVersion[1];
+ break;
+ }
+ }
+ }
+
+ // OmniWeb fix
+ if($info['id'] == 'OW') {
+ foreach(self::$omniWebVersions as $buildVersion => $productVersion) {
+ if(version_compare($info['version'], $buildVersion) >= 0) {
+ $info['major_number'] = $productVersion[0];
+ $info['minor_number'] = $productVersion[1];
+ $info['version'] = $productVersion[0] . '.' . $productVersion[1];
+ break;
+ }
+ }
+ }
+
+ // SeaMonkey fix
+ if($info['id'] == 'MO' && $info['version'] == '1.9') {
+ $info['id'] = 'SM';
+ }
+
+ $info['name'] = self::getBrowserNameFromId($info['id']);
+ $info['short_name'] = self::getBrowserShortNameFromId($info['id']);
return $info;
}
@@ -233,19 +410,47 @@ class UserAgentParser
// init browser names and short names
self::$browserIdToName = array_map('ucwords',array_flip(self::$browsers));
- self::$browserIdToName['CH'] = "Google Chrome";
+ self::$browserIdToName['AB'] = 'ABrowse';
+ self::$browserIdToName['AV'] = 'AmigaVoyager';
+ self::$browserIdToName['AW'] = 'Amiga AWeb';
+ self::$browserIdToName['BB'] = 'BlackBerry';
+ self::$browserIdToName['BX'] = 'BrowseX';
+ self::$browserIdToName['CO'] = 'CometBird';
+ self::$browserIdToName['EL'] = 'ELinks';
+ self::$browserIdToName['FF'] = 'Firefox';
+ self::$browserIdToName['HJ'] = 'HotJava';
+ self::$browserIdToName['IB'] = 'IBrowse';
+ self::$browserIdToName['IC'] = 'iCab';
+ self::$browserIdToName['KM'] = 'K-Meleon';
+ self::$browserIdToName['MC'] = 'NCSA Mosaic';
+ self::$browserIdToName['OW'] = 'OmniWeb';
+ self::$browserIdToName['SF'] = 'Safari';
+ self::$browserIdToName['SM'] = 'SeaMonkey';
+ self::$browserIdToName['WO'] = 'Palm webOS';
+ self::$browserIdToName['WP'] = 'WebPro';
self::$browserIdToShortName = self::$browserIdToName;
- self::$browserIdToShortName['IE'] = "IE";
- self::$browserIdToShortName['FB'] = "Firebird";
+ self::$browserIdToShortName['AW'] = 'AWeb';
+ self::$browserIdToShortName['FB'] = 'Firebird';
+ self::$browserIdToShortName['IE'] = 'IE';
+ self::$browserIdToShortName['MC'] = 'Mosaic';
+ self::$browserIdToShortName['WO'] = 'webOS';
// init OS names and short names
- self::$operatingSystemsIdToName = array_flip(self::$operatingSystems);
+ self::$operatingSystemsIdToName = array_merge(array_flip(self::$operatingSystems), array(
+ 'IPD' => 'iPod',
+ 'IPA' => 'iPad',
+ 'WME' => 'Windows Me',
+ 'BEO' => 'BeOS',
+ 'T64' => 'Tru64',
+ 'NDS' => 'Nintendo DS',
+ ));
self::$operatingSystemsIdToShortName = array_merge(self::$operatingSystemsIdToName, array(
'PS3' => 'PS3',
'PSP' => 'PSP',
- 'IPH' => 'iPhone',
- 'WII' => 'WII',
+ 'WII' => 'Wii',
+ 'NDS' => 'DS',
+ 'DSI' => 'DSi',
'WI7' => 'Win 7',
'WVI' => 'Win Vista',
'WS3' => 'Win S2003',
@@ -254,22 +459,13 @@ class UserAgentParser
'W2K' => 'Win 2000',
'WNT' => 'Win NT',
'WME' => 'Win Me',
- 'W95' => 'Win 95',
+ 'W95' => 'Win 95',
'WCE' => 'Win CE',
- 'MAC' => 'Mac OS',
- 'LIN' => 'Linux',
- 'INC' => 'Inconnu',
- 'SOS' => 'SunOS',
- 'BSD' => 'FreeBSD',
- 'AIX' => 'AIX',
- 'IRI' => 'IRIX',
- 'HPX' => 'HPX',
- 'OS2' => 'OS/2',
- 'NBS' => 'NetBSD',
+ 'WOS' => 'webOS',
'UNK' => 'Unknown',
- ));
+ ));
}
-
+
static public function getBrowserNameFromId($browserId)
{
self::init();
@@ -278,7 +474,7 @@ class UserAgentParser
}
return false;
}
-
+
static public function getBrowserShortNameFromId($browserId)
{
self::init();
@@ -287,7 +483,22 @@ class UserAgentParser
}
return false;
}
-
+
+ static public function getBrowserFamilyFromId($browserId)
+ {
+ self::init();
+ $familyNameToUse = 'unknown';
+ foreach(self::$browserType as $familyName => $aBrowsers)
+ {
+ if(in_array($browserId, $aBrowsers))
+ {
+ $familyNameToUse = $familyName;
+ break;
+ }
+ }
+ return $familyNameToUse;
+ }
+
static public function getOperatingSystemNameFromId($osId)
{
self::init();
@@ -304,6 +515,5 @@ class UserAgentParser
return self::$operatingSystemsIdToShortName[$osId];
}
return false;
-
- }
+ }
}
diff --git a/libs/Zend/Auth.php b/libs/Zend/Auth.php
index d53602269e..47d474458a 100644
--- a/libs/Zend/Auth.php
+++ b/libs/Zend/Auth.php
@@ -14,16 +14,16 @@
*
* @category Zend
* @package Zend_Auth
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Auth.php 18039 2009-09-09 03:35:19Z ralph $
+ * @version $Id: Auth.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Auth
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth
@@ -87,7 +87,7 @@ class Zend_Auth
/**
* @see Zend_Auth_Storage_Session
*/
- require_once 'Zend/Auth/Storage/Session.php';
+ // require_once 'Zend/Auth/Storage/Session.php';
$this->setStorage(new Zend_Auth_Storage_Session());
}
@@ -119,11 +119,11 @@ class Zend_Auth
/**
* 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());
}
diff --git a/libs/Zend/Auth/Adapter/DbTable.php b/libs/Zend/Auth/Adapter/DbTable.php
index db64bcba9e..30bbd2478d 100644
--- a/libs/Zend/Auth/Adapter/DbTable.php
+++ b/libs/Zend/Auth/Adapter/DbTable.php
@@ -14,34 +14,34 @@
*
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Adapter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: DbTable.php 18066 2009-09-10 18:47:53Z ralph $
+ * @version $Id: DbTable.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Adapter_Interface
*/
-require_once 'Zend/Auth/Adapter/Interface.php';
+// require_once 'Zend/Auth/Adapter/Interface.php';
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Adapter/Abstract.php';
+// require_once 'Zend/Db/Adapter/Abstract.php';
/**
* @see Zend_Auth_Result
*/
-require_once 'Zend/Auth/Result.php';
+// require_once 'Zend/Auth/Result.php';
/**
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Adapter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
@@ -58,7 +58,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
* @var Zend_Db_Select
*/
protected $_dbSelect = null;
-
+
/**
* $_tableName - the table name to check
*
@@ -185,7 +185,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
/**
* setCredentialTreatment() - allows the developer to pass a parameterized string that is
- * used to transform or treat the input credential data
+ * 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
@@ -241,10 +241,10 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
if ($this->_dbSelect == null) {
$this->_dbSelect = $this->_zendDb->select();
}
-
+
return $this->_dbSelect;
}
-
+
/**
* getResultRowObject() - Returns the result row as a stdClass object
*
@@ -292,8 +292,8 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
/**
* authenticate() - defined by Zend_Auth_Adapter_Interface. This method is called to
- * attempt an authenication. Previous to this call, this adapter would have already
- * been configured with all nessissary information to successfully connect to a database
+ * 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
@@ -314,8 +314,9 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
}
/**
- * _authenticateSetup() - This method abstracts the steps involved with making sure
- * that this adapter was indeed setup properly with all required peices of information.
+ * _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
@@ -340,7 +341,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception($exception);
}
@@ -391,7 +392,8 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
* performs a query against the database with that object.
*
* @param Zend_Db_Select $dbSelect
- * @throws Zend_Auth_Adapter_Exception - when a invalid select object is encoutered
+ * @throws Zend_Auth_Adapter_Exception - when an invalid select
+ * object is encountered
* @return array
*/
protected function _authenticateQuerySelect(Zend_Db_Select $dbSelect)
@@ -410,17 +412,17 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
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.');
+ . 'for validity.', 0, $e);
}
return $resultIdentities;
}
/**
- * _authenticateValidateResultSet() - This method attempts to make certian that only one
- * record was returned in the result set
+ * _authenticateValidateResultSet() - This method attempts to make
+ * certain that only one record was returned in the resultset
*
* @param array $resultIdentities
* @return true|Zend_Auth_Result
@@ -442,8 +444,9 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
}
/**
- * _authenticateValidateResult() - This method attempts to validate that the record in the
- * result set is indeed a record that matched the identity provided to this adapter.
+ * _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
@@ -451,7 +454,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
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.';
@@ -467,8 +470,8 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
}
/**
- * _authenticateCreateAuthResult() - This method creates a Zend_Auth_Result object
- * from the information that has been collected during the authenticate() attempt.
+ * _authenticateCreateAuthResult() - Creates a Zend_Auth_Result object from
+ * the information that has been collected during the authenticate() attempt.
*
* @return Zend_Auth_Result
*/
diff --git a/libs/Zend/Auth/Adapter/Digest.php b/libs/Zend/Auth/Adapter/Digest.php
index 259ae3f3cd..a099bef358 100644
--- a/libs/Zend/Auth/Adapter/Digest.php
+++ b/libs/Zend/Auth/Adapter/Digest.php
@@ -14,24 +14,24 @@
*
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Adapter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Digest.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Digest.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Adapter_Interface
*/
-require_once 'Zend/Auth/Adapter/Interface.php';
+// require_once 'Zend/Auth/Adapter/Interface.php';
/**
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Adapter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
@@ -186,7 +186,7 @@ class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception("Option '$optionRequired' must be set before authentication");
}
}
@@ -195,7 +195,7 @@ class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception("Cannot open '$this->_filename' for reading");
}
diff --git a/libs/Zend/Auth/Adapter/Exception.php b/libs/Zend/Auth/Adapter/Exception.php
index 0b5a4d43cf..23282dddf2 100644
--- a/libs/Zend/Auth/Adapter/Exception.php
+++ b/libs/Zend/Auth/Adapter/Exception.php
@@ -14,24 +14,24 @@
*
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Adapter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Auth_Exception
*/
-require_once 'Zend/Auth/Exception.php';
+// require_once 'Zend/Auth/Exception.php';
/**
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Adapter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Adapter_Exception extends Zend_Auth_Exception
diff --git a/libs/Zend/Auth/Adapter/Http.php b/libs/Zend/Auth/Adapter/Http.php
index 466ce42597..d645d8db93 100644
--- a/libs/Zend/Auth/Adapter/Http.php
+++ b/libs/Zend/Auth/Adapter/Http.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Http.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Adapter_Interface
*/
-require_once 'Zend/Auth/Adapter/Interface.php';
+// require_once 'Zend/Auth/Adapter/Interface.php';
/**
@@ -35,7 +35,7 @@ require_once 'Zend/Auth/Adapter/Interface.php';
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @todo Support auth-int
* @todo Track nonces, nonce-count, opaque for replay protection and stale support
@@ -171,7 +171,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception(__CLASS__ . ' requires the \'hash\' extension');
}
@@ -184,7 +184,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('Config key \'accept_schemes\' is required');
}
@@ -194,7 +194,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('No supported schemes given in \'accept_schemes\'. Valid values: '
. implode(', ', $this->_supportedSchemes));
}
@@ -208,7 +208,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('Config key \'realm\' is required, and must contain only printable '
. 'characters, excluding quotation marks and colons');
} else {
@@ -222,7 +222,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('Config key \'digest_domains\' is required, and must contain '
. 'only printable characters, excluding quotation marks');
} else {
@@ -234,7 +234,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('Config key \'nonce_timeout\' is required, and must be an '
. 'integer');
} else {
@@ -368,7 +368,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('Request and Response objects must be set before calling '
. 'authenticate()');
}
@@ -403,7 +403,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
// challenge again the client
return $this->_challengeClient();
}
-
+
switch ($clientScheme) {
case 'basic':
$result = $this->_basicAuth($authHeader);
@@ -415,7 +415,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('Unsupported authentication scheme');
}
@@ -502,14 +502,14 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('The value of the client Authorization header is required');
}
if (empty($this->_basicResolver)) {
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('A basicResolver object must be set before doing Basic '
. 'authentication');
}
@@ -521,7 +521,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('Unable to base64_decode Authorization header value');
}
@@ -559,14 +559,14 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('The value of the client Authorization header is required');
}
if (empty($this->_digestResolver)) {
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('A digestResolver object must be set before doing Digest authentication');
}
@@ -625,7 +625,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('Client requested an unsupported qop option');
}
// Using hash() should make parameterizing the hash algorithm
diff --git a/libs/Zend/Auth/Adapter/Http/Resolver/Exception.php b/libs/Zend/Auth/Adapter/Http/Resolver/Exception.php
index cb7b18be0d..5a4c9bf358 100644
--- a/libs/Zend/Auth/Adapter/Http/Resolver/Exception.php
+++ b/libs/Zend/Auth/Adapter/Http/Resolver/Exception.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Exception
*/
-require_once 'Zend/Auth/Exception.php';
+// require_once 'Zend/Auth/Exception.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Auth/Exception.php';
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Adapter_Http_Resolver_Exception extends Zend_Auth_Exception
diff --git a/libs/Zend/Auth/Adapter/Http/Resolver/File.php b/libs/Zend/Auth/Adapter/Http/Resolver/File.php
index 39b548ca66..d17c2ecb37 100644
--- a/libs/Zend/Auth/Adapter/Http/Resolver/File.php
+++ b/libs/Zend/Auth/Adapter/Http/Resolver/File.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: File.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Adapter_Http_Resolver_Interface
*/
-require_once 'Zend/Auth/Adapter/Http/Resolver/Interface.php';
+// require_once 'Zend/Auth/Adapter/Http/Resolver/Interface.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Auth/Adapter/Http/Resolver/Interface.php';
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Resolver_Interface
@@ -71,7 +71,7 @@ class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Res
/**
* @see Zend_Auth_Adapter_Http_Resolver_Exception
*/
- require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
throw new Zend_Auth_Adapter_Http_Resolver_Exception('Path not readable: ' . $path);
}
$this->_file = $path;
@@ -116,13 +116,13 @@ class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Res
/**
* @see Zend_Auth_Adapter_Http_Resolver_Exception
*/
- require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
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
*/
- require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
throw new Zend_Auth_Adapter_Http_Resolver_Exception('Username must consist only of printable characters, '
. 'excluding the colon');
}
@@ -130,13 +130,13 @@ class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Res
/**
* @see Zend_Auth_Adapter_Http_Resolver_Exception
*/
- require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
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
*/
- require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
throw new Zend_Auth_Adapter_Http_Resolver_Exception('Realm must consist only of printable characters, '
. 'excluding the colon.');
}
@@ -147,7 +147,7 @@ class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Res
/**
* @see Zend_Auth_Adapter_Http_Resolver_Exception
*/
- require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
+ // require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
throw new Zend_Auth_Adapter_Http_Resolver_Exception('Unable to open password file: ' . $this->_file);
}
diff --git a/libs/Zend/Auth/Adapter/Http/Resolver/Interface.php b/libs/Zend/Auth/Adapter/Http/Resolver/Interface.php
index d36a0125a2..78c0343147 100644
--- a/libs/Zend/Auth/Adapter/Http/Resolver/Interface.php
+++ b/libs/Zend/Auth/Adapter/Http/Resolver/Interface.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -30,7 +30,7 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Auth_Adapter_Http_Resolver_Interface
diff --git a/libs/Zend/Auth/Adapter/InfoCard.php b/libs/Zend/Auth/Adapter/InfoCard.php
index 1af3a08616..8f2572a571 100644
--- a/libs/Zend/Auth/Adapter/InfoCard.php
+++ b/libs/Zend/Auth/Adapter/InfoCard.php
@@ -15,25 +15,25 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: InfoCard.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: InfoCard.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Adapter_Interface
*/
-require_once 'Zend/Auth/Adapter/Interface.php';
+// require_once 'Zend/Auth/Adapter/Interface.php';
/**
* @see Zend_Auth_Result
*/
-require_once 'Zend/Auth/Result.php';
+// require_once 'Zend/Auth/Result.php';
/**
* @see Zend_InfoCard
*/
-require_once 'Zend/InfoCard.php';
+// require_once 'Zend/InfoCard.php';
/**
* A Zend_Auth Authentication Adapter allowing the use of Information Cards as an
@@ -42,7 +42,7 @@ require_once 'Zend/InfoCard.php';
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Adapter_InfoCard implements Zend_Auth_Adapter_Interface
diff --git a/libs/Zend/Auth/Adapter/Interface.php b/libs/Zend/Auth/Adapter/Interface.php
index 67cb6b8b02..3f8204842b 100644
--- a/libs/Zend/Auth/Adapter/Interface.php
+++ b/libs/Zend/Auth/Adapter/Interface.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Result
*/
-require_once 'Zend/Auth/Result.php';
+// require_once 'Zend/Auth/Result.php';
/**
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Auth_Adapter_Interface
diff --git a/libs/Zend/Auth/Adapter/Ldap.php b/libs/Zend/Auth/Adapter/Ldap.php
index 9c0fc7f785..20f31c1fe0 100644
--- a/libs/Zend/Auth/Adapter/Ldap.php
+++ b/libs/Zend/Auth/Adapter/Ldap.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ldap.php 17976 2009-09-04 14:50:25Z sgehrig $
+ * @version $Id: Ldap.php 21320 2010-03-04 16:05:09Z sgehrig $
*/
/**
* @see Zend_Auth_Adapter_Interface
*/
-require_once 'Zend/Auth/Adapter/Interface.php';
+// require_once 'Zend/Auth/Adapter/Interface.php';
/**
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
@@ -161,7 +161,7 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
/**
* setIdentity() - set the identity (username) to be used
*
- * Proxies to {@see setPassword()}
+ * Proxies to {@see setUsername()}
*
* Closes ZF-6813
*
@@ -199,7 +199,7 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Ldap
*/
- require_once 'Zend/Ldap.php';
+ // require_once 'Zend/Ldap.php';
$this->_ldap = new Zend_Ldap();
}
@@ -247,7 +247,7 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Ldap_Exception
*/
- require_once 'Zend/Ldap/Exception.php';
+ // require_once 'Zend/Ldap/Exception.php';
$messages = array();
$messages[0] = ''; // reserved
@@ -285,8 +285,8 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Auth_Adapter_Exception
*/
- require_once 'Zend/Auth/Adapter/Exception.php';
- throw new Zend_Auth_Adapter_Exception('Adapter options array not in array');
+ // require_once 'Zend/Auth/Adapter/Exception.php';
+ throw new Zend_Auth_Adapter_Exception('Adapter options array not an array');
}
$adapterOptions = $this->_prepareOptions($ldap, $options);
$dname = '';
@@ -314,6 +314,18 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
$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);
@@ -322,6 +334,10 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
$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';
@@ -408,7 +424,6 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
}
}
}
-
$ldap->setOptions($options);
return $adapterOptions;
}
@@ -437,7 +452,7 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
/**
* @see Zend_Ldap_Filter
*/
- require_once 'Zend/Ldap/Filter.php';
+ // require_once 'Zend/Ldap/Filter.php';
$groupName = Zend_Ldap_Filter::equals($adapterOptions['groupAttr'], $adapterOptions['group']);
$membership = Zend_Ldap_Filter::equals($adapterOptions['memberAttr'], $user);
$group = Zend_Ldap_Filter::andFilter($groupName, $membership);
@@ -446,14 +461,6 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
$group = $group->addAnd($groupFilter);
}
- /*
- * Fixes problem when authenticated user is not allowed to retrieve
- * group-membership information.
- * This requires that the user specified with "username" and "password"
- * in the Zend_Ldap options is able to retrieve the required information.
- */
- $ldap->bind();
-
$result = $ldap->count($group, $adapterOptions['groupDn'], $adapterOptions['groupScope']);
if ($result === 1) {
@@ -466,13 +473,14 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
/**
* getAccountObject() - Returns the result entry as a stdClass object
*
- * This ressembles the feature {@see Zend_Auth_Adapter_DbTable::getResultRowObject()}.
+ * 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())
+ public function getAccountObject(array $returnAttribs = array(), array $omitAttribs = array())
{
if (!$this->_authenticatedDn) {
return false;
@@ -480,8 +488,14 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
$returnObject = new stdClass();
+ $omitAttribs = array_map('strtolower', $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 {
diff --git a/libs/Zend/Auth/Adapter/OpenId.php b/libs/Zend/Auth/Adapter/OpenId.php
index 44e4684456..08f21d949b 100644
--- a/libs/Zend/Auth/Adapter/OpenId.php
+++ b/libs/Zend/Auth/Adapter/OpenId.php
@@ -15,22 +15,22 @@
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: OpenId.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: OpenId.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Adapter_Interface
*/
-require_once 'Zend/Auth/Adapter/Interface.php';
+// require_once 'Zend/Auth/Adapter/Interface.php';
/**
* @see Zend_OpenId_Consumer
*/
-require_once 'Zend/OpenId/Consumer.php';
+// require_once 'Zend/OpenId/Consumer.php';
/**
@@ -40,7 +40,7 @@ require_once 'Zend/OpenId/Consumer.php';
* @category Zend
* @package Zend_Auth
* @subpackage Zend_Auth_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Adapter_OpenId implements Zend_Auth_Adapter_Interface
diff --git a/libs/Zend/Auth/Exception.php b/libs/Zend/Auth/Exception.php
index c71f41c505..80334c1911 100644
--- a/libs/Zend/Auth/Exception.php
+++ b/libs/Zend/Auth/Exception.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Auth
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Auth
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Exception extends Zend_Exception
diff --git a/libs/Zend/Auth/Result.php b/libs/Zend/Auth/Result.php
index 18ba1023f9..964d44d80d 100644
--- a/libs/Zend/Auth/Result.php
+++ b/libs/Zend/Auth/Result.php
@@ -14,16 +14,16 @@
*
* @category Zend
* @package Zend_Auth
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Result.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Result.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Auth
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Result
diff --git a/libs/Zend/Auth/Storage/Exception.php b/libs/Zend/Auth/Storage/Exception.php
index 6f3af444c0..218c909c50 100644
--- a/libs/Zend/Auth/Storage/Exception.php
+++ b/libs/Zend/Auth/Storage/Exception.php
@@ -14,24 +14,24 @@
*
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Storage
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Exception
*/
-require_once 'Zend/Auth/Exception.php';
+// require_once 'Zend/Auth/Exception.php';
/**
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Storage
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Storage_Exception extends Zend_Auth_Exception
diff --git a/libs/Zend/Auth/Storage/Interface.php b/libs/Zend/Auth/Storage/Interface.php
index a604a0d8c6..9fedf01322 100644
--- a/libs/Zend/Auth/Storage/Interface.php
+++ b/libs/Zend/Auth/Storage/Interface.php
@@ -14,18 +14,17 @@
*
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Storage
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-
/**
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Storage
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Auth_Storage_Interface
diff --git a/libs/Zend/Auth/Storage/NonPersistent.php b/libs/Zend/Auth/Storage/NonPersistent.php
index 6c544fff4b..1dd034b7ef 100644
--- a/libs/Zend/Auth/Storage/NonPersistent.php
+++ b/libs/Zend/Auth/Storage/NonPersistent.php
@@ -14,17 +14,17 @@
*
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Storage
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: NonPersistent.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: NonPersistent.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Storage_Interface
*/
-require_once 'Zend/Auth/Storage/Interface.php';
+// require_once 'Zend/Auth/Storage/Interface.php';
/**
@@ -36,8 +36,8 @@ require_once 'Zend/Auth/Storage/Interface.php';
*
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Storage
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Storage_NonPersistent implements Zend_Auth_Storage_Interface
@@ -47,7 +47,6 @@ class Zend_Auth_Storage_NonPersistent implements Zend_Auth_Storage_Interface
*/
protected $_data;
-
/**
* Returns true if and only if storage is empty
*
diff --git a/libs/Zend/Auth/Storage/Session.php b/libs/Zend/Auth/Storage/Session.php
index 14027968b0..a3775ce3d3 100644
--- a/libs/Zend/Auth/Storage/Session.php
+++ b/libs/Zend/Auth/Storage/Session.php
@@ -14,30 +14,30 @@
*
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Storage
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Session.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Session.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Auth_Storage_Interface
*/
-require_once 'Zend/Auth/Storage/Interface.php';
+// require_once 'Zend/Auth/Storage/Interface.php';
/**
* @see Zend_Session
*/
-require_once 'Zend/Session.php';
+// require_once 'Zend/Session.php';
/**
* @category Zend
* @package Zend_Auth
- * @subpackage Zend_Auth_Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @subpackage Storage
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth_Storage_Session implements Zend_Auth_Storage_Interface
diff --git a/libs/Zend/Cache.php b/libs/Zend/Cache.php
index 1ea81411d8..761be75e17 100644
--- a/libs/Zend/Cache.php
+++ b/libs/Zend/Cache.php
@@ -14,15 +14,15 @@
*
* @category Zend
* @package Zend_Cache
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Cache.php 16200 2009-06-21 18:50:06Z thomas $
+ * @version $Id: Cache.php 21974 2010-04-23 17:10:17Z alexander $
*/
/**
* @package Zend_Cache
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Cache
@@ -40,15 +40,16 @@ abstract class Zend_Cache
*
* @var array
*/
- public static $standardBackends = array('File', 'Sqlite', 'Memcached', 'Apc', 'ZendPlatform', 'Xcache', 'TwoLevels');
+ public static $standardBackends = array('File', 'Sqlite', 'Memcached', 'Apc', 'ZendPlatform',
+ 'Xcache', 'TwoLevels', 'ZendServer_Disk', 'ZendServer_ShMem');
/**
* Standard backends which implement the ExtendedInterface
- *
+ *
* @var array
*/
public static $standardExtendedBackends = array('File', 'Apc', 'TwoLevels', 'Memcached', 'Sqlite');
-
+
/**
* Only for backward compatibily (may be removed in next major release)
*
@@ -73,7 +74,7 @@ abstract class Zend_Cache
const CLEANING_MODE_MATCHING_TAG = 'matchingTag';
const CLEANING_MODE_NOT_MATCHING_TAG = 'notMatchingTag';
const CLEANING_MODE_MATCHING_ANY_TAG = 'matchingAnyTag';
-
+
/**
* Factory
*
@@ -83,7 +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 (usefull only for custom backends/frontends)
+ * @param boolean $autoload if true, there will no // require_once for backend and frontend (usefull only for custom backends/frontends)
* @throws Zend_Cache_Exception
* @return Zend_Cache_Core|Zend_Cache_Frontend
*/
@@ -110,7 +111,7 @@ abstract class Zend_Cache
$frontendObject->setBackend($backendObject);
return $frontendObject;
}
-
+
/**
* Frontend Constructor
*
@@ -129,7 +130,7 @@ abstract class Zend_Cache
// we use a standard backend
$backendClass = 'Zend_Cache_Backend_' . $backend;
// security controls are explicit
- require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
+ // require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
} else {
// we use a custom backend
if (!preg_match('~^[\w]+$~D', $backend)) {
@@ -146,12 +147,12 @@ abstract class Zend_Cache
if (!(self::_isReadable($file))) {
self::throwException("file $file not found in include_path");
}
- require_once $file;
+ // require_once $file;
}
}
return new $backendClass($backendOptions);
}
-
+
/**
* Backend Constructor
*
@@ -171,7 +172,7 @@ abstract class Zend_Cache
// For perfs reasons, with frontend == 'Core', we can interact with the Core itself
$frontendClass = 'Zend_Cache_' . ($frontend != 'Core' ? 'Frontend_' : '') . $frontend;
// security controls are explicit
- require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php';
+ // require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php';
} else {
// we use a custom frontend
if (!preg_match('~^[\w]+$~D', $frontend)) {
@@ -188,7 +189,7 @@ abstract class Zend_Cache
if (!(self::_isReadable($file))) {
self::throwException("file $file not found in include_path");
}
- require_once $file;
+ // require_once $file;
}
}
return new $frontendClass($frontendOptions);
@@ -201,11 +202,11 @@ abstract class Zend_Cache
* @param string $msg Message for the exception
* @throws Zend_Cache_Exception
*/
- public static function throwException($msg)
+ public static function throwException($msg, Exception $e = null)
{
// For perfs reasons, we use this dynamic inclusion
- require_once 'Zend/Cache/Exception.php';
- throw new Zend_Cache_Exception($msg);
+ // require_once 'Zend/Cache/Exception.php';
+ throw new Zend_Cache_Exception($msg, 0, $e);
}
/**
@@ -220,6 +221,10 @@ abstract class Zend_Cache
$name = str_replace(array('-', '_', '.'), ' ', $name);
$name = ucwords($name);
$name = str_replace(' ', '', $name);
+ if (stripos($name, 'ZendServer') === 0) {
+ $name = 'ZendServer_' . substr($name, strlen('ZendServer'));
+ }
+
return $name;
}
diff --git a/libs/Zend/Cache/Backend.php b/libs/Zend/Cache/Backend.php
index 052181972f..f71dae135a 100644
--- a/libs/Zend/Cache/Backend.php
+++ b/libs/Zend/Cache/Backend.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Backend.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Backend.php 20882 2010-02-03 18:19:44Z matthew $
*/
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend
@@ -140,77 +140,77 @@ class Zend_Cache_Backend
{
return true;
}
-
+
/**
* Determine system TMP directory and detect if we have read access
*
- * inspired from Zend_File_Transfer_Adapter_Abstract
+ * inspired from Zend_File_Transfer_Adapter_Abstract
*
* @return string
* @throws Zend_Cache_Exception if unable to determine directory
*/
public function getTmpDir()
{
- $tmpdir = array();
+ $tmpdir = array();
foreach (array($_ENV, $_SERVER) as $tab) {
- foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
- if (isset($tab[$key])) {
- if (($key == 'windir') or ($key == 'SystemRoot')) {
+ foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
+ if (isset($tab[$key])) {
+ if (($key == 'windir') or ($key == 'SystemRoot')) {
$dir = realpath($tab[$key] . '\\temp');
} else {
- $dir = realpath($tab[$key]);
+ $dir = realpath($tab[$key]);
+ }
+ if ($this->_isGoodTmpDir($dir)) {
+ return $dir;
}
- if ($this->_isGoodTmpDir($dir)) {
- return $dir;
- }
- }
- }
+ }
+ }
}
$upload = ini_get('upload_tmp_dir');
if ($upload) {
$dir = realpath($upload);
- if ($this->_isGoodTmpDir($dir)) {
- return $dir;
- }
+ if ($this->_isGoodTmpDir($dir)) {
+ return $dir;
+ }
}
if (function_exists('sys_get_temp_dir')) {
$dir = sys_get_temp_dir();
- if ($this->_isGoodTmpDir($dir)) {
- return $dir;
- }
+ if ($this->_isGoodTmpDir($dir)) {
+ return $dir;
+ }
}
// Attemp to detect by creating a temporary file
$tempFile = tempnam(md5(uniqid(rand(), TRUE)), '');
if ($tempFile) {
- $dir = realpath(dirname($tempFile));
+ $dir = realpath(dirname($tempFile));
unlink($tempFile);
if ($this->_isGoodTmpDir($dir)) {
return $dir;
}
}
if ($this->_isGoodTmpDir('/tmp')) {
- return '/tmp';
+ return '/tmp';
}
if ($this->_isGoodTmpDir('\\temp')) {
- return '\\temp';
+ return '\\temp';
}
Zend_Cache::throwException('Could not determine temp directory, please specify a cache_dir manually');
}
-
+
/**
* Verify if the given temporary directory is readable and writable
- *
+ *
* @param $dir temporary directory
* @return boolean true if the directory is ok
*/
protected function _isGoodTmpDir($dir)
{
- if (is_readable($dir)) {
- if (is_writable($dir)) {
- return true;
- }
- }
- return false;
+ if (is_readable($dir)) {
+ if (is_writable($dir)) {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -226,23 +226,17 @@ class Zend_Cache_Backend
if (!isset($this->_directives['logging']) || !$this->_directives['logging']) {
return;
}
- try {
- /**
- * @see Zend_Log
- */
- require_once 'Zend/Log.php';
- } catch (Zend_Exception $e) {
- Zend_Cache::throwException('Logging feature is enabled but the Zend_Log class is not available');
- }
+
if (isset($this->_directives['logger'])) {
if ($this->_directives['logger'] instanceof Zend_Log) {
return;
- } else {
- Zend_Cache::throwException('Logger object is not an instance of Zend_Log class.');
}
+ Zend_Cache::throwException('Logger object is not an instance of Zend_Log class.');
}
+
// Create a default logger to the standard output stream
- require_once 'Zend/Log/Writer/Stream.php';
+ // require_once 'Zend/Log.php';
+ // require_once 'Zend/Log/Writer/Stream.php';
$logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
$this->_directives['logger'] = $logger;
}
@@ -261,7 +255,7 @@ class Zend_Cache_Backend
}
if (!isset($this->_directives['logger'])) {
- Zend_Cache::throwException('Logging is enabled but logger is not set.');
+ Zend_Cache::throwException('Logging is enabled but logger is not set.');
}
$logger = $this->_directives['logger'];
if (!$logger instanceof Zend_Log) {
diff --git a/libs/Zend/Cache/Backend/Apc.php b/libs/Zend/Cache/Backend/Apc.php
index fd99ae45ef..e25bd397bb 100644
--- a/libs/Zend/Cache/Backend/Apc.php
+++ b/libs/Zend/Cache/Backend/Apc.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Apc.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Apc.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -166,18 +166,18 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
* Return true if the automatic cleaning is available for the backend
*
* DEPRECATED : use getCapabilities() instead
- *
- * @deprecated
+ *
+ * @deprecated
* @return boolean
*/
public function isAutomaticCleaningAvailable()
{
return false;
}
-
+
/**
* Return the filling percentage of the backend storage
- *
+ *
* @throws Zend_Cache_Exception
* @return int integer between 0 and 100
*/
@@ -195,21 +195,21 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
}
return ((int) (100. * ($memUsed / $memSize)));
}
-
+
/**
* Return an array of stored tags
*
* @return array array of stored tags (string)
*/
public function getTags()
- {
+ {
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
return array();
}
-
+
/**
* Return an array of stored cache ids which match given tags
- *
+ *
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
@@ -218,26 +218,26 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
public function getIdsMatchingTags($tags = array())
{
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
- return array();
+ return array();
}
/**
* Return an array of stored cache ids which don't match given tags
- *
+ *
* In case of multiple tags, a logical OR is made between tags
*
* @param array $tags array of tags
* @return array array of not matching cache ids (string)
- */
+ */
public function getIdsNotMatchingTags($tags = array())
{
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
- return array();
+ return array();
}
-
+
/**
* Return an array of stored cache ids which match any given tags
- *
+ *
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
@@ -246,12 +246,12 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
public function getIdsMatchingAnyTags($tags = array())
{
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
- return array();
+ return array();
}
-
+
/**
* Return an array of stored cache ids
- *
+ *
* @return array array of stored cache ids (string)
*/
public function getIds()
@@ -264,7 +264,7 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
}
return $res;
}
-
+
/**
* Return an array of metadatas for the given cache id
*
@@ -272,7 +272,7 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
* - expire : the expire timestamp
* - tags : a string array of tags
* - mtime : timestamp of last modification time
- *
+ *
* @param string $id cache id
* @return array array of metadatas (false if the cache id is not found)
*/
@@ -294,9 +294,9 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
'mtime' => $mtime
);
}
- return false;
+ return false;
}
-
+
/**
* Give (if possible) an extra lifetime to the given cache id
*
@@ -318,17 +318,17 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
$lifetime = $tmp[2];
$newLifetime = $lifetime - (time() - $mtime) + $extraLifetime;
if ($newLifetime <=0) {
- return false;
+ return false;
}
apc_store($id, array($data, time(), $newLifetime), $newLifetime);
return true;
}
return false;
}
-
+
/**
* Return an associative array of capabilities (booleans) of the backend
- *
+ *
* The array must include these keys :
* - automatic_cleaning (is automating cleaning necessary)
* - tags (are tags supported)
@@ -337,7 +337,7 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
* - priority does the backend deal with priority when saving
* - infinite_lifetime (is infinite lifetime can work with this backend)
* - get_list (is it possible to get the list of cache ids and the complete list of tags)
- *
+ *
* @return array associative of with capabilities
*/
public function getCapabilities()
diff --git a/libs/Zend/Cache/Backend/BlackHole.php b/libs/Zend/Cache/Backend/BlackHole.php
new file mode 100644
index 0000000000..3eb382eca2
--- /dev/null
+++ b/libs/Zend/Cache/Backend/BlackHole.php
@@ -0,0 +1,250 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Cache
+ * @subpackage Zend_Cache_Backend
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: BlackHole.php 17867 2009-08-28 09:42:11Z yoshida@zend.co.jp $
+ */
+
+/**
+ * @see Zend_Cache_Backend_Interface
+ */
+// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+
+/**
+ * @see Zend_Cache_Backend
+ */
+// require_once 'Zend/Cache/Backend.php';
+
+/**
+ * @package Zend_Cache
+ * @subpackage Zend_Cache_Backend
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Cache_Backend_BlackHole
+ extends Zend_Cache_Backend
+ implements Zend_Cache_Backend_ExtendedInterface
+{
+ /**
+ * Test if a cache is available for the given id and (if yes) return it (false else)
+ *
+ * @param string $id cache id
+ * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
+ * @return string|false cached datas
+ */
+ public function load($id, $doNotTestCacheValidity = false)
+ {
+ return false;
+ }
+
+ /**
+ * Test if a cache is available or not (for the given id)
+ *
+ * @param string $id cache id
+ * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
+ */
+ public function test($id)
+ {
+ return false;
+ }
+
+ /**
+ * Save some string datas into a cache record
+ *
+ * Note : $data is always "string" (serialization is done by the
+ * core not by the backend)
+ *
+ * @param string $data Datas to cache
+ * @param string $id Cache id
+ * @param array $tags Array of strings, the cache record will be tagged by each string entry
+ * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
+ * @return boolean true if no problem
+ */
+ public function save($data, $id, $tags = array(), $specificLifetime = false)
+ {
+ return true;
+ }
+
+ /**
+ * Remove a cache record
+ *
+ * @param string $id cache id
+ * @return boolean true if no problem
+ */
+ public function remove($id)
+ {
+ return true;
+ }
+
+ /**
+ * Clean some cache records
+ *
+ * Available modes are :
+ * 'all' (default) => remove all cache entries ($tags is not used)
+ * 'old' => remove too old cache entries ($tags is not used)
+ * 'matchingTag' => remove cache entries matching all given tags
+ * ($tags can be an array of strings or a single string)
+ * 'notMatchingTag' => remove cache entries not matching one of the given tags
+ * ($tags can be an array of strings or a single string)
+ * 'matchingAnyTag' => remove cache entries matching any given tags
+ * ($tags can be an array of strings or a single string)
+ *
+ * @param string $mode clean mode
+ * @param tags array $tags array of tags
+ * @return boolean true if no problem
+ */
+ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
+ {
+ return true;
+ }
+
+ /**
+ * Return an array of stored cache ids
+ *
+ * @return array array of stored cache ids (string)
+ */
+ public function getIds()
+ {
+ return array();
+ }
+
+ /**
+ * Return an array of stored tags
+ *
+ * @return array array of stored tags (string)
+ */
+ public function getTags()
+ {
+ return array();
+ }
+
+ /**
+ * Return an array of stored cache ids which match given tags
+ *
+ * In case of multiple tags, a logical AND is made between tags
+ *
+ * @param array $tags array of tags
+ * @return array array of matching cache ids (string)
+ */
+ public function getIdsMatchingTags($tags = array())
+ {
+ return array();
+ }
+
+ /**
+ * Return an array of stored cache ids which don't match given tags
+ *
+ * In case of multiple tags, a logical OR is made between tags
+ *
+ * @param array $tags array of tags
+ * @return array array of not matching cache ids (string)
+ */
+ public function getIdsNotMatchingTags($tags = array())
+ {
+ return array();
+ }
+
+ /**
+ * Return an array of stored cache ids which match any given tags
+ *
+ * In case of multiple tags, a logical AND is made between tags
+ *
+ * @param array $tags array of tags
+ * @return array array of any matching cache ids (string)
+ */
+ public function getIdsMatchingAnyTags($tags = array())
+ {
+ return array();
+ }
+
+ /**
+ * Return the filling percentage of the backend storage
+ *
+ * @return int integer between 0 and 100
+ * @throws Zend_Cache_Exception
+ */
+ public function getFillingPercentage()
+ {
+ return 0;
+ }
+
+ /**
+ * Return an array of metadatas for the given cache id
+ *
+ * The array must include these keys :
+ * - expire : the expire timestamp
+ * - tags : a string array of tags
+ * - mtime : timestamp of last modification time
+ *
+ * @param string $id cache id
+ * @return array array of metadatas (false if the cache id is not found)
+ */
+ public function getMetadatas($id)
+ {
+ return false;
+ }
+
+ /**
+ * Give (if possible) an extra lifetime to the given cache id
+ *
+ * @param string $id cache id
+ * @param int $extraLifetime
+ * @return boolean true if ok
+ */
+ public function touch($id, $extraLifetime)
+ {
+ return false;
+ }
+
+ /**
+ * Return an associative array of capabilities (booleans) of the backend
+ *
+ * The array must include these keys :
+ * - automatic_cleaning (is automating cleaning necessary)
+ * - tags (are tags supported)
+ * - expired_read (is it possible to read expired cache records
+ * (for doNotTestCacheValidity option for example))
+ * - priority does the backend deal with priority when saving
+ * - infinite_lifetime (is infinite lifetime can work with this backend)
+ * - get_list (is it possible to get the list of cache ids and the complete list of tags)
+ *
+ * @return array associative of with capabilities
+ */
+ public function getCapabilities()
+ {
+ return array(
+ 'automatic_cleaning' => true,
+ 'tags' => true,
+ 'expired_read' => true,
+ 'priority' => true,
+ 'infinite_lifetime' => true,
+ 'get_list' => true,
+ );
+ }
+
+ /**
+ * PUBLIC METHOD FOR UNIT TESTING ONLY !
+ *
+ * Force a cache record to expire
+ *
+ * @param string $id cache id
+ */
+ public function ___expire($id)
+ {
+ }
+}
diff --git a/libs/Zend/Cache/Backend/ExtendedInterface.php b/libs/Zend/Cache/Backend/ExtendedInterface.php
index 22e559b25b..f24ecc1091 100644
--- a/libs/Zend/Cache/Backend/ExtendedInterface.php
+++ b/libs/Zend/Cache/Backend/ExtendedInterface.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ExtendedInterface.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: ExtendedInterface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend/Interface.php';
+// require_once 'Zend/Cache/Backend/Interface.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interface
@@ -36,21 +36,21 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
/**
* Return an array of stored cache ids
- *
+ *
* @return array array of stored cache ids (string)
*/
public function getIds();
-
+
/**
* Return an array of stored tags
*
* @return array array of stored tags (string)
*/
public function getTags();
-
+
/**
* Return an array of stored cache ids which match given tags
- *
+ *
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
@@ -60,24 +60,24 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
/**
* Return an array of stored cache ids which don't match given tags
- *
+ *
* In case of multiple tags, a logical OR is made between tags
*
* @param array $tags array of tags
* @return array array of not matching cache ids (string)
- */
+ */
public function getIdsNotMatchingTags($tags = array());
/**
* Return an array of stored cache ids which match any given tags
- *
+ *
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
* @return array array of any matching cache ids (string)
*/
public function getIdsMatchingAnyTags($tags = array());
-
+
/**
* Return the filling percentage of the backend storage
*
@@ -92,12 +92,12 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
* - expire : the expire timestamp
* - tags : a string array of tags
* - mtime : timestamp of last modification time
- *
+ *
* @param string $id cache id
* @return array array of metadatas (false if the cache id is not found)
*/
public function getMetadatas($id);
-
+
/**
* Give (if possible) an extra lifetime to the given cache id
*
@@ -106,10 +106,10 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
* @return boolean true if ok
*/
public function touch($id, $extraLifetime);
-
+
/**
* Return an associative array of capabilities (booleans) of the backend
- *
+ *
* The array must include these keys :
* - automatic_cleaning (is automating cleaning necessary)
* - tags (are tags supported)
@@ -118,9 +118,9 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
* - priority does the backend deal with priority when saving
* - infinite_lifetime (is infinite lifetime can work with this backend)
* - get_list (is it possible to get the list of cache ids and the complete list of tags)
- *
+ *
* @return array associative of with capabilities
*/
public function getCapabilities();
-
+
}
diff --git a/libs/Zend/Cache/Backend/File.php b/libs/Zend/Cache/Backend/File.php
index 51e2697ad9..eeddfa5b80 100644
--- a/libs/Zend/Cache/Backend/File.php
+++ b/libs/Zend/Cache/Backend/File.php
@@ -15,26 +15,26 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: File.php 17868 2009-08-28 09:46:30Z yoshida@zend.co.jp $
+ * @version $Id: File.php 21642 2010-03-25 17:07:02Z mabe $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -123,8 +123,8 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
$this->setCacheDir(self::getTmpDir() . DIRECTORY_SEPARATOR, false);
}
if (isset($this->_options['file_name_prefix'])) { // particular case for this option
- if (!preg_match('~^[\w]+$~', $this->_options['file_name_prefix'])) {
- Zend_Cache::throwException('Invalid file_name_prefix : must use only [a-zA-A0-9_]');
+ if (!preg_match('~^[a-zA-Z0-9_]+$~D', $this->_options['file_name_prefix'])) {
+ Zend_Cache::throwException('Invalid file_name_prefix : must use only [a-zA-Z0-9_]');
}
}
if ($this->_options['metadatas_array_max_size'] < 10) {
@@ -647,6 +647,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
$prefix = $this->_options['file_name_prefix'];
$glob = @glob($dir . $prefix . '--*');
if ($glob === false) {
+ // On some systems it is impossible to distinguish between empty match and an error.
return true;
}
foreach ($glob as $file) {
@@ -739,7 +740,8 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
$prefix = $this->_options['file_name_prefix'];
$glob = @glob($dir . $prefix . '--*');
if ($glob === false) {
- return true;
+ // On some systems it is impossible to distinguish between empty match and an error.
+ return array();
}
foreach ($glob as $file) {
if (is_file($file)) {
@@ -802,7 +804,12 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
}
if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
// Recursive call
- $result = array_unique(array_merge($result, $this->_get($file . DIRECTORY_SEPARATOR, $mode, $tags)));
+ $recursiveRs = $this->_get($file . DIRECTORY_SEPARATOR, $mode, $tags);
+ if ($recursiveRs === false) {
+ $this->_log('Zend_Cache_Backend_File::_get() / recursive call : can\'t list entries of "'.$file.'"');
+ } else {
+ $result = array_unique(array_merge($result, $recursiveRs));
+ }
}
}
return array_unique($result);
diff --git a/libs/Zend/Cache/Backend/Interface.php b/libs/Zend/Cache/Backend/Interface.php
index f2878f95ae..3e8c7d1211 100644
--- a/libs/Zend/Cache/Backend/Interface.php
+++ b/libs/Zend/Cache/Backend/Interface.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Cache_Backend_Interface
diff --git a/libs/Zend/Cache/Backend/Memcached.php b/libs/Zend/Cache/Backend/Memcached.php
index 86bbca3a1c..3c29bcce67 100644
--- a/libs/Zend/Cache/Backend/Memcached.php
+++ b/libs/Zend/Cache/Backend/Memcached.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Memcached.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Memcached.php 22208 2010-05-20 16:59:02Z mabe $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -155,16 +155,16 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
$server['failure_callback'] = self::DEFAULT_FAILURE_CALLBACK;
}
if ($this->_options['compatibility']) {
- // No status for compatibility mode (#ZF-5887)
- $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'],
+ // No status for compatibility mode (#ZF-5887)
+ $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'],
$server['weight'], $server['timeout'],
$server['retry_interval']);
- } else {
- $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'],
+ } else {
+ $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'],
$server['weight'], $server['timeout'],
$server['retry_interval'],
$server['status'], $server['failure_callback']);
- }
+ }
}
}
@@ -178,7 +178,7 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
public function load($id, $doNotTestCacheValidity = false)
{
$tmp = $this->_memcache->get($id);
- if (is_array($tmp)) {
+ if (is_array($tmp) && isset($tmp[0])) {
return $tmp[0];
}
return false;
@@ -219,13 +219,14 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
} else {
$flag = 0;
}
- // #ZF-5702 : we try add() first becase set() seems to be slower
- if (!($result = $this->_memcache->add($id, array($data, time(), $lifetime), $flag, $lifetime))) {
- $result = $this->_memcache->set($id, array($data, time(), $lifetime), $flag, $lifetime);
- }
+
+ // ZF-8856: using set because add needs a second request if item already exists
+ $result = @$this->_memcache->set($id, array($data, time(), $lifetime), $flag, $lifetime);
+
if (count($tags) > 0) {
- $this->_log("Zend_Cache_Backend_Memcached::save() : tags are unsupported by the Memcached backend");
+ $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_MEMCACHED_BACKEND);
}
+
return $result;
}
@@ -237,7 +238,7 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
*/
public function remove($id)
{
- return $this->_memcache->delete($id);
+ return $this->_memcache->delete($id, 0);
}
/**
@@ -380,25 +381,26 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
{
$mems = $this->_memcache->getExtendedStats();
- $memSize = 0;
- $memUsed = 0;
+ $memSize = null;
+ $memUsed = null;
foreach ($mems as $key => $mem) {
- if ($mem === false) {
- Zend_Cache::throwException('can\'t get stat from ' . $key);
- } else {
- $eachSize = $mem['limit_maxbytes'];
- if ($eachSize == 0) {
- Zend_Cache::throwException('can\'t get memory size from ' . $key);
- }
-
- $eachUsed = $mem['bytes'];
- if ($eachUsed > $eachSize) {
- $eachUsed = $eachSize;
- }
-
- $memSize += $eachSize;
- $memUsed += $eachUsed;
- }
+ if ($mem === false) {
+ $this->_log('can\'t get stat from ' . $key);
+ continue;
+ }
+
+ $eachSize = $mem['limit_maxbytes'];
+ $eachUsed = $mem['bytes'];
+ if ($eachUsed > $eachSize) {
+ $eachUsed = $eachSize;
+ }
+
+ $memSize += $eachSize;
+ $memUsed += $eachUsed;
+ }
+
+ if ($memSize === null || $memUsed === null) {
+ Zend_Cache::throwException('Can\'t get filling percentage');
}
return ((int) (100. * ($memUsed / $memSize)));
@@ -466,7 +468,7 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
}
// #ZF-5702 : we try replace() first becase set() seems to be slower
if (!($result = $this->_memcache->replace($id, array($data, time(), $newLifetime), $flag, $newLifetime))) {
- $result = $this->_memcache->set($id, array($data, time(), $newLifetime), $flag, $newLifetime);
+ $result = $this->_memcache->set($id, array($data, time(), $newLifetime), $flag, $newLifetime);
}
return $result;
}
diff --git a/libs/Zend/Cache/Backend/Sqlite.php b/libs/Zend/Cache/Backend/Sqlite.php
index 7430d7303b..3bb5ba91e3 100644
--- a/libs/Zend/Cache/Backend/Sqlite.php
+++ b/libs/Zend/Cache/Backend/Sqlite.php
@@ -15,26 +15,26 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Sqlite.php 17868 2009-08-28 09:46:30Z yoshida@zend.co.jp $
+ * @version $Id: Sqlite.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
diff --git a/libs/Zend/Cache/Backend/Static.php b/libs/Zend/Cache/Backend/Static.php
new file mode 100644
index 0000000000..19d83d5fd4
--- /dev/null
+++ b/libs/Zend/Cache/Backend/Static.php
@@ -0,0 +1,558 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Cache
+ * @subpackage Zend_Cache_Backend
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: BlackHole.php 17867 2009-08-28 09:42:11Z yoshida@zend.co.jp $
+ */
+
+/**
+ * @see Zend_Cache_Backend_Interface
+ */
+// require_once 'Zend/Cache/Backend/Interface.php';
+
+/**
+ * @see Zend_Cache_Backend
+ */
+// require_once 'Zend/Cache/Backend.php';
+
+/**
+ * @package Zend_Cache
+ * @subpackage Zend_Cache_Backend
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Cache_Backend_Static
+ extends Zend_Cache_Backend
+ implements Zend_Cache_Backend_Interface
+{
+ const INNER_CACHE_NAME = 'zend_cache_backend_static_tagcache';
+
+ /**
+ * Static backend options
+ * @var array
+ */
+ protected $_options = array(
+ 'public_dir' => null,
+ 'sub_dir' => 'html',
+ 'file_extension' => '.html',
+ 'index_filename' => 'index',
+ 'file_locking' => true,
+ 'cache_file_umask' => 0600,
+ 'cache_directory_umask' => 0700,
+ 'debug_header' => false,
+ 'tag_cache' => null,
+ 'disable_caching' => false
+ );
+
+ /**
+ * Cache for handling tags
+ * @var Zend_Cache_Core
+ */
+ protected $_tagCache = null;
+
+ /**
+ * Tagged items
+ * @var array
+ */
+ protected $_tagged = null;
+
+ /**
+ * Interceptor child method to handle the case where an Inner
+ * Cache object is being set since it's not supported by the
+ * standard backend interface
+ *
+ * @param string $name
+ * @param mixed $value
+ * @return Zend_Cache_Backend_Static
+ */
+ public function setOption($name, $value)
+ {
+ if ($name == 'tag_cache') {
+ $this->setInnerCache($value);
+ } else {
+ parent::setOption($name, $value);
+ }
+ return $this;
+ }
+
+ /**
+ * Retrieve any option via interception of the parent's statically held
+ * options including the local option for a tag cache.
+ *
+ * @param string $name
+ * @return mixed
+ */
+ public function getOption($name)
+ {
+ if ($name == 'tag_cache') {
+ return $this->getInnerCache();
+ } else {
+ if (in_array($name, $this->_options)) {
+ return $this->_options[$name];
+ }
+ if ($name == 'lifetime') {
+ return parent::getLifetime();
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Test if a cache is available for the given id and (if yes) return it (false else)
+ *
+ * Note : return value is always "string" (unserialization is done by the core not by the backend)
+ *
+ * @param string $id Cache id
+ * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
+ * @return string|false cached datas
+ */
+ public function load($id, $doNotTestCacheValidity = false)
+ {
+ if (empty($id)) {
+ $id = $this->_detectId();
+ } else {
+ $id = $this->_decodeId($id);
+ }
+ if (!$this->_verifyPath($id)) {
+ Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
+ }
+ if ($doNotTestCacheValidity) {
+ $this->_log("Zend_Cache_Backend_Static::load() : \$doNotTestCacheValidity=true is unsupported by the Static backend");
+ }
+
+ $fileName = basename($id);
+ if (empty($fileName)) {
+ $fileName = $this->_options['index_filename'];
+ }
+ $pathName = $this->_options['public_dir'] . dirname($id);
+ $file = rtrim($pathName, '/') . '/' . $fileName . $this->_options['file_extension'];
+ if (file_exists($file)) {
+ $content = file_get_contents($file);
+ return $content;
+ }
+
+ return false;
+ }
+
+ /**
+ * Test if a cache is available or not (for the given id)
+ *
+ * @param string $id cache id
+ * @return bool
+ */
+ public function test($id)
+ {
+ $id = $this->_decodeId($id);
+ if (!$this->_verifyPath($id)) {
+ Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
+ }
+
+ $fileName = basename($id);
+ if (empty($fileName)) {
+ $fileName = $this->_options['index_filename'];
+ }
+ if (is_null($this->_tagged) && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
+ $this->_tagged = $tagged;
+ } elseif (!$this->_tagged) {
+ return false;
+ }
+ $pathName = $this->_options['public_dir'] . dirname($id);
+
+ // Switch extension if needed
+ if (isset($this->_tagged[$id])) {
+ $extension = $this->_tagged[$id]['extension'];
+ } else {
+ $extension = $this->_options['file_extension'];
+ }
+ $file = $pathName . '/' . $fileName . $extension;
+ if (file_exists($file)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Save some string datas into a cache record
+ *
+ * Note : $data is always "string" (serialization is done by the
+ * core not by the backend)
+ *
+ * @param string $data Datas to cache
+ * @param string $id Cache id
+ * @param array $tags Array of strings, the cache record will be tagged by each string entry
+ * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
+ * @return boolean true if no problem
+ */
+ public function save($data, $id, $tags = array(), $specificLifetime = false)
+ {
+ if ($this->_options['disable_caching']) {
+ return true;
+ }
+ $extension = null;
+ if ($this->_isSerialized($data)) {
+ $data = unserialize($data);
+ $extension = '.' . ltrim($data[1], '.');
+ $data = $data[0];
+ }
+
+ clearstatcache();
+ if (is_null($id) || strlen($id) == 0) {
+ $id = $this->_detectId();
+ } else {
+ $id = $this->_decodeId($id);
+ }
+
+ $fileName = basename($id);
+ if (empty($fileName)) {
+ $fileName = $this->_options['index_filename'];
+ }
+
+ $pathName = realpath($this->_options['public_dir']) . dirname($id);
+ $this->_createDirectoriesFor($pathName);
+
+ if (is_null($id) || strlen($id) == 0) {
+ $dataUnserialized = unserialize($data);
+ $data = $dataUnserialized['data'];
+ }
+ $ext = $this->_options['file_extension'];
+ if ($extension) $ext = $extension;
+ $file = rtrim($pathName, '/') . '/' . $fileName . $ext;
+ if ($this->_options['file_locking']) {
+ $result = file_put_contents($file, $data, LOCK_EX);
+ } else {
+ $result = file_put_contents($file, $data);
+ }
+ @chmod($file, $this->_octdec($this->_options['cache_file_umask']));
+
+ if (is_null($this->_tagged) && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
+ $this->_tagged = $tagged;
+ } elseif (is_null($this->_tagged)) {
+ $this->_tagged = array();
+ }
+ if (!isset($this->_tagged[$id])) {
+ $this->_tagged[$id] = array();
+ }
+ if (!isset($this->_tagged[$id]['tags'])) {
+ $this->_tagged[$id]['tags'] = array();
+ }
+ $this->_tagged[$id]['tags'] = array_unique(array_merge($this->_tagged[$id]['tags'], $tags));
+ $this->_tagged[$id]['extension'] = $ext;
+ $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME);
+ return (bool) $result;
+ }
+
+ /**
+ * Recursively create the directories needed to write the static file
+ */
+ protected function _createDirectoriesFor($path)
+ {
+ $parts = explode('/', $path);
+ $directory = '';
+ foreach ($parts as $part) {
+ $directory = rtrim($directory, '/') . '/' . $part;
+ if (!is_dir($directory)) {
+ mkdir($directory, $this->_octdec($this->_options['cache_directory_umask']));
+ }
+ }
+ }
+
+ /**
+ * Detect serialization of data (cannot predict since this is the only way
+ * to obey the interface yet pass in another parameter).
+ *
+ * In future, ZF 2.0, check if we can just avoid the interface restraints.
+ *
+ * This format is the only valid one possible for the class, so it's simple
+ * to just run a regular expression for the starting serialized format.
+ */
+ protected function _isSerialized($data)
+ {
+ return preg_match("/a:2:\{i:0;s:\d+:\"/", $data);
+ }
+
+ /**
+ * Remove a cache record
+ *
+ * @param string $id Cache id
+ * @return boolean True if no problem
+ */
+ public function remove($id)
+ {
+ if (!$this->_verifyPath($id)) {
+ Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
+ }
+ $fileName = basename($id);
+ if (is_null($this->_tagged) && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
+ $this->_tagged = $tagged;
+ } elseif (!$this->_tagged) {
+ return false;
+ }
+ if (isset($this->_tagged[$id])) {
+ $extension = $this->_tagged[$id]['extension'];
+ } else {
+ $extension = $this->_options['file_extension'];
+ }
+ if (empty($fileName)) {
+ $fileName = $this->_options['index_filename'];
+ }
+ $pathName = $this->_options['public_dir'] . dirname($id);
+ $file = realpath($pathName) . '/' . $fileName . $extension;
+ if (!file_exists($file)) {
+ return false;
+ }
+ return unlink($file);
+ }
+
+ /**
+ * Remove a cache record recursively for the given directory matching a
+ * REQUEST_URI based relative path (deletes the actual file matching this
+ * in addition to the matching directory)
+ *
+ * @param string $id Cache id
+ * @return boolean True if no problem
+ */
+ public function removeRecursively($id)
+ {
+ if (!$this->_verifyPath($id)) {
+ Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
+ }
+ $fileName = basename($id);
+ if (empty($fileName)) {
+ $fileName = $this->_options['index_filename'];
+ }
+ $pathName = $this->_options['public_dir'] . dirname($id);
+ $file = $pathName . '/' . $fileName . $this->_options['file_extension'];
+ $directory = $pathName . '/' . $fileName;
+ if (file_exists($directory)) {
+ if (!is_writable($directory)) {
+ return false;
+ }
+ foreach (new DirectoryIterator($directory) as $file) {
+ if (true === $file->isFile()) {
+ if (false === unlink($file->getPathName())) {
+ return false;
+ }
+ }
+ }
+ rmdir(dirname($path));
+ }
+ if (file_exists($file)) {
+ if (!is_writable($file)) {
+ return false;
+ }
+ return unlink($file);
+ }
+ return true;
+ }
+
+ /**
+ * Clean some cache records
+ *
+ * Available modes are :
+ * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
+ * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
+ * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
+ * ($tags can be an array of strings or a single string)
+ * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
+ * ($tags can be an array of strings or a single string)
+ * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
+ * ($tags can be an array of strings or a single string)
+ *
+ * @param string $mode Clean mode
+ * @param array $tags Array of tags
+ * @return boolean true if no problem
+ */
+ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
+ {
+ $result = false;
+ switch ($mode) {
+ case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
+ case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
+ if (empty($tags)) {
+ throw new Zend_Exception('Cannot use tag matching modes as no tags were defined');
+ }
+ if (is_null($this->_tagged) && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
+ $this->_tagged = $tagged;
+ } elseif (!$this->_tagged) {
+ return true;
+ }
+ foreach ($tags as $tag) {
+ $urls = array_keys($this->_tagged);
+ foreach ($urls as $url) {
+ if (isset($this->_tagged[$url]['tags']) && in_array($tag, $this->_tagged[$url]['tags'])) {
+ $this->remove($url);
+ unset($this->_tagged[$url]);
+ }
+ }
+ }
+ $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME);
+ $result = true;
+ break;
+ case Zend_Cache::CLEANING_MODE_ALL:
+ if (is_null($this->_tagged)) {
+ $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME);
+ $this->_tagged = $tagged;
+ }
+ if (is_null($this->_tagged) || empty($this->_tagged)) {
+ return true;
+ }
+ $urls = array_keys($this->_tagged);
+ foreach ($urls as $url) {
+ $this->remove($url);
+ unset($this->_tagged[$url]);
+ }
+ $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME);
+ $result = true;
+ break;
+ case Zend_Cache::CLEANING_MODE_OLD:
+ $this->_log("Zend_Cache_Backend_Static : Selected Cleaning Mode Currently Unsupported By This Backend");
+ break;
+ case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
+ if (empty($tags)) {
+ throw new Zend_Exception('Cannot use tag matching modes as no tags were defined');
+ }
+ if (is_null($this->_tagged)) {
+ $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME);
+ $this->_tagged = $tagged;
+ }
+ if (is_null($this->_tagged) || empty($this->_tagged)) {
+ return true;
+ }
+ $urls = array_keys($this->_tagged);
+ foreach ($urls as $url) {
+ $difference = array_diff($tags, $this->_tagged[$url]['tags']);
+ if (count($tags) == count($difference)) {
+ $this->remove($url);
+ unset($this->_tagged[$url]);
+ }
+ }
+ $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME);
+ $result = true;
+ break;
+ default:
+ Zend_Cache::throwException('Invalid mode for clean() method');
+ break;
+ }
+ return $result;
+ }
+
+ /**
+ * Set an Inner Cache, used here primarily to store Tags associated
+ * with caches created by this backend. Note: If Tags are lost, the cache
+ * should be completely cleaned as the mapping of tags to caches will
+ * have been irrevocably lost.
+ *
+ * @param Zend_Cache_Core
+ * @return void
+ */
+ public function setInnerCache(Zend_Cache_Core $cache)
+ {
+ $this->_tagCache = $cache;
+ $this->_options['tag_cache'] = $cache;
+ }
+
+ /**
+ * Get the Inner Cache if set
+ *
+ * @return Zend_Cache_Core
+ */
+ public function getInnerCache()
+ {
+ if (is_null($this->_tagCache)) {
+ Zend_Cache::throwException('An Inner Cache has not been set; use setInnerCache()');
+ }
+ return $this->_tagCache;
+ }
+
+ /**
+ * Verify path exists and is non-empty
+ *
+ * @param string $path
+ * @return bool
+ */
+ protected function _verifyPath($path)
+ {
+ $path = realpath($path);
+ $base = realpath($this->_options['public_dir']);
+ return strncmp($path, $base, strlen($base)) !== 0;
+ }
+
+ /**
+ * Determine the page to save from the request
+ *
+ * @return string
+ */
+ protected function _detectId()
+ {
+ return $_SERVER['REQUEST_URI'];
+ }
+
+ /**
+ * Validate a cache id or a tag (security, reliable filenames, reserved prefixes...)
+ *
+ * Throw an exception if a problem is found
+ *
+ * @param string $string Cache id or tag
+ * @throws Zend_Cache_Exception
+ * @return void
+ * @deprecated Not usable until perhaps ZF 2.0
+ */
+ protected static function _validateIdOrTag($string)
+ {
+ if (!is_string($string)) {
+ Zend_Cache::throwException('Invalid id or tag : must be a string');
+ }
+
+ // Internal only checked in Frontend - not here!
+ if (substr($string, 0, 9) == 'internal-') {
+ return;
+ }
+
+ // Validation assumes no query string, fragments or scheme included - only the path
+ if (!preg_match(
+ '/^(?:\/(?:(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*\'()\[\]:@&=+$,;])*)?)+$/',
+ $string
+ )
+ ) {
+ Zend_Cache::throwException("Invalid id or tag '$string' : must be a valid URL path");
+ }
+ }
+
+ /**
+ * Detect an octal string and return its octal value for file permission ops
+ * otherwise return the non-string (assumed octal or decimal int already)
+ *
+ * @param $val The potential octal in need of conversion
+ * @return int
+ */
+ protected function _octdec($val)
+ {
+ if (decoct(octdec($val)) == $val && is_string($val)) {
+ return octdec($val);
+ }
+ return $val;
+ }
+
+ /**
+ * Decode a request URI from the provided ID
+ */
+ protected function _decodeId($id)
+ {
+ return pack('H*', $id);;
+ }
+}
diff --git a/libs/Zend/Cache/Backend/Test.php b/libs/Zend/Cache/Backend/Test.php
index 713b48954a..f143ab4609 100644
--- a/libs/Zend/Cache/Backend/Test.php
+++ b/libs/Zend/Cache/Backend/Test.php
@@ -15,29 +15,29 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Test.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Test.php 21292 2010-03-02 10:25:22Z mabe $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend/Interface.php';
+// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
+class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
{
/**
* Available options
@@ -103,7 +103,11 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B
public function load($id, $doNotTestCacheValidity = false)
{
$this->_addLog('get', array($id, $doNotTestCacheValidity));
- if ($id=='false') {
+ if ( $id == 'false'
+ || $id == 'd8523b3ee441006261eeffa5c3d3a0a7'
+ || $id == 'e83249ea22178277d5befc2c5e2e9ace'
+ || $id == '40f649b94977c0a6e76902e2a0b43587')
+ {
return false;
}
if ($id=='serialized') {
@@ -136,10 +140,7 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B
if ($id=='false') {
return false;
}
- if (($id=='d8523b3ee441006261eeffa5c3d3a0a7') or ($id=='3c439c922209e2cb0b54d6deffccd75a')) {
- return false;
- }
- if (($id=='40f649b94977c0a6e76902e2a0b43587') or ($id=='e83249ea22178277d5befc2c5e2e9ace')) {
+ if (($id=='3c439c922209e2cb0b54d6deffccd75a')) {
return false;
}
return 123456;
@@ -252,6 +253,145 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B
}
/**
+ * Return an array of stored cache ids
+ *
+ * @return array array of stored cache ids (string)
+ */
+ public function getIds()
+ {
+ return array(
+ 'prefix_id1', 'prefix_id2'
+ );
+ }
+
+ /**
+ * Return an array of stored tags
+ *
+ * @return array array of stored tags (string)
+ */
+ public function getTags()
+ {
+ return array(
+ 'tag1', 'tag2'
+ );
+ }
+
+ /**
+ * Return an array of stored cache ids which match given tags
+ *
+ * In case of multiple tags, a logical AND is made between tags
+ *
+ * @param array $tags array of tags
+ * @return array array of matching cache ids (string)
+ */
+ public function getIdsMatchingTags($tags = array())
+ {
+ if ($tags == array('tag1', 'tag2')) {
+ return array('prefix_id1', 'prefix_id2');
+ }
+
+ return array();
+ }
+
+ /**
+ * Return an array of stored cache ids which don't match given tags
+ *
+ * In case of multiple tags, a logical OR is made between tags
+ *
+ * @param array $tags array of tags
+ * @return array array of not matching cache ids (string)
+ */
+ public function getIdsNotMatchingTags($tags = array())
+ {
+ if ($tags == array('tag3', 'tag4')) {
+ return array('prefix_id3', 'prefix_id4');
+ }
+
+ return array();
+ }
+
+ /**
+ * Return an array of stored cache ids which match any given tags
+ *
+ * In case of multiple tags, a logical AND is made between tags
+ *
+ * @param array $tags array of tags
+ * @return array array of any matching cache ids (string)
+ */
+ public function getIdsMatchingAnyTags($tags = array())
+ {
+ if ($tags == array('tag5', 'tag6')) {
+ return array('prefix_id5', 'prefix_id6');
+ }
+
+ return array();
+ }
+
+ /**
+ * Return the filling percentage of the backend storage
+ *
+ * @return int integer between 0 and 100
+ */
+ public function getFillingPercentage()
+ {
+ return 50;
+ }
+
+ /**
+ * Return an array of metadatas for the given cache id
+ *
+ * The array must include these keys :
+ * - expire : the expire timestamp
+ * - tags : a string array of tags
+ * - mtime : timestamp of last modification time
+ *
+ * @param string $id cache id
+ * @return array array of metadatas (false if the cache id is not found)
+ */
+ public function getMetadatas($id)
+ {
+ return false;
+ }
+
+ /**
+ * Give (if possible) an extra lifetime to the given cache id
+ *
+ * @param string $id cache id
+ * @param int $extraLifetime
+ * @return boolean true if ok
+ */
+ public function touch($id, $extraLifetime)
+ {
+ return true;
+ }
+
+ /**
+ * Return an associative array of capabilities (booleans) of the backend
+ *
+ * The array must include these keys :
+ * - automatic_cleaning (is automating cleaning necessary)
+ * - tags (are tags supported)
+ * - expired_read (is it possible to read expired cache records
+ * (for doNotTestCacheValidity option for example))
+ * - priority does the backend deal with priority when saving
+ * - infinite_lifetime (is infinite lifetime can work with this backend)
+ * - get_list (is it possible to get the list of cache ids and the complete list of tags)
+ *
+ * @return array associative of with capabilities
+ */
+ public function getCapabilities()
+ {
+ return array(
+ 'automatic_cleaning' => true,
+ 'tags' => true,
+ 'expired_read' => false,
+ 'priority' => true,
+ 'infinite_lifetime' => true,
+ 'get_list' => true
+ );
+ }
+
+ /**
* Add an event to the log array
*
* @param string $methodName MethodName
diff --git a/libs/Zend/Cache/Backend/TwoLevels.php b/libs/Zend/Cache/Backend/TwoLevels.php
index b340645f6c..a537b739ca 100644
--- a/libs/Zend/Cache/Backend/TwoLevels.php
+++ b/libs/Zend/Cache/Backend/TwoLevels.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: TwoLevels.php 17741 2009-08-22 02:58:33Z yoshida@zend.co.jp $
+ * @version $Id: TwoLevels.php 21954 2010-04-19 19:19:24Z mabe $
*/
/**
* @see Zend_Cache_Backend_ExtendedInterface
*/
-require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -95,21 +95,21 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca
*
* @var Zend_Cache_Backend
*/
- private $_slowBackend;
+ protected $_slowBackend;
/**
* Fast Backend
*
* @var Zend_Cache_Backend
*/
- private $_fastBackend;
+ protected $_fastBackend;
/**
* Cache for the fast backend filling percentage
*
* @var int
*/
- private $_fastBackendFillingPercentage = null;
+ protected $_fastBackendFillingPercentage = null;
/**
* Constructor
@@ -121,20 +121,39 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca
public function __construct(array $options = array())
{
parent::__construct($options);
+
if ($this->_options['slow_backend'] === null) {
Zend_Cache::throwException('slow_backend option has to set');
+ } elseif ($this->_options['slow_backend'] instanceof Zend_Cache_Backend_ExtendedInterface) {
+ $this->_slowBackend = $this->_options['slow_backend'];
+ } else {
+ $this->_slowBackend = Zend_Cache::_makeBackend(
+ $this->_options['slow_backend'],
+ $this->_options['slow_backend_options'],
+ $this->_options['slow_backend_custom_naming'],
+ $this->_options['slow_backend_autoload']
+ );
+ if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_slowBackend))) {
+ Zend_Cache::throwException('slow_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
+ }
}
+
if ($this->_options['fast_backend'] === null) {
Zend_Cache::throwException('fast_backend option has to set');
+ } elseif ($this->_options['fast_backend'] instanceof Zend_Cache_Backend_ExtendedInterface) {
+ $this->_fastBackend = $this->_options['fast_backend'];
+ } else {
+ $this->_fastBackend = Zend_Cache::_makeBackend(
+ $this->_options['fast_backend'],
+ $this->_options['fast_backend_options'],
+ $this->_options['fast_backend_custom_naming'],
+ $this->_options['fast_backend_autoload']
+ );
+ if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_fastBackend))) {
+ Zend_Cache::throwException('fast_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
+ }
}
- $this->_slowBackend = Zend_Cache::_makeBackend($this->_options['slow_backend'], $this->_options['slow_backend_options'], $this->_options['slow_backend_custom_naming'], $this->_options['slow_backend_autoload']);
- $this->_fastBackend = Zend_Cache::_makeBackend($this->_options['fast_backend'], $this->_options['fast_backend_options'], $this->_options['fast_backend_custom_naming'], $this->_options['fast_backend_autoload']);
- if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_slowBackend))) {
- Zend_Cache::throwException('slow_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
- }
- if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_fastBackend))) {
- Zend_Cache::throwException('fast_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
- }
+
$this->_slowBackend->setDirectives($this->_directives);
$this->_fastBackend->setDirectives($this->_directives);
}
@@ -177,8 +196,14 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca
if (($priority > 0) && (10 * $priority >= $usage)) {
$fastLifetime = $this->_getFastLifetime($lifetime, $priority);
$boolFast = $this->_fastBackend->save($preparedData, $id, array(), $fastLifetime);
+ $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime);
+ } else {
+ $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime);
+ if ($boolSlow === true) {
+ $boolFast = $this->_fastBackend->remove($id);
+ }
}
- $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime);
+
return ($boolFast && $boolSlow);
}
diff --git a/libs/Zend/Cache/Backend/Xcache.php b/libs/Zend/Cache/Backend/Xcache.php
index 8f7af5963f..ccd9672ca6 100644
--- a/libs/Zend/Cache/Backend/Xcache.php
+++ b/libs/Zend/Cache/Backend/Xcache.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xcache.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Xcache.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend/Interface.php';
+// require_once 'Zend/Cache/Backend/Interface.php';
/**
* @see Zend_Cache_Backend
*/
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_Xcache extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
@@ -46,7 +46,7 @@ class Zend_Cache_Backend_Xcache extends Zend_Cache_Backend implements Zend_Cache
*/
const TAGS_UNSUPPORTED_BY_CLEAN_OF_XCACHE_BACKEND = 'Zend_Cache_Backend_Xcache::clean() : tags are unsupported by the Xcache backend';
const TAGS_UNSUPPORTED_BY_SAVE_OF_XCACHE_BACKEND = 'Zend_Cache_Backend_Xcache::save() : tags are unsupported by the Xcache backend';
-
+
/**
* Available options
*
diff --git a/libs/Zend/Cache/Backend/ZendPlatform.php b/libs/Zend/Cache/Backend/ZendPlatform.php
index 71bbdab3e0..90b7c608c4 100644
--- a/libs/Zend/Cache/Backend/ZendPlatform.php
+++ b/libs/Zend/Cache/Backend/ZendPlatform.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ZendPlatform.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: ZendPlatform.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @see Zend_Cache_Backend_Interface
*/
-require_once 'Zend/Cache/Backend/Interface.php';
+// require_once 'Zend/Cache/Backend/Interface.php';
/**
@@ -36,7 +36,7 @@ require_once 'Zend/Cache/Backend/Interface.php';
*
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_ZendPlatform extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
diff --git a/libs/Zend/Cache/Backend/ZendServer.php b/libs/Zend/Cache/Backend/ZendServer.php
index 55840efa43..f7a62f6276 100644
--- a/libs/Zend/Cache/Backend/ZendServer.php
+++ b/libs/Zend/Cache/Backend/ZendServer.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ZendServer.php 17672 2009-08-19 13:05:18Z yoshida@zend.co.jp $
+ * @version $Id: ZendServer.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** @see Zend_Cache_Backend_Interface */
-require_once 'Zend/Cache/Backend/Interface.php';
+// require_once 'Zend/Cache/Backend/Interface.php';
/** @see Zend_Cache_Backend */
-require_once 'Zend/Cache/Backend.php';
+// require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Cache_Backend_ZendServer extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
diff --git a/libs/Zend/Cache/Backend/ZendServer/Disk.php b/libs/Zend/Cache/Backend/ZendServer/Disk.php
index ba0dd4b366..49c604d005 100644
--- a/libs/Zend/Cache/Backend/ZendServer/Disk.php
+++ b/libs/Zend/Cache/Backend/ZendServer/Disk.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Disk.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Disk.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** @see Zend_Cache_Backend_Interface */
-require_once 'Zend/Cache/Backend/Interface.php';
+// require_once 'Zend/Cache/Backend/Interface.php';
/** @see Zend_Cache_Backend_ZendServer */
-require_once 'Zend/Cache/Backend/ZendServer.php';
+// require_once 'Zend/Cache/Backend/ZendServer.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface
@@ -50,7 +50,7 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
parent::__construct($options);
}
- /**
+ /**
* Store data
*
* @param mixed $data Object to store
@@ -60,13 +60,13 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
*/
protected function _store($data, $id, $timeToLive)
{
- if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id,
- $data,
- $timeToLive) === false) {
+ if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id,
+ $data,
+ $timeToLive) === false) {
$this->_log('Store operation failed.');
return false;
- }
- return true;
+ }
+ return true;
}
/**
@@ -76,7 +76,7 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
*/
protected function _fetch($id)
{
- return zend_disk_cache_fetch($this->_options['namespace'] . '::' . $id);
+ return zend_disk_cache_fetch($this->_options['namespace'] . '::' . $id);
}
/**
@@ -87,7 +87,7 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
*/
protected function _unset($id)
{
- return zend_disk_cache_delete($this->_options['namespace'] . '::' . $id);
+ return zend_disk_cache_delete($this->_options['namespace'] . '::' . $id);
}
/**
@@ -95,6 +95,6 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
*/
protected function _clear()
{
- zend_disk_cache_clear($this->_options['namespace']);
+ zend_disk_cache_clear($this->_options['namespace']);
}
}
diff --git a/libs/Zend/Cache/Backend/ZendServer/ShMem.php b/libs/Zend/Cache/Backend/ZendServer/ShMem.php
index 8e42eb60f1..fd08df68bb 100644
--- a/libs/Zend/Cache/Backend/ZendServer/ShMem.php
+++ b/libs/Zend/Cache/Backend/ZendServer/ShMem.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ShMem.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: ShMem.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** @see Zend_Cache_Backend_Interface */
-require_once 'Zend/Cache/Backend/Interface.php';
+// require_once 'Zend/Cache/Backend/Interface.php';
/** @see Zend_Cache_Backend_ZendServer */
-require_once 'Zend/Cache/Backend/ZendServer.php';
+// require_once 'Zend/Cache/Backend/ZendServer.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_ZendServer_ShMem extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface
diff --git a/libs/Zend/Cache/Core.php b/libs/Zend/Cache/Core.php
index 361fc3e75c..680d4d8028 100644
--- a/libs/Zend/Cache/Core.php
+++ b/libs/Zend/Cache/Core.php
@@ -14,20 +14,26 @@
*
* @category Zend
* @package Zend_Cache
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Core.php 18255 2009-09-18 17:26:32Z padraic $
+ * @version $Id: Core.php 21293 2010-03-02 10:26:32Z mabe $
*/
/**
* @package Zend_Cache
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Core
{
/**
+ * Messages
+ */
+ const BACKEND_NOT_SUPPORTS_TAG = 'tags are not supported by the current backend';
+ const BACKEND_NOT_IMPLEMENTS_EXTENDED_IF = 'Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available';
+
+ /**
* Backend Object
*
* @var object $_backend
@@ -256,6 +262,9 @@ class Zend_Cache_Core
if (!is_string($name) || !array_key_exists($name, $this->_options)) {
Zend_Cache::throwException("Incorrect option name : $name");
}
+ if ($name == 'lifetime' && empty($value)) {
+ $value = null;
+ }
$this->_options[$name] = $value;
}
@@ -307,7 +316,7 @@ class Zend_Cache_Core
* Test if a cache is available for the given id
*
* @param string $id Cache id
- * @return boolean True is a cache is available, false else
+ * @return int|false Last modified time of cache entry if it is available, false otherwise
*/
public function test($id)
{
@@ -463,12 +472,26 @@ class Zend_Cache_Core
public function getIdsMatchingTags($tags = array())
{
if (!$this->_extendedBackend) {
- Zend_Cache::throwException('Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available');
+ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
if (!($this->_backendCapabilities['tags'])) {
- Zend_Cache::throwException('tags are not supported by the current backend');
+ Zend_Cache::throwException(self::BACKEND_NOT_SUPPORT_TAG);
}
- return $this->_backend->getIdsMatchingTags($tags);
+
+ $ids = $this->_backend->getIdsMatchingTags($tags);
+
+ // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600)
+ if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') {
+ $prefix = & $this->_options['cache_id_prefix'];
+ $prefixLen = strlen($prefix);
+ foreach ($ids as &$id) {
+ if (strpos($id, $prefix) === 0) {
+ $id = substr($id, $prefixLen);
+ }
+ }
+ }
+
+ return $ids;
}
/**
@@ -482,12 +505,59 @@ class Zend_Cache_Core
public function getIdsNotMatchingTags($tags = array())
{
if (!$this->_extendedBackend) {
- Zend_Cache::throwException('Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available');
+ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
+ }
+ if (!($this->_backendCapabilities['tags'])) {
+ Zend_Cache::throwException(self::BACKEND_NOT_SUPPORT_TAG);
+ }
+
+ $ids = $this->_backend->getIdsNotMatchingTags($tags);
+
+ // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600)
+ if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') {
+ $prefix = & $this->_options['cache_id_prefix'];
+ $prefixLen = strlen($prefix);
+ foreach ($ids as &$id) {
+ if (strpos($id, $prefix) === 0) {
+ $id = substr($id, $prefixLen);
+ }
+ }
+ }
+
+ return $ids;
+ }
+
+ /**
+ * Return an array of stored cache ids which match any given tags
+ *
+ * In case of multiple tags, a logical OR is made between tags
+ *
+ * @param array $tags array of tags
+ * @return array array of matching any cache ids (string)
+ */
+ public function getIdsMatchingAnyTags($tags = array())
+ {
+ if (!$this->_extendedBackend) {
+ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
if (!($this->_backendCapabilities['tags'])) {
- Zend_Cache::throwException('tags are not supported by the current backend');
+ Zend_Cache::throwException(self::BACKEND_NOT_SUPPORT_TAG);
+ }
+
+ $ids = $this->_backend->getIdsMatchingAnyTags($tags);
+
+ // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600)
+ if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') {
+ $prefix = & $this->_options['cache_id_prefix'];
+ $prefixLen = strlen($prefix);
+ foreach ($ids as &$id) {
+ if (strpos($id, $prefix) === 0) {
+ $id = substr($id, $prefixLen);
+ }
+ }
}
- return $this->_backend->getIdsNotMatchingTags($tags);
+
+ return $ids;
}
/**
@@ -498,20 +568,23 @@ class Zend_Cache_Core
public function getIds()
{
if (!$this->_extendedBackend) {
- Zend_Cache::throwException('Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available');
- }
- $array = $this->_backend->getIds();
- if ((!isset($this->_options['cache_id_prefix'])) || ($this->_options['cache_id_prefix'] == '')) return $array;
- // we need to remove cache_id_prefix from ids (see #ZF-6178)
- $res = array();
- while (list(,$id) = each($array)) {
- if (strpos($id, $this->_options['cache_id_prefix']) === 0) {
- $res[] = preg_replace("~^{$this->_options['cache_id_prefix']}~", '', $id);
- } else {
- $res[] = $id;
- }
- }
- return $res;
+ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
+ }
+
+ $ids = $this->_backend->getIds();
+
+ // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600)
+ if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') {
+ $prefix = & $this->_options['cache_id_prefix'];
+ $prefixLen = strlen($prefix);
+ foreach ($ids as &$id) {
+ if (strpos($id, $prefix) === 0) {
+ $id = substr($id, $prefixLen);
+ }
+ }
+ }
+
+ return $ids;
}
/**
@@ -522,10 +595,10 @@ class Zend_Cache_Core
public function getTags()
{
if (!$this->_extendedBackend) {
- Zend_Cache::throwException('Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available');
+ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
if (!($this->_backendCapabilities['tags'])) {
- Zend_Cache::throwException('tags are not supported by the current backend');
+ Zend_Cache::throwException(self::BACKEND_NOT_SUPPORT_TAG);
}
return $this->_backend->getTags();
}
@@ -538,11 +611,11 @@ class Zend_Cache_Core
public function getFillingPercentage()
{
if (!$this->_extendedBackend) {
- Zend_Cache::throwException('Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available');
+ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
return $this->_backend->getFillingPercentage();
}
-
+
/**
* Return an array of metadatas for the given cache id
*
@@ -556,8 +629,8 @@ class Zend_Cache_Core
*/
public function getMetadatas($id)
{
- if (!$this->_extendedBackend) {
- Zend_Cache::throwException('Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available');
+ if (!$this->_extendedBackend) {
+ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
$id = $this->_id($id); // cache id may need prefix
return $this->_backend->getMetadatas($id);
@@ -573,7 +646,7 @@ class Zend_Cache_Core
public function touch($id, $extraLifetime)
{
if (!$this->_extendedBackend) {
- Zend_Cache::throwException('Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available');
+ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
$id = $this->_id($id); // cache id may need prefix
return $this->_backend->touch($id, $extraLifetime);
@@ -596,7 +669,7 @@ class Zend_Cache_Core
if (substr($string, 0, 9) == 'internal-') {
Zend_Cache::throwException('"internal-*" ids or tags are reserved');
}
- if (!preg_match('~^[\w]+$~D', $string)) {
+ if (!preg_match('~^[a-zA-Z0-9_]+$~D', $string)) {
Zend_Cache::throwException("Invalid id or tag '$string' : must use only [a-zA-Z0-9_]");
}
}
@@ -640,7 +713,7 @@ class Zend_Cache_Core
}
// Create a default logger to the standard output stream
- require_once 'Zend/Log/Writer/Stream.php';
+ // require_once 'Zend/Log/Writer/Stream.php';
$logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
$this->_options['logger'] = $logger;
}
diff --git a/libs/Zend/Cache/Exception.php b/libs/Zend/Cache/Exception.php
index 1e1e62c4d8..63a4a28838 100644
--- a/libs/Zend/Cache/Exception.php
+++ b/libs/Zend/Cache/Exception.php
@@ -14,19 +14,19 @@
*
* @category Zend
* @package Zend_Cache
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @package Zend_Cache
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Exception extends Zend_Exception {}
diff --git a/libs/Zend/Cache/Frontend/Capture.php b/libs/Zend/Cache/Frontend/Capture.php
new file mode 100644
index 0000000000..8536c5ffb5
--- /dev/null
+++ b/libs/Zend/Cache/Frontend/Capture.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Cache
+ * @subpackage Zend_Cache_Frontend
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+
+/**
+ * @see Zend_Cache_Core
+ */
+// require_once 'Zend/Cache/Core.php';
+
+
+/**
+ * @package Zend_Cache
+ * @subpackage Zend_Cache_Frontend
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Cache_Frontend_Capture extends Zend_Cache_Core
+{
+ /**
+ * Page identifiers
+ * @var array
+ */
+ protected $_idStack = array();
+
+ /**
+ * Tags
+ * @var array
+ */
+ protected $_tags = array();
+
+ protected $_extension = null;
+
+ /**
+ * Start the cache
+ *
+ * @param string $id Cache id
+ * @return mixed True if the cache is hit (false else) with $echoData=true (default) ; string else (datas)
+ */
+ public function start($id, array $tags, $extension = null)
+ {
+ $this->_tags = $tags;
+ $this->_extension = $extension;
+ ob_start(array($this, '_flush'));
+ ob_implicit_flush(false);
+ $this->_idStack[] = $id;
+ return false;
+ }
+
+ /**
+ * callback for output buffering
+ * (shouldn't really be called manually)
+ *
+ * @param string $data Buffered output
+ * @return string Data to send to browser
+ */
+ public function _flush($data)
+ {
+ $id = array_pop($this->_idStack);
+ if (is_null($id)) {
+ Zend_Cache::throwException('use of _flush() without a start()');
+ }
+ if ($this->_extension) {
+ $this->save(serialize(array($data, $this->_extension)), $id, $this->_tags);
+ } else {
+ $this->save($data, $id, $this->_tags);
+ }
+ return $data;
+ }
+}
diff --git a/libs/Zend/Cache/Frontend/Class.php b/libs/Zend/Cache/Frontend/Class.php
index 6c4ef471b8..3dbdcf666b 100644
--- a/libs/Zend/Cache/Frontend/Class.php
+++ b/libs/Zend/Cache/Frontend/Class.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Class.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Class.php 20379 2010-01-18 14:40:57Z mabe $
*/
/**
* @see Zend_Cache_Core
*/
-require_once 'Zend/Cache/Core.php';
+// require_once 'Zend/Cache/Core.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Frontend_Class extends Zend_Cache_Core
@@ -208,14 +208,14 @@ class Zend_Cache_Frontend_Class extends Zend_Cache_Core
// We do not have not cache
return call_user_func_array(array($this->_cachedEntity, $name), $parameters);
}
+
$id = $this->_makeId($name, $parameters);
- if ($this->test($id)) {
+ if ( ($rs = $this->load($id)) && isset($rs[0], $rs[1]) ) {
// A cache is available
- $result = $this->load($id);
- $output = $result[0];
- $return = $result[1];
+ $output = $rs[0];
+ $return = $rs[1];
} else {
- // A cache is not available
+ // A cache is not available (or not valid for this frontend)
ob_start();
ob_implicit_flush(false);
$return = call_user_func_array(array($this->_cachedEntity, $name), $parameters);
@@ -224,6 +224,7 @@ class Zend_Cache_Frontend_Class extends Zend_Cache_Core
$data = array($output, $return);
$this->save($data, $id, $this->_tags, $this->_specificLifetime, $this->_priority);
}
+
echo $output;
return $return;
}
diff --git a/libs/Zend/Cache/Frontend/File.php b/libs/Zend/Cache/Frontend/File.php
index 5e28e015d5..2cbfe74d0c 100644
--- a/libs/Zend/Cache/Frontend/File.php
+++ b/libs/Zend/Cache/Frontend/File.php
@@ -15,66 +15,66 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: File.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Cache_Core
*/
-require_once 'Zend/Cache/Core.php';
+// require_once 'Zend/Cache/Core.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Frontend_File extends Zend_Cache_Core
{
-
- /**
- * Consts for master_files_mode
- */
- const MODE_AND = 'AND';
- const MODE_OR = 'OR';
-
+
+ /**
+ * Consts for master_files_mode
+ */
+ const MODE_AND = 'AND';
+ const MODE_OR = 'OR';
+
/**
* Available options
*
* ====> (string) master_file :
* - a complete path of the master file
* - deprecated (see master_files)
- *
+ *
* ====> (array) master_files :
* - an array of complete path of master files
* - this option has to be set !
- *
+ *
* ====> (string) master_files_mode :
* - Zend_Cache_Frontend_File::MODE_AND or Zend_Cache_Frontend_File::MODE_OR
* - if MODE_AND, then all master files have to be touched to get a cache invalidation
* - if MODE_OR (default), then a single touched master file is enough to get a cache invalidation
*
* ====> (boolean) ignore_missing_master_files
- * - if set to true, missing master files are ignored silently
+ * - if set to true, missing master files are ignored silently
* - if set to false (default), an exception is thrown if there is a missing master file
* @var array available options
*/
protected $_specificOptions = array(
- 'master_file' => null,
+ 'master_file' => null,
'master_files' => null,
- 'master_files_mode' => 'OR',
- 'ignore_missing_master_files' => false
+ 'master_files_mode' => 'OR',
+ 'ignore_missing_master_files' => false
);
/**
* Master file mtimes
*
* Array of int
- *
+ *
* @var array
*/
private $_masterFile_mtimes = null;
@@ -95,10 +95,10 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core
Zend_Cache::throwException('master_files option must be set');
}
}
-
+
/**
* Change the master_file option
- *
+ *
* @param string $masterFile the complete path and name of the master file
*/
public function setMasterFiles($masterFiles)
@@ -109,27 +109,27 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core
$this->_masterFile_mtimes = array();
$i = 0;
foreach ($masterFiles as $masterFile) {
- $this->_masterFile_mtimes[$i] = @filemtime($masterFile);
- if ((!($this->_specificOptions['ignore_missing_master_files'])) && (!($this->_masterFile_mtimes[$i]))) {
- Zend_Cache::throwException('Unable to read master_file : '.$masterFile);
- }
- $i++;
+ $this->_masterFile_mtimes[$i] = @filemtime($masterFile);
+ if ((!($this->_specificOptions['ignore_missing_master_files'])) && (!($this->_masterFile_mtimes[$i]))) {
+ Zend_Cache::throwException('Unable to read master_file : '.$masterFile);
+ }
+ $i++;
}
}
-
+
/**
* Change the master_file option
- *
- * To keep the compatibility
- *
+ *
+ * To keep the compatibility
+ *
* @deprecated
* @param string $masterFile the complete path and name of the master file
- */
+ */
public function setMasterFile($masterFile)
{
- $this->setMasterFiles(array(0 => $masterFile));
+ $this->setMasterFiles(array(0 => $masterFile));
}
-
+
/**
* Public frontend to set an option
*
@@ -145,7 +145,7 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core
if ($name == 'master_file') {
$this->setMasterFile($value);
} else if ($name == 'master_files') {
- $this->setMasterFiles($value);
+ $this->setMasterFiles($value);
} else {
parent::setOption($name, $value);
}
@@ -174,33 +174,33 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core
* Test if a cache is available for the given id
*
* @param string $id Cache id
- * @return boolean True is a cache is available, false else
+ * @return int|false Last modified time of cache entry if it is available, false otherwise
*/
public function test($id)
{
$lastModified = parent::test($id);
if ($lastModified) {
- if ($this->_specificOptions['master_files_mode'] == self::MODE_AND) {
- // MODE_AND
- foreach($this->_masterFile_mtimes as $masterFileMTime) {
- if ($masterFileMTime) {
- if ($lastModified > $masterFileMTime) {
- return $lastModified;
- }
- }
- }
- } else {
- // MODE_OR
- $res = true;
- foreach($this->_masterFile_mtimes as $masterFileMTime) {
- if ($masterFileMTime) {
- if ($lastModified <= $masterFileMTime) {
- return false;
- }
- }
- }
- return $lastModified;
- }
+ if ($this->_specificOptions['master_files_mode'] == self::MODE_AND) {
+ // MODE_AND
+ foreach($this->_masterFile_mtimes as $masterFileMTime) {
+ if ($masterFileMTime) {
+ if ($lastModified > $masterFileMTime) {
+ return $lastModified;
+ }
+ }
+ }
+ } else {
+ // MODE_OR
+ $res = true;
+ foreach($this->_masterFile_mtimes as $masterFileMTime) {
+ if ($masterFileMTime) {
+ if ($lastModified <= $masterFileMTime) {
+ return false;
+ }
+ }
+ }
+ return $lastModified;
+ }
}
return false;
}
diff --git a/libs/Zend/Cache/Frontend/Function.php b/libs/Zend/Cache/Frontend/Function.php
index 03e28931ce..7d7f827fee 100644
--- a/libs/Zend/Cache/Frontend/Function.php
+++ b/libs/Zend/Cache/Frontend/Function.php
@@ -15,22 +15,22 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Function.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Function.php 20379 2010-01-18 14:40:57Z mabe $
*/
/**
* @see Zend_Cache_Core
*/
-require_once 'Zend/Cache/Core.php';
+// require_once 'Zend/Cache/Core.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Frontend_Function extends Zend_Cache_Core
@@ -76,7 +76,7 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core
* @param array $parameters Function parameters
* @param array $tags Cache tags
* @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
- * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends
+ * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends
* @return mixed Result
*/
public function call($name, $parameters = array(), $tags = array(), $specificLifetime = false, $priority = 8)
@@ -89,14 +89,14 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core
// We do not have not cache
return call_user_func_array($name, $parameters);
}
+
$id = $this->_makeId($name, $parameters);
- if ($this->test($id)) {
+ if ( ($rs = $this->load($id)) && isset($rs[0], $rs[1])) {
// A cache is available
- $result = $this->load($id);
- $output = $result[0];
- $return = $result[1];
+ $output = $rs[0];
+ $return = $rs[1];
} else {
- // A cache is not available
+ // A cache is not available (or not valid for this frontend)
ob_start();
ob_implicit_flush(false);
$return = call_user_func_array($name, $parameters);
@@ -105,6 +105,7 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core
$data = array($output, $return);
$this->save($data, $id, $tags, $specificLifetime, $priority);
}
+
echo $output;
return $return;
}
diff --git a/libs/Zend/Cache/Frontend/Output.php b/libs/Zend/Cache/Frontend/Output.php
index 00f200d722..1757381ce4 100644
--- a/libs/Zend/Cache/Frontend/Output.php
+++ b/libs/Zend/Cache/Frontend/Output.php
@@ -15,22 +15,22 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Output.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Output.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Cache_Core
*/
-require_once 'Zend/Cache/Core.php';
+// require_once 'Zend/Cache/Core.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Frontend_Output extends Zend_Cache_Core
diff --git a/libs/Zend/Cache/Frontend/Page.php b/libs/Zend/Cache/Frontend/Page.php
index 8a6a6f64f4..21ce6537a7 100644
--- a/libs/Zend/Cache/Frontend/Page.php
+++ b/libs/Zend/Cache/Frontend/Page.php
@@ -15,22 +15,22 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Page.php 16974 2009-07-22 19:23:08Z matthew $
+ * @version $Id: Page.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Cache_Core
*/
-require_once 'Zend/Cache/Core.php';
+// require_once 'Zend/Cache/Core.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Frontend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Frontend_Page extends Zend_Cache_Core
@@ -275,7 +275,7 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
header("$name: $value");
}
}
- if ($this->_specificOptions['debug_header']) {
+ if ($this->_specificOptions['debug_header']) {
echo 'DEBUG HEADER : This is a cached page !';
}
echo $data;
@@ -339,9 +339,9 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
{
$tmp = $_SERVER['REQUEST_URI'];
$array = explode('?', $tmp, 2);
- $tmp = $array[0];
+ $tmp = $array[0];
foreach (array('Get', 'Post', 'Session', 'Files', 'Cookie') as $arrayName) {
- $tmp2 = $this->_makePartialId($arrayName, $this->_activeOptions['cache_with_' . strtolower($arrayName) . '_variables'], $this->_activeOptions['make_id_with_' . strtolower($arrayName) . '_variables']);
+ $tmp2 = $this->_makePartialId($arrayName, $this->_activeOptions['cache_with_' . strtolower($arrayName) . '_variables'], $this->_activeOptions['make_id_with_' . strtolower($arrayName) . '_variables']);
if ($tmp2===false) {
return false;
}
@@ -360,7 +360,7 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
*/
protected function _makePartialId($arrayName, $bool1, $bool2)
{
- switch ($arrayName) {
+ switch ($arrayName) {
case 'Get':
$var = $_GET;
break;
diff --git a/libs/Zend/Cache/Manager.php b/libs/Zend/Cache/Manager.php
new file mode 100644
index 0000000000..d7f157038c
--- /dev/null
+++ b/libs/Zend/Cache/Manager.php
@@ -0,0 +1,286 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Cache
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/** @see Zend_Cache_Exception */
+// require_once 'Zend/Cache/Exception.php';
+
+/** @see Zend_Cache */
+// require_once 'Zend/Cache.php';
+
+/**
+ * @category Zend
+ * @package Zend_Cache
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Cache_Manager
+{
+ /**
+ * Constant holding reserved name for default Page Cache
+ */
+ const PAGECACHE = 'page';
+
+ /**
+ * Constant holding reserved name for default Page Tag Cache
+ */
+ const PAGETAGCACHE = 'pagetag';
+
+ /**
+ * Array of caches stored by the Cache Manager instance
+ *
+ * @var array
+ */
+ protected $_caches = array();
+
+ /**
+ * Array of ready made configuration templates for lazy
+ * loading caches.
+ *
+ * @var array
+ */
+ protected $_optionTemplates = array(
+ // Null Cache (Enforce Null/Empty Values)
+ 'skeleton' => array(
+ 'frontend' => array(
+ 'name' => null,
+ 'options' => array(),
+ ),
+ 'backend' => array(
+ 'name' => null,
+ 'options' => array(),
+ ),
+ ),
+ // Simple Common Default
+ 'default' => array(
+ 'frontend' => array(
+ 'name' => 'Core',
+ 'options' => array(
+ 'automatic_serialization' => true,
+ ),
+ ),
+ 'backend' => array(
+ 'name' => 'File',
+ 'options' => array(
+ 'cache_dir' => '../cache',
+ ),
+ ),
+ ),
+ // Static Page HTML Cache
+ 'page' => array(
+ 'frontend' => array(
+ 'name' => 'Capture',
+ 'options' => array(
+ 'ignore_user_abort' => true,
+ ),
+ ),
+ 'backend' => array(
+ 'name' => 'Static',
+ 'options' => array(
+ 'public_dir' => '../public',
+ ),
+ ),
+ ),
+ // Tag Cache
+ 'pagetag' => array(
+ 'frontend' => array(
+ 'name' => 'Core',
+ 'options' => array(
+ 'automatic_serialization' => true,
+ 'lifetime' => null
+ ),
+ ),
+ 'backend' => array(
+ 'name' => 'File',
+ 'options' => array(
+ 'cache_dir' => '../cache',
+ 'cache_file_umask' => 0644
+ ),
+ ),
+ ),
+ );
+
+ /**
+ * Set a new cache for the Cache Manager to contain
+ *
+ * @param string $name
+ * @param Zend_Cache_Core $cache
+ * @return Zend_Cache_Manager
+ */
+ public function setCache($name, Zend_Cache_Core $cache)
+ {
+ $this->_caches[$name] = $cache;
+ return $this;
+ }
+
+ /**
+ * Check if the Cache Manager contains the named cache object, or a named
+ * configuration template to lazy load the cache object
+ *
+ * @param string $name
+ * @return bool
+ */
+ public function hasCache($name)
+ {
+ if (isset($this->_caches[$name])
+ || $this->hasCacheTemplate($name)
+ ) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Fetch the named cache object, or instantiate and return a cache object
+ * using a named configuration template
+ *
+ * @param string $name
+ * @return Zend_Cache_Core
+ */
+ public function getCache($name)
+ {
+ if (isset($this->_caches[$name])) {
+ return $this->_caches[$name];
+ }
+ if (isset($this->_optionTemplates[$name])) {
+ if ($name == self::PAGECACHE
+ && (!isset($this->_optionTemplates[$name]['backend']['options']['tag_cache'])
+ || !$this->_optionTemplates[$name]['backend']['options']['tag_cache'] instanceof Zend_Cache_Core)
+ ) {
+ $this->_optionTemplates[$name]['backend']['options']['tag_cache']
+ = $this->getCache(self::PAGETAGCACHE);
+ }
+ $this->_caches[$name] = Zend_Cache::factory(
+ $this->_optionTemplates[$name]['frontend']['name'],
+ $this->_optionTemplates[$name]['backend']['name'],
+ isset($this->_optionTemplates[$name]['frontend']['options']) ? $this->_optionTemplates[$name]['frontend']['options'] : array(),
+ isset($this->_optionTemplates[$name]['backend']['options']) ? $this->_optionTemplates[$name]['backend']['options'] : array(),
+ isset($this->_optionTemplates[$name]['frontend']['customFrontendNaming']) ? $this->_optionTemplates[$name]['frontend']['customFrontendNaming'] : false,
+ isset($this->_optionTemplates[$name]['backend']['customBackendNaming']) ? $this->_optionTemplates[$name]['backend']['customBackendNaming'] : false,
+ isset($this->_optionTemplates[$name]['frontendBackendAutoload']) ? $this->_optionTemplates[$name]['frontendBackendAutoload'] : false
+ );
+ return $this->_caches[$name];
+ }
+ }
+
+ /**
+ * Set a named configuration template from which a cache object can later
+ * be lazy loaded
+ *
+ * @param string $name
+ * @param array $options
+ * @return Zend_Cache_Manager
+ */
+ public function setCacheTemplate($name, $options)
+ {
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } elseif (!is_array($options)) {
+ // require_once 'Zend/Cache/Exception.php';
+ throw new Zend_Cache_Exception('Options passed must be in'
+ . ' an associative array or instance of Zend_Config');
+ }
+ $this->_optionTemplates[$name] = $options;
+ return $this;
+ }
+
+ /**
+ * Check if the named configuration template
+ *
+ * @param string $name
+ * @return bool
+ */
+ public function hasCacheTemplate($name)
+ {
+ if (isset($this->_optionTemplates[$name])) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get the named configuration template
+ *
+ * @param string $name
+ * @return array
+ */
+ public function getCacheTemplate($name)
+ {
+ if (isset($this->_optionTemplates[$name])) {
+ return $this->_optionTemplates[$name];
+ }
+ }
+
+ /**
+ * Pass an array containing changes to be applied to a named
+ * configuration
+ * template
+ *
+ * @param string $name
+ * @param array $options
+ * @return Zend_Cache_Manager
+ * @throws Zend_Cache_Exception for invalid options format or if option templates do not have $name
+ */
+ public function setTemplateOptions($name, $options)
+ {
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } elseif (!is_array($options)) {
+ // require_once 'Zend/Cache/Exception.php';
+ throw new Zend_Cache_Exception('Options passed must be in'
+ . ' an associative array or instance of Zend_Config');
+ }
+ if (!isset($this->_optionTemplates[$name])) {
+ throw new Zend_Cache_Exception('A cache configuration template'
+ . 'does not exist with the name "' . $name . '"');
+ }
+ $this->_optionTemplates[$name]
+ = $this->_mergeOptions($this->_optionTemplates[$name], $options);
+ return $this;
+ }
+
+ /**
+ * Simple method to merge two configuration arrays
+ *
+ * @param array $current
+ * @param array $options
+ * @return array
+ */
+ protected function _mergeOptions(array $current, array $options)
+ {
+ if (isset($options['frontend']['name'])) {
+ $current['frontend']['name'] = $options['frontend']['name'];
+ }
+ if (isset($options['backend']['name'])) {
+ $current['backend']['name'] = $options['backend']['name'];
+ }
+ if (isset($options['frontend']['options'])) {
+ foreach ($options['frontend']['options'] as $key=>$value) {
+ $current['frontend']['options'][$key] = $value;
+ }
+ }
+ if (isset($options['backend']['options'])) {
+ foreach ($options['backend']['options'] as $key=>$value) {
+ $current['backend']['options'][$key] = $value;
+ }
+ }
+ return $current;
+ }
+}
diff --git a/libs/Zend/Config.php b/libs/Zend/Config.php
index 0652e9901f..0ba76392f4 100644
--- a/libs/Zend/Config.php
+++ b/libs/Zend/Config.php
@@ -14,16 +14,16 @@
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Config.php 16201 2009-06-21 18:51:15Z thomas $
+ * @version $Id: Config.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Config implements Countable, Iterator
@@ -83,7 +83,7 @@ class Zend_Config implements Countable, Iterator
/**
* Load file error string.
- *
+ *
* Is null if there was no error while file loading
*
* @var string
@@ -165,15 +165,15 @@ class Zend_Config implements Countable, Iterator
$this->_count = count($this->_data);
} else {
/** @see Zend_Config_Exception */
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception('Zend_Config is read only');
}
}
-
+
/**
* Deep clone of this instance to ensure that nested Zend_Configs
* are also cloned.
- *
+ *
* @return void
*/
public function __clone()
@@ -234,7 +234,7 @@ class Zend_Config implements Countable, Iterator
$this->_skipNextIteration = true;
} else {
/** @see Zend_Config_Exception */
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception('Zend_Config is read only');
}
@@ -374,7 +374,7 @@ class Zend_Config implements Countable, Iterator
}
}
}
-
+
/**
* Returns if this Zend_Config object is read only or not.
*
@@ -384,7 +384,7 @@ class Zend_Config implements Countable, Iterator
{
return !$this->_allowModifications;
}
-
+
/**
* Get the current extends
*
@@ -394,7 +394,7 @@ class Zend_Config implements Countable, Iterator
{
return $this->_extends;
}
-
+
/**
* Set an extend for Zend_Config_Writer
*
@@ -410,7 +410,7 @@ class Zend_Config implements Countable, Iterator
$this->_extends[$extendingSection] = $extendedSection;
}
}
-
+
/**
* Throws an exception if $extendingSection may not extend $extendedSection,
* and tracks the section extension if it is valid.
@@ -427,7 +427,7 @@ class Zend_Config implements Countable, Iterator
while (array_key_exists($extendedSectionCurrent, $this->_extends)) {
if ($this->_extends[$extendedSectionCurrent] == $extendingSection) {
/** @see Zend_Config_Exception */
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception('Illegal circular inheritance detected');
}
$extendedSectionCurrent = $this->_extends[$extendedSectionCurrent];
@@ -445,7 +445,7 @@ class Zend_Config implements Countable, Iterator
* @param integer $errline
*/
protected function _loadFileErrorHandler($errno, $errstr, $errfile, $errline)
- {
+ {
if ($this->_loadFileErrorStr === null) {
$this->_loadFileErrorStr = $errstr;
} else {
@@ -453,4 +453,32 @@ class Zend_Config implements Countable, Iterator
}
}
-}
+ /**
+ * Merge two arrays recursively, overwriting keys of the same name
+ * in $firstArray with the value in $secondArray.
+ *
+ * @param mixed $firstArray First array
+ * @param mixed $secondArray Second array to merge into first array
+ * @return array
+ */
+ protected function _arrayMergeRecursive($firstArray, $secondArray)
+ {
+ if (is_array($firstArray) && is_array($secondArray)) {
+ foreach ($secondArray as $key => $value) {
+ if (isset($firstArray[$key])) {
+ $firstArray[$key] = $this->_arrayMergeRecursive($firstArray[$key], $value);
+ } else {
+ if($key === 0) {
+ $firstArray= array(0=>$this->_arrayMergeRecursive($firstArray, $value));
+ } else {
+ $firstArray[$key] = $value;
+ }
+ }
+ }
+ } else {
+ $firstArray = $secondArray;
+ }
+
+ return $firstArray;
+ }
+} \ No newline at end of file
diff --git a/libs/Zend/Config/Exception.php b/libs/Zend/Config/Exception.php
index 859d3bf71c..8ef700783c 100644
--- a/libs/Zend/Config/Exception.php
+++ b/libs/Zend/Config/Exception.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Config_Exception extends Zend_Exception {}
diff --git a/libs/Zend/Config/Ini.php b/libs/Zend/Config/Ini.php
index efb6862713..63cab0f9a4 100644
--- a/libs/Zend/Config/Ini.php
+++ b/libs/Zend/Config/Ini.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ini.php 16201 2009-06-21 18:51:15Z thomas $
+ * @version $Id: Ini.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Config
*/
-require_once 'Zend/Config.php';
+// require_once 'Zend/Config.php';
/**
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Config_Ini extends Zend_Config
@@ -49,12 +49,12 @@ class Zend_Config_Ini extends Zend_Config
protected $_sectionSeparator = ':';
/**
- * Wether to skip extends or not
+ * Whether to skip extends or not
*
* @var boolean
*/
protected $_skipExtends = false;
-
+
/**
* Loads the section $section from the config file $filename for
* access facilitated by nested object properties.
@@ -103,7 +103,7 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception('Filename is not set');
}
@@ -129,7 +129,7 @@ class Zend_Config_Ini extends Zend_Config
$dataArray = array();
foreach ($iniArray as $sectionName => $sectionData) {
if(!is_array($sectionData)) {
- $dataArray = array_merge_recursive($dataArray, $this->_processKey(array(), $sectionName, $sectionData));
+ $dataArray = $this->_arrayMergeRecursive($dataArray, $this->_processKey(array(), $sectionName, $sectionData));
} else {
$dataArray[$sectionName] = $this->_processSection($iniArray, $sectionName);
}
@@ -146,44 +146,59 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $filename");
}
- $dataArray = array_merge($this->_processSection($iniArray, $sectionName), $dataArray);
+ $dataArray = $this->_arrayMergeRecursive($this->_processSection($iniArray, $sectionName), $dataArray);
}
parent::__construct($dataArray, $allowModifications);
- }
+ }
$this->_loadedSection = $section;
}
-
+
/**
- * Load the ini file and preprocess the section separator (':' in the
- * section name (that is used for section extension) so that the resultant
- * array has the correct section names and the extension information is
- * stored in a sub-key called ';extends'. We use ';extends' as this can
- * never be a valid key name in an INI file that has been loaded using
- * parse_ini_file().
- *
+ * Load the INI file from disk using parse_ini_file(). Use a private error
+ * handler to convert any loading errors into a Zend_Config_Exception
+ *
* @param string $filename
* @throws Zend_Config_Exception
* @return array
*/
- protected function _loadIniFile($filename)
+ protected function _parseIniFile($filename)
{
set_error_handler(array($this, '_loadFileErrorHandler'));
- $loaded = parse_ini_file($filename, true); // Warnings and errors are suppressed
+ $iniArray = parse_ini_file($filename, true); // Warnings and errors are suppressed
restore_error_handler();
+
// Check if there was a error while loading file
if ($this->_loadFileErrorStr !== null) {
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception($this->_loadFileErrorStr);
}
+
+ return $iniArray;
+ }
+ /**
+ * Load the ini file and preprocess the section separator (':' in the
+ * section name (that is used for section extension) so that the resultant
+ * array has the correct section names and the extension information is
+ * stored in a sub-key called ';extends'. We use ';extends' as this can
+ * never be a valid key name in an INI file that has been loaded using
+ * parse_ini_file().
+ *
+ * @param string $filename
+ * @throws Zend_Config_Exception
+ * @return array
+ */
+ protected function _loadIniFile($filename)
+ {
+ $loaded = $this->_parseIniFile($filename);
$iniArray = array();
foreach ($loaded as $key => $data)
{
@@ -203,14 +218,14 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Section '$thisSection' may not extend multiple sections in $filename");
}
}
return $iniArray;
}
-
+
/**
* Process each element in the section and handle the ";extends" inheritance
* key. Passes control to _processKey() to handle the nest separator
@@ -230,7 +245,7 @@ class Zend_Config_Ini extends Zend_Config
if (strtolower($key) == ';extends') {
if (isset($iniArray[$value])) {
$this->_assertValidExtend($section, $value);
-
+
if (!$this->_skipExtends) {
$config = $this->_processSection($iniArray, $value, $config);
}
@@ -238,7 +253,7 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Parent section '$section' cannot be found");
}
} else {
@@ -274,7 +289,7 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Cannot create sub-key for '{$pieces[0]}' as key already exists");
}
$config[$pieces[0]] = $this->_processKey($config[$pieces[0]], $pieces[1], $value);
@@ -282,7 +297,7 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Invalid key '$key'");
}
} else {
diff --git a/libs/Zend/Config/Writer.php b/libs/Zend/Config/Writer.php
index 56bb66bfd1..9bfedca748 100644
--- a/libs/Zend/Config/Writer.php
+++ b/libs/Zend/Config/Writer.php
@@ -14,28 +14,28 @@
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Writer.php 16201 2009-06-21 18:51:15Z thomas $
+ * @version $Id: Writer.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Config_Writer
{
/**
* Option keys to skip when calling setOptions()
- *
+ *
* @var array
*/
protected $_skipOptions = array(
'options'
);
-
+
/**
* Config object to write
*
@@ -45,8 +45,8 @@ abstract class Zend_Config_Writer
/**
* Create a new adapter
- *
- * $options can only be passed as array or be omitted
+ *
+ * $options can only be passed as array or be omitted
*
* @param null|array $options
*/
@@ -56,7 +56,7 @@ abstract class Zend_Config_Writer
$this->setOptions($options);
}
}
-
+
/**
* Set options via a Zend_Config instance
*
@@ -66,10 +66,10 @@ abstract class Zend_Config_Writer
public function setConfig(Zend_Config $config)
{
$this->_config = $config;
-
+
return $this;
}
-
+
/**
* Set options via an array
*
@@ -88,10 +88,10 @@ abstract class Zend_Config_Writer
$this->$method($value);
}
}
-
+
return $this;
}
-
+
/**
* Write a Zend_Config object to it's target
*
diff --git a/libs/Zend/Config/Writer/Array.php b/libs/Zend/Config/Writer/Array.php
index dd880b010b..6e9b158997 100644
--- a/libs/Zend/Config/Writer/Array.php
+++ b/libs/Zend/Config/Writer/Array.php
@@ -14,119 +14,42 @@
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Array.php 16201 2009-06-21 18:51:15Z thomas $
+ * @version $Id: Array.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Config_Writer
*/
-require_once 'Zend/Config/Writer.php';
+// require_once 'Zend/Config/Writer/FileAbstract.php';
/**
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Config_Writer_Array extends Zend_Config_Writer
+class Zend_Config_Writer_Array extends Zend_Config_Writer_FileAbstract
{
/**
- * Filename to write to
+ * Render a Zend_Config into a PHP Array config string.
*
- * @var string
+ * @since 1.10
+ * @return string
*/
- protected $_filename = null;
-
- /**
- * Wether to exclusively lock the file or not
- *
- * @var boolean
- */
- protected $_exclusiveLock = false;
-
- /**
- * Set the target filename
- *
- * @param string $filename
- * @return Zend_Config_Writer_Array
- */
- public function setFilename($filename)
- {
- $this->_filename = $filename;
-
- return $this;
- }
-
- /**
- * Set wether to exclusively lock the file or not
- *
- * @param boolean $exclusiveLock
- * @return Zend_Config_Writer_Array
- */
- public function setExclusiveLock($exclusiveLock)
- {
- $this->_exclusiveLock = $exclusiveLock;
-
- return $this;
- }
-
- /**
- * Defined by Zend_Config_Writer
- *
- * @param string $filename
- * @param Zend_Config $config
- * @param boolean $exclusiveLock
- * @throws Zend_Config_Exception When filename was not set
- * @throws Zend_Config_Exception When filename is not writable
- * @return void
- */
- public function write($filename = null, Zend_Config $config = null, $exclusiveLock = null)
+ public function render()
{
- if ($filename !== null) {
- $this->setFilename($filename);
- }
-
- if ($config !== null) {
- $this->setConfig($config);
- }
-
- if ($exclusiveLock !== null) {
- $this->setExclusiveLock($exclusiveLock);
- }
-
- if ($this->_filename === null) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('No filename was set');
- }
-
- if ($this->_config === null) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('No config was set');
- }
-
$data = $this->_config->toArray();
$sectionName = $this->_config->getSectionName();
-
+
if (is_string($sectionName)) {
$data = array($sectionName => $data);
}
-
+
$arrayString = "<?php\n"
. "return " . var_export($data, true) . ";\n";
-
- $flags = 0;
-
- if ($this->_exclusiveLock) {
- $flags |= LOCK_EX;
- }
-
- $result = @file_put_contents($this->_filename, $arrayString, $flags);
-
- if ($result === false) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('Could not write to file "' . $this->_filename . '"');
- }
+
+ return $arrayString;
}
}
diff --git a/libs/Zend/Config/Writer/FileAbstract.php b/libs/Zend/Config/Writer/FileAbstract.php
new file mode 100644
index 0000000000..ee14b772fa
--- /dev/null
+++ b/libs/Zend/Config/Writer/FileAbstract.php
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Config
+ * @package Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+// require_once "Zend/Config/Writer.php";
+
+/**
+ * Abstract File Writer
+ *
+ * @category Zend
+ * @package Zend_package
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: FileAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+class Zend_Config_Writer_FileAbstract extends Zend_Config_Writer
+{
+ /**
+ * Filename to write to
+ *
+ * @var string
+ */
+ protected $_filename = null;
+
+ /**
+ * Wether to exclusively lock the file or not
+ *
+ * @var boolean
+ */
+ protected $_exclusiveLock = false;
+
+ /**
+ * Set the target filename
+ *
+ * @param string $filename
+ * @return Zend_Config_Writer_Array
+ */
+ public function setFilename($filename)
+ {
+ $this->_filename = $filename;
+
+ return $this;
+ }
+
+ /**
+ * Set wether to exclusively lock the file or not
+ *
+ * @param boolean $exclusiveLock
+ * @return Zend_Config_Writer_Array
+ */
+ public function setExclusiveLock($exclusiveLock)
+ {
+ $this->_exclusiveLock = $exclusiveLock;
+
+ return $this;
+ }
+
+ /**
+ * Write configuration to file.
+ *
+ * @param string $filename
+ * @param Zend_Config $config
+ * @param bool $exclusiveLock
+ * @return void
+ */
+ public function write($filename = null, Zend_Config $config = null, $exclusiveLock = null)
+ {
+ if ($filename !== null) {
+ $this->setFilename($filename);
+ }
+
+ if ($config !== null) {
+ $this->setConfig($config);
+ }
+
+ if ($exclusiveLock !== null) {
+ $this->setExclusiveLock($exclusiveLock);
+ }
+
+ if ($this->_filename === null) {
+ // require_once 'Zend/Config/Exception.php';
+ throw new Zend_Config_Exception('No filename was set');
+ }
+
+ if ($this->_config === null) {
+ // require_once 'Zend/Config/Exception.php';
+ throw new Zend_Config_Exception('No config was set');
+ }
+
+ $configString = $this->render();
+
+ $flags = 0;
+
+ if ($this->_exclusiveLock) {
+ $flags |= LOCK_EX;
+ }
+
+ $result = @file_put_contents($this->_filename, $configString, $flags);
+
+ if ($result === false) {
+ // require_once 'Zend/Config/Exception.php';
+ throw new Zend_Config_Exception('Could not write to file "' . $this->_filename . '"');
+ }
+ }
+
+ /**
+ * Render a Zend_Config into a config file string.
+ *
+ * @since 1.10
+ * @todo For 2.0 this should be redone into an abstract method.
+ * @return string
+ */
+ public function render()
+ {
+ return "";
+ }
+} \ No newline at end of file
diff --git a/libs/Zend/Config/Writer/Ini.php b/libs/Zend/Config/Writer/Ini.php
index ea65ca87c3..163c95e216 100644
--- a/libs/Zend/Config/Writer/Ini.php
+++ b/libs/Zend/Config/Writer/Ini.php
@@ -14,123 +14,81 @@
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ini.php 16201 2009-06-21 18:51:15Z thomas $
+ * @version $Id: Ini.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Config_Writer
*/
-require_once 'Zend/Config/Writer.php';
+// require_once 'Zend/Config/Writer/FileAbstract.php';
/**
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Config_Writer_Ini extends Zend_Config_Writer
+class Zend_Config_Writer_Ini extends Zend_Config_Writer_FileAbstract
{
/**
- * Filename to write to
- *
- * @var string
- */
- protected $_filename = null;
-
- /**
- * Wether to exclusively lock the file or not
- *
- * @var boolean
- */
- protected $_exclusiveLock = false;
-
- /**
* String that separates nesting levels of configuration data identifiers
*
* @var string
*/
protected $_nestSeparator = '.';
-
+
/**
- * Set the target filename
+ * If true the ini string is rendered in the global namespace without sections.
*
- * @param string $filename
- * @return Zend_Config_Writer_Xml
+ * @var bool
*/
- public function setFilename($filename)
- {
- $this->_filename = $filename;
-
- return $this;
- }
-
+ protected $_renderWithoutSections = false;
+
/**
- * Set wether to exclusively lock the file or not
+ * Set the nest separator
*
- * @param boolean $exclusiveLock
- * @return Zend_Config_Writer_Array
+ * @param string $filename
+ * @return Zend_Config_Writer_Ini
*/
- public function setExclusiveLock($exclusiveLock)
+ public function setNestSeparator($separator)
{
- $this->_exclusiveLock = $exclusiveLock;
-
+ $this->_nestSeparator = $separator;
+
return $this;
}
-
+
/**
- * Set the nest separator
+ * Set if rendering should occour without sections or not.
*
- * @param string $filename
+ * If set to true, the INI file is rendered without sections completely
+ * into the global namespace of the INI file.
+ *
+ * @param bool $withoutSections
* @return Zend_Config_Writer_Ini
*/
- public function setNestSeparator($separator)
+ public function setRenderWithoutSections($withoutSections=true)
{
- $this->_nestSeparator = $separator;
-
+ $this->_renderWithoutSections = (bool)$withoutSections;
return $this;
}
-
+
/**
- * Defined by Zend_Config_Writer
+ * Render a Zend_Config into a INI config string.
*
- * @param string $filename
- * @param Zend_Config $config
- * @param boolean $exclusiveLock
- * @throws Zend_Config_Exception When filename was not set
- * @throws Zend_Config_Exception When filename is not writable
- * @return void
+ * @since 1.10
+ * @return string
*/
- public function write($filename = null, Zend_Config $config = null, $exclusiveLock = null)
+ public function render()
{
- if ($filename !== null) {
- $this->setFilename($filename);
- }
-
- if ($config !== null) {
- $this->setConfig($config);
- }
-
- if ($exclusiveLock !== null) {
- $this->setExclusiveLock($exclusiveLock);
- }
-
- if ($this->_filename === null) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('No filename was set');
- }
-
- if ($this->_config === null) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('No config was set');
- }
-
$iniString = '';
$extends = $this->_config->getExtends();
$sectionName = $this->_config->getSectionName();
-
- if (is_string($sectionName)) {
+
+ if($this->_renderWithoutSections == true) {
+ $iniString .= $this->_addBranch($this->_config);
+ } else if (is_string($sectionName)) {
$iniString .= '[' . $sectionName . ']' . "\n"
. $this->_addBranch($this->_config)
. "\n";
@@ -145,28 +103,17 @@ class Zend_Config_Writer_Ini extends Zend_Config_Writer
if (isset($extends[$sectionName])) {
$sectionName .= ' : ' . $extends[$sectionName];
}
-
+
$iniString .= '[' . $sectionName . ']' . "\n"
. $this->_addBranch($data)
. "\n";
}
}
}
-
- $flags = 0;
-
- if ($this->_exclusiveLock) {
- $flags |= LOCK_EX;
- }
-
- $result = @file_put_contents($this->_filename, $iniString, $flags);
- if ($result === false) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('Could not write to file "' . $this->_filename . '"');
- }
+ return $iniString;
}
-
+
/**
* Add a branch to an INI string recursively
*
@@ -179,7 +126,7 @@ class Zend_Config_Writer_Ini extends Zend_Config_Writer
foreach ($config as $key => $value) {
$group = array_merge($parents, array($key));
-
+
if ($value instanceof Zend_Config) {
$iniString .= $this->_addBranch($value, $group);
} else {
@@ -189,10 +136,10 @@ class Zend_Config_Writer_Ini extends Zend_Config_Writer
. "\n";
}
}
-
+
return $iniString;
}
-
+
/**
* Prepare a value for INI
*
@@ -205,8 +152,12 @@ class Zend_Config_Writer_Ini extends Zend_Config_Writer
return $value;
} elseif (is_bool($value)) {
return ($value ? 'true' : 'false');
+ } elseif (strpos($value, '"') === false) {
+ return '"' . $value . '"';
} else {
- return '"' . addslashes($value) . '"';
+ /** @see Zend_Config_Exception */
+ // require_once 'Zend/Config/Exception.php';
+ throw new Zend_Config_Exception('Value can not contain double quotes "');
}
}
}
diff --git a/libs/Zend/Config/Writer/Xml.php b/libs/Zend/Config/Writer/Xml.php
index 764b461ded..7b779d63af 100644
--- a/libs/Zend/Config/Writer/Xml.php
+++ b/libs/Zend/Config/Writer/Xml.php
@@ -14,107 +14,41 @@
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xml.php 16924 2009-07-21 16:34:04Z dasprid $
+ * @version $Id: Xml.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Config_Writer
*/
-require_once 'Zend/Config/Writer.php';
+// require_once 'Zend/Config/Writer/FileAbstract.php';
/**
* @see Zend_Config_Xml
*/
-require_once 'Zend/Config/Xml.php';
+// require_once 'Zend/Config/Xml.php';
/**
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Config_Writer_Xml extends Zend_Config_Writer
+class Zend_Config_Writer_Xml extends Zend_Config_Writer_FileAbstract
{
/**
- * Filename to write to
+ * Render a Zend_Config into a XML config string.
*
- * @var string
+ * @since 1.10
+ * @return string
*/
- protected $_filename = null;
-
- /**
- * Wether to exclusively lock the file or not
- *
- * @var boolean
- */
- protected $_exclusiveLock = false;
-
- /**
- * Set the target filename
- *
- * @param string $filename
- * @return Zend_Config_Writer_Xml
- */
- public function setFilename($filename)
- {
- $this->_filename = $filename;
-
- return $this;
- }
-
- /**
- * Set wether to exclusively lock the file or not
- *
- * @param boolean $exclusiveLock
- * @return Zend_Config_Writer_Array
- */
- public function setExclusiveLock($exclusiveLock)
+ public function render()
{
- $this->_exclusiveLock = $exclusiveLock;
-
- return $this;
- }
-
- /**
- * Defined by Zend_Config_Writer
- *
- * @param string $filename
- * @param Zend_Config $config
- * @param boolean $exclusiveLock
- * @throws Zend_Config_Exception When filename was not set
- * @throws Zend_Config_Exception When filename is not writable
- * @return void
- */
- public function write($filename = null, Zend_Config $config = null, $exclusiveLock = null)
- {
- if ($filename !== null) {
- $this->setFilename($filename);
- }
-
- if ($config !== null) {
- $this->setConfig($config);
- }
-
- if ($exclusiveLock !== null) {
- $this->setExclusiveLock($exclusiveLock);
- }
-
- if ($this->_filename === null) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('No filename was set');
- }
-
- if ($this->_config === null) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('No config was set');
- }
-
$xml = new SimpleXMLElement('<zend-config xmlns:zf="' . Zend_Config_Xml::XML_NAMESPACE . '"/>');
$extends = $this->_config->getExtends();
$sectionName = $this->_config->getSectionName();
-
+
if (is_string($sectionName)) {
$child = $xml->addChild($sectionName);
@@ -125,35 +59,24 @@ class Zend_Config_Writer_Xml extends Zend_Config_Writer
$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();
-
- $flags = 0;
-
- if ($this->_exclusiveLock) {
- $flags |= LOCK_EX;
- }
-
- $result = @file_put_contents($this->_filename, $xmlString, $flags);
-
- if ($result === false) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('Could not write to file "' . $this->_filename . '"');
- }
+
+ return $xmlString;
}
-
+
/**
* Add a branch to an XML object recursively
*
@@ -165,35 +88,35 @@ class Zend_Config_Writer_Xml extends Zend_Config_Writer
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')) {
- require_once 'Zend/Config/Exception.php';
- throw new Zend_Config_Exception('Mixing of string and numeric keys is not allowed');
+ // require_once 'Zend/Config/Exception.php';
+ 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, (string) $value);
-
+ $child = $parent->addChild($branchName);
+
$this->_addBranch($value, $child, $parent);
} else {
$parent->addChild($branchName, (string) $value);
}
- } else {
+ } else {
if ($value instanceof Zend_Config) {
$child = $xml->addChild($key);
-
+
$this->_addBranch($value, $child, $xml);
} else {
$xml->addChild($key, (string) $value);
diff --git a/libs/Zend/Config/Xml.php b/libs/Zend/Config/Xml.php
index e68bfd3b32..698247cec8 100644
--- a/libs/Zend/Config/Xml.php
+++ b/libs/Zend/Config/Xml.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xml.php 17267 2009-07-29 02:13:18Z yoshida@zend.co.jp $
+ * @version $Id: Xml.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Config
*/
-require_once 'Zend/Config.php';
+// require_once 'Zend/Config.php';
/**
* XML Adapter for Zend_Config
*
* @category Zend
* @package Zend_Config
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Config_Xml extends Zend_Config
@@ -40,7 +40,7 @@ class Zend_Config_Xml extends Zend_Config
const XML_NAMESPACE = 'http://framework.zend.com/xml/zend-config-xml/1.0/';
/**
- * Wether to skip extends or not
+ * Whether to skip extends or not
*
* @var boolean
*/
@@ -61,14 +61,14 @@ class Zend_Config_Xml extends Zend_Config
*
* @param string $xml XML file or string to process
* @param mixed $section Section to process
- * @param boolean $options Whether modifiacations are allowed at runtime
+ * @param boolean $options Whether modifications are allowed at runtime
* @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)) {
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception('Filename is not set');
}
@@ -94,7 +94,7 @@ class Zend_Config_Xml extends Zend_Config
restore_error_handler();
// Check if there was a error while loading file
if ($this->_loadFileErrorStr !== null) {
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception($this->_loadFileErrorStr);
}
@@ -109,7 +109,7 @@ class Zend_Config_Xml extends Zend_Config
$dataArray = array();
foreach ($section as $sectionName) {
if (!isset($config->$sectionName)) {
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $xml");
}
@@ -119,7 +119,7 @@ class Zend_Config_Xml extends Zend_Config
parent::__construct($dataArray, $allowModifications);
} else {
if (!isset($config->$section)) {
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Section '$section' cannot be found in $xml");
}
@@ -148,7 +148,7 @@ class Zend_Config_Xml extends Zend_Config
protected function _processExtends(SimpleXMLElement $element, $section, array $config = array())
{
if (!isset($element->$section)) {
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Section '$section' cannot be found");
}
@@ -205,7 +205,7 @@ class Zend_Config_Xml extends Zend_Config
// Search for local 'const' nodes and replace them
if (count($xmlObject->children(self::XML_NAMESPACE)) > 0) {
if (count($xmlObject->children()) > 0) {
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("A node with a 'const' childnode may not have any other children");
}
@@ -224,14 +224,14 @@ class Zend_Config_Xml extends Zend_Config
switch ($node->localName) {
case 'const':
if (!$node->hasAttributeNS(self::XML_NAMESPACE, 'name')) {
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Misssing 'name' attribute in 'const' node");
}
$constantName = $node->getAttributeNS(self::XML_NAMESPACE, 'name');
if (!defined($constantName)) {
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Constant with name '$constantName' was not defined");
}
@@ -241,7 +241,7 @@ class Zend_Config_Xml extends Zend_Config
break;
default:
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Unknown node with name '$node->localName' found");
}
}
@@ -283,33 +283,4 @@ class Zend_Config_Xml extends Zend_Config
return $config;
}
-
- /**
- * Merge two arrays recursively, overwriting keys of the same name
- * in $firstArray with the value in $secondArray.
- *
- * @param mixed $firstArray First array
- * @param mixed $secondArray Second array to merge into first array
- * @return array
- */
- protected function _arrayMergeRecursive($firstArray, $secondArray)
- {
- if (is_array($firstArray) && is_array($secondArray)) {
- foreach ($secondArray as $key => $value) {
- if (isset($firstArray[$key])) {
- $firstArray[$key] = $this->_arrayMergeRecursive($firstArray[$key], $value);
- } else {
- if($key === 0) {
- $firstArray= array(0=>$this->_arrayMergeRecursive($firstArray, $value));
- } else {
- $firstArray[$key] = $value;
- }
- }
- }
- } else {
- $firstArray = $secondArray;
- }
-
- return $firstArray;
- }
}
diff --git a/libs/Zend/Db.php b/libs/Zend/Db.php
index b62bcdbbee..9bbf1e793f 100644
--- a/libs/Zend/Db.php
+++ b/libs/Zend/Db.php
@@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Db
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Db.php 18373 2009-09-22 19:16:25Z ralph $
+ * @version $Id: Db.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -26,7 +26,7 @@
*
* @category Zend
* @package Zend_Db
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db
@@ -219,7 +219,7 @@ class Zend_Db
/**
* @see Zend_Db_Exception
*/
- require_once 'Zend/Db/Exception.php';
+ // require_once 'Zend/Db/Exception.php';
throw new Zend_Db_Exception('Adapter parameters must be in an array or a Zend_Config object');
}
@@ -230,7 +230,7 @@ class Zend_Db
/**
* @see Zend_Db_Exception
*/
- require_once 'Zend/Db/Exception.php';
+ // require_once 'Zend/Db/Exception.php';
throw new Zend_Db_Exception('Adapter name must be specified in a string');
}
@@ -253,10 +253,10 @@ class Zend_Db
* Load the adapter class. This throws an exception
* if the specified class cannot be loaded.
*/
- if (!class_exists($adapterName)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($adapterName);
- }
+ // if (!class_exists($adapterName)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($adapterName);
+ // }
/*
* Create an instance of the adapter class.
@@ -271,7 +271,7 @@ class Zend_Db
/**
* @see Zend_Db_Exception
*/
- require_once 'Zend/Db/Exception.php';
+ // require_once 'Zend/Db/Exception.php';
throw new Zend_Db_Exception("Adapter class '$adapterName' does not extend Zend_Db_Adapter_Abstract");
}
diff --git a/libs/Zend/Db/Adapter/Abstract.php b/libs/Zend/Db/Adapter/Abstract.php
index bd00da96f4..09ab9e692d 100644
--- a/libs/Zend/Db/Adapter/Abstract.php
+++ b/libs/Zend/Db/Adapter/Abstract.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 18633 2009-10-17 05:36:58Z ralph $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db
*/
-require_once 'Zend/Db.php';
+// require_once 'Zend/Db.php';
/**
* @see Zend_Db_Select
*/
-require_once 'Zend/Db/Select.php';
+// require_once 'Zend/Db/Select.php';
/**
* Class for connecting to SQL databases and performing common operations.
@@ -37,7 +37,7 @@ require_once 'Zend/Db/Select.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Db_Adapter_Abstract
@@ -175,7 +175,7 @@ abstract class Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception('Adapter parameters must be in an array or a Zend_Config object');
}
}
@@ -230,7 +230,7 @@ abstract class Zend_Db_Adapter_Abstract
break;
default:
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception('Case must be one of the following constants: '
. 'Zend_Db::CASE_NATURAL, Zend_Db::CASE_LOWER, Zend_Db::CASE_UPPER');
}
@@ -272,7 +272,7 @@ abstract class Zend_Db_Adapter_Abstract
// we need at least a dbname
if (! array_key_exists('dbname', $config)) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Configuration array must have a key for 'dbname' that names the database instance");
}
@@ -280,7 +280,7 @@ abstract class Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Configuration array must have a key for 'password' for login credentials");
}
@@ -288,7 +288,7 @@ abstract class Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Configuration array must have a key for 'username' for login credentials");
}
}
@@ -358,7 +358,7 @@ abstract class Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Profiler_Exception
*/
- require_once 'Zend/Db/Profiler/Exception.php';
+ // require_once 'Zend/Db/Profiler/Exception.php';
throw new Zend_Db_Profiler_Exception('Profiler argument must be an instance of either Zend_Db_Profiler'
. ' or Zend_Config when provided as an object');
}
@@ -379,16 +379,16 @@ abstract class Zend_Db_Adapter_Abstract
}
if ($profilerInstance === null) {
- if (!class_exists($profilerClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($profilerClass);
- }
+ // if (!class_exists($profilerClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($profilerClass);
+ // }
$profilerInstance = new $profilerClass();
}
if (!$profilerInstance instanceof Zend_Db_Profiler) {
/** @see Zend_Db_Profiler_Exception */
- require_once 'Zend/Db/Profiler/Exception.php';
+ // require_once 'Zend/Db/Profiler/Exception.php';
throw new Zend_Db_Profiler_Exception('Class ' . get_class($profilerInstance) . ' does not extend '
. 'Zend_Db_Profiler');
}
@@ -579,7 +579,7 @@ abstract class Zend_Db_Adapter_Abstract
$i++;
} else {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception(get_class($this) ." doesn't support positional or named binding");
}
}
@@ -902,7 +902,7 @@ abstract class Zend_Db_Adapter_Abstract
return str_replace('?', $this->quote($value, $type), $text);
} else {
while ($count > 0) {
- if (strpos($text, '?') != false) {
+ if (strpos($text, '?') !== false) {
$text = substr_replace($text, $this->quote($value, $type), strpos($text, '?'), 1);
}
--$count;
@@ -1097,7 +1097,7 @@ abstract class Zend_Db_Adapter_Abstract
{
if ($this->_allowSerialization == false) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception(get_class($this) ." is not allowed to be serialized");
}
$this->_connection = false;
diff --git a/libs/Zend/Db/Adapter/Db2.php b/libs/Zend/Db/Adapter/Db2.php
index 9d9e9849f3..bde2100793 100644
--- a/libs/Zend/Db/Adapter/Db2.php
+++ b/libs/Zend/Db/Adapter/Db2.php
@@ -15,31 +15,31 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Db2.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Db2.php 20096 2010-01-06 02:05:09Z bkarwin $
*
*/
/**
* @see Zend_Db
*/
-require_once 'Zend/Db.php';
+// require_once 'Zend/Db.php';
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Adapter/Abstract.php';
+// require_once 'Zend/Db/Adapter/Abstract.php';
/**
* @see Zend_Db_Statement_Db2
*/
-require_once 'Zend/Db/Statement/Db2.php';
+// require_once 'Zend/Db/Statement/Db2.php';
/**
* @package Zend_Db
- * @copyright Copyright (c) 2005-2009 Zend Technologies Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -127,7 +127,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception('The IBM DB2 extension is required for this adapter but the extension is not loaded');
}
@@ -184,7 +184,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception(db2_conn_errormsg(), db2_conn_error());
}
}
@@ -223,10 +223,10 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
{
$this->_connect();
$stmtClass = $this->_defaultStmtClass;
- if (!class_exists($stmtClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($stmtClass);
- }
+ // if (!class_exists($stmtClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($stmtClass);
+ // }
$stmt = new $stmtClass($this, $sql);
$stmt->setFetchMode($this->_fetchMode);
return $stmt;
@@ -258,7 +258,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception("execution mode not supported");
break;
}
@@ -373,7 +373,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
if ($schemaName === null && $this->_config['schema'] != null) {
$schemaName = $this->_config['schema'];
}
-
+
if (!$this->_isI5) {
$sql = "SELECT DISTINCT c.tabschema, c.tabname, c.colname, c.colno,
@@ -402,14 +402,14 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
$sql = "SELECT DISTINCT C.TABLE_SCHEMA, C.TABLE_NAME, C.COLUMN_NAME, C.ORDINAL_POSITION,
C.DATA_TYPE, C.COLUMN_DEFAULT, C.NULLS ,C.LENGTH, C.SCALE, LEFT(C.IDENTITY,1),
LEFT(tc.TYPE, 1) AS tabconsttype, k.COLSEQ
- FROM QSYS2.SYSCOLUMNS C
+ FROM QSYS2.SYSCOLUMNS C
LEFT JOIN (QSYS2.syskeycst k JOIN QSYS2.SYSCST tc
ON (k.TABLE_SCHEMA = tc.TABLE_SCHEMA
AND k.TABLE_NAME = tc.TABLE_NAME
- AND LEFT(tc.type,1) = 'P'))
+ AND LEFT(tc.type,1) = 'P'))
ON (C.TABLE_SCHEMA = k.TABLE_SCHEMA
AND C.TABLE_NAME = k.TABLE_NAME
- AND C.COLUMN_NAME = k.COLUMN_NAME)
+ AND C.COLUMN_NAME = k.COLUMN_NAME)
WHERE "
. $this->quoteInto('UPPER(C.TABLE_NAME) = UPPER(?)', $tableName);
@@ -583,7 +583,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception(
db2_conn_errormsg($this->_connection),
db2_conn_error($this->_connection));
@@ -603,7 +603,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception(
db2_conn_errormsg($this->_connection),
db2_conn_error($this->_connection));
@@ -631,14 +631,14 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception('FETCH_BOUND is not supported yet');
break;
default:
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception("Invalid fetch mode '$mode' specified");
break;
}
@@ -659,7 +659,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception("LIMIT argument count=$count is not valid");
}
@@ -668,7 +668,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Db2_Exception
*/
- require_once 'Zend/Db/Adapter/Db2/Exception.php';
+ // require_once 'Zend/Db/Adapter/Db2/Exception.php';
throw new Zend_Db_Adapter_Db2_Exception("LIMIT argument offset=$offset is not valid");
}
diff --git a/libs/Zend/Db/Adapter/Db2/Exception.php b/libs/Zend/Db/Adapter/Db2/Exception.php
index 621274745d..8104606d59 100644
--- a/libs/Zend/Db/Adapter/Db2/Exception.php
+++ b/libs/Zend/Db/Adapter/Db2/Exception.php
@@ -15,22 +15,22 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Adapter_Exception
*/
-require_once 'Zend/Db/Adapter/Exception.php';
+// require_once 'Zend/Db/Adapter/Exception.php';
/**
* Zend_Db_Adapter_Db2_Exception
*
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Db2_Exception extends Zend_Db_Adapter_Exception
@@ -38,8 +38,8 @@ class Zend_Db_Adapter_Db2_Exception extends Zend_Db_Adapter_Exception
protected $code = '00000';
protected $message = 'unknown exception';
- function __construct($msg = 'unknown exception', $state = '00000') {
- $this->message = $msg;
- $this->code = $state;
+ function __construct($message = 'unknown exception', $code = '00000', Exception $e = null)
+ {
+ parent::__construct($message, $code, $e);
}
}
diff --git a/libs/Zend/Db/Adapter/Exception.php b/libs/Zend/Db/Adapter/Exception.php
index 51c06874a6..2510ef6526 100644
--- a/libs/Zend/Db/Adapter/Exception.php
+++ b/libs/Zend/Db/Adapter/Exception.php
@@ -15,44 +15,43 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 17860 2009-08-27 22:48:48Z beberlei $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Exception
*/
-require_once 'Zend/Db/Exception.php';
+// require_once 'Zend/Db/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Exception extends Zend_Db_Exception
{
protected $_chainedException = null;
- public function __construct($message = null, Exception $e = null)
+ public function __construct($message = '', $code = 0, Exception $e = null)
{
- if ($e) {
- $this->_chainedException = $e;
- $this->code = $e->getCode();
+ if ($e && (0 === $code)) {
+ $code = $e->getCode();
}
- parent::__construct($message);
+ parent::__construct($message, $code, $e);
}
public function hasChainedException()
{
- return ($this->_chainedException!==null);
+ return ($this->_previous !== null);
}
public function getChainedException()
{
- return $this->_chainedException;
+ return $this->getPrevious();
}
}
diff --git a/libs/Zend/Db/Adapter/Mysqli.php b/libs/Zend/Db/Adapter/Mysqli.php
index 3b686948c8..eb9437d059 100644
--- a/libs/Zend/Db/Adapter/Mysqli.php
+++ b/libs/Zend/Db/Adapter/Mysqli.php
@@ -15,38 +15,38 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mysqli.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Mysqli.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Adapter/Abstract.php';
+// require_once 'Zend/Db/Adapter/Abstract.php';
/**
* @see Zend_Db_Profiler
*/
-require_once 'Zend/Db/Profiler.php';
+// require_once 'Zend/Db/Profiler.php';
/**
* @see Zend_Db_Select
*/
-require_once 'Zend/Db/Select.php';
+// require_once 'Zend/Db/Select.php';
/**
* @see Zend_Db_Statement_Mysqli
*/
-require_once 'Zend/Db/Statement/Mysqli.php';
+// require_once 'Zend/Db/Statement/Mysqli.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
@@ -140,7 +140,7 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Mysqli_Exception
*/
- require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
throw new Zend_Db_Adapter_Mysqli_Exception($this->getConnection()->error);
}
return $result;
@@ -200,7 +200,7 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Mysqli_Exception
*/
- require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
throw new Zend_Db_Adapter_Mysqli_Exception($this->getConnection()->error);
}
@@ -287,7 +287,7 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Mysqli_Exception
*/
- require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
throw new Zend_Db_Adapter_Mysqli_Exception('The Mysqli extension is required for this adapter but the extension is not loaded');
}
@@ -329,7 +329,7 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Mysqli_Exception
*/
- require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
throw new Zend_Db_Adapter_Mysqli_Exception(mysqli_connect_error());
}
@@ -374,10 +374,10 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
$this->_stmt->close();
}
$stmtClass = $this->_defaultStmtClass;
- if (!class_exists($stmtClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($stmtClass);
- }
+ // if (!class_exists($stmtClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($stmtClass);
+ // }
$stmt = new $stmtClass($this, $sql);
if ($stmt === false) {
return false;
@@ -467,14 +467,14 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Mysqli_Exception
*/
- require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
throw new Zend_Db_Adapter_Mysqli_Exception('FETCH_BOUND is not supported yet');
break;
default:
/**
* @see Zend_Db_Adapter_Mysqli_Exception
*/
- require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
throw new Zend_Db_Adapter_Mysqli_Exception("Invalid fetch mode '$mode' specified");
}
}
@@ -494,7 +494,7 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Mysqli_Exception
*/
- require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
throw new Zend_Db_Adapter_Mysqli_Exception("LIMIT argument count=$count is not valid");
}
@@ -503,7 +503,7 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Mysqli_Exception
*/
- require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
throw new Zend_Db_Adapter_Mysqli_Exception("LIMIT argument offset=$offset is not valid");
}
diff --git a/libs/Zend/Db/Adapter/Mysqli/Exception.php b/libs/Zend/Db/Adapter/Mysqli/Exception.php
index f2fbd8f958..f7f9f4a8fa 100644
--- a/libs/Zend/Db/Adapter/Mysqli/Exception.php
+++ b/libs/Zend/Db/Adapter/Mysqli/Exception.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*
*/
/**
* Zend
*/
-require_once 'Zend/Db/Adapter/Exception.php';
+// require_once 'Zend/Db/Adapter/Exception.php';
/**
* Zend_Db_Adapter_Mysqli_Exception
@@ -32,7 +32,7 @@ require_once 'Zend/Db/Adapter/Exception.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Mysqli_Exception extends Zend_Db_Adapter_Exception
diff --git a/libs/Zend/Db/Adapter/Oracle.php b/libs/Zend/Db/Adapter/Oracle.php
index 233335825d..17fb8488f4 100644
--- a/libs/Zend/Db/Adapter/Oracle.php
+++ b/libs/Zend/Db/Adapter/Oracle.php
@@ -15,26 +15,26 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Oracle.php 18415 2009-09-25 17:46:24Z mikaelkael $
+ * @version $Id: Oracle.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Adapter/Abstract.php';
+// require_once 'Zend/Db/Adapter/Abstract.php';
/**
* @see Zend_Db_Statement_Oracle
*/
-require_once 'Zend/Db/Statement/Oracle.php';
+// require_once 'Zend/Db/Statement/Oracle.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
@@ -115,14 +115,14 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception('The OCI8 extension is required for this adapter but the extension is not loaded');
}
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
$connectionFuncName = ($this->_config['persistent'] == true) ? 'oci_pconnect' : 'oci_connect';
-
+
$this->_connection = @$connectionFuncName(
$this->_config['username'],
$this->_config['password'],
@@ -134,7 +134,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception(oci_error());
}
}
@@ -204,10 +204,10 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
{
$this->_connect();
$stmtClass = $this->_defaultStmtClass;
- if (!class_exists($stmtClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($stmtClass);
- }
+ // if (!class_exists($stmtClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($stmtClass);
+ // }
$stmt = new $stmtClass($this, $sql);
if ($stmt instanceof Zend_Db_Statement_Oracle) {
$stmt->setLobAsString($this->getLobAsString());
@@ -360,7 +360,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
TC.DATA_SCALE, TC.DATA_PRECISION, C.CONSTRAINT_TYPE, CC.POSITION
FROM ALL_TAB_COLUMNS TC
LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C
- ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND C.CONSTRAINT_TYPE = 'P'))
+ ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND CC.OWNER = C.OWNER AND C.CONSTRAINT_TYPE = 'P'))
ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME
WHERE UPPER(TC.TABLE_NAME) = UPPER(:TBNAME)";
$bind[':TBNAME'] = $tableName;
@@ -467,7 +467,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception(oci_error($this->_connection));
}
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
@@ -485,7 +485,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception(oci_error($this->_connection));
}
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
@@ -513,14 +513,14 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception('FETCH_BOUND is not supported yet');
break;
default:
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception("Invalid fetch mode '$mode' specified");
break;
}
@@ -542,7 +542,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception("LIMIT argument count=$count is not valid");
}
@@ -551,7 +551,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception("LIMIT argument offset=$offset is not valid");
}
@@ -588,7 +588,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Adapter/Oracle/Exception.php';
+ // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception("Invalid execution mode '$mode' specified");
break;
}
diff --git a/libs/Zend/Db/Adapter/Oracle/Exception.php b/libs/Zend/Db/Adapter/Oracle/Exception.php
index 39809b10df..a2f43ae893 100644
--- a/libs/Zend/Db/Adapter/Oracle/Exception.php
+++ b/libs/Zend/Db/Adapter/Oracle/Exception.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Adapter_Exception
*/
-require_once 'Zend/Db/Adapter/Exception.php';
+// require_once 'Zend/Db/Adapter/Exception.php';
/**
* Zend_Db_Adapter_Oracle_Exception
@@ -31,7 +31,7 @@ require_once 'Zend/Db/Adapter/Exception.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Oracle_Exception extends Zend_Db_Adapter_Exception
diff --git a/libs/Zend/Db/Adapter/Pdo/Abstract.php b/libs/Zend/Db/Adapter/Pdo/Abstract.php
index 9d05f417b4..0ffc1f428f 100644
--- a/libs/Zend/Db/Adapter/Pdo/Abstract.php
+++ b/libs/Zend/Db/Adapter/Pdo/Abstract.php
@@ -15,22 +15,22 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 17860 2009-08-27 22:48:48Z beberlei $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Adapter/Abstract.php';
+// require_once 'Zend/Db/Adapter/Abstract.php';
/**
* @see Zend_Db_Statement_Pdo
*/
-require_once 'Zend/Db/Statement/Pdo.php';
+// require_once 'Zend/Db/Statement/Pdo.php';
/**
@@ -39,7 +39,7 @@ require_once 'Zend/Db/Statement/Pdo.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
@@ -99,7 +99,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception('The PDO extension is required for this adapter but the extension is not loaded');
}
@@ -108,7 +108,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception('The ' . $this->_pdoType . ' driver is not currently installed');
}
@@ -119,7 +119,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
if (isset($this->_config['persistent']) && ($this->_config['persistent'] == true)) {
$this->_config['driver_options'][PDO::ATTR_PERSISTENT] = true;
}
-
+
try {
$this->_connection = new PDO(
$dsn,
@@ -140,8 +140,8 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
- throw new Zend_Db_Adapter_Exception($e->getMessage(), $e);
+ // require_once 'Zend/Db/Adapter/Exception.php';
+ throw new Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -177,10 +177,10 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
{
$this->_connect();
$stmtClass = $this->_defaultStmtClass;
- if (!class_exists($stmtClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($stmtClass);
- }
+ // if (!class_exists($stmtClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($stmtClass);
+ // }
$stmt = new $stmtClass($this, $sql);
$stmt->setFetchMode($this->_fetchMode);
return $stmt;
@@ -240,7 +240,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Statement_Exception
*/
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -258,26 +258,26 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
if ($sql instanceof Zend_Db_Select) {
$sql = $sql->assemble();
}
-
+
try {
$affected = $this->getConnection()->exec($sql);
-
+
if ($affected === false) {
$errorInfo = $this->getConnection()->errorInfo();
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($errorInfo[2]);
}
-
+
return $affected;
} catch (PDOException $e) {
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
- throw new Zend_Db_Adapter_Exception($e->getMessage(), $e);
+ // require_once 'Zend/Db/Adapter/Exception.php';
+ throw new Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -338,7 +338,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception('The PDO extension is required for this adapter but the extension is not loaded');
}
switch ($mode) {
@@ -354,7 +354,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Invalid fetch mode '$mode' specified");
break;
}
diff --git a/libs/Zend/Db/Adapter/Pdo/Ibm.php b/libs/Zend/Db/Adapter/Pdo/Ibm.php
index 47d91da0dc..22738248a9 100644
--- a/libs/Zend/Db/Adapter/Pdo/Ibm.php
+++ b/libs/Zend/Db/Adapter/Pdo/Ibm.php
@@ -15,30 +15,30 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ibm.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Ibm.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** @see Zend_Db_Adapter_Pdo_Abstract */
-require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
+// require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
/** @see Zend_Db_Abstract_Pdo_Ibm_Db2 */
-require_once 'Zend/Db/Adapter/Pdo/Ibm/Db2.php';
+// require_once 'Zend/Db/Adapter/Pdo/Ibm/Db2.php';
/** @see Zend_Db_Abstract_Pdo_Ibm_Ids */
-require_once 'Zend/Db/Adapter/Pdo/Ibm/Ids.php';
+// require_once 'Zend/Db/Adapter/Pdo/Ibm/Ids.php';
/** @see Zend_Db_Statement_Pdo_Ibm */
-require_once 'Zend/Db/Statement/Pdo/Ibm.php';
+// require_once 'Zend/Db/Statement/Pdo/Ibm.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Pdo_Ibm extends Zend_Db_Adapter_Pdo_Abstract
@@ -131,12 +131,12 @@ class Zend_Db_Adapter_Pdo_Ibm extends Zend_Db_Adapter_Pdo_Abstract
}
} catch (PDOException $e) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
$error = strpos($e->getMessage(), 'driver does not support that attribute');
if ($error) {
- throw new Zend_Db_Adapter_Exception("PDO_IBM driver extension is downlevel. Please use driver release version 1.2.1 or later");
+ throw new Zend_Db_Adapter_Exception("PDO_IBM driver extension is downlevel. Please use driver release version 1.2.1 or later", 0, $e);
} else {
- throw new Zend_Db_Adapter_Exception($e->getMessage());
+ throw new Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e);
}
}
}
@@ -178,7 +178,7 @@ class Zend_Db_Adapter_Pdo_Ibm extends Zend_Db_Adapter_Pdo_Abstract
if (array_key_exists('host', $this->_config) &&
!array_key_exists('port', $config)) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Configuration must have a key for 'port' when 'host' is specified");
}
}
diff --git a/libs/Zend/Db/Adapter/Pdo/Ibm/Db2.php b/libs/Zend/Db/Adapter/Pdo/Ibm/Db2.php
index 99182c0576..94899d4462 100644
--- a/libs/Zend/Db/Adapter/Pdo/Ibm/Db2.php
+++ b/libs/Zend/Db/Adapter/Pdo/Ibm/Db2.php
@@ -15,24 +15,24 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Db2.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Db2.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** @see Zend_Db_Adapter_Pdo_Ibm */
-require_once 'Zend/Db/Adapter/Pdo/Ibm.php';
+// require_once 'Zend/Db/Adapter/Pdo/Ibm.php';
/** @see Zend_Db_Statement_Pdo_Ibm */
-require_once 'Zend/Db/Statement/Pdo/Ibm.php';
+// require_once 'Zend/Db/Statement/Pdo/Ibm.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Pdo_Ibm_Db2
@@ -168,13 +168,13 @@ class Zend_Db_Adapter_Pdo_Ibm_Db2
$count = intval($count);
if ($count < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
} else {
$offset = intval($offset);
if ($offset < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
diff --git a/libs/Zend/Db/Adapter/Pdo/Ibm/Ids.php b/libs/Zend/Db/Adapter/Pdo/Ibm/Ids.php
index 766106332b..5777e5621c 100644
--- a/libs/Zend/Db/Adapter/Pdo/Ibm/Ids.php
+++ b/libs/Zend/Db/Adapter/Pdo/Ibm/Ids.php
@@ -15,24 +15,24 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ids.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Ids.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** @see Zend_Db_Adapter_Pdo_Ibm */
-require_once 'Zend/Db/Adapter/Pdo/Ibm.php';
+// require_once 'Zend/Db/Adapter/Pdo/Ibm.php';
/** @see Zend_Db_Statement_Pdo_Ibm */
-require_once 'Zend/Db/Statement/Pdo/Ibm.php';
+// require_once 'Zend/Db/Statement/Pdo/Ibm.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Pdo_Ibm_Ids
@@ -250,7 +250,7 @@ class Zend_Db_Adapter_Pdo_Ibm_Ids
$count = intval($count);
if ($count < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
} else if ($count == 0) {
$limit_sql = str_ireplace("SELECT", "SELECT * FROM (SELECT", $sql);
@@ -259,7 +259,7 @@ class Zend_Db_Adapter_Pdo_Ibm_Ids
$offset = intval($offset);
if ($offset < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
if ($offset == 0) {
diff --git a/libs/Zend/Db/Adapter/Pdo/Mssql.php b/libs/Zend/Db/Adapter/Pdo/Mssql.php
index b61a4d61cc..0bd7a1bfbd 100644
--- a/libs/Zend/Db/Adapter/Pdo/Mssql.php
+++ b/libs/Zend/Db/Adapter/Pdo/Mssql.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mssql.php 17792 2009-08-24 16:18:02Z ralph $
+ * @version $Id: Mssql.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Pdo_Abstract
*/
-require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
+// require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract
@@ -254,7 +254,7 @@ class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract
if ($schemaName != null) {
$sql .= ", @table_owner = " . $this->quoteIdentifier($schemaName, true);
}
-
+
$stmt = $this->query($sql);
$primaryKeysResult = $stmt->fetchAll(Zend_Db::FETCH_NUM);
$primaryKeyColumn = array();
@@ -319,14 +319,14 @@ class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract
$count = intval($count);
if ($count <= 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
}
$offset = intval($offset);
if ($offset < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
@@ -335,46 +335,46 @@ class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract
'SELECT $1TOP ' . ($count+$offset) . ' ',
$sql
);
-
+
if ($offset > 0) {
- $orderby = stristr($sql, 'ORDER BY');
-
- if ($orderby !== false) {
- $orderParts = explode(',', substr($orderby, 8));
- $pregReplaceCount = null;
- $orderbyInverseParts = array();
- foreach ($orderParts as $orderPart) {
- $orderPart = rtrim($orderPart);
- $inv = preg_replace('/\s+desc$/i', ' ASC', $orderPart, 1, $pregReplaceCount);
- if ($pregReplaceCount) {
- $orderbyInverseParts[] = $inv;
- continue;
- }
- $inv = preg_replace('/\s+asc$/i', ' DESC', $orderPart, 1, $pregReplaceCount);
- if ($pregReplaceCount) {
- $orderbyInverseParts[] = $inv;
- continue;
- } else {
- $orderbyInverseParts[] = $orderPart . ' DESC';
- }
- }
-
- $orderbyInverse = 'ORDER BY ' . implode(', ', $orderbyInverseParts);
- }
-
-
-
-
- $sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl';
- if ($orderby !== false) {
- $sql .= ' ' . $orderbyInverse . ' ';
- }
- $sql .= ') AS outer_tbl';
- if ($orderby !== false) {
- $sql .= ' ' . $orderby;
- }
+ $orderby = stristr($sql, 'ORDER BY');
+
+ if ($orderby !== false) {
+ $orderParts = explode(',', substr($orderby, 8));
+ $pregReplaceCount = null;
+ $orderbyInverseParts = array();
+ foreach ($orderParts as $orderPart) {
+ $orderPart = rtrim($orderPart);
+ $inv = preg_replace('/\s+desc$/i', ' ASC', $orderPart, 1, $pregReplaceCount);
+ if ($pregReplaceCount) {
+ $orderbyInverseParts[] = $inv;
+ continue;
+ }
+ $inv = preg_replace('/\s+asc$/i', ' DESC', $orderPart, 1, $pregReplaceCount);
+ if ($pregReplaceCount) {
+ $orderbyInverseParts[] = $inv;
+ continue;
+ } else {
+ $orderbyInverseParts[] = $orderPart . ' DESC';
+ }
+ }
+
+ $orderbyInverse = 'ORDER BY ' . implode(', ', $orderbyInverseParts);
+ }
+
+
+
+
+ $sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl';
+ if ($orderby !== false) {
+ $sql .= ' ' . $orderbyInverse . ' ';
+ }
+ $sql .= ') AS outer_tbl';
+ if ($orderby !== false) {
+ $sql .= ' ' . $orderby;
+ }
}
-
+
return $sql;
}
diff --git a/libs/Zend/Db/Adapter/Pdo/Mysql.php b/libs/Zend/Db/Adapter/Pdo/Mysql.php
index 98551812cc..0e4d794922 100644
--- a/libs/Zend/Db/Adapter/Pdo/Mysql.php
+++ b/libs/Zend/Db/Adapter/Pdo/Mysql.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mysql.php 16942 2009-07-22 04:03:09Z ralph $
+ * @version $Id: Mysql.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Pdo_Abstract
*/
-require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
+// require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Abstract
@@ -235,14 +235,14 @@ class Zend_Db_Adapter_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Abstract
$count = intval($count);
if ($count <= 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
}
$offset = intval($offset);
if ($offset < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
diff --git a/libs/Zend/Db/Adapter/Pdo/Oci.php b/libs/Zend/Db/Adapter/Pdo/Oci.php
index 91ce3ac370..fb47ad1c0b 100644
--- a/libs/Zend/Db/Adapter/Pdo/Oci.php
+++ b/libs/Zend/Db/Adapter/Pdo/Oci.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Oci.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Oci.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Pdo_Abstract
*/
-require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
+// require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Pdo_Oci extends Zend_Db_Adapter_Pdo_Abstract
@@ -186,7 +186,7 @@ class Zend_Db_Adapter_Pdo_Oci extends Zend_Db_Adapter_Pdo_Abstract
TC.DATA_SCALE, TC.DATA_PRECISION, C.CONSTRAINT_TYPE, CC.POSITION
FROM ALL_TAB_COLUMNS TC
LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C
- ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND C.CONSTRAINT_TYPE = 'P'))
+ ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND CC.OWNER = C.OWNER AND C.CONSTRAINT_TYPE = 'P'))
ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME
WHERE UPPER(TC.TABLE_NAME) = UPPER(:TBNAME)";
$bind[':TBNAME'] = $tableName;
@@ -347,14 +347,14 @@ class Zend_Db_Adapter_Pdo_Oci extends Zend_Db_Adapter_Pdo_Abstract
$count = intval($count);
if ($count <= 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
}
$offset = intval($offset);
if ($offset < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
diff --git a/libs/Zend/Db/Adapter/Pdo/Pgsql.php b/libs/Zend/Db/Adapter/Pdo/Pgsql.php
index 0c1d0ca2e8..bec14b569b 100644
--- a/libs/Zend/Db/Adapter/Pdo/Pgsql.php
+++ b/libs/Zend/Db/Adapter/Pdo/Pgsql.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Pgsql.php 18646 2009-10-18 13:16:21Z mikaelkael $
+ * @version $Id: Pgsql.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Pdo_Abstract
*/
-require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
+// require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
@@ -195,15 +195,15 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
$desc = array();
foreach ($result as $key => $row) {
$defaultValue = $row[$default_value];
- if ($row[$type] == 'varchar') {
- if (preg_match('/character varying(?:\((\d+)\))?/', $row[$complete_type], $matches)) {
+ if ($row[$type] == 'varchar' || $row[$type] == 'bpchar' ) {
+ if (preg_match('/character(?: varying)?(?:\((\d+)\))?/', $row[$complete_type], $matches)) {
if (isset($matches[1])) {
$row[$length] = $matches[1];
} else {
$row[$length] = null; // unlimited
}
}
- if (preg_match("/^'(.*?)'::character varying$/", $defaultValue, $matches)) {
+ if (preg_match("/^'(.*?)'::(?:character varying|bpchar)$/", $defaultValue, $matches)) {
$defaultValue = $matches[1];
}
}
@@ -249,7 +249,7 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
}
@@ -258,7 +258,7 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
diff --git a/libs/Zend/Db/Adapter/Pdo/Sqlite.php b/libs/Zend/Db/Adapter/Pdo/Sqlite.php
index 82687d5a9d..f1e6562ef7 100644
--- a/libs/Zend/Db/Adapter/Pdo/Sqlite.php
+++ b/libs/Zend/Db/Adapter/Pdo/Sqlite.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Sqlite.php 18214 2009-09-18 05:30:19Z ralph $
+ * @version $Id: Sqlite.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Pdo_Abstract
*/
-require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
+// require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Db/Adapter/Pdo/Abstract.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
@@ -106,7 +106,7 @@ class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
// we need at least a dbname
if (! array_key_exists('dbname', $config)) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Configuration array must have a key for 'dbname' that names the database instance");
}
}
@@ -140,7 +140,7 @@ class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
if ($retval === false) {
$error = $this->_connection->errorInfo();
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($error[2]);
}
@@ -148,7 +148,7 @@ class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
if ($retval === false) {
$error = $this->_connection->errorInfo();
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($error[2]);
}
}
@@ -198,11 +198,11 @@ class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
public function describeTable($tableName, $schemaName = null)
{
$sql = 'PRAGMA ';
-
+
if ($schemaName) {
$sql .= $this->quoteIdentifier($schemaName) . '.';
}
-
+
$sql .= 'table_info('.$this->quoteIdentifier($tableName).')';
$stmt = $this->query($sql);
@@ -275,14 +275,14 @@ class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
$count = intval($count);
if ($count <= 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
}
$offset = intval($offset);
if ($offset < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
diff --git a/libs/Zend/Db/Adapter/Sqlsrv.php b/libs/Zend/Db/Adapter/Sqlsrv.php
index 3de2500ea1..533523759e 100644
--- a/libs/Zend/Db/Adapter/Sqlsrv.php
+++ b/libs/Zend/Db/Adapter/Sqlsrv.php
@@ -15,25 +15,26 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Sqlsrv.php 21197 2010-02-24 16:12:53Z rob $
*/
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Adapter/Abstract.php';
+// require_once 'Zend/Db/Adapter/Abstract.php';
/**
* @see Zend_Db_Statement_Sqlsrv
*/
-require_once 'Zend/Db/Statement/Sqlsrv.php';
+// require_once 'Zend/Db/Statement/Sqlsrv.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
@@ -120,7 +121,7 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Sqlsrv_Exception
*/
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception('The Sqlsrv extension is required for this adapter but the extension is not loaded');
}
@@ -147,11 +148,11 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
foreach ($this->_config['driver_options'] as $option => $value) {
// A value may be a constant.
if (is_string($value)) {
- $constantValue = @constant(strtoupper($value));
- if ($constantValue === null) {
- $connectionInfo[$option] = $value;
+ $constantName = strtoupper($value);
+ if (defined($constantName)) {
+ $connectionInfo[$option] = constant($constantName);
} else {
- $connectionInfo[$option] = $constantValue;
+ $connectionInfo[$option] = $value;
}
}
}
@@ -163,7 +164,7 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Sqlsrv_Exception
*/
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception(sqlsrv_errors());
}
}
@@ -180,7 +181,7 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
// we need at least a dbname
if (! array_key_exists('dbname', $config)) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Configuration array must have a key for 'dbname' that names the database instance");
}
@@ -188,7 +189,7 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Configuration array must have a key for 'password' for login credentials.
If Windows Authentication is desired, both keys 'username' and 'password' should be ommited from config.");
}
@@ -197,7 +198,7 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
/**
* @see Zend_Db_Adapter_Exception
*/
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("Configuration array must have a key for 'username' for login credentials.
If Windows Authentication is desired, both keys 'username' and 'password' should be ommited from config.");
}
@@ -238,12 +239,12 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
$sql = "SERIALIZABLE";
break;
default:
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception("Invalid transaction isolation level mode '$level' specified");
}
if (!sqlsrv_query($this->_connection, "SET TRANSACTION ISOLATION LEVEL $sql;")) {
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception("Transaction cannot be changed to '$level'");
}
@@ -286,13 +287,13 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
$this->_connect();
$stmtClass = $this->_defaultStmtClass;
- if (!class_exists($stmtClass)) {
+ // if (!class_exists($stmtClass)) {
/**
* @see Zend_Loader
*/
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($stmtClass);
- }
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($stmtClass);
+ // }
$stmt = new $stmtClass($this, $sql);
$stmt->setFetchMode($this->_fetchMode);
@@ -518,7 +519,7 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
protected function _beginTransaction()
{
if (!sqlsrv_begin_transaction($this->_connection)) {
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception(sqlsrv_errors());
}
}
@@ -532,7 +533,7 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
protected function _commit()
{
if (!sqlsrv_commit($this->_connection)) {
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception(sqlsrv_errors());
}
}
@@ -546,7 +547,7 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
protected function _rollBack()
{
if (!sqlsrv_rollback($this->_connection)) {
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception(sqlsrv_errors());
}
}
@@ -570,11 +571,11 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
$this->_fetchMode = $mode;
break;
case Zend_Db::FETCH_BOUND: // bound to PHP variable
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception('FETCH_BOUND is not supported yet');
break;
default:
- require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Adapter/Sqlsrv/Exception.php';
throw new Zend_Db_Adapter_Sqlsrv_Exception("Invalid fetch mode '$mode' specified");
break;
}
@@ -593,34 +594,40 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
{
$count = intval($count);
if ($count <= 0) {
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
}
$offset = intval($offset);
if ($offset < 0) {
/** @see Zend_Db_Adapter_Exception */
- require_once 'Zend/Db/Adapter/Exception.php';
+ // require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
- $orderby = stristr($sql, 'ORDER BY');
- if ($orderby !== false) {
- $sort = (stripos($orderby, ' desc') !== false) ? 'desc' : 'asc';
- $order = str_ireplace('ORDER BY', '', $orderby);
- $order = trim(preg_replace('/\bASC\b|\bDESC\b/i', '', $order));
- }
-
- $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . ($count+$offset) . ' ', $sql);
-
- $sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl';
- if ($orderby !== false) {
- $sql .= ' ORDER BY ' . $order . ' ';
- $sql .= (stripos($sort, 'asc') !== false) ? 'DESC' : 'ASC';
- }
- $sql .= ') AS outer_tbl';
- if ($orderby !== false) {
- $sql .= ' ORDER BY ' . $order . ' ' . $sort;
+ if ($offset == 0) {
+ $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . $count . ' ', $sql);
+ } else {
+ $orderby = stristr($sql, 'ORDER BY');
+ if ($orderby !== false) {
+ $sort = (stripos($orderby, ' desc') !== false) ? 'desc' : 'asc';
+ $order = str_ireplace('ORDER BY', '', $orderby);
+ $order = trim(preg_replace('/\bASC\b|\bDESC\b/i', '', $order));
+ }
+
+ $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . ($count+$offset) . ' ', $sql);
+
+ $sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl';
+ if ($orderby !== false) {
+ $innerOrder = preg_replace('/\".*\".\"(.*)\"/i', '"inner_tbl"."$1"', $order);
+ $sql .= ' ORDER BY ' . $innerOrder . ' ';
+ $sql .= (stripos($sort, 'asc') !== false) ? 'DESC' : 'ASC';
+ }
+ $sql .= ') AS outer_tbl';
+ if ($orderby !== false) {
+ $outerOrder = preg_replace('/\".*\".\"(.*)\"/i', '"outer_tbl"."$1"', $order);
+ $sql .= ' ORDER BY ' . $outerOrder . ' ' . $sort;
+ }
}
return $sql;
diff --git a/libs/Zend/Db/Adapter/Sqlsrv/Exception.php b/libs/Zend/Db/Adapter/Sqlsrv/Exception.php
index a07b3eb9a3..1f68aa9c56 100644
--- a/libs/Zend/Db/Adapter/Sqlsrv/Exception.php
+++ b/libs/Zend/Db/Adapter/Sqlsrv/Exception.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- *
+ * @version $Id: Exception.php 20629 2010-01-25 21:17:23Z ralph $
*/
/**
* @see Zend_Db_Adapter_Exception
*/
-require_once 'Zend/Db/Adapter/Exception.php';
+// require_once 'Zend/Db/Adapter/Exception.php';
/**
* Zend_Db_Adapter_Sqlsrv_Exception
@@ -31,7 +31,7 @@ require_once 'Zend/Db/Adapter/Exception.php';
* @category Zend
* @package Zend_Db
* @subpackage Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Adapter_Sqlsrv_Exception extends Zend_Db_Adapter_Exception
@@ -58,6 +58,6 @@ class Zend_Db_Adapter_Sqlsrv_Exception extends Zend_Db_Adapter_Exception
$code = (int) $message['code'];
$message = (string) $message['message'];
}
- parent::__construct($message, new Exception($message, $code));
+ parent::__construct($message, $code, new Exception($message, $code));
}
}
diff --git a/libs/Zend/Db/Exception.php b/libs/Zend/Db/Exception.php
index 3d30302674..43e374b1b0 100644
--- a/libs/Zend/Db/Exception.php
+++ b/libs/Zend/Db/Exception.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Db
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Db
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Exception extends Zend_Exception
diff --git a/libs/Zend/Db/Expr.php b/libs/Zend/Db/Expr.php
index 2f2b7d51db..df366b3b2a 100644
--- a/libs/Zend/Db/Expr.php
+++ b/libs/Zend/Db/Expr.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Db
* @subpackage Expr
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Expr.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Expr.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -43,7 +43,7 @@
* @category Zend
* @package Zend_Db
* @subpackage Expr
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Expr
diff --git a/libs/Zend/Db/Profiler.php b/libs/Zend/Db/Profiler.php
index d0b2af5f1a..9d695b877d 100644
--- a/libs/Zend/Db/Profiler.php
+++ b/libs/Zend/Db/Profiler.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Db
* @subpackage Profiler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Profiler.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Profiler.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Db
* @subpackage Profiler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Profiler
@@ -68,6 +68,15 @@ class Zend_Db_Profiler
*/
const TRANSACTION = 64;
+ /**
+ * Inform that a query is stored (in case of filtering)
+ */
+ const STORED = 'stored';
+
+ /**
+ * Inform that a query is ignored (in case of filtering)
+ */
+ const IGNORED = 'ignored';
/**
* Array of Zend_Db_Profiler_Query objects.
@@ -269,7 +278,7 @@ class Zend_Db_Profiler
/**
* @see Zend_Db_Profiler_Query
*/
- require_once 'Zend/Db/Profiler/Query.php';
+ // require_once 'Zend/Db/Profiler/Query.php';
$this->_queryProfiles[] = new Zend_Db_Profiler_Query($queryText, $queryType);
end($this->_queryProfiles);
@@ -289,7 +298,7 @@ class Zend_Db_Profiler
{
// Don't do anything if the Zend_Db_Profiler is not enabled.
if (!$this->_enabled) {
- return;
+ return self::IGNORED;
}
// Check for a valid query handle.
@@ -297,7 +306,7 @@ class Zend_Db_Profiler
/**
* @see Zend_Db_Profiler_Exception
*/
- require_once 'Zend/Db/Profiler/Exception.php';
+ // require_once 'Zend/Db/Profiler/Exception.php';
throw new Zend_Db_Profiler_Exception("Profiler has no query with handle '$queryId'.");
}
@@ -308,7 +317,7 @@ class Zend_Db_Profiler
/**
* @see Zend_Db_Profiler_Exception
*/
- require_once 'Zend/Db/Profiler/Exception.php';
+ // require_once 'Zend/Db/Profiler/Exception.php';
throw new Zend_Db_Profiler_Exception("Query with profiler handle '$queryId' has already ended.");
}
@@ -321,7 +330,7 @@ class Zend_Db_Profiler
*/
if (null !== $this->_filterElapsedSecs && $qp->getElapsedSecs() < $this->_filterElapsedSecs) {
unset($this->_queryProfiles[$queryId]);
- return;
+ return self::IGNORED;
}
/**
@@ -330,8 +339,10 @@ class Zend_Db_Profiler
*/
if (null !== $this->_filterTypes && !($qp->getQueryType() & $this->_filterTypes)) {
unset($this->_queryProfiles[$queryId]);
- return;
+ return self::IGNORED;
}
+
+ return self::STORED;
}
/**
@@ -348,7 +359,7 @@ class Zend_Db_Profiler
/**
* @see Zend_Db_Profiler_Exception
*/
- require_once 'Zend/Db/Profiler/Exception.php';
+ // require_once 'Zend/Db/Profiler/Exception.php';
throw new Zend_Db_Profiler_Exception("Query handle '$queryId' not found in profiler log.");
}
diff --git a/libs/Zend/Db/Profiler/Exception.php b/libs/Zend/Db/Profiler/Exception.php
index 3494622c2d..6caab626f7 100644
--- a/libs/Zend/Db/Profiler/Exception.php
+++ b/libs/Zend/Db/Profiler/Exception.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Db
* @subpackage Profiler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Exception
*/
-require_once 'Zend/Db/Exception.php';
+// require_once 'Zend/Db/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Profiler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Profiler_Exception extends Zend_Db_Exception
diff --git a/libs/Zend/Db/Profiler/Firebug.php b/libs/Zend/Db/Profiler/Firebug.php
index 35a4ebd7b9..0ffaf142be 100644
--- a/libs/Zend/Db/Profiler/Firebug.php
+++ b/libs/Zend/Db/Profiler/Firebug.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Db
* @subpackage Profiler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Firebug.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Db_Profiler */
-require_once 'Zend/Db/Profiler.php';
+// require_once 'Zend/Db/Profiler.php';
/** Zend_Wildfire_Plugin_FirePhp */
-require_once 'Zend/Wildfire/Plugin/FirePhp.php';
+// require_once 'Zend/Wildfire/Plugin/FirePhp.php';
/** Zend_Wildfire_Plugin_FirePhp_TableMessage */
-require_once 'Zend/Wildfire/Plugin/FirePhp/TableMessage.php';
+// require_once 'Zend/Wildfire/Plugin/FirePhp/TableMessage.php';
/**
* Writes DB events as log messages to the Firebug Console via FirePHP.
- *
+ *
* @category Zend
* @package Zend_Db
* @subpackage Profiler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Profiler_Firebug extends Zend_Db_Profiler
@@ -45,25 +45,25 @@ class Zend_Db_Profiler_Firebug extends Zend_Db_Profiler
* @var string
*/
protected $_label = null;
-
+
/**
* The label template for this profiler
* @var string
*/
protected $_label_template = '%label% (%totalCount% @ %totalDuration% sec)';
-
+
/**
* The message envelope holding the profiling summary
* @var Zend_Wildfire_Plugin_FirePhp_TableMessage
*/
protected $_message = null;
-
+
/**
* The total time taken for all profiled queries.
* @var float
*/
protected $_totalElapsedTime = 0;
-
+
/**
* Constructor
*
@@ -90,7 +90,7 @@ class Zend_Db_Profiler_Firebug extends Zend_Db_Profiler
parent::setEnabled($enable);
if ($this->getEnabled()) {
-
+
if (!$this->_message) {
$this->_message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_label);
$this->_message->setBuffered(true);
@@ -106,7 +106,7 @@ class Zend_Db_Profiler_Firebug extends Zend_Db_Profiler
$this->_message->setDestroy(true);
$this->_message = null;
}
-
+
}
return $this;
@@ -121,28 +121,28 @@ class Zend_Db_Profiler_Firebug extends Zend_Db_Profiler
*/
public function queryEnd($queryId)
{
- parent::queryEnd($queryId);
-
- if (!$this->getEnabled()) {
+ $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()
diff --git a/libs/Zend/Db/Profiler/Query.php b/libs/Zend/Db/Profiler/Query.php
index 74f3fe1aec..aacc16fbb9 100644
--- a/libs/Zend/Db/Profiler/Query.php
+++ b/libs/Zend/Db/Profiler/Query.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Db
* @subpackage Profiler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Query.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Query.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Db
* @subpackage Profiler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Profiler_Query
diff --git a/libs/Zend/Db/Select.php b/libs/Zend/Db/Select.php
index c8f1c77607..721f3ec859 100644
--- a/libs/Zend/Db/Select.php
+++ b/libs/Zend/Db/Select.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Db
* @subpackage Select
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Select.php 18511 2009-10-12 14:33:35Z ralph $
+ * @version $Id: Select.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Adapter/Abstract.php';
+// require_once 'Zend/Db/Adapter/Abstract.php';
/**
* @see Zend_Db_Expr
*/
-require_once 'Zend/Db/Expr.php';
+// require_once 'Zend/Db/Expr.php';
/**
@@ -38,7 +38,7 @@ require_once 'Zend/Db/Expr.php';
* @category Zend
* @package Zend_Db
* @subpackage Select
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Select
@@ -173,7 +173,7 @@ class Zend_Db_Select
*/
public function getBind()
{
- return $this->_bind;
+ return $this->_bind;
}
/**
@@ -184,9 +184,9 @@ class Zend_Db_Select
*/
public function bind($bind)
{
- $this->_bind = $bind;
+ $this->_bind = $bind;
- return $this;
+ return $this;
}
/**
@@ -243,14 +243,15 @@ class Zend_Db_Select
public function columns($cols = '*', $correlationName = null)
{
if ($correlationName === null && count($this->_parts[self::FROM])) {
- $correlationName = current(array_keys($this->_parts[self::FROM]));
+ $correlationNameKeys = array_keys($this->_parts[self::FROM]);
+ $correlationName = current($correlationNameKeys);
}
if (!array_key_exists($correlationName, $this->_parts[self::FROM])) {
/**
* @see Zend_Db_Select_Exception
*/
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("No table has been specified for the FROM clause");
}
@@ -262,20 +263,31 @@ class Zend_Db_Select
/**
* Adds a UNION clause to the query.
*
- * The first parameter $select can be a string, an existing Zend_Db_Select
- * object or an array of either of these types.
+ * The first parameter has to be an array of Zend_Db_Select or
+ * sql query strings.
*
- * @param array|string|Zend_Db_Select $select One or more select clauses for the UNION.
+ * <code>
+ * $sql1 = $db->select();
+ * $sql2 = "SELECT ...";
+ * $select = $db->select()
+ * ->union(array($sql1, $sql2))
+ * ->order("id");
+ * </code>
+ *
+ * @param array $select Array of select clauses for the union.
* @return Zend_Db_Select This Zend_Db_Select object.
*/
public function union($select = array(), $type = self::SQL_UNION)
{
if (!is_array($select)) {
- $select = array();
+ // require_once 'Zend/Db/Select/Exception.php';
+ throw new Zend_Db_Select_Exception(
+ "union() only accepts an array of Zend_Db_Select instances of sql query strings."
+ );
}
if (!in_array($type, self::$_unionTypes)) {
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Invalid union type '{$type}'");
}
@@ -454,7 +466,7 @@ class Zend_Db_Select
* </code>
*
* @param string $cond The WHERE condition.
- * @param string $value OPTIONAL A single value to quote into the condition.
+ * @param mixed $value OPTIONAL The value to quote into the condition.
* @param constant $type OPTIONAL The type of the given value
* @return Zend_Db_Select This Zend_Db_Select object.
*/
@@ -471,7 +483,7 @@ class Zend_Db_Select
* Otherwise identical to where().
*
* @param string $cond The WHERE condition.
- * @param string $value OPTIONAL A single value to quote into the condition.
+ * @param mixed $value OPTIONAL The value to quote into the condition.
* @param constant $type OPTIONAL The type of the given value
* @return Zend_Db_Select This Zend_Db_Select object.
*
@@ -514,7 +526,7 @@ class Zend_Db_Select
* appears. See {@link where()} for an example
*
* @param string $cond The HAVING condition.
- * @param string|Zend_Db_Expr $val A single value to quote into the condition.
+ * @param string|Zend_Db_Expr $val The value to quote into the condition.
* @return Zend_Db_Select This Zend_Db_Select object.
*/
public function having($cond)
@@ -539,7 +551,7 @@ class Zend_Db_Select
* Otherwise identical to orHaving().
*
* @param string $cond The HAVING condition.
- * @param string $val A single value to quote into the condition.
+ * @param mixed $val The value to quote into the condition.
* @return Zend_Db_Select This Zend_Db_Select object.
*
* @see having()
@@ -652,7 +664,7 @@ class Zend_Db_Select
{
$part = strtolower($part);
if (!array_key_exists($part, $this->_parts)) {
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Invalid Select part '$part'");
}
return $this->_parts[$part];
@@ -745,12 +757,12 @@ class Zend_Db_Select
/**
* @see Zend_Db_Select_Exception
*/
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Invalid join type '$type'");
}
if (count($this->_parts[self::UNION])) {
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Invalid use of table with " . self::SQL_UNION);
}
@@ -786,16 +798,16 @@ class Zend_Db_Select
list($schema, $tableName) = explode('.', $tableName);
}
+ $lastFromCorrelationName = null;
if (!empty($correlationName)) {
if (array_key_exists($correlationName, $this->_parts[self::FROM])) {
/**
* @see Zend_Db_Select_Exception
*/
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("You cannot define a correlation name '$correlationName' more than once");
}
-
- $lastFromCorrelationName = null;
+
if ($type == self::FROM) {
// append this from after the last from joinType
$tmpFromParts = $this->_parts[self::FROM];
@@ -827,7 +839,7 @@ class Zend_Db_Select
// add to the columns from this joined table
if ($type == self::FROM && $lastFromCorrelationName == null) {
$lastFromCorrelationName = true;
- }
+ }
$this->_tableCols($correlationName, $cols, $lastFromCorrelationName);
return $this;
@@ -861,7 +873,7 @@ class Zend_Db_Select
public function _joinUsing($type, $name, $cond, $cols = '*', $schema = null)
{
if (empty($this->_parts[self::FROM])) {
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("You can only perform a joinUsing after specifying a FROM table");
}
@@ -945,7 +957,7 @@ class Zend_Db_Select
} else {
$tmpColumns = array();
}
-
+
// find the correlation name to insert after
if (is_string($afterCorrelationName)) {
while ($tmpColumns) {
@@ -960,7 +972,7 @@ class Zend_Db_Select
foreach ($columnValues as $columnValue) {
array_push($this->_parts[self::COLUMNS], $columnValue);
}
-
+
// finish ensuring that all previous values are applied (if they exist)
while ($tmpColumns) {
array_push($this->_parts[self::COLUMNS], array_shift($tmpColumns));
@@ -972,7 +984,7 @@ class Zend_Db_Select
* Internal function for creating the where clause
*
* @param string $condition
- * @param string $value optional
+ * @param mixed $value optional
* @param string $type optional
* @param boolean $bool true = AND, false = OR
* @return string clause
@@ -980,7 +992,7 @@ class Zend_Db_Select
protected function _where($condition, $value = null, $type = null, $bool = true)
{
if (count($this->_parts[self::UNION])) {
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Invalid use of where clause with " . self::SQL_UNION);
}
@@ -1104,7 +1116,7 @@ class Zend_Db_Select
$tmp = '';
$joinType = ($table['joinType'] == self::FROM) ? self::INNER_JOIN : $table['joinType'];
-
+
// Add join clause (if applicable)
if (! empty($from)) {
$tmp .= ' ' . strtoupper($joinType) . ' ';
@@ -1246,8 +1258,7 @@ class Zend_Db_Select
if (!empty($this->_parts[self::LIMIT_OFFSET])) {
$offset = (int) $this->_parts[self::LIMIT_OFFSET];
- // This should reduce to the max integer PHP can support
- $count = intval(9223372036854775807);
+ $count = PHP_INT_MAX;
}
if (!empty($this->_parts[self::LIMIT_COUNT])) {
@@ -1303,11 +1314,11 @@ class Zend_Db_Select
if ($type) {
$type .= ' join';
if (!in_array($type, self::$_joinTypes)) {
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Unrecognized method '$method()'");
}
if (in_array($type, array(self::CROSS_JOIN, self::NATURAL_JOIN))) {
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Cannot perform a joinUsing with method '$method()'");
}
} else {
@@ -1317,7 +1328,7 @@ class Zend_Db_Select
return call_user_func_array(array($this, '_joinUsing'), $args);
}
- require_once 'Zend/Db/Select/Exception.php';
+ // require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Unrecognized method '$method()'");
}
diff --git a/libs/Zend/Db/Select/Exception.php b/libs/Zend/Db/Select/Exception.php
index 23fdf2dfec..dc02cb40ab 100644
--- a/libs/Zend/Db/Select/Exception.php
+++ b/libs/Zend/Db/Select/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Db
* @subpackage Select
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Exception
*/
-require_once 'Zend/Db/Exception.php';
+// require_once 'Zend/Db/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Select
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
diff --git a/libs/Zend/Db/Statement.php b/libs/Zend/Db/Statement.php
index 7dada0964a..df99fa0133 100644
--- a/libs/Zend/Db/Statement.php
+++ b/libs/Zend/Db/Statement.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Statement.php 17858 2009-08-27 22:04:38Z ralph $
+ * @version $Id: Statement.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db
*/
-require_once 'Zend/Db.php';
+// require_once 'Zend/Db.php';
/**
* @see Zend_Db_Statement_Interface
*/
-require_once 'Zend/Db/Statement/Interface.php';
+// require_once 'Zend/Db/Statement/Interface.php';
/**
* Abstract class to emulate a PDOStatement for native database adapters.
@@ -36,7 +36,7 @@ require_once 'Zend/Db/Statement/Interface.php';
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
@@ -46,7 +46,7 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
* @var resource|object The driver level statement object/resource
*/
protected $_stmt = null;
-
+
/**
* @var Zend_Db_Adapter_Abstract
*/
@@ -120,14 +120,14 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
/**
* Internal method called by abstract statment constructor to setup
* the driver level statement
- *
+ *
* @return void
*/
protected function _prepare($sql)
{
return;
}
-
+
/**
* @param string $sql
* @return void
@@ -148,7 +148,7 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
/**
* @see Zend_Db_Statement_Exception
*/
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception("Invalid bind-variable position '$val'");
}
} else if ($val[0] == ':') {
@@ -156,7 +156,7 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
/**
* @see Zend_Db_Statement_Exception
*/
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception("Invalid bind-variable name '$val'");
}
}
@@ -241,7 +241,7 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
/**
* @see Zend_Db_Statement_Exception
*/
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception('Invalid bind-variable position');
}
@@ -263,7 +263,7 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
/**
* @see Zend_Db_Statement_Exception
*/
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception("Invalid bind-variable position '$parameter'");
}
@@ -433,7 +433,7 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
/**
* @see Zend_Db_Statement_Exception
*/
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception('invalid fetch mode');
break;
}
@@ -472,9 +472,9 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
{
return $this->_adapter;
}
-
+
/**
- * Gets the resource or object setup by the
+ * Gets the resource or object setup by the
* _parse
* @return unknown_type
*/
diff --git a/libs/Zend/Db/Statement/Db2.php b/libs/Zend/Db/Statement/Db2.php
index c2dac3a646..729d65c61a 100644
--- a/libs/Zend/Db/Statement/Db2.php
+++ b/libs/Zend/Db/Statement/Db2.php
@@ -15,22 +15,22 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Db2.php 17857 2009-08-27 22:01:47Z ralph $
+ * @version $Id: Db2.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Statement
*/
-require_once 'Zend/Db/Statement.php';
+// require_once 'Zend/Db/Statement.php';
/**
* Extends for DB2 native adapter.
*
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Db2 extends Zend_Db_Statement
@@ -65,7 +65,7 @@ class Zend_Db_Statement_Db2 extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Db2_Exception
*/
- require_once 'Zend/Db/Statement/Db2/Exception.php';
+ // require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception(
db2_stmt_errormsg(),
db2_stmt_error()
@@ -100,7 +100,7 @@ class Zend_Db_Statement_Db2 extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Db2_Exception
*/
- require_once 'Zend/Db/Statement/Db2/Exception.php';
+ // require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception(
db2_stmt_errormsg(),
db2_stmt_error()
@@ -154,7 +154,7 @@ class Zend_Db_Statement_Db2 extends Zend_Db_Statement
$error = db2_stmt_error();
if ($error === '') {
- return false;
+ return false;
}
return $error;
@@ -168,10 +168,10 @@ class Zend_Db_Statement_Db2 extends Zend_Db_Statement
*/
public function errorInfo()
{
- $error = $this->errorCode();
- if ($error === false){
- return false;
- }
+ $error = $this->errorCode();
+ if ($error === false){
+ return false;
+ }
/*
* Return three-valued array like PDO. But DB2 does not distinguish
@@ -208,7 +208,7 @@ class Zend_Db_Statement_Db2 extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Db2_Exception
*/
- require_once 'Zend/Db/Statement/Db2/Exception.php';
+ // require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception(
db2_stmt_errormsg(),
db2_stmt_error());
@@ -272,7 +272,7 @@ class Zend_Db_Statement_Db2 extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Db2_Exception
*/
- require_once 'Zend/Db/Statement/Db2/Exception.php';
+ // require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception("Invalid fetch mode '$style' specified");
break;
}
@@ -306,7 +306,7 @@ class Zend_Db_Statement_Db2 extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Db2_Exception
*/
- require_once 'Zend/Db/Statement/Db2/Exception.php';
+ // require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception(__FUNCTION__ . '() is not implemented');
}
diff --git a/libs/Zend/Db/Statement/Db2/Exception.php b/libs/Zend/Db/Statement/Db2/Exception.php
index 0b04bf4af2..d77b5d830c 100644
--- a/libs/Zend/Db/Statement/Db2/Exception.php
+++ b/libs/Zend/Db/Statement/Db2/Exception.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Statement_Exception
*/
-require_once 'Zend/Db/Statement/Exception.php';
+// require_once 'Zend/Db/Statement/Exception.php';
/**
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
diff --git a/libs/Zend/Db/Statement/Exception.php b/libs/Zend/Db/Statement/Exception.php
index 7c9d58992a..511888a5e3 100644
--- a/libs/Zend/Db/Statement/Exception.php
+++ b/libs/Zend/Db/Statement/Exception.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 17860 2009-08-27 22:48:48Z beberlei $
+ * @version $Id: Exception.php 20514 2010-01-22 07:57:10Z ralph $
*/
/**
* @see Zend_Db_Exception
*/
-require_once 'Zend/Db/Exception.php';
+// require_once 'Zend/Db/Exception.php';
/**
* Zend_Db_Statement_Exception
@@ -31,36 +31,19 @@ require_once 'Zend/Db/Exception.php';
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Exception extends Zend_Db_Exception
{
/**
- * @var Exception
- */
- protected $_chainedException = null;
-
- /**
- * @param string $message
- * @param string|int $code
- * @param Exception $chainedException
- */
- public function __construct($message = null, $code = null, Exception $chainedException=null)
- {
- $this->message = $message;
- $this->code = $code;
- $this->_chainedException = $chainedException;
- }
-
- /**
* Check if this general exception has a specific database driver specific exception nested inside.
- *
+ *
* @return bool
*/
public function hasChainedException()
{
- return ($this->_chainedException!==null);
+ return ($this->getPrevious() !== null);
}
/**
@@ -68,6 +51,6 @@ class Zend_Db_Statement_Exception extends Zend_Db_Exception
*/
public function getChainedException()
{
- return $this->_chainedException;
+ return $this->getPrevious();
}
}
diff --git a/libs/Zend/Db/Statement/Interface.php b/libs/Zend/Db/Statement/Interface.php
index 2cf951b057..701c64010e 100644
--- a/libs/Zend/Db/Statement/Interface.php
+++ b/libs/Zend/Db/Statement/Interface.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
@@ -26,7 +26,7 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Db_Statement_Interface
diff --git a/libs/Zend/Db/Statement/Mysqli.php b/libs/Zend/Db/Statement/Mysqli.php
index a1870f13fa..51dba7160f 100644
--- a/libs/Zend/Db/Statement/Mysqli.php
+++ b/libs/Zend/Db/Statement/Mysqli.php
@@ -15,25 +15,25 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mysqli.php 18195 2009-09-17 20:58:05Z bittarman $
+ * @version $Id: Mysqli.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Statement
*/
-require_once 'Zend/Db/Statement.php';
+// require_once 'Zend/Db/Statement.php';
+
-
/**
* Extends for Mysqli
*
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
@@ -73,7 +73,7 @@ class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Mysqli_Exception
*/
- require_once 'Zend/Db/Statement/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
throw new Zend_Db_Statement_Mysqli_Exception("Mysqli prepare error: " . $mysqli->error, $mysqli->errno);
}
}
@@ -210,7 +210,7 @@ class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Mysqli_Exception
*/
- require_once 'Zend/Db/Statement/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement execute error : " . $this->_stmt->error, $this->_stmt->errno);
}
@@ -222,7 +222,7 @@ class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Mysqli_Exception
*/
- require_once 'Zend/Db/Statement/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement metadata error: " . $this->_stmt->error, $this->_stmt->errno);
}
}
@@ -275,12 +275,12 @@ class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
// fetch the next result
$retval = $this->_stmt->fetch();
switch ($retval) {
- case null: // end of data
- case false: // error occurred
- $this->_stmt->reset();
- return false;
- default:
- // fallthrough
+ case null: // end of data
+ case false: // error occurred
+ $this->_stmt->reset();
+ return false;
+ default:
+ // fallthrough
}
// make sure we have a fetch mode
@@ -319,7 +319,7 @@ class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Mysqli_Exception
*/
- require_once 'Zend/Db/Statement/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
throw new Zend_Db_Statement_Mysqli_Exception("Invalid fetch mode '$style' specified");
break;
}
@@ -339,7 +339,7 @@ class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Mysqli_Exception
*/
- require_once 'Zend/Db/Statement/Mysqli/Exception.php';
+ // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
throw new Zend_Db_Statement_Mysqli_Exception(__FUNCTION__.'() is not implemented');
}
diff --git a/libs/Zend/Db/Statement/Mysqli/Exception.php b/libs/Zend/Db/Statement/Mysqli/Exception.php
index a90162db02..4847231476 100644
--- a/libs/Zend/Db/Statement/Mysqli/Exception.php
+++ b/libs/Zend/Db/Statement/Mysqli/Exception.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Statement_Exception
*/
-require_once 'Zend/Db/Statement/Exception.php';
+// require_once 'Zend/Db/Statement/Exception.php';
/**
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
diff --git a/libs/Zend/Db/Statement/Oracle.php b/libs/Zend/Db/Statement/Oracle.php
index 0c8c18a6bd..d84d2bab7f 100644
--- a/libs/Zend/Db/Statement/Oracle.php
+++ b/libs/Zend/Db/Statement/Oracle.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Oracle.php 18636 2009-10-17 05:44:41Z ralph $
+ * @version $Id: Oracle.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Statement
*/
-require_once 'Zend/Db/Statement.php';
+// require_once 'Zend/Db/Statement.php';
/**
* Extends for Oracle.
@@ -31,7 +31,7 @@ require_once 'Zend/Db/Statement.php';
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Oracle extends Zend_Db_Statement
@@ -92,7 +92,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(oci_error($connection));
}
}
@@ -125,7 +125,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
}
@@ -249,7 +249,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
}
}
@@ -259,7 +259,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
}
@@ -323,7 +323,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(
array(
'code' => 'HYC00',
@@ -337,7 +337,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception($error);
}
@@ -374,7 +374,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(
array(
'code' => 'HYC00',
@@ -402,7 +402,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(
array(
'code' => 'HYC00',
@@ -419,7 +419,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception($error);
}
if (!$rows) {
@@ -442,7 +442,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception($error);
}
}
@@ -472,7 +472,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception($error);
}
@@ -481,7 +481,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
}
@@ -516,7 +516,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception($error);
}
@@ -538,7 +538,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Statement_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(
array(
'code' => 'HYC00',
@@ -567,7 +567,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
- require_once 'Zend/Db/Statement/Oracle/Exception.php';
+ // require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
}
diff --git a/libs/Zend/Db/Statement/Oracle/Exception.php b/libs/Zend/Db/Statement/Oracle/Exception.php
index 26f5412eef..d5e21bad3f 100644
--- a/libs/Zend/Db/Statement/Oracle/Exception.php
+++ b/libs/Zend/Db/Statement/Oracle/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Statement_Exception
*/
-require_once 'Zend/Db/Statement/Exception.php';
+// require_once 'Zend/Db/Statement/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
diff --git a/libs/Zend/Db/Statement/Pdo.php b/libs/Zend/Db/Statement/Pdo.php
index c0f6bc5248..b9e9400d28 100644
--- a/libs/Zend/Db/Statement/Pdo.php
+++ b/libs/Zend/Db/Statement/Pdo.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Pdo.php 18079 2009-09-11 17:46:45Z ralph $
+ * @version $Id: Pdo.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Statement
*/
-require_once 'Zend/Db/Statement.php';
+// require_once 'Zend/Db/Statement.php';
/**
* Proxy class to wrap a PDOStatement object.
@@ -34,7 +34,7 @@ require_once 'Zend/Db/Statement.php';
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggregate
@@ -57,7 +57,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
$this->_stmt = $this->_adapter->getConnection()->prepare($sql);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -81,7 +81,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
return $this->_stmt->bindColumn($column, $param, $type);
}
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -113,7 +113,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
}
return $this->_stmt->bindParam($parameter, $variable, $type, $length, $options);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -132,9 +132,9 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
if (is_string($parameter) && $parameter[0] != ':') {
$parameter = ":$parameter";
}
-
+
$this->_bindParam[$parameter] = $value;
-
+
try {
if ($type === null) {
return $this->_stmt->bindValue($parameter, $value);
@@ -142,7 +142,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
return $this->_stmt->bindValue($parameter, $value, $type);
}
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -158,7 +158,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->closeCursor();
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -175,7 +175,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->columnCount();
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -192,7 +192,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->errorCode();
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -209,7 +209,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->errorInfo();
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -230,8 +230,8 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
return $this->_stmt->execute();
}
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
- throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
+ // require_once 'Zend/Db/Statement/Exception.php';
+ throw new Zend_Db_Statement_Exception($e->getMessage(), (int) $e->getCode(), $e);
}
}
@@ -252,7 +252,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->fetch($style, $cursor, $offset);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -290,7 +290,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
return $this->_stmt->fetchAll($style);
}
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -307,7 +307,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->fetchColumn($col);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -325,7 +325,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->fetchObject($class, $config);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -342,7 +342,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->getAttribute($key);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -359,7 +359,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->getColumnMeta($column);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -377,7 +377,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->nextRowset();
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -395,7 +395,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->rowCount();
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -413,7 +413,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->setAttribute($key, $val);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
@@ -431,7 +431,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
try {
return $this->_stmt->setFetchMode($mode);
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
diff --git a/libs/Zend/Db/Statement/Pdo/Ibm.php b/libs/Zend/Db/Statement/Pdo/Ibm.php
index 29ae3db62e..20b6aea7a9 100644
--- a/libs/Zend/Db/Statement/Pdo/Ibm.php
+++ b/libs/Zend/Db/Statement/Pdo/Ibm.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ibm.php 17860 2009-08-27 22:48:48Z beberlei $
+ * @version $Id: Ibm.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Statement_Pdo
*/
-require_once 'Zend/Db/Statement/Pdo.php';
+// require_once 'Zend/Db/Statement/Pdo.php';
/**
* Proxy class to wrap a PDOStatement object for IBM Databases.
@@ -34,7 +34,7 @@ require_once 'Zend/Db/Statement/Pdo.php';
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Pdo_Ibm extends Zend_Db_Statement_Pdo
@@ -86,7 +86,7 @@ class Zend_Db_Statement_Pdo_Ibm extends Zend_Db_Statement_Pdo
return $this->_stmt->bindParam($parameter, $variable, $type, $length, $options);
}
} catch (PDOException $e) {
- require_once 'Zend/Db/Statement/Exception.php';
+ // require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
diff --git a/libs/Zend/Db/Statement/Pdo/Oci.php b/libs/Zend/Db/Statement/Pdo/Oci.php
index e4b1edc638..2306228187 100644
--- a/libs/Zend/Db/Statement/Pdo/Oci.php
+++ b/libs/Zend/Db/Statement/Pdo/Oci.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Oci.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Oci.php 21105 2010-02-19 21:27:09Z mikaelkael $
*/
/**
* @see Zend_Db_Statement_Pdo
*/
-require_once 'Zend/Db/Statement/Pdo.php';
+// require_once 'Zend/Db/Statement/Pdo.php';
/**
* Proxy class to wrap a PDOStatement object for IBM Databases.
@@ -34,7 +34,7 @@ require_once 'Zend/Db/Statement/Pdo.php';
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Pdo_Oci extends Zend_Db_Statement_Pdo
@@ -66,4 +66,26 @@ class Zend_Db_Statement_Pdo_Oci extends Zend_Db_Statement_Pdo
}
return $results;
}
+
+
+ /**
+ * 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)
+ {
+ $row = parent::fetch($style, $cursor, $offset);
+
+ $remove = $this->_adapter->foldCase('zend_db_rownum');
+ if (is_array($row) && array_key_exists($remove, $row)) {
+ unset($row[$remove]);
+ }
+
+ return $row;
+ }
} \ No newline at end of file
diff --git a/libs/Zend/Db/Statement/Sqlsrv.php b/libs/Zend/Db/Statement/Sqlsrv.php
index 45c243edf1..9663c83ccf 100644
--- a/libs/Zend/Db/Statement/Sqlsrv.php
+++ b/libs/Zend/Db/Statement/Sqlsrv.php
@@ -15,14 +15,15 @@
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Sqlsrv.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Statement
*/
-require_once 'Zend/Db/Statement.php';
+// require_once 'Zend/Db/Statement.php';
/**
* Extends for Microsoft SQL Server Driver for PHP
@@ -30,7 +31,7 @@ require_once 'Zend/Db/Statement.php';
* @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
@@ -65,7 +66,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
$this->_stmt = sqlsrv_prepare($connection, $sql);
if (!$this->_stmt) {
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
}
@@ -201,7 +202,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
$this->_stmt = sqlsrv_query($connection, $this->_originalSQL, $params);
if (!$this->_stmt) {
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
}
@@ -232,7 +233,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
$values = sqlsrv_fetch_array($this->_stmt, SQLSRV_FETCH_ASSOC);
if (!$values && (null !== $error = sqlsrv_errors())) {
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception($error);
}
@@ -269,7 +270,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
$row = $this->_fetchBound($row);
break;
default:
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception("Invalid fetch mode '$style' specified");
break;
}
@@ -292,7 +293,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
if (!sqlsrv_fetch($this->_stmt)) {
if (null !== $error = sqlsrv_errors()) {
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception($error);
}
@@ -302,7 +303,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
$data = sqlsrv_get_field($this->_stmt, $col); //0-based
if ($data === false) {
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
}
@@ -326,7 +327,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
$obj = sqlsrv_fetch_object($this->_stmt);
if ($error = sqlsrv_errors()) {
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception($error);
}
@@ -372,7 +373,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
public function nextRowset()
{
if (sqlsrv_next_result($this->_stmt) === false) {
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
}
@@ -401,7 +402,7 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
// Strict check is necessary; 0 is a valid return value
if ($num_rows === false) {
- require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
+ // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
}
diff --git a/libs/Zend/Db/Statement/Sqlsrv/Exception.php b/libs/Zend/Db/Statement/Sqlsrv/Exception.php
index 02378627f9..cbd4cf4d45 100644
--- a/libs/Zend/Db/Statement/Sqlsrv/Exception.php
+++ b/libs/Zend/Db/Statement/Sqlsrv/Exception.php
@@ -12,21 +12,23 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
+ * @category Zend
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Statement_Exception
*/
-require_once 'Zend/Db/Statement/Exception.php';
+// require_once 'Zend/Db/Statement/Exception.php';
/**
* @package Zend_Db
* @subpackage Statement
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Statement_Sqlsrv_Exception extends Zend_Db_Statement_Exception
diff --git a/libs/Zend/Db/Table.php b/libs/Zend/Db/Table.php
index 20319fd1ec..ba22f7f262 100644
--- a/libs/Zend/Db/Table.php
+++ b/libs/Zend/Db/Table.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Table.php 16733 2009-07-15 13:16:50Z ralph $
+ * @version $Id: Table.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
- * Zend_Db_Table_Abstract
+ * @see Zend_Db_Table_Abstract
*/
-require_once 'Zend/Db/Table/Abstract.php';
+// require_once 'Zend/Db/Table/Abstract.php';
/**
* @see Zend_Db_Table_Definition
*/
-require_once 'Zend/Db/Table/Definition.php';
+// require_once 'Zend/Db/Table/Definition.php';
/**
* Class for SQL table interface.
@@ -36,25 +36,25 @@ require_once 'Zend/Db/Table/Definition.php';
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Table extends Zend_Db_Table_Abstract
{
-
+
/**
* __construct() - For concrete implementation of Zend_Db_Table
*
* @param string|array $config string can reference a Zend_Registry key for a db adapter
- * OR it can refernece the name of a table
- * @param unknown_type $definition
+ * OR it can reference the name of a table
+ * @param array|Zend_Db_Table_Definition $definition
*/
public function __construct($config = array(), $definition = null)
{
if ($definition !== null && is_array($definition)) {
$definition = new Zend_Db_Table_Definition($definition);
}
-
+
if (is_string($config)) {
if (Zend_Registry::isRegistered($config)) {
trigger_error(__CLASS__ . '::' . __METHOD__ . '(\'registryName\') is not valid usage of Zend_Db_Table, '
@@ -73,12 +73,7 @@ class Zend_Db_Table extends Zend_Db_Table_Abstract
}
}
}
-
+
parent::__construct($config);
}
-
-
-
-
-
}
diff --git a/libs/Zend/Db/Table/Abstract.php b/libs/Zend/Db/Table/Abstract.php
index f0a6ea18d7..e07ed22517 100644
--- a/libs/Zend/Db/Table/Abstract.php
+++ b/libs/Zend/Db/Table/Abstract.php
@@ -15,25 +15,25 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 17822 2009-08-26 00:03:56Z ralph $
+ * @version $Id: Abstract.php 21079 2010-02-18 18:15:49Z tech13 $
*/
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Adapter/Abstract.php';
+// require_once 'Zend/Db/Adapter/Abstract.php';
/**
* @see Zend_Db_Adapter_Abstract
*/
-require_once 'Zend/Db/Select.php';
+// require_once 'Zend/Db/Select.php';
/**
* @see Zend_Db
*/
-require_once 'Zend/Db.php';
+// require_once 'Zend/Db.php';
/**
* Class for SQL table interface.
@@ -41,7 +41,7 @@ require_once 'Zend/Db.php';
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Db_Table_Abstract
@@ -93,14 +93,14 @@ abstract class Zend_Db_Table_Abstract
* @var unknown_type
*/
protected $_definition = null;
-
+
/**
* Optional definition config name used in concrete implementation
*
* @var string
*/
protected $_definitionConfigName = null;
-
+
/**
* Default cache for information provided by the adapter's describeTable() method.
*
@@ -326,7 +326,7 @@ abstract class Zend_Db_Table_Abstract
return $this;
}
-
+
/**
* setDefinition()
*
@@ -338,7 +338,7 @@ abstract class Zend_Db_Table_Abstract
$this->_definition = $definition;
return $this;
}
-
+
/**
* getDefinition()
*
@@ -348,7 +348,7 @@ abstract class Zend_Db_Table_Abstract
{
return $this->_definition;
}
-
+
/**
* setDefinitionConfigName()
*
@@ -360,7 +360,7 @@ abstract class Zend_Db_Table_Abstract
$this->_definitionConfigName = $definitionConfigName;
return $this;
}
-
+
/**
* getDefinitionConfigName()
*
@@ -466,11 +466,11 @@ abstract class Zend_Db_Table_Abstract
$refMap = $this->_getReferenceMapNormalized();
if ($ruleKey !== null) {
if (!isset($refMap[$ruleKey])) {
- require_once "Zend/Db/Table/Exception.php";
+ // require_once "Zend/Db/Table/Exception.php";
throw new Zend_Db_Table_Exception("No reference rule \"$ruleKey\" from table $thisClass to table $tableClassname");
}
if ($refMap[$ruleKey][self::REF_TABLE_CLASS] != $tableClassname) {
- require_once "Zend/Db/Table/Exception.php";
+ // require_once "Zend/Db/Table/Exception.php";
throw new Zend_Db_Table_Exception("Reference rule \"$ruleKey\" does not reference table $tableClassname");
}
return $refMap[$ruleKey];
@@ -480,7 +480,7 @@ abstract class Zend_Db_Table_Abstract
return $reference;
}
}
- require_once "Zend/Db/Table/Exception.php";
+ // require_once "Zend/Db/Table/Exception.php";
throw new Zend_Db_Table_Exception("No reference from table $thisClass to table $tableClassname");
}
@@ -603,11 +603,11 @@ abstract class Zend_Db_Table_Abstract
return null;
}
if (is_string($db)) {
- require_once 'Zend/Registry.php';
+ // require_once 'Zend/Registry.php';
$db = Zend_Registry::get($db);
}
if (!$db instanceof Zend_Db_Adapter_Abstract) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception('Argument must be of type Zend_Db_Adapter_Abstract, or a Registry key where a Zend_Db_Adapter_Abstract object is stored');
}
return $db;
@@ -698,11 +698,11 @@ abstract class Zend_Db_Table_Abstract
return null;
}
if (is_string($metadataCache)) {
- require_once 'Zend/Registry.php';
+ // require_once 'Zend/Registry.php';
$metadataCache = Zend_Registry::get($metadataCache);
}
if (!$metadataCache instanceof Zend_Cache_Core) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception('Argument must be of type Zend_Cache_Core, or a Registry key where a Zend_Cache_Core object is stored');
}
return $metadataCache;
@@ -750,7 +750,7 @@ abstract class Zend_Db_Table_Abstract
if (! $this->_db) {
$this->_db = self::getDefaultAdapter();
if (!$this->_db instanceof Zend_Db_Adapter_Abstract) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception('No adapter found for ' . get_class($this));
}
}
@@ -803,10 +803,10 @@ abstract class Zend_Db_Table_Abstract
// If $this has a metadata cache
if (null !== $this->_metadataCache) {
// Define the cache identifier where the metadata are saved
-
+
//get db configuration
$dbConfig = $this->_db->getConfig();
-
+
// Define the cache identifier where the metadata are saved
$cacheId = md5( // port:host/dbname:schema.table (based on availabilty)
(isset($dbConfig['options']['port']) ? ':'.$dbConfig['options']['port'] : null)
@@ -823,11 +823,7 @@ abstract class Zend_Db_Table_Abstract
$metadata = $this->_db->describeTable($this->_name, $this->_schema);
// If $this has a metadata cache, then cache the metadata
if (null !== $this->_metadataCache && !$this->_metadataCache->save($metadata, $cacheId)) {
- /**
- * @see Zend_Db_Table_Exception
- */
- require_once 'Zend/Db/Table/Exception.php';
- throw new Zend_Db_Table_Exception('Failed saving metadata to metadataCache');
+ trigger_error('Failed saving metadata to metadataCache', E_USER_NOTICE);
}
}
@@ -876,7 +872,7 @@ abstract class Zend_Db_Table_Abstract
// if no primary key was specified and none was found in the metadata
// then throw an exception.
if (empty($this->_primary)) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception('A table must have a primary key, but none was found');
}
} else if (!is_array($this->_primary)) {
@@ -888,7 +884,7 @@ abstract class Zend_Db_Table_Abstract
$cols = $this->_getCols();
if (! array_intersect((array) $this->_primary, $cols) == (array) $this->_primary) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Primary key column(s) ("
. implode(',', (array) $this->_primary)
. ") are not columns in this table ("
@@ -990,7 +986,7 @@ abstract class Zend_Db_Table_Abstract
}
if (!array_key_exists($key, $info)) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception('There is no table information for the key "' . $key . '"');
}
@@ -1005,7 +1001,7 @@ abstract class Zend_Db_Table_Abstract
*/
public function select($withFromPart = self::SELECT_WITHOUT_FROM_PART)
{
- require_once 'Zend/Db/Table/Select.php';
+ // require_once 'Zend/Db/Table/Select.php';
$select = new Zend_Db_Table_Select($this);
if ($withFromPart == self::SELECT_WITH_FROM_PART) {
$select->from($this->info(self::NAME), Zend_Db_Table_Select::SQL_WILDCARD, $this->info(self::SCHEMA));
@@ -1092,7 +1088,7 @@ abstract class Zend_Db_Table_Abstract
/**
* @see Zend_Db_Table_Exception
*/
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception('Column "' . $column . '" not found in table.');
}
@@ -1225,12 +1221,12 @@ abstract class Zend_Db_Table_Abstract
$keyNames = array_values((array) $this->_primary);
if (count($args) < count($keyNames)) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Too few columns for the primary key");
}
if (count($args) > count($keyNames)) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Too many columns for the primary key");
}
@@ -1247,7 +1243,7 @@ abstract class Zend_Db_Table_Abstract
if ($numberTerms == 0) {
$numberTerms = $keyValuesCount;
} else if ($keyValuesCount != $numberTerms) {
- require_once 'Zend/Db/Table/Exception.php';
+ // require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Missing value(s) for the primary key");
}
$keyValues = array_values($keyValues);
@@ -1280,13 +1276,13 @@ abstract class Zend_Db_Table_Abstract
// issue ZF-5775 (empty where clause should return empty rowset)
if ($whereClause == null) {
$rowsetClass = $this->getRowsetClass();
- if (!class_exists($rowsetClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($rowsetClass);
- }
+ // if (!class_exists($rowsetClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($rowsetClass);
+ // }
return new $rowsetClass(array('table' => $this, 'rowClass' => $this->getRowClass(), 'stored' => true));
}
-
+
return $this->fetchAll($whereClause);
}
@@ -1333,10 +1329,10 @@ abstract class Zend_Db_Table_Abstract
);
$rowsetClass = $this->getRowsetClass();
- if (!class_exists($rowsetClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($rowsetClass);
- }
+ // if (!class_exists($rowsetClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($rowsetClass);
+ // }
return new $rowsetClass($data);
}
@@ -1382,10 +1378,10 @@ abstract class Zend_Db_Table_Abstract
);
$rowClass = $this->getRowClass();
- if (!class_exists($rowClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($rowClass);
- }
+ // if (!class_exists($rowClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($rowClass);
+ // }
return new $rowClass($data);
}
@@ -1445,10 +1441,10 @@ abstract class Zend_Db_Table_Abstract
);
$rowClass = $this->getRowClass();
- if (!class_exists($rowClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($rowClass);
- }
+ // if (!class_exists($rowClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($rowClass);
+ // }
$row = new $rowClass($config);
$row->setFromArray($data);
return $row;
diff --git a/libs/Zend/Db/Table/Definition.php b/libs/Zend/Db/Table/Definition.php
index edea0ee640..30e601a5b1 100644
--- a/libs/Zend/Db/Table/Definition.php
+++ b/libs/Zend/Db/Table/Definition.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Definition.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Definition.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
@@ -26,17 +26,17 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Table_Definition
{
-
+
/**
* @var array
*/
protected $_tableConfigs = array();
-
+
/**
* __construct()
*
@@ -50,7 +50,7 @@ class Zend_Db_Table_Definition
$this->setOptions($options);
}
}
-
+
/**
* setConfig()
*
@@ -62,7 +62,7 @@ class Zend_Db_Table_Definition
$this->setOptions($config->toArray());
return $this;
}
-
+
/**
* setOptions()
*
@@ -76,7 +76,7 @@ class Zend_Db_Table_Definition
}
return $this;
}
-
+
/**
* @param string $tableName
* @param array $tableConfig
@@ -87,15 +87,15 @@ class Zend_Db_Table_Definition
// @todo logic here
$tableConfig[Zend_Db_Table::DEFINITION_CONFIG_NAME] = $tableName;
$tableConfig[Zend_Db_Table::DEFINITION] = $this;
-
+
if (!isset($tableConfig[Zend_Db_Table::NAME])) {
$tableConfig[Zend_Db_Table::NAME] = $tableName;
}
-
+
$this->_tableConfigs[$tableName] = $tableConfig;
return $this;
}
-
+
/**
* getTableConfig()
*
@@ -106,7 +106,7 @@ class Zend_Db_Table_Definition
{
return $this->_tableConfigs[$tableName];
}
-
+
/**
* removeTableConfig()
*
@@ -116,7 +116,7 @@ class Zend_Db_Table_Definition
{
unset($this->_tableConfigs[$tableName]);
}
-
+
/**
* hasTableConfig()
*
diff --git a/libs/Zend/Db/Table/Exception.php b/libs/Zend/Db/Table/Exception.php
index 2d85136109..3757324052 100644
--- a/libs/Zend/Db/Table/Exception.php
+++ b/libs/Zend/Db/Table/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Exception
*/
-require_once 'Zend/Db/Exception.php';
+// require_once 'Zend/Db/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Table_Exception extends Zend_Db_Exception
diff --git a/libs/Zend/Db/Table/Row.php b/libs/Zend/Db/Table/Row.php
index 970c493419..5e80a644c0 100644
--- a/libs/Zend/Db/Table/Row.php
+++ b/libs/Zend/Db/Table/Row.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Row.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Row.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Table_Row_Abstract
*/
-require_once 'Zend/Db/Table/Row/Abstract.php';
+// require_once 'Zend/Db/Table/Row/Abstract.php';
/**
@@ -34,7 +34,7 @@ require_once 'Zend/Db/Table/Row/Abstract.php';
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Table_Row extends Zend_Db_Table_Row_Abstract
diff --git a/libs/Zend/Db/Table/Row/Abstract.php b/libs/Zend/Db/Table/Row/Abstract.php
index 501bae171a..c7243eb003 100644
--- a/libs/Zend/Db/Table/Row/Abstract.php
+++ b/libs/Zend/Db/Table/Row/Abstract.php
@@ -15,24 +15,24 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Abstract.php 22230 2010-05-21 20:59:18Z ralph $
*/
/**
* @see Zend_Db
*/
-require_once 'Zend/Db.php';
+// require_once 'Zend/Db.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
+abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggregate
{
/**
@@ -122,7 +122,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
if (isset($config['data'])) {
if (!is_array($config['data'])) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception('Data must be an array');
}
$this->_data = $config['data'];
@@ -157,7 +157,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
protected function _transformColumn($columnName)
{
if (!is_string($columnName)) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception('Specified column is not a string');
}
// Perform no transformation by default
@@ -175,7 +175,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
{
$columnName = $this->_transformColumn($columnName);
if (!array_key_exists($columnName, $this->_data)) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Specified column \"$columnName\" is not in the row");
}
return $this->_data[$columnName];
@@ -193,7 +193,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
{
$columnName = $this->_transformColumn($columnName);
if (!array_key_exists($columnName, $this->_data)) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Specified column \"$columnName\" is not in the row");
}
$this->_data[$columnName] = $value;
@@ -211,11 +211,11 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
{
$columnName = $this->_transformColumn($columnName);
if (!array_key_exists($columnName, $this->_data)) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Specified column \"$columnName\" is not in the row");
}
if ($this->isConnected() && in_array($columnName, $this->_table->info('primary'))) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Specified column \"$columnName\" is a primary key and should not be unset");
}
unset($this->_data[$columnName]);
@@ -293,13 +293,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
}
/**
- * Does nothing
+ * Proxy to __unset
* Required by the ArrayAccess implementation
*
* @param string $offset
*/
public function offsetUnset($offset)
{
+ return $this->__unset($offset);
}
/**
@@ -341,7 +342,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$tableClass = get_class($table);
if (! $table instanceof $this->_tableClass) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("The specified Table is of class $tableClass, expecting class to be instance of $this->_tableClass");
}
@@ -351,13 +352,13 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$info = $this->_table->info();
if ($info['cols'] != array_keys($this->_data)) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception('The specified Table does not have the same columns as the Row');
}
if (! array_intersect((array) $this->_primary, $info['primary']) == (array) $this->_primary) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("The specified Table '$tableClass' does not have the same primary key as the Row");
}
@@ -450,7 +451,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
* A read-only row cannot be saved.
*/
if ($this->_readOnly === true) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception('This row has been marked read-only');
}
@@ -472,9 +473,9 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
if (is_array($primaryKey)) {
$newPrimaryKey = $primaryKey;
} else {
- //ZF-6167 Use tempPrimaryKey temporary to avoid that zend encoding fails.
+ //ZF-6167 Use tempPrimaryKey temporary to avoid that zend encoding fails.
$tempPrimaryKey = (array) $this->_primary;
- $newPrimaryKey = array(current($tempPrimaryKey) => $primaryKey);
+ $newPrimaryKey = array(current($tempPrimaryKey) => $primaryKey);
}
/**
@@ -508,7 +509,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
* A read-only row cannot be saved.
*/
if ($this->_readOnly === true) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception('This row has been marked read-only');
}
@@ -597,7 +598,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
* A read-only row cannot be deleted.
*/
if ($this->_readOnly === true) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception('This row has been marked read-only');
}
@@ -641,6 +642,11 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
return $result;
}
+ public function getIterator()
+ {
+ return new ArrayIterator((array) $this->_data);
+ }
+
/**
* Returns the column/value data as an array.
*
@@ -686,7 +692,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
protected function _getTable()
{
if (!$this->_connected) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception('Cannot save a Row unless it is connected');
}
return $this->_table;
@@ -701,7 +707,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
protected function _getPrimaryKey($useDirty = true)
{
if (!is_array($this->_primary)) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("The primary key must be set as an array");
}
@@ -712,7 +718,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$array = array_intersect_key($this->_cleanData, $primary);
}
if (count($primary) != count($array)) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("The specified Table '$this->_tableClass' does not have the same primary key as the Row");
}
return $array;
@@ -754,7 +760,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$row = $this->_getTable()->fetchRow($where);
if (null === $row) {
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception('Cannot refresh row as parent is missing');
}
@@ -865,13 +871,13 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
if (is_string($dependentTable)) {
$dependentTable = $this->_getTableFromString($dependentTable);
}
-
+
if (!$dependentTable instanceof Zend_Db_Table_Abstract) {
$type = gettype($dependentTable);
if ($type == 'object') {
$type = get_class($dependentTable);
}
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Dependent table must be a Zend_Db_Table_Abstract, but it is $type");
}
@@ -921,13 +927,13 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
if (is_string($parentTable)) {
$parentTable = $this->_getTableFromString($parentTable);
}
-
+
if (!$parentTable instanceof Zend_Db_Table_Abstract) {
$type = gettype($parentTable);
if ($type == 'object') {
$type = get_class($parentTable);
}
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Parent table must be a Zend_Db_Table_Abstract, but it is $type");
}
@@ -937,7 +943,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
&& ($parentTable->getDefinition() == null)) {
$parentTable->setOptions(array(Zend_Db_Table_Abstract::DEFINITION => $tableDefinition));
}
-
+
if ($select === null) {
$select = $parentTable->select();
} else {
@@ -955,7 +961,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$parentColumnName = $parentDb->foldCase($map[Zend_Db_Table_Abstract::REF_COLUMNS][$i]);
$parentColumn = $parentDb->quoteIdentifier($parentColumnName, true);
$parentInfo = $parentTable->info();
-
+
// determine where part
$type = $parentInfo[Zend_Db_Table_Abstract::METADATA][$parentColumnName]['DATA_TYPE'];
$nullable = $parentInfo[Zend_Db_Table_Abstract::METADATA][$parentColumnName]['NULLABLE'];
@@ -966,7 +972,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
} else {
$select->where("$parentColumn = ?", $value, $type);
}
-
+
}
return $parentTable->fetchRow($select);
@@ -989,13 +995,13 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
if (is_string($intersectionTable)) {
$intersectionTable = $this->_getTableFromString($intersectionTable);
}
-
+
if (!$intersectionTable instanceof Zend_Db_Table_Abstract) {
$type = gettype($intersectionTable);
if ($type == 'object') {
$type = get_class($intersectionTable);
}
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Intersection table must be a Zend_Db_Table_Abstract, but it is $type");
}
@@ -1005,17 +1011,17 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
&& ($intersectionTable->getDefinition() == null)) {
$intersectionTable->setOptions(array(Zend_Db_Table_Abstract::DEFINITION => $tableDefinition));
}
-
+
if (is_string($matchTable)) {
$matchTable = $this->_getTableFromString($matchTable);
}
-
+
if (! $matchTable instanceof Zend_Db_Table_Abstract) {
$type = gettype($matchTable);
if ($type == 'object') {
$type = get_class($matchTable);
}
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Match table must be a Zend_Db_Table_Abstract, but it is $type");
}
@@ -1025,7 +1031,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
&& ($matchTable->getDefinition() == null)) {
$matchTable->setOptions(array(Zend_Db_Table_Abstract::DEFINITION => $tableDefinition));
}
-
+
if ($select === null) {
$select = $matchTable->select();
} else {
@@ -1050,7 +1056,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
}
$joinCond = implode(' AND ', $joinCond);
- $select->from(array('i' => $interName), Zend_Db_Select::SQL_WILDCARD, $interSchema)
+ $select->from(array('i' => $interName), array(), $interSchema)
->joinInner(array('m' => $matchName), $joinCond, Zend_Db_Select::SQL_WILDCARD, $matchSchema)
->setIntegrityCheck(false);
@@ -1077,15 +1083,15 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
);
$rowsetClass = $matchTable->getRowsetClass();
- if (!class_exists($rowsetClass)) {
- try {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($rowsetClass);
- } catch (Zend_Exception $e) {
- require_once 'Zend/Db/Table/Row/Exception.php';
- throw new Zend_Db_Table_Row_Exception($e->getMessage());
- }
- }
+ // if (!class_exists($rowsetClass)) {
+ // try {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($rowsetClass);
+ // } catch (Zend_Exception $e) {
+ // require_once 'Zend/Db/Table/Row/Exception.php';
+ // throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e);
+ // }
+ // }
$rowset = new $rowsetClass($config);
return $rowset;
}
@@ -1148,7 +1154,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
return $this->findDependentRowset($class, $ruleKey1, $select);
}
- require_once 'Zend/Db/Table/Row/Exception.php';
+ // require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Unrecognized method '$method()'");
}
@@ -1164,29 +1170,29 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
if ($this->_table instanceof Zend_Db_Table_Abstract) {
$tableDefinition = $this->_table->getDefinition();
-
+
if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) {
return new Zend_Db_Table($tableName, $tableDefinition);
- }
- }
-
- // assume the tableName is the class name
- if (!class_exists($tableName)) {
- try {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($tableName);
- } catch (Zend_Exception $e) {
- require_once 'Zend/Db/Table/Row/Exception.php';
- throw new Zend_Db_Table_Row_Exception($e->getMessage());
}
}
+ // assume the tableName is the class name
+ // if (!class_exists($tableName)) {
+ // try {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($tableName);
+ // } catch (Zend_Exception $e) {
+ // require_once 'Zend/Db/Table/Row/Exception.php';
+ // throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e);
+ // }
+ // }
+
$options = array();
-
+
if (($table = $this->_getTable())) {
$options['db'] = $table->getAdapter();
}
-
+
if (isset($tableDefinition) && $tableDefinition !== null) {
$options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition;
}
diff --git a/libs/Zend/Db/Table/Row/Exception.php b/libs/Zend/Db/Table/Row/Exception.php
index 12d17febcd..236c4bec42 100644
--- a/libs/Zend/Db/Table/Row/Exception.php
+++ b/libs/Zend/Db/Table/Row/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Table_Exception
*/
-require_once 'Zend/Db/Table/Exception.php';
+// require_once 'Zend/Db/Table/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Table_Row_Exception extends Zend_Db_Table_Exception
diff --git a/libs/Zend/Db/Table/Rowset.php b/libs/Zend/Db/Table/Rowset.php
index b7e495d6d0..186abe14fd 100644
--- a/libs/Zend/Db/Table/Rowset.php
+++ b/libs/Zend/Db/Table/Rowset.php
@@ -16,16 +16,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Rowset.php 16203 2009-06-21 18:56:17Z thomas $
+ * @version $Id: Rowset.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Table_Rowset_Abstract
*/
-require_once 'Zend/Db/Table/Rowset/Abstract.php';
+// require_once 'Zend/Db/Table/Rowset/Abstract.php';
/**
@@ -35,7 +35,7 @@ require_once 'Zend/Db/Table/Rowset/Abstract.php';
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Table_Rowset extends Zend_Db_Table_Rowset_Abstract
diff --git a/libs/Zend/Db/Table/Rowset/Abstract.php b/libs/Zend/Db/Table/Rowset/Abstract.php
index d9e324baf1..8cafadc91e 100644
--- a/libs/Zend/Db/Table/Rowset/Abstract.php
+++ b/libs/Zend/Db/Table/Rowset/Abstract.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Countable, ArrayAccess
@@ -111,10 +111,10 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
if (isset($config['rowClass'])) {
$this->_rowClass = $config['rowClass'];
}
- if (!class_exists($this->_rowClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($this->_rowClass);
- }
+ // if (!class_exists($this->_rowClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($this->_rowClass);
+ // }
if (isset($config['data'])) {
$this->_data = $config['data'];
}
@@ -321,7 +321,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
{
$position = (int) $position;
if ($position < 0 || $position >= $this->_count) {
- require_once 'Zend/Db/Table/Rowset/Exception.php';
+ // require_once 'Zend/Db/Table/Rowset/Exception.php';
throw new Zend_Db_Table_Rowset_Exception("Illegal index $position");
}
$this->_pointer = $position;
@@ -390,8 +390,8 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
$this->seek($position);
$row = $this->current();
} catch (Zend_Db_Table_Rowset_Exception $e) {
- require_once 'Zend/Db/Table/Rowset/Exception.php';
- throw new Zend_Db_Table_Rowset_Exception('No row could be found at position ' . (int) $position);
+ // require_once 'Zend/Db/Table/Rowset/Exception.php';
+ throw new Zend_Db_Table_Rowset_Exception('No row could be found at position ' . (int) $position, 0, $e);
}
if ($seek == false) {
$this->seek($key);
diff --git a/libs/Zend/Db/Table/Rowset/Exception.php b/libs/Zend/Db/Table/Rowset/Exception.php
index 99b4dc54a4..8696c74e06 100644
--- a/libs/Zend/Db/Table/Rowset/Exception.php
+++ b/libs/Zend/Db/Table/Rowset/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Table_Exception
*/
-require_once 'Zend/Db/Table/Exception.php';
+// require_once 'Zend/Db/Table/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Table_Rowset_Exception extends Zend_Db_Table_Exception
diff --git a/libs/Zend/Db/Table/Select.php b/libs/Zend/Db/Table/Select.php
index c99a5ad8de..699c071884 100644
--- a/libs/Zend/Db/Table/Select.php
+++ b/libs/Zend/Db/Table/Select.php
@@ -16,22 +16,22 @@
* @category Zend
* @package Zend_Db
* @subpackage Select
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Select.php 18200 2009-09-17 21:25:37Z beberlei $
+ * @version $Id: Select.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Select
*/
-require_once 'Zend/Db/Select.php';
+// require_once 'Zend/Db/Select.php';
/**
* @see Zend_Db_Table_Abstract
*/
-require_once 'Zend/Db/Table/Abstract.php';
+// require_once 'Zend/Db/Table/Abstract.php';
/**
@@ -40,7 +40,7 @@ require_once 'Zend/Db/Table/Abstract.php';
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Table_Select extends Zend_Db_Select
@@ -195,7 +195,7 @@ class Zend_Db_Table_Select extends Zend_Db_Select
if (count($this->_parts[self::UNION]) == 0) {
-
+
// If no fields are specified we assume all fields from primary table
if (!count($fields)) {
$this->from($primary, self::SQL_WILDCARD, $schema);
@@ -211,7 +211,7 @@ class Zend_Db_Table_Select extends Zend_Db_Select
// Check each column to ensure it only references the primary table
if ($column) {
if (!isset($from[$table]) || $from[$table]['tableName'] != $primary) {
- require_once 'Zend/Db/Table/Select/Exception.php';
+ // require_once 'Zend/Db/Table/Select/Exception.php';
throw new Zend_Db_Table_Select_Exception('Select query cannot join with another table');
}
}
diff --git a/libs/Zend/Db/Table/Select/Exception.php b/libs/Zend/Db/Table/Select/Exception.php
index 886f11876e..ac03702c2d 100644
--- a/libs/Zend/Db/Table/Select/Exception.php
+++ b/libs/Zend/Db/Table/Select/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Db
* @subpackage Select
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Exception
*/
-require_once 'Zend/Db/Select/Exception.php';
+// require_once 'Zend/Db/Select/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
diff --git a/libs/Zend/Exception.php b/libs/Zend/Exception.php
index 3cb5704b3f..bbfb792e93 100644
--- a/libs/Zend/Exception.php
+++ b/libs/Zend/Exception.php
@@ -14,18 +14,82 @@
*
* @category Zend
* @package Zend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
-
/**
- * @category Zend
- * @package Zend
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
+* @category Zend
+* @package Zend
+* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+* @license http://framework.zend.com/license/new-bsd New BSD License
+*/
class Zend_Exception extends Exception
-{}
+{
+ /**
+ * @var null|Exception
+ */
+ private $_previous = null;
+
+ /**
+ * Construct the exception
+ *
+ * @param string $msg
+ * @param int $code
+ * @param Exception $previous
+ * @return void
+ */
+ public function __construct($msg = '', $code = 0, Exception $previous = null)
+ {
+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
+ parent::__construct($msg, (int) $code);
+ $this->_previous = $previous;
+ } else {
+ parent::__construct($msg, (int) $code, $previous);
+ }
+ }
+
+ /**
+ * Overloading
+ *
+ * For PHP < 5.3.0, provides access to the getPrevious() method.
+ *
+ * @param string $method
+ * @param array $args
+ * @return mixed
+ */
+ public function __call($method, array $args)
+ {
+ if ('getprevious' == strtolower($method)) {
+ return $this->_getPrevious();
+ }
+ return null;
+ }
+
+ /**
+ * String representation of the exception
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
+ if (null !== ($e = $this->getPrevious())) {
+ return $e->__toString()
+ . "\n\nNext "
+ . parent::__toString();
+ }
+ }
+ return parent::__toString();
+ }
+ /**
+ * Returns previous Exception
+ *
+ * @return Exception|null
+ */
+ protected function _getPrevious()
+ {
+ return $this->_previous;
+ }
+}
diff --git a/libs/Zend/Feed.php b/libs/Zend/Feed.php
index b8555c7ce8..5e4d7b0894 100644
--- a/libs/Zend/Feed.php
+++ b/libs/Zend/Feed.php
@@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Feed.php 18291 2009-09-18 21:00:51Z padraic $
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -29,7 +29,7 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed
@@ -84,7 +84,7 @@ class Zend_Feed
/**
* @see Zend_Http_Client
*/
- require_once 'Zend/Http/Client.php';
+ // require_once 'Zend/Http/Client.php';
self::$_httpClient = new Zend_Http_Client();
}
@@ -173,7 +173,7 @@ class Zend_Feed
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
}
$feed = $response->getBody();
@@ -194,7 +194,7 @@ class Zend_Feed
$libxml_errflag = libxml_use_internal_errors(true);
$doc = new DOMDocument;
if (trim($string) == '') {
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Document/string being imported'
. ' is an Empty string or comes from an empty HTTP response');
}
@@ -216,7 +216,7 @@ class Zend_Feed
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception($errormsg);
}
@@ -226,7 +226,7 @@ class Zend_Feed
/**
* @see Zend_Feed_Atom
*/
- require_once 'Zend/Feed/Atom.php';
+ // require_once 'Zend/Feed/Atom.php';
// return a newly created Zend_Feed_Atom object
return new Zend_Feed_Atom(null, $string);
}
@@ -236,7 +236,7 @@ class Zend_Feed
/**
* @see Zend_Feed_Rss
*/
- require_once 'Zend/Feed/Rss.php';
+ // require_once 'Zend/Feed/Rss.php';
// return a newly created Zend_Feed_Rss object
return new Zend_Feed_Rss(null, $string);
}
@@ -245,7 +245,7 @@ class Zend_Feed
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid or unsupported feed format');
}
@@ -266,7 +266,7 @@ class Zend_Feed
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg");
}
return self::importString($feed);
@@ -293,7 +293,7 @@ class Zend_Feed
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus());
}
$contents = $response->getBody();
@@ -307,7 +307,7 @@ class Zend_Feed
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("Internal error: $php_errormsg");
}
@@ -380,15 +380,15 @@ class Zend_Feed
public static function importArray(array $data, $format = 'atom')
{
$obj = 'Zend_Feed_' . ucfirst(strtolower($format));
- if (!class_exists($obj)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($obj);
- }
+ // if (!class_exists($obj)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($obj);
+ // }
/**
* @see Zend_Feed_Builder
*/
- require_once 'Zend/Feed/Builder.php';
+ // require_once 'Zend/Feed/Builder.php';
return new $obj(null, null, new Zend_Feed_Builder($data));
}
@@ -402,10 +402,10 @@ class Zend_Feed
public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom')
{
$obj = 'Zend_Feed_' . ucfirst(strtolower($format));
- if (!class_exists($obj)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($obj);
- }
+ // if (!class_exists($obj)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($obj);
+ // }
return new $obj(null, null, $builder);
}
}
diff --git a/libs/Zend/Feed/Abstract.php b/libs/Zend/Feed/Abstract.php
index ce59dc0793..8cd77dee7c 100644
--- a/libs/Zend/Feed/Abstract.php
+++ b/libs/Zend/Feed/Abstract.php
@@ -15,16 +15,16 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 18293 2009-09-18 22:16:07Z padraic $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Element
*/
-require_once 'Zend/Feed/Element.php';
+// require_once 'Zend/Feed/Element.php';
/**
@@ -37,7 +37,7 @@ require_once 'Zend/Feed/Element.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator, Countable
@@ -77,10 +77,10 @@ abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator,
$client->setUri($uri);
$response = $client->request('GET');
if ($response->getStatus() !== 200) {
- /**
+ /**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
}
$this->_element = $response->getBody();
@@ -123,11 +123,11 @@ abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator,
$php_errormsg = '(error message not available)';
}
}
-
- /**
+
+ /**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg");
}
diff --git a/libs/Zend/Feed/Atom.php b/libs/Zend/Feed/Atom.php
index db0055c5c2..8a723f862d 100644
--- a/libs/Zend/Feed/Atom.php
+++ b/libs/Zend/Feed/Atom.php
@@ -15,21 +15,21 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Atom.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Abstract
*/
-require_once 'Zend/Feed/Abstract.php';
+// require_once 'Zend/Feed/Abstract.php';
/**
* @see Zend_Feed_Entry_Atom
*/
-require_once 'Zend/Feed/Entry/Atom.php';
+// require_once 'Zend/Feed/Entry/Atom.php';
/**
@@ -44,7 +44,7 @@ require_once 'Zend/Feed/Entry/Atom.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Atom extends Zend_Feed_Abstract
@@ -89,10 +89,10 @@ class Zend_Feed_Atom extends Zend_Feed_Abstract
// Try to find a single <entry> instead.
$element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0);
if (!$element) {
- /**
+ /**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('No root <feed> or <' . $this->_entryElementName
. '> element found, cannot parse feed.');
}
@@ -376,10 +376,10 @@ class Zend_Feed_Atom extends Zend_Feed_Abstract
public function send()
{
if (headers_sent()) {
- /**
+ /**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Cannot send ATOM because headers have already been sent.');
}
diff --git a/libs/Zend/Feed/Builder.php b/libs/Zend/Feed/Builder.php
index a0adbb1643..a9517ce5be 100644
--- a/libs/Zend/Feed/Builder.php
+++ b/libs/Zend/Feed/Builder.php
@@ -15,26 +15,26 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Builder.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Builder.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Builder_Interface
*/
-require_once 'Zend/Feed/Builder/Interface.php';
+// require_once 'Zend/Feed/Builder/Interface.php';
/**
* @see Zend_Feed_Builder_Header
*/
-require_once 'Zend/Feed/Builder/Header.php';
+// require_once 'Zend/Feed/Builder/Header.php';
/**
* @see Zend_Feed_Builder_Entry
*/
-require_once 'Zend/Feed/Builder/Entry.php';
+// require_once 'Zend/Feed/Builder/Entry.php';
/**
@@ -44,7 +44,7 @@ require_once 'Zend/Feed/Builder/Entry.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
@@ -212,7 +212,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
* @throws Zend_Feed_Builder_Exception
* @return void
*/
- private function _createHeader(array $data)
+ protected function _createHeader(array $data)
{
$mandatories = array('title', 'link', 'charset');
foreach ($mandatories as $mandatory) {
@@ -220,7 +220,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("$mandatory key is missing");
}
}
@@ -268,7 +268,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your cloud");
}
}
@@ -282,7 +282,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your textInput");
}
}
@@ -340,7 +340,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
* @throws Zend_Feed_Builder_Exception
* @return void
*/
- private function _createEntries(array $data)
+ protected function _createEntries(array $data)
{
foreach ($data as $row) {
$mandatories = array('title', 'link', 'description');
@@ -349,7 +349,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("$mandatory key is missing");
}
}
@@ -379,7 +379,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("$mandatory key of source property is missing");
}
}
@@ -395,4 +395,4 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
$this->_entries[] = $entry;
}
}
-} \ No newline at end of file
+}
diff --git a/libs/Zend/Feed/Builder/Entry.php b/libs/Zend/Feed/Builder/Entry.php
index e428928717..6e7edc67b0 100644
--- a/libs/Zend/Feed/Builder/Entry.php
+++ b/libs/Zend/Feed/Builder/Entry.php
@@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -29,7 +29,7 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Builder_Entry extends ArrayObject
@@ -224,7 +224,7 @@ class Zend_Feed_Builder_Entry extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to define the name of the category");
}
@@ -263,7 +263,7 @@ class Zend_Feed_Builder_Entry extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to supply an url for your enclosure");
}
$type = isset($enclosure['type']) ? $enclosure['type'] : '';
diff --git a/libs/Zend/Feed/Builder/Exception.php b/libs/Zend/Feed/Builder/Exception.php
index b213ceb42b..9037cc891a 100644
--- a/libs/Zend/Feed/Builder/Exception.php
+++ b/libs/Zend/Feed/Builder/Exception.php
@@ -15,16 +15,16 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Exception
*/
-require_once 'Zend/Feed/Exception.php';
+// require_once 'Zend/Feed/Exception.php';
/**
@@ -32,7 +32,7 @@ require_once 'Zend/Feed/Exception.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Builder_Exception extends Zend_Feed_Exception
diff --git a/libs/Zend/Feed/Builder/Header.php b/libs/Zend/Feed/Builder/Header.php
index a234377a15..51a57953f2 100644
--- a/libs/Zend/Feed/Builder/Header.php
+++ b/libs/Zend/Feed/Builder/Header.php
@@ -15,20 +15,20 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Header.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Header.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Builder_Header_Itunes
*/
-require_once 'Zend/Feed/Builder/Header/Itunes.php';
+// require_once 'Zend/Feed/Builder/Header/Itunes.php';
/**
* @see Zend_Uri
*/
-require_once 'Zend/Uri.php';
+// require_once 'Zend/Uri.php';
/**
@@ -39,7 +39,7 @@ require_once 'Zend/Uri.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Builder_Header extends ArrayObject
@@ -172,13 +172,13 @@ class Zend_Feed_Builder_Header extends ArrayObject
/**
* @see Zend_Validate_EmailAddress
*/
- require_once 'Zend/Validate/EmailAddress.php';
+ // require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($email)) {
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the email property");
}
$this->offsetSet('email', $email);
@@ -246,13 +246,13 @@ class Zend_Feed_Builder_Header extends ArrayObject
/**
* @see Zend_Validate_EmailAddress
*/
- require_once 'Zend/Validate/EmailAddress.php';
+ // require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($webmaster)) {
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the webmaster property");
}
$this->offsetSet('webmaster', $webmaster);
@@ -272,13 +272,13 @@ class Zend_Feed_Builder_Header extends ArrayObject
/**
* @see Zend_Validate_Int
*/
- require_once 'Zend/Validate/Int.php';
+ // require_once 'Zend/Validate/Int.php';
$validate = new Zend_Validate_Int();
if (!$validate->isValid($ttl)) {
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set an integer value to the ttl property");
}
$this->offsetSet('ttl', $ttl);
@@ -317,7 +317,7 @@ class Zend_Feed_Builder_Header extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception('Passed parameter is not a valid HTTP URI');
}
if (!$uri->getPort()) {
@@ -362,7 +362,7 @@ class Zend_Feed_Builder_Header extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you can not have more than 24 rows in the skipHours property");
}
foreach ($hours as $hour) {
@@ -370,7 +370,7 @@ class Zend_Feed_Builder_Header extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("$hour has te be between 0 and 23");
}
}
@@ -392,7 +392,7 @@ class Zend_Feed_Builder_Header extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
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');
@@ -401,7 +401,7 @@ class Zend_Feed_Builder_Header extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("$day is not a valid day");
}
}
diff --git a/libs/Zend/Feed/Builder/Header/Itunes.php b/libs/Zend/Feed/Builder/Header/Itunes.php
index cbb443bbae..9445460c07 100644
--- a/libs/Zend/Feed/Builder/Header/Itunes.php
+++ b/libs/Zend/Feed/Builder/Header/Itunes.php
@@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Itunes.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Itunes.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -28,7 +28,7 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Builder_Header_Itunes extends ArrayObject
@@ -66,14 +66,14 @@ class Zend_Feed_Builder_Header_Itunes extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set at least one itunes category");
}
if ($nb > 3) {
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set at most three itunes categories");
}
foreach ($categories as $i => $category) {
@@ -81,7 +81,7 @@ class Zend_Feed_Builder_Header_Itunes extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set the main category (category #$i)");
}
}
@@ -112,16 +112,16 @@ class Zend_Feed_Builder_Header_Itunes extends ArrayObject
public function setOwner($name = '', $email = '')
{
if (!empty($email)) {
- /**
- * @see Zend_Validate_EmailAddress
- */
- require_once 'Zend/Validate/EmailAddress.php';
+ /**
+ * @see Zend_Validate_EmailAddress
+ */
+ // require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($email)) {
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property");
}
}
@@ -182,7 +182,7 @@ class Zend_Feed_Builder_Header_Itunes extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set yes or no to the itunes block property");
}
$this->offsetSet('block', $block);
@@ -203,7 +203,7 @@ class Zend_Feed_Builder_Header_Itunes extends ArrayObject
/**
* @see Zend_Feed_Builder_Exception
*/
- require_once 'Zend/Feed/Builder/Exception.php';
+ // require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set yes, no or clean to the itunes explicit property");
}
$this->offsetSet('explicit', $explicit);
diff --git a/libs/Zend/Feed/Builder/Interface.php b/libs/Zend/Feed/Builder/Interface.php
index a3cce7e018..9dce55f815 100644
--- a/libs/Zend/Feed/Builder/Interface.php
+++ b/libs/Zend/Feed/Builder/Interface.php
@@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -29,7 +29,7 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Feed_Builder_Interface
diff --git a/libs/Zend/Feed/Element.php b/libs/Zend/Feed/Element.php
index 2f0337d54f..b7a8e632f2 100644
--- a/libs/Zend/Feed/Element.php
+++ b/libs/Zend/Feed/Element.php
@@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Element.php 18568 2009-10-16 11:59:55Z sgehrig $
+ * @version $Id: Element.php 20104 2010-01-06 21:26:01Z matthew $
*/
@@ -26,7 +26,7 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Element implements ArrayAccess
@@ -38,6 +38,11 @@ class Zend_Feed_Element implements ArrayAccess
protected $_element;
/**
+ * @var string Character encoding to utilize
+ */
+ protected $_encoding = 'UTF-8';
+
+ /**
* @var Zend_Feed_Element
*/
protected $_parentElement;
@@ -148,6 +153,27 @@ class Zend_Feed_Element implements ArrayAccess
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.
@@ -205,18 +231,18 @@ class Zend_Feed_Element implements ArrayAccess
if (strpos($var, ':') !== false) {
list($ns, $elt) = explode(':', $var, 2);
$node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns),
- $var, htmlspecialchars($val, ENT_NOQUOTES, 'UTF-8'));
+ $var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding()));
$this->_element->appendChild($node);
} else {
$node = $this->_element->ownerDocument->createElement($var,
- htmlspecialchars($val, ENT_NOQUOTES, 'UTF-8'));
+ htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding()));
$this->_element->appendChild($node);
}
} elseif (count($nodes) > 1) {
- /**
+ /**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Cannot set the value of multiple tags simultaneously.');
} else {
$nodes[0]->nodeValue = $val;
diff --git a/libs/Zend/Feed/Entry/Abstract.php b/libs/Zend/Feed/Entry/Abstract.php
index ba82f1fca1..60c10cc89a 100644
--- a/libs/Zend/Feed/Entry/Abstract.php
+++ b/libs/Zend/Feed/Entry/Abstract.php
@@ -15,21 +15,21 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed
*/
-require_once 'Zend/Feed.php';
+// require_once 'Zend/Feed.php';
/**
* @see Zend_Feed_Element
*/
-require_once 'Zend/Feed/Element.php';
+// require_once 'Zend/Feed/Element.php';
/**
@@ -38,7 +38,7 @@ require_once 'Zend/Feed/Element.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Feed_Entry_Abstract extends Zend_Feed_Element
@@ -93,19 +93,19 @@ abstract class Zend_Feed_Entry_Abstract extends Zend_Feed_Element
}
}
- /**
+ /**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg");
}
$element = $doc->getElementsByTagName($this->_rootElement)->item(0);
if (!$element) {
- /**
+ /**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
}
} else {
diff --git a/libs/Zend/Feed/Entry/Atom.php b/libs/Zend/Feed/Entry/Atom.php
index 7cbfce2c0e..01a17232eb 100644
--- a/libs/Zend/Feed/Entry/Atom.php
+++ b/libs/Zend/Feed/Entry/Atom.php
@@ -15,16 +15,16 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Atom.php 18184 2009-09-17 18:26:40Z padraic $
+ * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Entry_Abstract
*/
-require_once 'Zend/Feed/Entry/Abstract.php';
+// require_once 'Zend/Feed/Entry/Abstract.php';
/**
@@ -32,15 +32,15 @@ require_once 'Zend/Feed/Entry/Abstract.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
{
- /**
- * Content-Type
- */
- const CONTENT_TYPE = 'application/atom+xml';
+ /**
+ * Content-Type
+ */
+ const CONTENT_TYPE = 'application/atom+xml';
/**
* Root XML element for Atom entries.
@@ -79,7 +79,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Cannot delete entry; no link rel="edit" is present.');
}
@@ -107,7 +107,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("Expected response code 2xx, got $httpStatus");
}
} while (true);
@@ -144,7 +144,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Cannot edit entry; no link rel="edit" is present.');
}
@@ -164,7 +164,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Expected response code 200, got ' . $response->getStatus());
}
} else {
@@ -172,7 +172,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('PostURI must be specified to save new entries.');
}
$client = Zend_Feed::getHttpClient();
@@ -185,7 +185,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Expected response code 201, got '
. $response->getStatus());
}
@@ -210,7 +210,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('XML cannot be parsed: ' . $php_errormsg);
}
@@ -219,7 +219,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('No root <feed> element found in server response:'
. "\n\n" . $client->responseBody);
}
diff --git a/libs/Zend/Feed/Entry/Rss.php b/libs/Zend/Feed/Entry/Rss.php
index 464601b5e7..a03fe8052e 100644
--- a/libs/Zend/Feed/Entry/Rss.php
+++ b/libs/Zend/Feed/Entry/Rss.php
@@ -15,16 +15,16 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Rss.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Rss.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Entry_Abstract
*/
-require_once 'Zend/Feed/Entry/Abstract.php';
+// require_once 'Zend/Feed/Entry/Abstract.php';
/**
@@ -32,7 +32,7 @@ require_once 'Zend/Feed/Entry/Abstract.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Entry_Rss extends Zend_Feed_Entry_Abstract
@@ -98,7 +98,7 @@ class Zend_Feed_Entry_Rss extends Zend_Feed_Entry_Abstract
return parent::__isset($var);
}
}
-
+
/**
* Overwrites parent::_call method to enable read access
* to content:encoded element.
diff --git a/libs/Zend/Feed/Exception.php b/libs/Zend/Feed/Exception.php
index c77bb35495..1142c88a00 100644
--- a/libs/Zend/Feed/Exception.php
+++ b/libs/Zend/Feed/Exception.php
@@ -15,16 +15,16 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16205 2009-06-21 19:08:45Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
@@ -34,7 +34,7 @@ require_once 'Zend/Exception.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Exception extends Zend_Exception
diff --git a/libs/Zend/Feed/Pubsubhubbub.php b/libs/Zend/Feed/Pubsubhubbub.php
new file mode 100644
index 0000000000..eeffd74218
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub.php
@@ -0,0 +1,152 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Http_Client
+ */
+// require_once 'Zend/Http/Client.php';
+
+/**
+ * @see Zend_Uri
+ */
+// require_once 'Zend/Uri.php';
+
+/**
+ * @see Zend_Version
+ */
+// require_once 'Zend/Version.php';
+
+/**
+ * @see Zend_Feed_Reader
+ */
+// require_once 'Zend/Feed/Reader.php';
+
+/**
+ * @see Zend_Feed_Abstract
+ */
+// require_once 'Zend/Feed/Abstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Pubsubhubbub
+{
+ /**
+ * Verification Modes
+ */
+ const VERIFICATION_MODE_SYNC = 'sync';
+ const VERIFICATION_MODE_ASYNC = 'async';
+
+ /**
+ * Subscription States
+ */
+ const SUBSCRIPTION_VERIFIED = 'verified';
+ const SUBSCRIPTION_NOTVERIFIED = 'not_verified';
+ const SUBSCRIPTION_TODELETE = 'to_delete';
+
+ /**
+ * Singleton instance if required of the HTTP client
+ *
+ * @var Zend_Http_Client
+ */
+ protected static $httpClient = null;
+
+ /**
+ * Simple utility function which imports any feed URL and
+ * determines the existence of Hub Server endpoints. This works
+ * best if directly given an instance of Zend_Feed_Reader_Atom|Rss
+ * to leverage off.
+ *
+ * @param Zend_Feed_Reader_FeedAbstract|Zend_Feed_Abstract|string $source
+ * @return array
+ */
+ public static function detectHubs($source)
+ {
+ if (is_string($source)) {
+ $feed = Zend_Feed_Reader::import($source);
+ } elseif (is_object($source) && $source instanceof Zend_Feed_Reader_FeedAbstract) {
+ $feed = $source;
+ } elseif (is_object($source) && $source instanceof Zend_Feed_Abstract) {
+ $feed = Zend_Feed_Reader::importFeed($source);
+ } else {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ throw new Zend_Feed_Pubsubhubbub_Exception('The source parameter was'
+ . ' invalid, i.e. not a URL string or an instance of type'
+ . ' Zend_Feed_Reader_FeedAbstract or Zend_Feed_Abstract');
+ }
+ return $feed->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/libs/Zend/Feed/Pubsubhubbub/CallbackAbstract.php b/libs/Zend/Feed/Pubsubhubbub/CallbackAbstract.php
new file mode 100644
index 0000000000..2fae31b831
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/CallbackAbstract.php
@@ -0,0 +1,307 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @subpackage Callback
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Feed_Pubsubhubbub_CallbackInterface
+ */
+// require_once 'Zend/Feed/Pubsubhubbub/CallbackInterface.php';
+
+/**
+ * @see Zend_Feed_Pubsubhubbub_HttpResponse
+ */
+// require_once 'Zend/Feed/Pubsubhubbub/HttpResponse.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @subpackage Callback
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract
+ implements Zend_Feed_Pubsubhubbub_CallbackInterface
+{
+ /**
+ * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used
+ * to background save any verification tokens associated with a subscription
+ * or other.
+ *
+ * @var Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
+ */
+ protected $_storage = null;
+
+ /**
+ * 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.
+ *
+ * @var Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http
+ */
+ protected $_httpResponse = null;
+
+ /**
+ * The number of Subscribers for which any updates are on behalf of.
+ *
+ * @var int
+ */
+ protected $_subscriberCount = 1;
+
+ /**
+ * Constructor; accepts an array or Zend_Config instance to preset
+ * options for the Subscriber without calling all supported setter
+ * methods in turn.
+ *
+ * @param array|Zend_Config $options Options array or Zend_Config instance
+ */
+ public function __construct($config = null)
+ {
+ if (!is_null($config)) {
+ $this->setConfig($config);
+ }
+ }
+
+ /**
+ * Process any injected configuration options
+ *
+ * @param array|Zend_Config $options Options array or Zend_Config instance
+ * @return Zend_Feed_Pubsubhubbub_CallbackAbstract
+ */
+ public function setConfig($config)
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ } elseif (!is_array($config)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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.
+ *
+ * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
+ */
+ public function getStorage()
+ {
+ if ($this->_storage === null) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @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)
+ ) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_CallbackAbstract
+ */
+ public function setSubscriberCount($count)
+ {
+ $count = intval($count);
+ if ($count <= 0) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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_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
+ */
+ 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/libs/Zend/Feed/Pubsubhubbub/CallbackInterface.php b/libs/Zend/Feed/Pubsubhubbub/CallbackInterface.php
new file mode 100644
index 0000000000..ce30a6bb23
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/CallbackInterface.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @subpackage Callback
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @subpackage Callback
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+interface Zend_Feed_Pubsubhubbub_CallbackInterface
+{
+ /**
+ * 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 $httpData GET/POST data if available and not in $_GET/POST
+ * @param bool $sendResponseNow Whether to send response now or when asked
+ */
+ public function handle(array $httpData = null, $sendResponseNow = false);
+
+ /**
+ * 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();
+
+ /**
+ * 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
+ */
+ public function setHttpResponse($httpResponse);
+
+ /**
+ * 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();
+}
diff --git a/libs/Zend/Feed/Pubsubhubbub/Exception.php b/libs/Zend/Feed/Pubsubhubbub/Exception.php
new file mode 100644
index 0000000000..5bc562c94e
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/Exception.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Exception
+ */
+// require_once 'Zend/Exception.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Pubsubhubbub_Exception extends Zend_Exception
+{}
diff --git a/libs/Zend/Feed/Pubsubhubbub/HttpResponse.php b/libs/Zend/Feed/Pubsubhubbub/HttpResponse.php
new file mode 100644
index 0000000000..e44f0eb86a
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/HttpResponse.php
@@ -0,0 +1,233 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Feed_Pubsubhubbub
+ */
+// require_once 'Zend/Feed/Pubsubhubbub.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Pubsubhubbub_HttpResponse
+{
+ /**
+ * The body of any response to the current callback request
+ *
+ * @var string
+ */
+ protected $_body = '';
+
+ /**
+ * Array of headers. Each header is an array with keys 'name' and 'value'
+ *
+ * @var array
+ */
+ protected $_headers = array();
+
+ /**
+ * HTTP response code to use in headers
+ *
+ * @var int
+ */
+ protected $_httpResponseCode = 200;
+
+ /**
+ * Send the response, including all headers
+ *
+ * @return void
+ */
+ public function sendResponse()
+ {
+ $this->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) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_HttpResponse
+ */
+ public function setHttpResponseCode($code)
+ {
+ if (!is_int($code) || (100 > $code) || (599 < $code)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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/libs/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php b/libs/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php
new file mode 100644
index 0000000000..eab4b56322
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+
+/** @see Zend_Db_Table */
+// require_once 'Zend/Db/Table.php';
+
+/**
+ * @see Zend_Registry
+ * Seems to fix the file not being included by Zend_Db_Table...
+ */
+// require_once 'Zend/Registry.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Pubsubhubbub_Model_ModelAbstract
+{
+ /**
+ * Zend_Db_Table instance to host database methods
+ *
+ * @var Zend_Db_Table
+ */
+ protected $_db = null;
+
+ /**
+ * Constructor
+ *
+ * @param array $data
+ * @param Zend_Db_Table_Abstract $tableGateway
+ * @return void
+ */
+ public function __construct(Zend_Db_Table_Abstract $tableGateway = null)
+ {
+ if (is_null($tableGateway)) {
+ $parts = explode('_', get_class($this));
+ $table = strtolower(array_pop($parts));
+ $this->_db = new Zend_Db_Table($table);
+ } else {
+ $this->_db = $tableGateway;
+ }
+ }
+
+}
diff --git a/libs/Zend/Feed/Pubsubhubbub/Model/Subscription.php b/libs/Zend/Feed/Pubsubhubbub/Model/Subscription.php
new file mode 100644
index 0000000000..ea971b4f77
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/Model/Subscription.php
@@ -0,0 +1,131 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @subpackage Entity
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** @see Zend_Feed_Pubsubhubbub_Model_ModelAbstract */
+// require_once 'Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php';
+
+/** @see Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */
+// require_once 'Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @subpackage Entity
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Pubsubhubbub_Model_Subscription
+ extends Zend_Feed_Pubsubhubbub_Model_ModelAbstract
+ implements Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
+{
+
+ /**
+ * Save subscription to RDMBS
+ *
+ * @param array $data
+ * @return bool
+ */
+ public function setSubscription(array $data)
+ {
+ if (!isset($data['id'])) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ throw new Zend_Feed_Pubsubhubbub_Exception(
+ 'ID must be set before attempting a save'
+ );
+ }
+ $result = $this->_db->find($data['id']);
+ if ($result) {
+ $data['created_time'] = $result->current()->created_time;
+ $now = new Zend_Date;
+ if ($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
+ * @return array
+ */
+ public function getSubscription($key)
+ {
+ if (empty($key) || !is_string($key)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"'
+ .' of "' . $key . '" must be a non-empty string');
+ }
+ $result = $this->_db->find($key);
+ if ($result) {
+ return (array) $result->current();
+ }
+ return false;
+ }
+
+ /**
+ * Determine if a subscription matching the key exists
+ *
+ * @param string $key
+ * @return bool
+ */
+ public function hasSubscription($key)
+ {
+ if (empty($key) || !is_string($key)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"'
+ .' of "' . $key . '" must be a non-empty string');
+ }
+ $result = $this->_db->find($key);
+ if ($result) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Delete a subscription
+ *
+ * @param string $key
+ * @return bool
+ */
+ public function deleteSubscription($key)
+ {
+ $result = $this->_db->find($key);
+ if ($result) {
+ $this->_db->delete(
+ $this->_db->getAdapter()->quoteInto('id = ?', $key)
+ );
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/libs/Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php b/libs/Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php
new file mode 100644
index 0000000000..f8a6e6a3e3
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @subpackage Entity
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @subpackage Entity
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+interface Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
+{
+
+ /**
+ * Save subscription to RDMBS
+ *
+ * @param array $data The key must be stored here as a $data['id'] entry
+ * @return bool
+ */
+ public function setSubscription(array $data);
+
+ /**
+ * Get subscription by ID/key
+ *
+ * @param string $key
+ * @return array
+ */
+ public function getSubscription($key);
+
+ /**
+ * Determine if a subscription matching the key exists
+ *
+ * @param string $key
+ * @return bool
+ */
+ public function hasSubscription($key);
+
+ /**
+ * Delete a subscription
+ *
+ * @param string $key
+ * @return bool
+ */
+ public function deleteSubscription($key);
+
+}
diff --git a/libs/Zend/Feed/Pubsubhubbub/Publisher.php b/libs/Zend/Feed/Pubsubhubbub/Publisher.php
new file mode 100644
index 0000000000..dfc388beca
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/Publisher.php
@@ -0,0 +1,417 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Feed_Pubsubhubbub
+ */
+// require_once 'Zend/Feed/Pubsubhubbub.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Pubsubhubbub_Publisher
+{
+ /**
+ * An array of URLs for all Hub Servers used by the Publisher, and to
+ * which all topic update notifications will be sent.
+ *
+ * @var array
+ */
+ protected $_hubUrls = array();
+
+ /**
+ * An array of topic (Atom or RSS feed) URLs which have been updated and
+ * whose updated status will be notified to all Hub Servers.
+ *
+ * @var array
+ */
+ protected $_updatedTopicUrls = array();
+
+ /**
+ * An array of any errors including keys for 'response', 'hubUrl'.
+ * The response is the actual Zend_Http_Response object.
+ *
+ * @var array
+ */
+ protected $_errors = array();
+
+ /**
+ * An array of topic (Atom or RSS feed) URLs which have been updated and
+ * whose updated status will be notified to all Hub Servers.
+ *
+ * @var array
+ */
+ protected $_parameters = array();
+
+ /**
+ * Constructor; accepts an array or Zend_Config instance to preset
+ * options for the Publisher without calling all supported setter
+ * methods in turn.
+ *
+ * @param array|Zend_Config $options Options array or Zend_Config instance
+ * @return void
+ */
+ public function __construct($config = null)
+ {
+ if (!is_null($config)) {
+ $this->setConfig($config);
+ }
+ }
+
+ /**
+ * Process any injected configuration options
+ *
+ * @param array|Zend_Config $options Options array or Zend_Config instance
+ * @return Zend_Feed_Pubsubhubbub_Publisher
+ */
+ public function setConfig($config)
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ } elseif (!is_array($config)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_Publisher
+ */
+ public function addHubUrl($url)
+ {
+ if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_Publisher
+ */
+ public function addUpdatedTopicUrl($url)
+ {
+ if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @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)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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) && !is_null($value))) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_Publisher
+ */
+ public function removeParameter($name)
+ {
+ if (empty($name) || !is_string($name)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ *
+ * @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)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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);
+ return $client;
+ }
+}
diff --git a/libs/Zend/Feed/Pubsubhubbub/Subscriber.php b/libs/Zend/Feed/Pubsubhubbub/Subscriber.php
new file mode 100644
index 0000000000..9921bce594
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/Subscriber.php
@@ -0,0 +1,856 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Feed_Pubsubhubbub
+ */
+// require_once 'Zend/Feed/Pubsubhubbub.php';
+
+/**
+ * @see Zend_Date
+ */
+// require_once 'Zend/Date.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Pubsubhubbub_Subscriber
+{
+ /**
+ * An array of URLs for all Hub Servers to subscribe/unsubscribe.
+ *
+ * @var array
+ */
+ protected $_hubUrls = array();
+
+ /**
+ * An array of optional parameters to be included in any
+ * (un)subscribe requests.
+ *
+ * @var array
+ */
+ protected $_parameters = array();
+
+ /**
+ * The URL of the topic (Rss or Atom feed) which is the subject of
+ * our current intent to subscribe to/unsubscribe from updates from
+ * the currently configured Hub Servers.
+ *
+ * @var string
+ */
+ protected $_topicUrl = '';
+
+ /**
+ * The URL Hub Servers must use when communicating with this Subscriber
+ *
+ * @var string
+ */
+ protected $_callbackUrl = '';
+
+ /**
+ * The number of seconds for which the subscriber would like to have the
+ * subscription active. Defaults to null, i.e. not sent, to setup a
+ * permanent subscription if possible.
+ *
+ * @var int
+ */
+ protected $_leaseSeconds = null;
+
+ /**
+ * The preferred verification mode (sync or async). By default, this
+ * Subscriber prefers synchronous verification, but is considered
+ * desireable to support asynchronous verification if possible.
+ *
+ * Zend_Feed_Pubsubhubbub_Subscriber will always send both modes, whose
+ * order of occurance in the parameter list determines this preference.
+ *
+ * @var string
+ */
+ protected $_preferredVerificationMode
+ = Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC;
+
+ /**
+ * An array of any errors including keys for 'response', 'hubUrl'.
+ * The response is the actual Zend_Http_Response object.
+ *
+ * @var array
+ */
+ protected $_errors = array();
+
+ /**
+ * An array of Hub Server URLs for Hubs operating at this time in
+ * asynchronous verification mode.
+ *
+ * @var array
+ */
+ protected $_asyncHubs = array();
+
+ /**
+ * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background
+ * save any verification tokens associated with a subscription or other.
+ *
+ * @var Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
+ */
+ protected $_storage = null;
+
+ /**
+ * An array of authentication credentials for HTTP Basic Authentication
+ * if required by specific Hubs. The array is indexed by Hub Endpoint URI
+ * and the value is a simple array of the username and password to apply.
+ *
+ * @var array
+ */
+ protected $_authentications = array();
+
+ /**
+ * Tells the Subscriber to append any subscription identifier to the path
+ * of the base Callback URL. E.g. an identifier "subkey1" would be added
+ * to the callback URL "http://www.example.com/callback" to create a subscription
+ * specific Callback URL of "http://www.example.com/callback/subkey1".
+ *
+ * This is required for all Hubs using the Pubsubhubbub 0.1 Specification.
+ * It should be manually intercepted and passed to the Callback class using
+ * Zend_Feed_Pubsubhubbub_Subscriber_Callback::setSubscriptionKey(). Will
+ * require a route in the form "callback/:subkey" to allow the parameter be
+ * retrieved from an action using the Zend_Controller_Action::_getParam()
+ * method.
+ *
+ * @var string
+ */
+ protected $_usePathParameter = false;
+
+ /**
+ * Constructor; accepts an array or Zend_Config instance to preset
+ * options for the Subscriber without calling all supported setter
+ * methods in turn.
+ *
+ * @param array|Zend_Config $options Options array or Zend_Config instance
+ * @return void
+ */
+ public function __construct($config = null)
+ {
+ if (!is_null($config)) {
+ $this->setConfig($config);
+ }
+ }
+
+ /**
+ * Process any injected configuration options
+ *
+ * @param array|Zend_Config $options Options array or Zend_Config instance
+ * @return Zend_Feed_Pubsubhubbub_Subscriber
+ */
+ public function setConfig($config)
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ } elseif (!is_array($config)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_Subscriber
+ */
+ public function setTopicUrl($url)
+ {
+ if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ *
+ * @return string
+ */
+ public function getTopicUrl()
+ {
+ if (empty($this->_topicUrl)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_Subscriber
+ */
+ public function setLeaseSeconds($seconds)
+ {
+ $seconds = intval($seconds);
+ if ($seconds <= 0) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_Subscriber
+ */
+ public function setCallbackUrl($url)
+ {
+ if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ *
+ * @return string
+ */
+ public function getCallbackUrl()
+ {
+ if (empty($this->_callbackUrl)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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'
+ * @return Zend_Feed_Pubsubhubbub_Subscriber
+ */
+ public function setPreferredVerificationMode($mode)
+ {
+ if ($mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC
+ && $mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_Subscriber
+ */
+ public function addHubUrl($url)
+ {
+ if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @return Zend_Feed_Pubsubhubbub_Subscriber
+ */
+ public function addAuthentication($url, array $authentication)
+ {
+ if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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
+ * @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)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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) && !is_null($value))) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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 string $name
+ * @param string|null $value
+ * @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
+ * @return Zend_Feed_Pubsubhubbub_Subscriber
+ */
+ public function removeParameter($name)
+ {
+ if (empty($name) || !is_string($name)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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.
+ *
+ * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
+ */
+ public function getStorage()
+ {
+ if ($this->_storage === null) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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)
+ *
+ * @return void
+ */
+ 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)
+ *
+ * @return void
+ */
+ 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
+ * @return void
+ */
+ protected function _doRequest($mode)
+ {
+ $client = $this->_getHttpClient();
+ $hubs = $this->getHubUrls();
+ if (empty($hubs)) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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));
+ $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
+ *
+ * @param string $mode Must be "subscribe" or "unsubscribe"
+ * @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 mode $hubUrl
+ * @return string
+ */
+ protected function _getRequestParameters($hubUrl, $mode)
+ {
+ if (!in_array($mode, array('subscribe', 'unsubscribe'))) {
+ // require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
+ 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' && !is_null($this->getLeaseSeconds())) {
+ $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.
+ *
+ * @param string $hubUrl The Hub Server URL for which this token will apply
+ * @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 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/libs/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php b/libs/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php
new file mode 100644
index 0000000000..1f42375839
--- /dev/null
+++ b/libs/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php
@@ -0,0 +1,328 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Feed_Pubsubhubbub
+ */
+// require_once 'Zend/Feed/Pubsubhubbub.php';
+
+/**
+ * @see Zend_Feed_Pubsubhubbub
+ */
+// require_once 'Zend/Feed/Pubsubhubbub/CallbackAbstract.php';
+
+/**
+ * @see Zend_Feed_Reader
+ */
+// require_once 'Zend/Feed/Reader.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Pubsubhubbub
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Pubsubhubbub_Subscriber_Callback
+ extends Zend_Feed_Pubsubhubbub_CallbackAbstract
+{
+ /**
+ * Contains the content of any feeds sent as updates to the Callback URL
+ *
+ * @var string
+ */
+ protected $_feedUpdate = null;
+
+ /**
+ * Holds a manually set subscription key (i.e. identifies a unique
+ * subscription) which is typical when it is not passed in the query string
+ * but is part of the Callback URL path, requiring manual retrieval e.g.
+ * using a route and the Zend_Controller_Action::_getParam() method.
+ *
+ * @var string
+ */
+ protected $_subscriptionKey = null;
+
+ /**
+ * After verification, this is set to the verified subscription's data.
+ *
+ * @var array
+ */
+ protected $_currentSubscriptionData = null;
+
+ /**
+ * Set a subscription key to use for the current callback request manually.
+ * Required if usePathParameter is enabled for the Subscriber.
+ *
+ * @param string $key
+ * @return Zend_Feed_Pubsubhubbub_Subscriber_Callback
+ */
+ public function setSubscriptionKey($key)
+ {
+ $this->_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.
+ */
+ if (strtolower($_SERVER['REQUEST_METHOD']) == 'post'
+ && $this->_hasValidVerifyToken(null, false)
+ && ($this->_getHeader('Content-Type') == 'application/atom+xml'
+ || $this->_getHeader('Content-Type') == 'application/rss+xml'
+ || $this->_getHeader('Content-Type') == 'application/xml'
+ || $this->_getHeader('Content-Type') == 'text/xml'
+ || $this->_getHeader('Content-Type') == 'application/rdf+xml')
+ ) {
+ $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 (is_null($this->_feedUpdate)) {
+ 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/libs/Zend/Feed/Reader.php b/libs/Zend/Feed/Reader.php
index ced12cf7c7..26bf661cdf 100644
--- a/libs/Zend/Feed/Reader.php
+++ b/libs/Zend/Feed/Reader.php
@@ -14,49 +14,55 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Reader.php 17391 2009-08-05 11:27:52Z padraic $
+ * @version $Id: Reader.php 22093 2010-05-04 12:55:06Z padraic $
*/
/**
* @see Zend_Feed
*/
-require_once 'Zend/Feed.php';
+// require_once 'Zend/Feed.php';
/**
* @see Zend_Feed_Reader_Feed_Rss
*/
-require_once 'Zend/Feed/Reader/Feed/Rss.php';
+// require_once 'Zend/Feed/Reader/Feed/Rss.php';
/**
* @see Zend_Feed_Reader_Feed_Atom
*/
-require_once 'Zend/Feed/Reader/Feed/Atom.php';
+// require_once 'Zend/Feed/Reader/Feed/Atom.php';
+
+/**
+ * @see Zend_Feed_Reader_FeedSet
+ */
+// require_once 'Zend/Feed/Reader/FeedSet.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader
{
- /**
- * Namespace constants
- */
- const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#';
+ /**
+ * Namespace constants
+ */
+ const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#';
const NAMESPACE_ATOM_10 = 'http://www.w3.org/2005/Atom';
const NAMESPACE_RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
const NAMESPACE_RSS_090 = 'http://my.netscape.com/rdf/simple/0.9/';
const NAMESPACE_RSS_10 = 'http://purl.org/rss/1.0/';
/**
- * Feed type constants
- */
- const TYPE_ANY = 'any';
- const TYPE_ATOM_03 = 'atom-03';
+ * Feed type constants
+ */
+ const TYPE_ANY = 'any';
+ const TYPE_ATOM_03 = 'atom-03';
const TYPE_ATOM_10 = 'atom-10';
+ const TYPE_ATOM_10_ENTRY = 'atom-10-entry';
const TYPE_ATOM_ANY = 'atom';
const TYPE_RSS_090 = 'rss-090';
const TYPE_RSS_091 = 'rss-091';
@@ -161,7 +167,7 @@ class Zend_Feed_Reader
/**
* @see Zend_Http_Client
*/
- require_once 'Zend/Http/Client.php';
+ // require_once 'Zend/Http/Client.php';
self::$_httpClient = new Zend_Http_Client();
}
@@ -208,13 +214,13 @@ class Zend_Feed_Reader
}
/**
- * Import a feed by providing a URL
- *
- * @param string $url The URL to the feed
+ * 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_Feed_Interface
- */
+ * @return Zend_Feed_Reader_FeedInterface
+ */
public static function import($uri, $etag = null, $lastModified = null)
{
$cache = self::getCache();
@@ -245,7 +251,7 @@ class Zend_Feed_Reader
}
$response = $client->request('GET');
if ($response->getStatus() !== 200 && $response->getStatus() !== 304) {
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
}
if ($response->getStatus() == 304) {
@@ -268,7 +274,7 @@ class Zend_Feed_Reader
}
$response = $client->request('GET');
if ($response->getStatus() !== 200) {
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
}
$responseXml = $response->getBody();
@@ -277,10 +283,12 @@ class Zend_Feed_Reader
} else {
$response = $client->request('GET');
if ($response->getStatus() !== 200) {
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
}
- return self::importString($response->getBody());
+ $reader = self::importString($response->getBody());
+ $reader->setOriginalSourceUri($uri);
+ return $reader;
}
}
@@ -288,8 +296,8 @@ class Zend_Feed_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_Feed_Interface
- */
+ * @return Zend_Feed_Reader_FeedInterface
+ */
public static function importFeed(Zend_Feed_Abstract $feed)
{
$dom = $feed->getDOM()->ownerDocument;
@@ -298,7 +306,7 @@ class Zend_Feed_Reader
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);
+ $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type);
}
return $reader;
@@ -308,7 +316,7 @@ class Zend_Feed_Reader
* Import a feed froma string
*
* @param string $string
- * @return Zend_Feed_Reader_Feed_Interface
+ * @return Zend_Feed_Reader_FeedInterface
*/
public static function importString($string)
{
@@ -321,12 +329,12 @@ class Zend_Feed_Reader
// Build error message
$error = libxml_get_last_error();
if ($error && $error->message) {
- $errormsg = "DOMDocument cannot parse XML: {$error->message}";
+ $errormsg = "DOMDocument cannot parse XML: {$error->message}";
} else {
- $errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity";
+ $errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity";
}
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception($errormsg);
}
@@ -336,8 +344,14 @@ class Zend_Feed_Reader
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 {
- $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type);
+ // require_once 'Zend/Feed/Exception.php';
+ 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;
}
@@ -358,7 +372,7 @@ class Zend_Feed_Reader
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg");
}
return self::importString($feed);
@@ -374,62 +388,48 @@ class Zend_Feed_Reader
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus());
}
$responseHtml = $response->getBody();
- @ini_set('track_errors', 1);
+ $libxml_errflag = libxml_use_internal_errors(true);
$dom = new DOMDocument;
- $status = @$dom->loadHTML($responseHtml);
- @ini_restore('track_errors');
+ $status = $dom->loadHTML($responseHtml);
+ libxml_use_internal_errors($libxml_errflag);
if (!$status) {
- 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)';
- }
+ // 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";
}
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg");
+
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception($errormsg);
}
- $feedLinks = new stdClass;
+ $feedSet = new Zend_Feed_Reader_FeedSet;
$links = $dom->getElementsByTagName('link');
- foreach ($links as $link) {
- if (strtolower($link->getAttribute('rel')) !== 'alternate'
- || !$link->getAttribute('type') || !$link->getAttribute('href')) {
- continue;
- }
- if (!isset($feedLinks->rss) && $link->getAttribute('type') == 'application/rss+xml') {
- $feedLinks->rss = $link->getAttribute('href');
- } elseif(!isset($feedLinks->atom) && $link->getAttribute('type') == 'application/atom+xml') {
- $feedLinks->atom = $link->getAttribute('href');
- } elseif(!isset($feedLinks->rdf) && $link->getAttribute('type') == 'application/rdf+xml') {
- $feedLinks->rdf = $link->getAttribute('href');
- }
- if (isset($feedLinks->rss) && isset($feedLinks->atom) && isset($feedLinks->rdf)) {
- break;
- }
- }
- return $feedLinks;
+ $feedSet->addLinks($links, $uri);
+ return $feedSet;
}
/**
* Detect the feed type of the provided feed
*
- * @param Zend_Feed_Abstract $feed A fully instantiated Zend_Feed object
+ * @param Zend_Feed_Abstract|DOMDocument|string $feed
* @return string
*/
- public static function detectType($feed)
+ public static function detectType($feed, $specOnly = false)
{
if ($feed instanceof Zend_Feed_Reader_FeedInterface) {
$dom = $feed->getDomDocument();
- } elseif($feed instanceof DomDocument) {
+ } elseif($feed instanceof DOMDocument) {
$dom = $feed;
} elseif(is_string($feed) && !empty($feed)) {
@ini_set('track_errors', 1);
$dom = new DOMDocument;
- $status = @$doc->loadXML($string);
+ $status = @$dom->loadXML($feed);
@ini_restore('track_errors');
if (!$status) {
if (!isset($php_errormsg)) {
@@ -439,12 +439,13 @@ class Zend_Feed_Reader
$php_errormsg = '(error message not available)';
}
}
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg");
}
} else {
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception('Invalid object/scalar provided: must be of type Zend_Feed_Reader_FeedInterface, DomDocument or string');
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception('Invalid object/scalar provided: must'
+ . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string');
}
$xpath = new DOMXPath($dom);
@@ -509,6 +510,14 @@ class Zend_Feed_Reader
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);
@@ -537,7 +546,7 @@ class Zend_Feed_Reader
public static function getPluginLoader()
{
if (!isset(self::$_pluginLoader)) {
- require_once 'Zend/Loader/PluginLoader.php';
+ // require_once 'Zend/Loader/PluginLoader.php';
self::$_pluginLoader = new Zend_Loader_PluginLoader(array(
'Zend_Feed_Reader_Extension_' => 'Zend/Feed/Reader/Extension/',
));
@@ -607,7 +616,7 @@ class Zend_Feed_Reader
if (!self::getPluginLoader()->isLoaded($feedName)
&& !self::getPluginLoader()->isLoaded($entryName)
) {
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Could not load extension: ' . $name
. 'using Plugin Loader. Check prefix paths are configured and extension exists.');
}
@@ -689,4 +698,24 @@ class Zend_Feed_Reader
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/libs/Zend/Feed/Reader/Collection.php b/libs/Zend/Feed/Reader/Collection.php
new file mode 100644
index 0000000000..fba2b52b52
--- /dev/null
+++ b/libs/Zend/Feed/Reader/Collection.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Reader_Collection extends ArrayObject
+{
+
+
+
+}
diff --git a/libs/Zend/Feed/Reader/Collection/Author.php b/libs/Zend/Feed/Reader/Collection/Author.php
new file mode 100644
index 0000000000..6a039974b6
--- /dev/null
+++ b/libs/Zend/Feed/Reader/Collection/Author.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Author.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @see Zend_Feed_Reader_Collection_CollectionAbstract
+ */
+// require_once 'Zend/Feed/Reader/Collection/CollectionAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Reader_Collection_Author
+extends Zend_Feed_Reader_Collection_CollectionAbstract
+{
+
+ /**
+ * Return a simple array of the most relevant slice of
+ * the author values, i.e. all author names.
+ *
+ * @return array
+ */
+ public function getValues() {
+ $authors = array();
+ foreach ($this->getIterator() as $element) {
+ $authors[] = $element['name'];
+ }
+ return array_unique($authors);
+ }
+
+}
diff --git a/libs/Zend/Feed/Reader/Collection/Category.php b/libs/Zend/Feed/Reader/Collection/Category.php
new file mode 100644
index 0000000000..2587c13268
--- /dev/null
+++ b/libs/Zend/Feed/Reader/Collection/Category.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Category.php 20954 2010-02-06 17:56:27Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Reader_Collection_CollectionAbstract
+ */
+// require_once 'Zend/Feed/Reader/Collection/CollectionAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Reader_Collection_Category
+extends Zend_Feed_Reader_Collection_CollectionAbstract
+{
+
+ /**
+ * Return a simple array of the most relevant slice of
+ * the collection values. For example, feed categories contain
+ * the category name, domain/URI, and other data. This method would
+ * merely return the most useful data - i.e. the category names.
+ *
+ * @return array
+ */
+ public function getValues() {
+ $categories = array();
+ foreach ($this->getIterator() as $element) {
+ if (isset($element['label']) && !empty($element['label'])) {
+ $categories[] = $element['label'];
+ } else {
+ $categories[] = $element['term'];
+ }
+ }
+ return array_unique($categories);
+ }
+
+}
diff --git a/libs/Zend/Feed/Reader/Collection/CollectionAbstract.php b/libs/Zend/Feed/Reader/Collection/CollectionAbstract.php
new file mode 100644
index 0000000000..7b6dbd0317
--- /dev/null
+++ b/libs/Zend/Feed/Reader/Collection/CollectionAbstract.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: CollectionAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+abstract class Zend_Feed_Reader_Collection_CollectionAbstract extends ArrayObject
+{
+
+ /**
+ * Return a simple array of the most relevant slice of
+ * the collection values. For example, feed categories contain
+ * the category name, domain/URI, and other data. This method would
+ * merely return the most useful data - i.e. the category names.
+ *
+ * @return array
+ */
+ public abstract function getValues();
+
+}
diff --git a/libs/Zend/Feed/Reader/Entry/Atom.php b/libs/Zend/Feed/Reader/Entry/Atom.php
index b788cd2533..77289b411b 100644
--- a/libs/Zend/Feed/Reader/Entry/Atom.php
+++ b/libs/Zend/Feed/Reader/Entry/Atom.php
@@ -14,35 +14,35 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Atom.php 16966 2009-07-22 15:22:18Z padraic $
+ * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_EntryInterface
*/
-require_once 'Zend/Feed/Reader/EntryInterface.php';
+// require_once 'Zend/Feed/Reader/EntryInterface.php';
/**
* @see Zend_Feed_Reader_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/EntryAbstract.php';
/**
* @see Zend_Feed_Reader_Extension_Atom_Entry
*/
-require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php';
+// require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface
@@ -74,9 +74,12 @@ class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract impleme
$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
@@ -295,7 +298,7 @@ class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract impleme
return $this->_data['commentcount'];
}
- $commentcount = $this->getExtension('Thread')>getCommentCount();
+ $commentcount = $this->getExtension('Thread')->getCommentCount();
if (!$commentcount) {
$commentcount = $this->getExtension('Atom')->getCommentCount();
@@ -341,6 +344,46 @@ class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract impleme
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)
diff --git a/libs/Zend/Feed/Reader/Entry/Rss.php b/libs/Zend/Feed/Reader/Entry/Rss.php
index b91990a665..21a30a98fc 100644
--- a/libs/Zend/Feed/Reader/Entry/Rss.php
+++ b/libs/Zend/Feed/Reader/Entry/Rss.php
@@ -14,65 +14,70 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Rss.php 18367 2009-09-22 14:55:59Z padraic $
+ * @version $Id: Rss.php 22301 2010-05-26 10:15:13Z padraic $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_EntryInterface
*/
-require_once 'Zend/Feed/Reader/EntryInterface.php';
+// require_once 'Zend/Feed/Reader/EntryInterface.php';
/**
* @see Zend_Feed_Reader_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/EntryAbstract.php';
/**
* @see Zend_Feed_Reader_Extension_DublinCore_Entry
*/
-require_once 'Zend/Feed/Reader/Extension/DublinCore/Entry.php';
+// require_once 'Zend/Feed/Reader/Extension/DublinCore/Entry.php';
/**
* @see Zend_Feed_Reader_Extension_Content_Entry
*/
-require_once 'Zend/Feed/Reader/Extension/Content/Entry.php';
+// require_once 'Zend/Feed/Reader/Extension/Content/Entry.php';
/**
* @see Zend_Feed_Reader_Extension_Atom_Entry
*/
-require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php';
+// require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php';
/**
* @see Zend_Feed_Reader_Extension_WellformedWeb_Entry
*/
-require_once 'Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php';
+// require_once 'Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php';
/**
* @see Zend_Feed_Reader_Extension_Slash_Entry
*/
-require_once 'Zend/Feed/Reader/Extension/Slash/Entry.php';
+// require_once 'Zend/Feed/Reader/Extension/Slash/Entry.php';
/**
* @see Zend_Feed_Reader_Extension_Thread_Entry
*/
-require_once 'Zend/Feed/Reader/Extension/Thread/Entry.php';
+// require_once 'Zend/Feed/Reader/Extension/Thread/Entry.php';
/**
* @see Zend_Date
*/
-require_once 'Zend/Date.php';
+// require_once 'Zend/Date.php';
+
+/**
+ * @see Zend_Feed_Reader_Collection_Category
+ */
+// require_once 'Zend/Feed/Reader/Collection/Category.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface
@@ -154,45 +159,50 @@ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implemen
if (array_key_exists('authors', $this->_data)) {
return $this->_data['authors'];
}
-
+
$authors = array();
- // @todo: create a list from all potential sources rather than from alternatives
- if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 &&
- $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) {
- $list = $this->_xpath->evaluate($this->_xpathQueryRss.'//author');
- } else {
- $list = $this->_xpath->evaluate($this->_xpathQueryRdf.'//rss:author');
- }
- if (!$list->length) {
- 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');
+ $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) {
- if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20
- && preg_match("/\(([^\)]+)\)/", $author->nodeValue, $matches, PREG_OFFSET_CAPTURE)
- ) {
- // source name from RSS 2.0 <author>
- // format "joe@example.com (Joe Bloggs)"
- $authors[] = $matches[1][0];
- } else {
- $authors[] = $author->nodeValue;
- }
+ $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;
+ }
}
-
- $authors = array_unique($authors);
}
- if (empty($authors)) {
- $authors = $this->getExtension('DublinCore')->getAuthors();
+ if (count($authors) == 0) {
+ $authors = $this->getExtension('Atom')->getAuthors();
+ } else {
+ $authors = new Zend_Feed_Reader_Collection_Author(
+ Zend_Feed_Reader::arrayUnique($authors)
+ );
}
- if (empty($authors)) {
- $authors = $this->getExtension('Atom')->getAuthors();
+ if (count($authors) == 0) {
+ $authors = null;
}
$this->_data['authors'] = $authors;
@@ -255,21 +265,27 @@ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implemen
) {
$dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)');
if ($dateModified) {
- $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) {
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception(
- 'Could not load date due to unrecognised'
- .' format (should follow RFC 822 or 2822):'
- . $e->getMessage()
- );
+ $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) {
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception(
+ 'Could not load date due to unrecognised'
+ .' format (should follow RFC 822 or 2822):'
+ . $e->getMessage(),
+ 0, $e
+ );
+ }
}
}
}
@@ -324,8 +340,6 @@ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implemen
if (!$description) {
$description = null;
- } else {
- $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding());
}
$this->_data['description'] = $description;
@@ -458,6 +472,46 @@ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implemen
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
diff --git a/libs/Zend/Feed/Reader/EntryAbstract.php b/libs/Zend/Feed/Reader/EntryAbstract.php
index 153149ebcc..f73e1d1e8e 100644
--- a/libs/Zend/Feed/Reader/EntryAbstract.php
+++ b/libs/Zend/Feed/Reader/EntryAbstract.php
@@ -14,15 +14,15 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: EntryAbstract.php 16966 2009-07-22 15:22:18Z padraic $
+ * @version $Id: EntryAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Feed_Reader_EntryAbstract
@@ -118,6 +118,9 @@ abstract class Zend_Feed_Reader_EntryAbstract
public function getEncoding()
{
$assumed = $this->getDomDocument()->encoding;
+ if (empty($assumed)) {
+ $assumed = 'UTF-8';
+ }
return $assumed;
}
@@ -134,7 +137,7 @@ abstract class Zend_Feed_Reader_EntryAbstract
return $dom->saveXml();
}
- /**
+ /**
* Get the entry type
*
* @return string
@@ -151,10 +154,13 @@ abstract class Zend_Feed_Reader_EntryAbstract
*/
public function getXpath()
{
+ if (!$this->_xpath) {
+ $this->setXpath(new DOMXPath($this->getDomDocument()));
+ }
return $this->_xpath;
}
- /**
+ /**
* Set the XPath query
*
* @param DOMXPath $xpath
@@ -167,16 +173,6 @@ abstract class Zend_Feed_Reader_EntryAbstract
}
/**
- * Serialize the entry to an array
- *
- * @return array
- */
- public function toArray()
- {
- return $this->_data;
- }
-
- /**
* Get registered extensions
*
* @return array
@@ -215,7 +211,7 @@ abstract class Zend_Feed_Reader_EntryAbstract
return call_user_func_array(array($extension, $method), $args);
}
}
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Method: ' . $method
. 'does not exist and could not be located on a registered Extension');
}
diff --git a/libs/Zend/Feed/Reader/EntryInterface.php b/libs/Zend/Feed/Reader/EntryInterface.php
index dafbe293dd..392a533a30 100644
--- a/libs/Zend/Feed/Reader/EntryInterface.php
+++ b/libs/Zend/Feed/Reader/EntryInterface.php
@@ -14,15 +14,15 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: EntryInterface.php 16953 2009-07-22 11:57:25Z padraic $
+ * @version $Id: EntryInterface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Feed_Reader_EntryInterface
@@ -133,4 +133,11 @@ interface Zend_Feed_Reader_EntryInterface
* @return string
*/
public function getCommentFeedLink();
+
+ /**
+ * Get all categories
+ *
+ * @return Zend_Feed_Reader_Collection_Category
+ */
+ public function getCategories();
}
diff --git a/libs/Zend/Feed/Reader/Extension/Atom/Entry.php b/libs/Zend/Feed/Reader/Extension/Atom/Entry.php
index f442115801..1efa197787 100644
--- a/libs/Zend/Feed/Reader/Extension/Atom/Entry.php
+++ b/libs/Zend/Feed/Reader/Extension/Atom/Entry.php
@@ -14,41 +14,51 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 18655 2009-10-20 14:17:39Z padraic $
+ * @version $Id: Entry.php 22301 2010-05-26 10:15:13Z padraic $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_Extension_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
/**
* @see Zend_Date
*/
-require_once 'Zend/Date.php';
+// require_once 'Zend/Date.php';
/**
* @see Zend_Uri
*/
-require_once 'Zend/Uri.php';
+// require_once 'Zend/Uri.php';
+
+/**
+ * @see Zend_Feed_Reader_Collection_Category
+ */
+// require_once 'Zend/Feed/Reader/Collection/Category.php';
+
+/**
+ * @see Zend_Feed_Reader_Feed_Atom_Source
+ */
+// require_once 'Zend/Feed/Reader/Feed/Atom/Source.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_Atom_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
- /**
+ /**
* Get the specified author
*
* @param int $index
@@ -76,33 +86,34 @@ class Zend_Feed_Reader_Extension_Atom_Entry
return $this->_data['authors'];
}
- $authors = $this->_xpath->query(
- $this->getXpathPrefix() . '//atom:author' . '|'
- . $this->getXpathPrefix(). '//atom:contributor'
- );
+ $authors = array();
+ $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:author');
- if (!$authors->length) {
- $authors = $this->_xpath->query(
- '//atom:author' . '|' . '//atom:contributor'
- );
+ if (!$list->length) {
+ /**
+ * TODO: Limit query to feed level els only!
+ */
+ $list = $this->getXpath()->query('//atom:author');
}
- $people = array();
-
- if ($authors->length) {
- foreach ($authors as $author) {
+ if ($list->length) {
+ foreach ($list as $author) {
$author = $this->_getAuthor($author);
-
if (!empty($author)) {
- $people[] = $author;
+ $authors[] = $author;
}
}
}
- $people = array_unique($people);
-
- $this->_data['authors'] = $people;
+ 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'];
}
@@ -116,21 +127,65 @@ class Zend_Feed_Reader_Extension_Atom_Entry
if (array_key_exists('content', $this->_data)) {
return $this->_data['content'];
}
-
- $content = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:content)');
-
- if ($content) {
- $content = html_entity_decode($content, ENT_QUOTES, $this->getEncoding());
+
+ $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;
+ }
}
+
+ //var_dump($content); exit;
if (!$content) {
$content = $this->getDescription();
}
- $this->_data['content'] = $content;
+ $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
@@ -145,10 +200,10 @@ class Zend_Feed_Reader_Extension_Atom_Entry
$date = null;
- if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) {
- $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)');
+ if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) {
+ $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)');
} else {
- $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)');
+ $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)');
}
if ($dateCreated) {
@@ -174,10 +229,10 @@ class Zend_Feed_Reader_Extension_Atom_Entry
$date = null;
- if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) {
- $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)');
+ if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) {
+ $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)');
} else {
- $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)');
+ $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)');
}
if ($dateModified) {
@@ -201,12 +256,10 @@ class Zend_Feed_Reader_Extension_Atom_Entry
return $this->_data['description'];
}
- $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:summary)');
+ $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:summary)');
if (!$description) {
$description = null;
- } else {
- $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding());
}
$this->_data['description'] = $description;
@@ -227,7 +280,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
$enclosure = null;
- $nodeList = $this->_xpath->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]');
+ $nodeList = $this->getXpath()->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]');
if ($nodeList->length > 0) {
$enclosure = new stdClass();
@@ -252,7 +305,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
return $this->_data['id'];
}
- $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)');
+ $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)');
if (!$id) {
if ($this->getPermalink()) {
@@ -268,7 +321,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
return $this->_data['id'];
}
-
+
/**
* Get the base URI of the feed (if set).
*
@@ -279,19 +332,19 @@ class Zend_Feed_Reader_Extension_Atom_Entry
if (array_key_exists('baseUrl', $this->_data)) {
return $this->_data['baseUrl'];
}
-
- $baseUrl = $this->_xpath->evaluate('string('
+
+ $baseUrl = $this->getXpath()->evaluate('string('
. $this->getXpathPrefix() . '/@xml:base[1]'
. ')');
-
+
if (!$baseUrl) {
- $baseUrl = $this->_xpath->evaluate('string(//@xml:base[1])');
+ $baseUrl = $this->getXpath()->evaluate('string(//@xml:base[1])');
}
if (!$baseUrl) {
$baseUrl = null;
}
-
+
$this->_data['baseUrl'] = $baseUrl;
return $this->_data['baseUrl'];
@@ -329,7 +382,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
$links = array();
- $list = $this->_xpath->query(
+ $list = $this->getXpath()->query(
$this->getXpathPrefix() . '//atom:link[@rel="alternate"]/@href' . '|' .
$this->getXpathPrefix() . '//atom:link[not(@rel)]/@href'
);
@@ -366,12 +419,10 @@ class Zend_Feed_Reader_Extension_Atom_Entry
return $this->_data['title'];
}
- $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)');
+ $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)');
if (!$title) {
$title = null;
- } else {
- $title = html_entity_decode($title, ENT_QUOTES, $this->getEncoding());
}
$this->_data['title'] = $title;
@@ -392,8 +443,8 @@ class Zend_Feed_Reader_Extension_Atom_Entry
$count = null;
- $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0');
- $list = $this->_xpath->query(
+ $this->getXpath()->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0');
+ $list = $this->getXpath()->query(
$this->getXpathPrefix() . '//atom:link[@rel="replies"]/@thread10:count'
);
@@ -419,7 +470,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
$link = null;
- $list = $this->_xpath->query(
+ $list = $this->getXpath()->query(
$this->getXpathPrefix() . '//atom:link[@rel="replies" and @type="text/html"]/@href'
);
@@ -446,7 +497,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
$link = null;
- $list = $this->_xpath->query(
+ $list = $this->getXpath()->query(
$this->getXpathPrefix() . '//atom:link[@rel="replies" and @type="application/'.$type.'+xml"]/@href'
);
@@ -461,6 +512,72 @@ class Zend_Feed_Reader_Extension_Atom_Entry
}
/**
+ * 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.
*/
@@ -485,35 +602,28 @@ class Zend_Feed_Reader_Extension_Atom_Entry
*/
protected function _getAuthor(DOMElement $element)
{
- $email = null;
- $name = null;
- $uri = null;
+ $author = array();
$emailNode = $element->getElementsByTagName('email');
$nameNode = $element->getElementsByTagName('name');
$uriNode = $element->getElementsByTagName('uri');
-
- if ($emailNode->length) {
- $email = $emailNode->item(0)->nodeValue;
+
+ if ($emailNode->length && strlen($emailNode->item(0)->nodeValue) > 0) {
+ $author['email'] = $emailNode->item(0)->nodeValue;
}
- if ($nameNode->length) {
- $name = $nameNode->item(0)->nodeValue;
+ if ($nameNode->length && strlen($nameNode->item(0)->nodeValue) > 0) {
+ $author['name'] = $nameNode->item(0)->nodeValue;
}
- if ($uriNode->length) {
- $uri = $uriNode->item(0)->nodeValue;
+ if ($uriNode->length && strlen($uriNode->item(0)->nodeValue) > 0) {
+ $author['uri'] = $uriNode->item(0)->nodeValue;
}
- if (!empty($email)) {
- return $email . (empty($name) ? '' : ' (' . $name . ')');
- } else if (!empty($name)) {
- return $name;
- } else if (!empty($uri)) {
- return $uri;
+ if (empty($author)) {
+ return null;
}
-
- return null;
+ return $author;
}
/**
@@ -521,18 +631,12 @@ class Zend_Feed_Reader_Extension_Atom_Entry
*/
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) {
+ switch ($this->_getAtomType()) {
case Zend_Feed_Reader::TYPE_ATOM_03:
- $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03);
+ $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03);
break;
default:
- $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10);
+ $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10);
break;
}
}
@@ -542,17 +646,16 @@ class Zend_Feed_Reader_Extension_Atom_Entry
*/
protected function _getAtomType()
{
- $nslist = $this->getDomDocument()->documentElement->attributes;
- if (!$nslist->length) {
- return null;
- }
- foreach ($nslist as $ns) {
- if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_10) {
- return Zend_Feed_Reader::TYPE_ATOM_10;
- }
- if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_03) {
- return Zend_Feed_Reader::TYPE_ATOM_03;
- }
+ $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/libs/Zend/Feed/Reader/Extension/Atom/Feed.php b/libs/Zend/Feed/Reader/Extension/Atom/Feed.php
index 4b1de87ed8..3e0e2079c5 100644
--- a/libs/Zend/Feed/Reader/Extension/Atom/Feed.php
+++ b/libs/Zend/Feed/Reader/Extension/Atom/Feed.php
@@ -14,33 +14,38 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Feed.php 18655 2009-10-20 14:17:39Z padraic $
+ * @version $Id: Feed.php 22301 2010-05-26 10:15:13Z padraic $
*/
/**
* @see Zend_Feed_Reader_Extension_FeedAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
/**
* @see Zend_Date
*/
-require_once 'Zend/Date.php';
+// require_once 'Zend/Date.php';
/**
* @see Zend_Uri
*/
-require_once 'Zend/Uri.php';
+// require_once 'Zend/Uri.php';
+
+/**
+ * @see Zend_Feed_Reader_Collection_Author
+ */
+// require_once 'Zend/Feed/Reader/Collection/Author.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_Atom_Feed
+class Zend_Feed_Reader_Extension_Atom_Feed
extends Zend_Feed_Reader_Extension_FeedAbstract
{
/**
@@ -71,38 +76,28 @@ class Zend_Feed_Reader_Extension_Atom_Feed
return $this->_data['authors'];
}
- $authors = $this->_xpath->query('//atom:author');
- $contributors = $this->_xpath->query('//atom:contributor');
+ $list = $this->_xpath->query('//atom:author');
- $people = array();
+ $authors = array();
- if ($authors->length) {
- foreach ($authors as $author) {
+ if ($list->length) {
+ foreach ($list as $author) {
$author = $this->_getAuthor($author);
-
if (!empty($author)) {
- $people[] = $author;
- }
- }
- }
-
- if ($contributors->length) {
- foreach ($contributors as $contributor) {
- $contributor = $this->_getAuthor($contributor);
-
- if (!empty($contributor)) {
- $people[] = $contributor;
+ $authors[] = $author;
}
}
}
- if (empty($people)) {
- $people = null;
+ if (count($authors) == 0) {
+ $authors = null;
} else {
- $people = array_unique($people);
+ $authors = new Zend_Feed_Reader_Collection_Author(
+ Zend_Feed_Reader::arrayUnique($authors)
+ );
}
- $this->_data['authors'] = $people;
+ $this->_data['authors'] = $authors;
return $this->_data['authors'];
}
@@ -236,8 +231,6 @@ class Zend_Feed_Reader_Extension_Atom_Feed
if (!$generator) {
$generator = null;
- } else {
- $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding());
}
$this->_data['generator'] = $generator;
@@ -245,7 +238,7 @@ class Zend_Feed_Reader_Extension_Atom_Feed
return $this->_data['generator'];
}
- /**
+ /**
* Get the feed ID
*
* @return string|null
@@ -298,7 +291,31 @@ class Zend_Feed_Reader_Extension_Atom_Feed
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 base URI of the feed (if set).
*
@@ -332,12 +349,12 @@ class Zend_Feed_Reader_Extension_Atom_Feed
}
$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);
@@ -369,6 +386,34 @@ class Zend_Feed_Reader_Extension_Atom_Feed
}
/**
+ * 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
@@ -389,8 +434,49 @@ class Zend_Feed_Reader_Extension_Atom_Feed
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
@@ -398,37 +484,30 @@ class Zend_Feed_Reader_Extension_Atom_Feed
*/
protected function _getAuthor(DOMElement $element)
{
- $email = null;
- $name = null;
- $uri = null;
+ $author = array();
$emailNode = $element->getElementsByTagName('email');
$nameNode = $element->getElementsByTagName('name');
$uriNode = $element->getElementsByTagName('uri');
-
- if ($emailNode->length) {
- $email = $emailNode->item(0)->nodeValue;
+
+ if ($emailNode->length && strlen($emailNode->item(0)->nodeValue) > 0) {
+ $author['email'] = $emailNode->item(0)->nodeValue;
}
- if ($nameNode->length) {
- $name = $nameNode->item(0)->nodeValue;
+ if ($nameNode->length && strlen($nameNode->item(0)->nodeValue) > 0) {
+ $author['name'] = $nameNode->item(0)->nodeValue;
}
- if ($uriNode->length) {
- $uri = $uriNode->item(0)->nodeValue;
+ if ($uriNode->length && strlen($uriNode->item(0)->nodeValue) > 0) {
+ $author['uri'] = $uriNode->item(0)->nodeValue;
}
- if (!empty($email)) {
- return $email . (empty($name) ? '' : ' (' . $name . ')');
- } else if (!empty($name)) {
- return $name;
- } else if (!empty($uri)) {
- return $uri;
+ if (empty($author)) {
+ return null;
}
-
- 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.
@@ -451,7 +530,7 @@ class Zend_Feed_Reader_Extension_Atom_Feed
*/
protected function _registerNamespaces()
{
- if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10
+ if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10
|| $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03
) {
return; // pre-registered at Feed level
@@ -472,17 +551,16 @@ class Zend_Feed_Reader_Extension_Atom_Feed
*/
protected function _getAtomType()
{
- $nslist = $this->getDomDocument()->documentElement->attributes;
- if (!$nslist->length) {
- return null;
- }
- foreach ($nslist as $ns) {
- if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_10) {
- return Zend_Feed_Reader::TYPE_ATOM_10;
- }
- if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_03) {
- return Zend_Feed_Reader::TYPE_ATOM_03;
- }
+ $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/libs/Zend/Feed/Reader/Extension/Content/Entry.php b/libs/Zend/Feed/Reader/Extension/Content/Entry.php
index 7145281ecb..ca10f24a3b 100644
--- a/libs/Zend/Feed/Reader/Extension/Content/Entry.php
+++ b/libs/Zend/Feed/Reader/Extension/Content/Entry.php
@@ -14,43 +14,40 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Entry.php 22301 2010-05-26 10:15:13Z padraic $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_Entry_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_Content_Entry
+class Zend_Feed_Reader_Extension_Content_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
public function getContent()
{
- if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10
+ if ($this->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)');
}
- if ($content) {
- $content = html_entity_decode($content, ENT_QUOTES, $this->getEncoding());
- }
return $content;
}
diff --git a/libs/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php b/libs/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php
index b9830089d3..5e78db10ab 100644
--- a/libs/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php
+++ b/libs/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php
@@ -14,25 +14,25 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader_Extension_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
/**
* @see Zend_Feed_Reader_Extension_CreativeCommons_Feed
*/
-require_once 'Zend/Feed/Reader/Extension/CreativeCommons/Feed.php';
+// require_once 'Zend/Feed/Reader/Extension/CreativeCommons/Feed.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_CreativeCommons_Entry extends Zend_Feed_Reader_Extension_EntryAbstract
diff --git a/libs/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php b/libs/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php
index c3d0cd2d42..3d29c6911f 100644
--- a/libs/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php
+++ b/libs/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php
@@ -14,23 +14,23 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Feed.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader_Extension_FeedAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_CreativeCommons_Feed
+class Zend_Feed_Reader_Extension_CreativeCommons_Feed
extends Zend_Feed_Reader_Extension_FeedAbstract
{
/**
diff --git a/libs/Zend/Feed/Reader/Extension/DublinCore/Entry.php b/libs/Zend/Feed/Reader/Extension/DublinCore/Entry.php
index 522e2c1498..4ad104b6ff 100644
--- a/libs/Zend/Feed/Reader/Extension/DublinCore/Entry.php
+++ b/libs/Zend/Feed/Reader/Extension/DublinCore/Entry.php
@@ -14,33 +14,33 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 16711 2009-07-14 16:10:54Z matthew $
+ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_Extension_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
/**
* @see Zend_Date
*/
-require_once 'Zend/Date.php';
+// require_once 'Zend/Date.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_DublinCore_Entry
+class Zend_Feed_Reader_Extension_DublinCore_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**
@@ -87,22 +87,56 @@ class Zend_Feed_Reader_Extension_DublinCore_Entry
if ($list->length) {
foreach ($list as $author) {
- if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20
- && preg_match("/\(([^\)]+)\)/", $author->nodeValue, $matches, PREG_OFFSET_CAPTURE)
- ) {
- $authors[] = $matches[1][0];
- } else {
- $authors[] = $author->nodeValue;
- }
+ $authors[] = array(
+ 'name' => $author->nodeValue
+ );
}
-
- $authors = array_unique($authors);
+ $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
diff --git a/libs/Zend/Feed/Reader/Extension/DublinCore/Feed.php b/libs/Zend/Feed/Reader/Extension/DublinCore/Feed.php
index 68078578b2..4e4bcf4888 100644
--- a/libs/Zend/Feed/Reader/Extension/DublinCore/Feed.php
+++ b/libs/Zend/Feed/Reader/Extension/DublinCore/Feed.php
@@ -14,31 +14,36 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Feed.php 16711 2009-07-14 16:10:54Z matthew $
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader_Extension_FeedAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
/**
* @see Zend_Date
*/
-require_once 'Zend/Date.php';
+// require_once 'Zend/Date.php';
+
+/**
+ * @see Zend_Feed_Reader_Collection_Author
+ */
+// require_once 'Zend/Feed/Reader/Collection/Author.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_DublinCore_Feed
+class Zend_Feed_Reader_Extension_DublinCore_Feed
extends Zend_Feed_Reader_Extension_FeedAbstract
{
- /**
+ /**
* Get a single author
*
* @param int $index
@@ -79,13 +84,18 @@ class Zend_Feed_Reader_Extension_DublinCore_Feed
$list = $this->_xpath->query('//dc10:publisher');
}
}
-
- foreach ($list as $authorObj) {
- $authors[] = $authorObj->nodeValue;
- }
-
- if (!empty($authors)) {
- $authors = array_unique($authors);
+
+ 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;
@@ -251,6 +261,40 @@ class Zend_Feed_Reader_Extension_DublinCore_Feed
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
diff --git a/libs/Zend/Feed/Reader/Extension/EntryAbstract.php b/libs/Zend/Feed/Reader/Extension/EntryAbstract.php
index 68ae193cf7..299c1bfbaf 100644
--- a/libs/Zend/Feed/Reader/Extension/EntryAbstract.php
+++ b/libs/Zend/Feed/Reader/Extension/EntryAbstract.php
@@ -14,15 +14,15 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: EntryAbstract.php 16711 2009-07-14 16:10:54Z matthew $
+ * @version $Id: EntryAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Feed_Reader_Extension_EntryAbstract
@@ -86,14 +86,14 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
if (!is_null($type)) {
$this->_data['type'] = $type;
} else {
- $this->_data['type'] = Zend_Feed_Reader::detectType($feed);
+ $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
+ 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
+ } elseif ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10
|| $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03
) {
$this->setXpathPrefix('//atom:entry[' . ($this->_entryKey+1) . ']');
@@ -123,7 +123,7 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
return $assumed;
}
- /**
+ /**
* Get the entry type
*
* @return string
@@ -153,6 +153,9 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
*/
public function getXpath()
{
+ if (!$this->_xpath) {
+ $this->setXpath(new DOMXPath($this->getDomDocument()));
+ }
return $this->_xpath;
}
@@ -178,8 +181,8 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
/**
* Set the XPath prefix
- *
- * @param string $prefix
+ *
+ * @param string $prefix
* @return Zend_Feed_Reader_Extension_EntryAbstract
*/
public function setXpathPrefix($prefix)
@@ -190,7 +193,7 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
/**
* Register XML namespaces
- *
+ *
* @return void
*/
protected abstract function _registerNamespaces();
diff --git a/libs/Zend/Feed/Reader/Extension/FeedAbstract.php b/libs/Zend/Feed/Reader/Extension/FeedAbstract.php
index 973dd81197..23d97d3f7a 100644
--- a/libs/Zend/Feed/Reader/Extension/FeedAbstract.php
+++ b/libs/Zend/Feed/Reader/Extension/FeedAbstract.php
@@ -14,36 +14,36 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: FeedAbstract.php 16711 2009-07-14 16:10:54Z matthew $
+ * @version $Id: FeedAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_Entry_Atom
*/
-require_once 'Zend/Feed/Reader/Entry/Atom.php';
+// require_once 'Zend/Feed/Reader/Entry/Atom.php';
/**
* @see Zend_Feed_Reader_Entry_Rss
*/
-require_once 'Zend/Feed/Reader/Entry/Rss.php';
+// require_once 'Zend/Feed/Reader/Entry/Rss.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Feed_Reader_Extension_FeedAbstract
{
- /**
+ /**
* Parsed feed data
*
* @var array
@@ -139,10 +139,33 @@ abstract class Zend_Feed_Reader_Extension_FeedAbstract
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
+ *
+ * @return string
*/
public function getXpathPrefix()
{
diff --git a/libs/Zend/Feed/Reader/Extension/Podcast/Entry.php b/libs/Zend/Feed/Reader/Extension/Podcast/Entry.php
index 7af2285421..bbe340ce63 100644
--- a/libs/Zend/Feed/Reader/Extension/Podcast/Entry.php
+++ b/libs/Zend/Feed/Reader/Extension/Podcast/Entry.php
@@ -14,25 +14,25 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 16792 2009-07-17 02:52:37Z norm2782 $
+ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_Extension_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_Podcast_Entry extends Zend_Feed_Reader_Extension_EntryAbstract
diff --git a/libs/Zend/Feed/Reader/Extension/Podcast/Feed.php b/libs/Zend/Feed/Reader/Extension/Podcast/Feed.php
index b213d34590..c4ea180f7c 100644
--- a/libs/Zend/Feed/Reader/Extension/Podcast/Feed.php
+++ b/libs/Zend/Feed/Reader/Extension/Podcast/Feed.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Feed.php 16792 2009-07-17 02:52:37Z norm2782 $
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader_Extension_FeedAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_Podcast_Feed extends Zend_Feed_Reader_Extension_FeedAbstract
diff --git a/libs/Zend/Feed/Reader/Extension/Slash/Entry.php b/libs/Zend/Feed/Reader/Extension/Slash/Entry.php
index b2aa12457b..222c0e1062 100644
--- a/libs/Zend/Feed/Reader/Extension/Slash/Entry.php
+++ b/libs/Zend/Feed/Reader/Extension/Slash/Entry.php
@@ -14,28 +14,28 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_Extension_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_Slash_Entry
+class Zend_Feed_Reader_Extension_Slash_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**
diff --git a/libs/Zend/Feed/Reader/Extension/Syndication/Feed.php b/libs/Zend/Feed/Reader/Extension/Syndication/Feed.php
index bd205bcf61..5b383cfedb 100644
--- a/libs/Zend/Feed/Reader/Extension/Syndication/Feed.php
+++ b/libs/Zend/Feed/Reader/Extension/Syndication/Feed.php
@@ -14,25 +14,25 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Feed.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader_Extension_FeedAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
-require_once 'Zend/Date.php';
+// require_once 'Zend/Date.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_Syndication_Feed
+class Zend_Feed_Reader_Extension_Syndication_Feed
extends Zend_Feed_Reader_Extension_FeedAbstract
{
/**
@@ -57,7 +57,7 @@ class Zend_Feed_Reader_Extension_Syndication_Feed
case 'yearly':
return $period;
default:
- throw new Zend_Feed_Exception("Feed specified invalid update period: '$period'."
+ throw new Zend_Feed_Exception("Feed specified invalid update period: '$period'."
. " Must be one of hourly, daily, weekly or yearly"
);
}
@@ -100,13 +100,13 @@ class Zend_Feed_Reader_Extension_Syndication_Feed
switch ($period)
{
//intentional fall through
- case 'yearly':
+ case 'yearly':
$ticks *= 52; //TODO: fix generalisation, how?
- case 'weekly':
+ case 'weekly':
$ticks *= 7;
- case 'daily':
+ case 'daily':
$ticks *= 24;
- case 'hourly':
+ case 'hourly':
$ticks *= 3600;
break;
default: //Never arrive here, exception thrown in getPeriod()
diff --git a/libs/Zend/Feed/Reader/Extension/Thread/Entry.php b/libs/Zend/Feed/Reader/Extension/Thread/Entry.php
index c8b632726c..e8a4bde92f 100644
--- a/libs/Zend/Feed/Reader/Extension/Thread/Entry.php
+++ b/libs/Zend/Feed/Reader/Extension/Thread/Entry.php
@@ -14,28 +14,28 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader_Extension_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_Thread_Entry
+class Zend_Feed_Reader_Extension_Thread_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**
* Get the "in-reply-to" value
- *
+ *
* @return string
*/
public function getInReplyTo()
diff --git a/libs/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php b/libs/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php
index 8c96f6e316..fe47448338 100644
--- a/libs/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php
+++ b/libs/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php
@@ -14,28 +14,28 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Feed_Reader_Extension_EntryAbstract
*/
-require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
+// require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Feed_Reader_Extension_WellFormedWeb_Entry
+class Zend_Feed_Reader_Extension_WellFormedWeb_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**
diff --git a/libs/Zend/Feed/Reader/Feed/Atom.php b/libs/Zend/Feed/Reader/Feed/Atom.php
index 0256e36122..8199355995 100644
--- a/libs/Zend/Feed/Reader/Feed/Atom.php
+++ b/libs/Zend/Feed/Reader/Feed/Atom.php
@@ -14,25 +14,25 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Atom.php 18655 2009-10-20 14:17:39Z padraic $
+ * @version $Id: Atom.php 22108 2010-05-05 13:44:11Z padraic $
*/
/**
* @see Zend_Feed_Reader_FeedAbstract
*/
-require_once 'Zend/Feed/Reader/FeedAbstract.php';
+// require_once 'Zend/Feed/Reader/FeedAbstract.php';
/**
* @see Zend_Feed_Reader_Extension_Atom_Feed
*/
-require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php';
+// require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
@@ -41,15 +41,16 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
/**
* Constructor
*
- * @param Zend_Feed_Abstract $feed
+ * @param DOMDocument $dom
* @param string $type
- * @param string $xpath
*/
- public function __construct(DomDocument $dom, $type = null)
+ public function __construct(DOMDocument $dom, $type = null)
{
parent::__construct($dom, $type);
$atomClass = Zend_Feed_Reader::getPluginLoader()->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');
}
@@ -83,9 +84,9 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
return $this->_data['authors'];
}
- $people = $this->getExtension('Atom')->getAuthors();
+ $authors = $this->getExtension('Atom')->getAuthors();
- $this->_data['authors'] = $people;
+ $this->_data['authors'] = $authors;
return $this->_data['authors'];
}
@@ -157,6 +158,16 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
}
/**
+ * 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
@@ -196,7 +207,7 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
return $this->_data['generator'];
}
- /**
+ /**
* Get the feed ID
*
* @return string|null
@@ -239,7 +250,7 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
return $this->_data['language'];
}
-
+
/**
* Get a link to the source website
*
@@ -277,6 +288,24 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
}
/**
+ * 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
@@ -289,6 +318,10 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
$link = $this->getExtension('Atom')->getFeedLink();
+ if (is_null($link) || empty($link)) {
+ $link = $this->getOriginalSourceUri();
+ }
+
$this->_data['feedlink'] = $link;
return $this->_data['feedlink'];
@@ -312,9 +345,50 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
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()
{
diff --git a/libs/Zend/Feed/Reader/Feed/Atom/Source.php b/libs/Zend/Feed/Reader/Feed/Atom/Source.php
new file mode 100644
index 0000000000..bdd972f93e
--- /dev/null
+++ b/libs/Zend/Feed/Reader/Feed/Atom/Source.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Atom.php 19165 2009-11-21 16:46:40Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Reader_Feed_Atom
+ */
+// require_once 'Zend/Feed/Reader/Feed/Atom.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Reader_Feed_Atom_Source extends Zend_Feed_Reader_Feed_Atom
+{
+
+ /**
+ * Constructor: Create a Source object which is largely just a normal
+ * Zend_Feed_Reader_FeedAbstract object only designed to retrieve feed level
+ * metadata from an Atom entry's source element.
+ *
+ * @param DOMElement $source
+ * @param string $xpathPrefix Passed from parent Entry object
+ * @param string $type Nearly always Atom 1.0
+ */
+ public function __construct(DOMElement $source, $xpathPrefix, $type = Zend_Feed_Reader::TYPE_ATOM_10)
+ {
+ $this->_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/libs/Zend/Feed/Reader/Feed/Rss.php b/libs/Zend/Feed/Reader/Feed/Rss.php
index 2dc2ec86f4..bff78c3455 100644
--- a/libs/Zend/Feed/Reader/Feed/Rss.php
+++ b/libs/Zend/Feed/Reader/Feed/Rss.php
@@ -14,35 +14,40 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Rss.php 18367 2009-09-22 14:55:59Z padraic $
+ * @version $Id: Rss.php 22301 2010-05-26 10:15:13Z padraic $
*/
/**
* @see Zend_Feed_Reader_FeedAbstract
*/
-require_once 'Zend/Feed/Reader/FeedAbstract.php';
+// require_once 'Zend/Feed/Reader/FeedAbstract.php';
/**
* @see Zend_feed_Reader_Extension_Atom_Feed
*/
-require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php';
+// require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php';
/**
* @see Zend_Feed_Reader_Extension_DublinCore_Feed
*/
-require_once 'Zend/Feed/Reader/Extension/DublinCore/Feed.php';
+// require_once 'Zend/Feed/Reader/Extension/DublinCore/Feed.php';
/**
* @see Zend_Date
*/
-require_once 'Zend/Date.php';
+// require_once 'Zend/Date.php';
+
+/**
+ * @see Zend_Feed_Reader_Collection_Author
+ */
+// require_once 'Zend/Feed/Reader/Collection/Author.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
@@ -51,9 +56,8 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
/**
* Constructor
*
- * @param Zend_Feed_Abstract $feed
+ * @param DOMDocument $dom
* @param string $type
- * @param string $xpath
*/
public function __construct(DomDocument $dom, $type = null)
{
@@ -74,7 +78,7 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
}
}
- /**
+ /**
* Get a single author
*
* @param int $index
@@ -101,33 +105,54 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
if (array_key_exists('authors', $this->_data)) {
return $this->_data['authors'];
}
-
+
$authors = array();
-
- if (empty($authors)) {
- $authors = $this->getExtension('DublinCore')->getAuthors();
- }
-
- if (empty($authors)) {
- 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');
+ $authors_dc = $this->getExtension('DublinCore')->getAuthors();
+ if (!empty($authors_dc)) {
+ foreach ($authors_dc as $author) {
+ $authors[] = array(
+ 'name' => $author['name']
+ );
}
+ }
- foreach ($list as $authorObj) {
- $authors[] = $authorObj->nodeValue;
+ /**
+ * 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 (empty($authors)) {
+ if (count($authors) == 0) {
$authors = $this->getExtension('Atom')->getAuthors();
+ } else {
+ $authors = new Zend_Feed_Reader_Collection_Author(
+ Zend_Feed_Reader::arrayUnique($authors)
+ );
}
- if (empty($authors)) {
+ if (count($authors) == 0) {
$authors = null;
- } else {
- $authors = array_unique($authors);
}
$this->_data['authors'] = $authors;
@@ -170,7 +195,7 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
return $this->_data['copyright'];
}
- /**
+ /**
* Get the feed creation date
*
* @return string|null
@@ -201,21 +226,27 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
$dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)');
}
if ($dateModified) {
- $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) {
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception(
- 'Could not load date due to unrecognised'
- .' format (should follow RFC 822 or 2822):'
- . $e->getMessage()
- );
+ $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) {
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception(
+ 'Could not load date due to unrecognised'
+ .' format (should follow RFC 822 or 2822):'
+ . $e->getMessage(),
+ 0, $e
+ );
+ }
}
}
}
@@ -240,6 +271,60 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
}
/**
+ * 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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
@@ -318,6 +403,60 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
}
/**
+ * 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
@@ -404,8 +543,8 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
$link = $this->getExtension('Atom')->getFeedLink();
- if (!$link) {
- $link = null;
+ if (is_null($link) || empty($link)) {
+ $link = $this->getOriginalSourceUri();
}
$this->_data['feedlink'] = $link;
@@ -438,9 +577,6 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
} else {
$generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)');
}
- if ($generator) {
- $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding());
- }
}
if (empty($generator)) {
@@ -493,7 +629,71 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
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
*
*/
diff --git a/libs/Zend/Feed/Reader/FeedAbstract.php b/libs/Zend/Feed/Reader/FeedAbstract.php
index 1e8da71726..bda9f23b46 100644
--- a/libs/Zend/Feed/Reader/FeedAbstract.php
+++ b/libs/Zend/Feed/Reader/FeedAbstract.php
@@ -14,41 +14,30 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: FeedAbstract.php 16966 2009-07-22 15:22:18Z padraic $
+ * @version $Id: FeedAbstract.php 22093 2010-05-04 12:55:06Z padraic $
*/
/**
* @see Zend_Feed_Reader
*/
-require_once 'Zend/Feed/Reader.php';
-
-/**
- * @see Zend_Feed_Reader_Entry_Atom
- */
-require_once 'Zend/Feed/Reader/Entry/Atom.php';
-
-
-/**
- * @see Zend_Feed_Reader_Entry_Rss
- */
-require_once 'Zend/Feed/Reader/Entry/Rss.php';
+// require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_feed_Reader_FeedInterface
*/
-require_once 'Zend/Feed/Reader/FeedInterface.php';
+// require_once 'Zend/Feed/Reader/FeedInterface.php';
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInterface
{
- /**
+ /**
* Parsed feed data
*
* @var array
@@ -83,9 +72,21 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
*/
protected $_xpath = null;
+ /**
+ * Array of loaded extensions
+ *
+ * @var array
+ */
protected $_extensions = array();
/**
+ * Original Source URI (set if imported from a URI)
+ *
+ * @var string
+ */
+ protected $_originalSourceUri = null;
+
+ /**
* Constructor
*
* @param DomDocument The DOM object for the feed's XML
@@ -106,7 +107,30 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
$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.
*
@@ -117,10 +141,10 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
return count($this->_entries);
}
- /**
+ /**
* Return the current entry
*
- * @return Zend_Feed_Reader_Entry_Interface
+ * @return Zend_Feed_Reader_EntryInterface
*/
public function current()
{
@@ -153,6 +177,9 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
public function getEncoding()
{
$assumed = $this->getDomDocument()->encoding;
+ if (empty($assumed)) {
+ $assumed = 'UTF-8';
+ }
return $assumed;
}
@@ -196,7 +223,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
return $this->_data['type'];
}
- /**
+ /**
* Return the current feed key
*
* @return unknown
@@ -206,7 +233,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
return $this->_entriesKey;
}
- /**
+ /**
* Move the feed pointer forward
*
*/
@@ -225,16 +252,6 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
}
/**
- * Return the feed as an array
- *
- * @return array
- */
- public function toArray() // untested
- {
- return $this->_data;
- }
-
- /**
* Check to see if the iterator is still valid
*
* @return boolean
@@ -256,7 +273,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
return call_user_func_array(array($extension, $method), $args);
}
}
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Method: ' . $method
. 'does not exist and could not be located on a registered Extension');
}
diff --git a/libs/Zend/Feed/Reader/FeedInterface.php b/libs/Zend/Feed/Reader/FeedInterface.php
index 3278f3ea75..35060bafce 100644
--- a/libs/Zend/Feed/Reader/FeedInterface.php
+++ b/libs/Zend/Feed/Reader/FeedInterface.php
@@ -14,15 +14,15 @@
*
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: FeedInterface.php 16953 2009-07-22 11:57:25Z padraic $
+ * @version $Id: FeedInterface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Feed_Reader
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Feed_Reader_FeedInterface extends Iterator, Countable
@@ -111,5 +111,12 @@ interface Zend_Feed_Reader_FeedInterface extends Iterator, Countable
* @return string|null
*/
public function getTitle();
+
+ /**
+ * Get all categories
+ *
+ * @return Zend_Feed_Reader_Collection_Category
+ */
+ public function getCategories();
}
diff --git a/libs/Zend/Feed/Reader/FeedSet.php b/libs/Zend/Feed/Reader/FeedSet.php
new file mode 100644
index 0000000000..57ccbf6056
--- /dev/null
+++ b/libs/Zend/Feed/Reader/FeedSet.php
@@ -0,0 +1,148 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: FeedSet.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @see Zend_Feed_Reader
+ */
+// require_once 'Zend/Feed/Reader.php';
+
+/**
+ * @see Zend_Uri
+ */
+// require_once 'Zend/Uri.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Reader
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Reader_FeedSet extends ArrayObject
+{
+
+ public $rss = null;
+
+ public $rdf = null;
+
+ public $atom = null;
+
+ /**
+ * Import a DOMNodeList from any document containing a set of links
+ * for alternate versions of a document, which will normally refer to
+ * RSS/RDF/Atom feeds for the current document.
+ *
+ * All such links are stored internally, however the first instance of
+ * each RSS, RDF or Atom type has its URI stored as a public property
+ * as a shortcut where the use case is simply to get a quick feed ref.
+ *
+ * Note that feeds are not loaded at this point, but will be lazy
+ * loaded automatically when each links 'feed' array key is accessed.
+ *
+ * @param DOMNodeList $links
+ * @param string $uri
+ * @return void
+ */
+ public function addLinks(DOMNodeList $links, $uri)
+ {
+ foreach ($links as $link) {
+ if (strtolower($link->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 (!is_null($uri)) {
+ $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/libs/Zend/Feed/Rss.php b/libs/Zend/Feed/Rss.php
index 351dcdf2e5..19eaa8ec19 100644
--- a/libs/Zend/Feed/Rss.php
+++ b/libs/Zend/Feed/Rss.php
@@ -15,21 +15,21 @@
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Rss.php 18266 2009-09-18 18:32:30Z padraic $
+ * @version $Id: Rss.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Feed_Abstract
*/
-require_once 'Zend/Feed/Abstract.php';
+// require_once 'Zend/Feed/Abstract.php';
/**
* @see Zend_Feed_Entry_Rss
*/
-require_once 'Zend/Feed/Entry/Rss.php';
+// require_once 'Zend/Feed/Entry/Rss.php';
/**
@@ -43,7 +43,7 @@ require_once 'Zend/Feed/Entry/Rss.php';
*
* @category Zend
* @package Zend_Feed
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Rss extends Zend_Feed_Abstract
@@ -82,7 +82,7 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
// 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);
+ $this->_element = $rdfTags->item(0);
} else {
$this->_element = $this->_element->getElementsByTagName('channel')->item(0);
}
@@ -90,7 +90,7 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('No root <channel> element found, cannot parse channel.');
}
@@ -282,11 +282,12 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
$author = '';
$email = '';
if (isset($array->itunes->owner)) {
- if (isset($array->itunes->owner['name'])) {
- $author = $array->itunes->owner['name'];
+ $itunesOwner = $array->itunes->owner;
+ if (isset($itunesOwner['name'])) {
+ $author = $itunesOwner['name'];
}
- if (isset($array->itunes->owner['email'])) {
- $email = $array->itunes->owner['email'];
+ if (isset($itunesOwner['email'])) {
+ $email = $itunesOwner['email'];
}
}
if (empty($author) && isset($array->author)) {
@@ -411,6 +412,9 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
if (isset($dataentry->guid)) {
$guid = $this->_element->createElement('guid', $dataentry->guid);
+ if (!Zend_Uri::check($dataentry->guid)) {
+ $guid->setAttribute('isPermaLink', 'false');
+ }
$item->appendChild($guid);
}
@@ -514,7 +518,7 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
/**
* @see Zend_Feed_Exception
*/
- require_once 'Zend/Feed/Exception.php';
+ // require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Cannot send RSS because headers have already been sent.');
}
diff --git a/libs/Zend/Feed/Writer.php b/libs/Zend/Feed/Writer.php
new file mode 100644
index 0000000000..1a40f63cd9
--- /dev/null
+++ b/libs/Zend/Feed/Writer.php
@@ -0,0 +1,267 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Writer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer
+{
+ /**
+ * Namespace constants
+ */
+ const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#';
+ const NAMESPACE_ATOM_10 = 'http://www.w3.org/2005/Atom';
+ const NAMESPACE_RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
+ const NAMESPACE_RSS_090 = 'http://my.netscape.com/rdf/simple/0.9/';
+ const NAMESPACE_RSS_10 = 'http://purl.org/rss/1.0/';
+
+ /**
+ * Feed type constants
+ */
+ const TYPE_ANY = 'any';
+ const TYPE_ATOM_03 = 'atom-03';
+ const TYPE_ATOM_10 = 'atom-10';
+ const TYPE_ATOM_ANY = 'atom';
+ const TYPE_RSS_090 = 'rss-090';
+ const TYPE_RSS_091 = 'rss-091';
+ const TYPE_RSS_091_NETSCAPE = 'rss-091n';
+ const TYPE_RSS_091_USERLAND = 'rss-091u';
+ const TYPE_RSS_092 = 'rss-092';
+ const TYPE_RSS_093 = 'rss-093';
+ const TYPE_RSS_094 = 'rss-094';
+ const TYPE_RSS_10 = 'rss-10';
+ const TYPE_RSS_20 = 'rss-20';
+ const TYPE_RSS_ANY = 'rss';
+
+ /**
+ * PluginLoader instance used by component
+ *
+ * @var Zend_Loader_PluginLoader_Interface
+ */
+ protected static $_pluginLoader = null;
+
+ /**
+ * Path on which to search for Extension classes
+ *
+ * @var array
+ */
+ protected static $_prefixPaths = array();
+
+ /**
+ * Array of registered extensions by class postfix (after the base class
+ * name) across four categories - data containers and renderers for entry
+ * and feed levels.
+ *
+ * @var array
+ */
+ protected static $_extensions = array(
+ 'entry' => 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)) {
+ // require_once 'Zend/Loader/PluginLoader.php';
+ 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)
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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/libs/Zend/Feed/Writer/Deleted.php b/libs/Zend/Feed/Writer/Deleted.php
new file mode 100644
index 0000000000..19bb56b49e
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Deleted.php
@@ -0,0 +1,202 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+// require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php';
+
+ /**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Deleted
+{
+
+ /**
+ * Internal array containing all data associated with this entry or item.
+ *
+ * @var array
+ */
+ protected $_data = array();
+
+ /**
+ * Holds the value "atom" or "rss" depending on the feed type set when
+ * when last exported.
+ *
+ * @var string
+ */
+ protected $_type = null;
+
+ /**
+ * Set the feed character encoding
+ *
+ * @return string|null
+ */
+ public function setEncoding($encoding)
+ {
+ if (empty($encoding) || !is_string($encoding)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'];
+ }
+
+ /**
+ * 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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 (is_null($date)) {
+ $zdate = new Zend_Date;
+ } elseif (ctype_digit($date) && strlen($date) == 10) {
+ $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
+ } elseif ($date instanceof Zend_Date) {
+ $zdate = $date;
+ } else {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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/libs/Zend/Feed/Writer/Entry.php b/libs/Zend/Feed/Writer/Entry.php
new file mode 100644
index 0000000000..01d290e6fb
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Entry.php
@@ -0,0 +1,761 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Entry.php 22065 2010-04-30 14:04:57Z padraic $
+ */
+
+/**
+ * @see Zend_Date
+ */
+// require_once 'Zend/Date.php';
+
+/**
+ * @see Zend_Date
+ */
+// require_once 'Zend/Uri.php';
+
+// require_once 'Zend/Feed/Writer/Source.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Entry
+{
+
+ /**
+ * Internal array containing all data associated with this entry or item.
+ *
+ * @var array
+ */
+ protected $_data = array();
+
+ /**
+ * Registered extensions
+ *
+ * @var array
+ */
+ protected $_extensions = array();
+
+ /**
+ * Holds the value "atom" or "rss" depending on the feed type set when
+ * when last exported.
+ *
+ * @var string
+ */
+ protected $_type = null;
+
+ /**
+ * Constructor: Primarily triggers the registration of core extensions and
+ * loads those appropriate to this data container.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ Zend_Feed_Writer::registerCoreExtensions();
+ $this->_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'])
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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['name']) || !is_string($name['name'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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 (is_null($date)) {
+ $zdate = new Zend_Date;
+ } elseif (ctype_digit($date) && strlen($date) == 10) {
+ $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
+ } elseif ($date instanceof Zend_Date) {
+ $zdate = $date;
+ } else {
+ // require_once 'Zend/Feed/Exception.php';
+ 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 (is_null($date)) {
+ $zdate = new Zend_Date;
+ } elseif (ctype_digit($date) && strlen($date) == 10) {
+ $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
+ } elseif ($date instanceof Zend_Date) {
+ $zdate = $date;
+ } else {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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 (empty($count) || !is_numeric($count) || (int) $count < 0) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'))) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception('Enclosure "uri" is not set');
+ }
+ if (!Zend_Uri::check($enclosure['uri'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ }
+ }
+ // require_once 'Zend/Feed/Exception.php';
+ 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/libs/Zend/Feed/Writer/Exception/InvalidMethodException.php b/libs/Zend/Feed/Writer/Exception/InvalidMethodException.php
new file mode 100644
index 0000000000..4510f12b68
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Exception/InvalidMethodException.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: InvalidMethodException.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+
+/**
+ * @see Zend_Feed_Exception
+ */
+// require_once 'Zend/Feed/Exception.php';
+
+
+/**
+ * Feed exceptions
+ *
+ * Class to represent exceptions that occur during Feed operations.
+ *
+ * @category Zend
+ * @package Zend_Feed
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Exception_InvalidMethodException extends Zend_Exception
+{}
diff --git a/libs/Zend/Feed/Writer/Extension/Atom/Renderer/Feed.php b/libs/Zend/Feed/Writer/Extension/Atom/Renderer/Feed.php
new file mode 100644
index 0000000000..588a57af66
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/Atom/Renderer/Feed.php
@@ -0,0 +1,123 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Feed.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_Atom_Renderer_Feed
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render feed
+ *
+ * @return void
+ */
+ public function render()
+ {
+ /**
+ * RSS 2.0 only. Used mainly to include Atom links and
+ * Pubsubhubbub Hub endpoint URIs under the Atom namespace
+ */
+ if (strtolower($this->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/libs/Zend/Feed/Writer/Extension/Content/Renderer/Entry.php b/libs/Zend/Feed/Writer/Extension/Content/Renderer/Entry.php
new file mode 100644
index 0000000000..0036c6325e
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/Content/Renderer/Entry.php
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Entry.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_Content_Renderer_Entry
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render entry
+ *
+ * @return void
+ */
+ public function render()
+ {
+ if (strtolower($this->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/libs/Zend/Feed/Writer/Extension/DublinCore/Renderer/Entry.php b/libs/Zend/Feed/Writer/Extension/DublinCore/Renderer/Entry.php
new file mode 100644
index 0000000000..c433ea3a6c
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/DublinCore/Renderer/Entry.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Entry.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_DublinCore_Renderer_Entry
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render entry
+ *
+ * @return void
+ */
+ public function render()
+ {
+ if (strtolower($this->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/libs/Zend/Feed/Writer/Extension/DublinCore/Renderer/Feed.php b/libs/Zend/Feed/Writer/Extension/DublinCore/Renderer/Feed.php
new file mode 100644
index 0000000000..e1a0105019
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/DublinCore/Renderer/Feed.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Feed.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_DublinCore_Renderer_Feed
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render feed
+ *
+ * @return void
+ */
+ public function render()
+ {
+ if (strtolower($this->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/libs/Zend/Feed/Writer/Extension/ITunes/Entry.php b/libs/Zend/Feed/Writer/Extension/ITunes/Entry.php
new file mode 100644
index 0000000000..1d7fbc5070
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/ITunes/Entry.php
@@ -0,0 +1,242 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_ITunes_Entry
+{
+ /**
+ * Array of Feed data for rendering by Extension's renderers
+ *
+ * @var array
+ */
+ protected $_data = array();
+
+ /**
+ * Encoding of all text values
+ *
+ * @var string
+ */
+ protected $_encoding = 'UTF-8';
+
+ /**
+ * Set feed encoding
+ *
+ * @param string $enc
+ * @return Zend_Feed_Writer_Extension_ITunes_Entry
+ */
+ public function setEncoding($enc)
+ {
+ $this->_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) {
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception('invalid parameter: "block" may only'
+ . ' contain alphabetic characters');
+ }
+ if (iconv_strlen($value, $this->getEncoding()) > 255) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'))) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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))
+ ) {
+ // require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php';
+ 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/libs/Zend/Feed/Writer/Extension/ITunes/Feed.php b/libs/Zend/Feed/Writer/Extension/ITunes/Feed.php
new file mode 100644
index 0000000000..caf0440a03
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/ITunes/Feed.php
@@ -0,0 +1,361 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_ITunes_Feed
+{
+ /**
+ * Array of Feed data for rendering by Extension's renderers
+ *
+ * @var array
+ */
+ protected $_data = array();
+
+ /**
+ * Encoding of all text values
+ *
+ * @var string
+ */
+ protected $_encoding = 'UTF-8';
+
+ /**
+ * Set feed encoding
+ *
+ * @param string $enc
+ * @return Zend_Feed_Writer_Extension_ITunes_Feed
+ */
+ public function setEncoding($enc)
+ {
+ $this->_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) {
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception('invalid parameter: "block" may only'
+ . ' contain alphabetic characters');
+ }
+ if (iconv_strlen($value, $this->getEncoding()) > 255) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception('invalid parameter: "image" may only'
+ . ' be a valid URI/IRI');
+ }
+ if (!in_array(substr($value, -3), array('jpg','png'))) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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_Feed
+ */
+ public function setItunesExplicit($value)
+ {
+ if (!in_array($value, array('yes','no','clean'))) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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))
+ ) {
+ // require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php';
+ 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/libs/Zend/Feed/Writer/Extension/ITunes/Renderer/Entry.php b/libs/Zend/Feed/Writer/Extension/ITunes/Renderer/Entry.php
new file mode 100644
index 0000000000..046cb546fb
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/ITunes/Renderer/Entry.php
@@ -0,0 +1,216 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Entry.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_ITunes_Renderer_Entry
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render entry
+ *
+ * @return void
+ */
+ public function render()
+ {
+ $this->_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 (is_null($block)) {
+ 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 (is_null($explicit)) {
+ 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/libs/Zend/Feed/Writer/Extension/ITunes/Renderer/Feed.php b/libs/Zend/Feed/Writer/Extension/ITunes/Renderer/Feed.php
new file mode 100644
index 0000000000..192d19ec42
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/ITunes/Renderer/Feed.php
@@ -0,0 +1,320 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Feed.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_ITunes_Renderer_Feed
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render feed
+ *
+ * @return void
+ */
+ public function render()
+ {
+ $this->_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 (is_null($block)) {
+ 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 (is_null($explicit)) {
+ 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/libs/Zend/Feed/Writer/Extension/RendererAbstract.php b/libs/Zend/Feed/Writer/Extension/RendererAbstract.php
new file mode 100644
index 0000000000..b381be3657
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/RendererAbstract.php
@@ -0,0 +1,179 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to padraic dot brady at yahoo dot com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer_Entry_Rss
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererInterface
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererInterface.php';
+
+ /**
+ * @category Zend
+ * @package Zend_Feed_Writer_Entry_Rss
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+abstract class Zend_Feed_Writer_Extension_RendererAbstract
+ implements Zend_Feed_Writer_Extension_RendererInterface
+{
+ /**
+ * @var DOMDocument
+ */
+ protected $_dom = null;
+
+ /**
+ * @var mixed
+ */
+ protected $_entry = null;
+
+ /**
+ * @var DOMElement
+ */
+ protected $_base = null;
+
+ /**
+ * @var mixed
+ */
+ protected $_container = null;
+
+ /**
+ * @var string
+ */
+ protected $_type = null;
+
+ /**
+ * @var DOMElement
+ */
+ protected $_rootElement = null;
+
+ /**
+ * Encoding of all text values
+ *
+ * @var string
+ */
+ protected $_encoding = 'UTF-8';
+
+ /**
+ * Constructor
+ *
+ * @param mixed $container
+ * @return void
+ */
+ public function __construct($container)
+ {
+ $this->_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/libs/Zend/Feed/Writer/Extension/RendererInterface.php b/libs/Zend/Feed/Writer/Extension/RendererInterface.php
new file mode 100644
index 0000000000..e9c9014176
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/RendererInterface.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to padraic dot brady at yahoo dot com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+interface Zend_Feed_Writer_Extension_RendererInterface
+{
+ /**
+ * Constructor
+ *
+ * @param mixed $container
+ * @return void
+ */
+ public function __construct($container);
+
+ /**
+ * Set DOMDocument and DOMElement on which to operate
+ *
+ * @param DOMDocument $dom
+ * @param DOMElement $base
+ * @return void
+ */
+ public function setDomDocument(DOMDocument $dom, DOMElement $base);
+
+ /**
+ * Render
+ *
+ * @return void
+ */
+ public function render();
+
+ /**
+ * Retrieve container
+ *
+ * @return mixed
+ */
+ public function getDataContainer();
+}
diff --git a/libs/Zend/Feed/Writer/Extension/Slash/Renderer/Entry.php b/libs/Zend/Feed/Writer/Extension/Slash/Renderer/Entry.php
new file mode 100644
index 0000000000..2814775551
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/Slash/Renderer/Entry.php
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Entry.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_Slash_Renderer_Entry
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render entry
+ *
+ * @return void
+ */
+ public function render()
+ {
+ if (strtolower($this->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) {
+ $count = 0;
+ }
+ $tcount = $this->_dom->createElement('slash:comments');
+ $tcount->nodeValue = $count;
+ $root->appendChild($tcount);
+ $this->_called = true;
+ }
+}
diff --git a/libs/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.php b/libs/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.php
new file mode 100644
index 0000000000..69e731d4ba
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.php
@@ -0,0 +1,145 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Entry.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_Threading_Renderer_Entry
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render entry
+ *
+ * @return void
+ */
+ public function render()
+ {
+ if (strtolower($this->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 (!is_null($count)) {
+ $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 (!is_null($count)) {
+ $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 (is_null($count)) {
+ return;
+ }
+ $tcount = $this->_dom->createElement('thr:total');
+ $tcount->nodeValue = $count;
+ $root->appendChild($tcount);
+ $this->_called = true;
+ }
+}
diff --git a/libs/Zend/Feed/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/libs/Zend/Feed/Writer/Extension/WellFormedWeb/Renderer/Entry.php
new file mode 100644
index 0000000000..c57244ae4b
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Extension/WellFormedWeb/Renderer/Entry.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Entry.php 20326 2010-01-16 00:20:43Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Extension_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Extension_WellFormedWeb_Renderer_Entry
+ extends Zend_Feed_Writer_Extension_RendererAbstract
+{
+
+ /**
+ * Set to TRUE if a rendering method actually renders something. This
+ * is used to prevent premature appending of a XML namespace declaration
+ * until an element which requires it is actually appended.
+ *
+ * @var bool
+ */
+ protected $_called = false;
+
+ /**
+ * Render entry
+ *
+ * @return void
+ */
+ public function render()
+ {
+ if (strtolower($this->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/libs/Zend/Feed/Writer/Feed.php b/libs/Zend/Feed/Writer/Feed.php
new file mode 100644
index 0000000000..724caed1a2
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Feed.php
@@ -0,0 +1,281 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Feed.php 20519 2010-01-22 14:06:24Z padraic $
+ */
+
+/**
+ * @see Zend_Date
+ */
+// require_once 'Zend/Date.php';
+
+/**
+ * @see Zend_Date
+ */
+// require_once 'Zend/Uri.php';
+
+/**
+ * @see Zend_Feed_Writer
+ */
+// require_once 'Zend/Feed/Writer.php';
+
+/**
+ * @see Zend_Feed_Writer_Entry
+ */
+// require_once 'Zend/Feed/Writer/Entry.php';
+
+/**
+ * @see Zend_Feed_Writer_Deleted
+ */
+// require_once 'Zend/Feed/Writer/Deleted.php';
+
+/**
+ * @see Zend_Feed_Writer_Renderer_Feed_Atom
+ */
+// require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php';
+
+/**
+ * @see Zend_Feed_Writer_Renderer_Feed_Rss
+ */
+// require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php';
+
+// require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Feed extends Zend_Feed_Writer_Feed_FeedAbstract
+implements Iterator, Countable
+{
+
+ /**
+ * Contains all entry objects
+ *
+ * @var array
+ */
+ protected $_entries = array();
+
+ /**
+ * A pointer for the iterator to keep track of the entries array
+ *
+ * @var int
+ */
+ protected $_entriesKey = 0;
+
+ /**
+ * Creates a new Zend_Feed_Writer_Entry 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_Entry
+ */
+ public function createEntry()
+ {
+ $entry = new Zend_Feed_Writer_Entry;
+ if ($this->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]);
+ }
+ // require_once 'Zend/Feed/Exception.php';
+ 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];
+ }
+ // require_once 'Zend/Feed/Exception.php';
+ 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 $type The feed type "rss" or "atom" to export as
+ * @return string
+ */
+ public function export($type, $ignoreExceptions = false)
+ {
+ $this->setType(strtolower($type));
+ $type = ucfirst($this->getType());
+ if ($type !== 'Rss' && $type !== 'Atom') {
+ // require_once 'Zend/Feed/Exception.php';
+ 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/libs/Zend/Feed/Writer/Feed/FeedAbstract.php b/libs/Zend/Feed/Writer/Feed/FeedAbstract.php
new file mode 100644
index 0000000000..bc2a0fa06f
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Feed/FeedAbstract.php
@@ -0,0 +1,805 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @see Zend_Date
+ */
+// require_once 'Zend/Date.php';
+
+/**
+ * @see Zend_Date
+ */
+// require_once 'Zend/Uri.php';
+
+/**
+ * @see Zend_Feed_Writer
+ */
+// require_once 'Zend/Feed/Writer.php';
+
+/**
+ * @see Zend_Feed_Writer_Entry
+ */
+// require_once 'Zend/Feed/Writer/Entry.php';
+
+/**
+ * @see Zend_Feed_Writer_Renderer_Feed_Atom
+ */
+// require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php';
+
+/**
+ * @see Zend_Feed_Writer_Renderer_Feed_Rss
+ */
+// require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Feed_FeedAbstract
+{
+ /**
+ * Contains all Feed level date to append in feed output
+ *
+ * @var array
+ */
+ protected $_data = array();
+
+ /**
+ * Holds the value "atom" or "rss" depending on the feed type set when
+ * when last exported.
+ *
+ * @var string
+ */
+ protected $_type = null;
+
+ /**
+ * Constructor: Primarily triggers the registration of core extensions and
+ * loads those appropriate to this data container.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ Zend_Feed_Writer::registerCoreExtensions();
+ $this->_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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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['name']) || !is_string($name['name'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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 (is_null($date)) {
+ $zdate = new Zend_Date;
+ } elseif (ctype_digit($date) && strlen($date) == 10) {
+ $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
+ } elseif ($date instanceof Zend_Date) {
+ $zdate = $date;
+ } else {
+ // require_once 'Zend/Feed/Exception.php';
+ 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 (is_null($date)) {
+ $zdate = new Zend_Date;
+ } elseif (ctype_digit($date) && strlen($date) == 10) {
+ $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
+ } elseif ($date instanceof Zend_Date) {
+ $zdate = $date;
+ } else {
+ // require_once 'Zend/Feed/Exception.php';
+ 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 (is_null($date)) {
+ $zdate = new Zend_Date;
+ } elseif (ctype_digit($date) && strlen($date) == 10) {
+ $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
+ } elseif ($date instanceof Zend_Date) {
+ $zdate = $date;
+ } else {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI');
+ }
+ $this->_data['id'] = $id;
+ }
+
+ /**
+ * 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ throw new Zend_Feed_Exception('Invalid parameter: parameter \'uri\''
+ . ' must be a non-empty string and valid URI/IRI');
+ }
+ $this->_data['image'] = $data;
+ }
+
+ /**
+ * Set the feed language
+ *
+ * @return string|null
+ */
+ public function setLanguage($language)
+ {
+ if (empty($language) || !is_string($language)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'))) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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'])
+ ) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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 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) {
+ }
+ }
+ // require_once 'Zend/Feed/Exception.php';
+ 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/libs/Zend/Feed/Writer/Renderer/Entry/Atom.php b/libs/Zend/Feed/Writer/Renderer/Entry/Atom.php
new file mode 100644
index 0000000000..76095e89f0
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/Entry/Atom.php
@@ -0,0 +1,410 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Atom.php 22065 2010-04-30 14:04:57Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Renderer_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php';
+
+// require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/Source.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Renderer_Entry_Atom
+ extends Zend_Feed_Writer_Renderer_RendererAbstract
+ implements Zend_Feed_Writer_Renderer_RendererInterface
+{
+ /**
+ * Constructor
+ *
+ * @param Zend_Feed_Writer_Entry $container
+ * @return void
+ */
+ public function __construct (Zend_Feed_Writer_Entry $container)
+ {
+ parent::__construct($container);
+ }
+
+ /**
+ * Render atom entry
+ *
+ * @return Zend_Feed_Writer_Renderer_Entry_Atom
+ */
+ public function render()
+ {
+ $this->_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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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())) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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);
+ }
+
+ /**
+ * 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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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->loadXML('<xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml">'
+ . $xhtml . '</xhtml:div>');
+ 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/libs/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php b/libs/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php
new file mode 100644
index 0000000000..fb75262935
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php
@@ -0,0 +1,121 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Atom.php 20506 2010-01-21 22:19:05Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Renderer_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Renderer_Entry_Atom_Deleted
+ extends Zend_Feed_Writer_Renderer_RendererAbstract
+ implements Zend_Feed_Writer_Renderer_RendererInterface
+{
+ /**
+ * Constructor
+ *
+ * @param Zend_Feed_Writer_Deleted $container
+ * @return void
+ */
+ public function __construct (Zend_Feed_Writer_Deleted $container)
+ {
+ parent::__construct($container);
+ }
+
+ /**
+ * Render atom entry
+ *
+ * @return Zend_Feed_Writer_Renderer_Entry_Atom
+ */
+ public function render()
+ {
+ $this->_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/libs/Zend/Feed/Writer/Renderer/Entry/Rss.php b/libs/Zend/Feed/Writer/Renderer/Entry/Rss.php
new file mode 100644
index 0000000000..74e80f5707
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/Entry/Rss.php
@@ -0,0 +1,346 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Rss.php 22065 2010-04-30 14:04:57Z padraic $
+ */
+
+/**
+ * @see Zend_Feed_Writer_Renderer_RendererAbstract
+ */
+// require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Renderer_Entry_Rss
+ extends Zend_Feed_Writer_Renderer_RendererAbstract
+ implements Zend_Feed_Writer_Renderer_RendererInterface
+{
+ /**
+ * Constructor
+ *
+ * @param Zend_Feed_Writer_Entry $container
+ * @return void
+ */
+ public function __construct (Zend_Feed_Writer_Entry $container)
+ {
+ parent::__construct($container);
+ }
+
+ /**
+ * Render RSS entry
+ *
+ * @return Zend_Feed_Writer_Renderer_Entry_Rss
+ */
+ public function render()
+ {
+ $this->_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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ $exception = new Zend_Feed_Exception('Enclosure "type" is not set');
+ if (!$this->_ignoreExceptions) {
+ throw $exception;
+ } else {
+ $this->_exceptions[] = $exception;
+ return;
+ }
+ }
+ if (!isset($data['length'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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/libs/Zend/Feed/Writer/Renderer/Feed/Atom.php b/libs/Zend/Feed/Writer/Renderer/Feed/Atom.php
new file mode 100644
index 0000000000..2c88dd4298
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/Feed/Atom.php
@@ -0,0 +1,130 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Atom.php 22098 2010-05-04 18:03:29Z padraic $
+ */
+
+/** @see Zend_Feed_Writer_Feed */
+// require_once 'Zend/Feed/Writer/Feed.php';
+
+/** @see Zend_Version */
+// require_once 'Zend/Version.php';
+
+/** @see Zend_Feed_Writer_Renderer_RendererInterface */
+// require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php';
+
+/** @see Zend_Feed_Writer_Renderer_Entry_Atom */
+// require_once 'Zend/Feed/Writer/Renderer/Entry/Atom.php';
+
+/** @see Zend_Feed_Writer_Renderer_Entry_Atom_Deleted */
+// require_once 'Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php';
+
+/** @see Zend_Feed_Writer_Renderer_RendererAbstract */
+// require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php';
+
+// require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Renderer_Feed_Atom
+ extends Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract
+ implements Zend_Feed_Writer_Renderer_RendererInterface
+{
+ /**
+ * Constructor
+ *
+ * @param Zend_Feed_Writer_Feed $container
+ * @return void
+ */
+ public function __construct (Zend_Feed_Writer_Feed $container)
+ {
+ parent::__construct($container);
+ }
+
+ /**
+ * Render Atom feed
+ *
+ * @return Zend_Feed_Writer_Renderer_Feed_Atom
+ */
+ public function render()
+ {
+ if (!$this->_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->_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/libs/Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php b/libs/Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php
new file mode 100644
index 0000000000..254516e5b5
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php
@@ -0,0 +1,427 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/** @see Zend_Feed_Writer_Feed */
+// require_once 'Zend/Feed/Writer/Feed.php';
+
+/** @see Zend_Version */
+// require_once 'Zend/Version.php';
+
+/** @see Zend_Feed_Writer_Renderer_RendererInterface */
+// require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php';
+
+/** @see Zend_Feed_Writer_Renderer_Entry_Atom */
+// require_once 'Zend/Feed/Writer/Renderer/Entry/Atom.php';
+
+/** @see Zend_Feed_Writer_Renderer_RendererAbstract */
+// require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract
+ extends Zend_Feed_Writer_Renderer_RendererAbstract
+{
+ /**
+ * Constructor
+ *
+ * @param Zend_Feed_Writer_Feed $container
+ * @return void
+ */
+ public function __construct ($container)
+ {
+ parent::__construct($container);
+ }
+
+ /**
+ * Set feed language
+ *
+ * @param DOMDocument $dom
+ * @param DOMElement $root
+ * @return void
+ */
+ protected function _setLanguage(DOMDocument $dom, DOMElement $root)
+ {
+ if ($this->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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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 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/libs/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php b/libs/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php
new file mode 100644
index 0000000000..125fed1eaf
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+// require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Renderer_Feed_Atom_Source
+ extends Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract
+ implements Zend_Feed_Writer_Renderer_RendererInterface
+{
+
+ /**
+ * Constructor
+ *
+ * @param Zend_Feed_Writer_Feed_Source $container
+ * @return void
+ */
+ public function __construct (Zend_Feed_Writer_Source $container)
+ {
+ parent::__construct($container);
+ }
+
+ /**
+ * Render Atom Feed Metadata (Source element)
+ *
+ * @return Zend_Feed_Writer_Renderer_Feed_Atom
+ */
+ public function render()
+ {
+ if (!$this->_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/libs/Zend/Feed/Writer/Renderer/Feed/Rss.php b/libs/Zend/Feed/Writer/Renderer/Feed/Rss.php
new file mode 100644
index 0000000000..07b94e7b86
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/Feed/Rss.php
@@ -0,0 +1,505 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Rss.php 22108 2010-05-05 13:44:11Z padraic $
+ */
+
+/** @see Zend_Feed_Writer_Feed */
+// require_once 'Zend/Feed/Writer/Feed.php';
+
+/** @see Zend_Version */
+// require_once 'Zend/Version.php';
+
+/** @see Zend_Feed_Writer_Renderer_RendererInterface */
+// require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php';
+
+/** @see Zend_Feed_Writer_Renderer_Entry_Rss */
+// require_once 'Zend/Feed/Writer/Renderer/Entry/Rss.php';
+
+/** @see Zend_Feed_Writer_Renderer_RendererAbstract */
+// require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Renderer_Feed_Rss
+ extends Zend_Feed_Writer_Renderer_RendererAbstract
+ implements Zend_Feed_Writer_Renderer_RendererInterface
+{
+ /**
+ * Constructor
+ *
+ * @param Zend_Feed_Writer_Feed $container
+ * @return void
+ */
+ public function __construct (Zend_Feed_Writer_Feed $container)
+ {
+ parent::__construct($container);
+ }
+
+ /**
+ * Render RSS feed
+ *
+ * @return Zend_Feed_Writer_Renderer_Feed_Rss
+ */
+ public function render()
+ {
+ if (!$this->_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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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()) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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'])) {
+ // require_once 'Zend/Feed/Exception.php';
+ $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/libs/Zend/Feed/Writer/Renderer/RendererAbstract.php b/libs/Zend/Feed/Writer/Renderer/RendererAbstract.php
new file mode 100644
index 0000000000..b3457ed643
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/RendererAbstract.php
@@ -0,0 +1,250 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: RendererAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/** @see Zend_Feed_Writer */
+// require_once 'Zend/Feed/Writer.php';
+
+/** @see Zend_Version */
+// require_once 'Zend/Version.php';
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Renderer_RendererAbstract
+{
+ /**
+ * Extensions
+ * @var array
+ */
+ protected $_extensions = array();
+
+ /**
+ * @var mixed
+ */
+ protected $_container = null;
+
+ /**
+ * @var DOMDocument
+ */
+ protected $_dom = null;
+
+ /**
+ * @var bool
+ */
+ protected $_ignoreExceptions = false;
+
+ /**
+ * @var array
+ */
+ protected $_exceptions = array();
+
+ /**
+ * Encoding of all text values
+ *
+ * @var string
+ */
+ protected $_encoding = 'UTF-8';
+
+ /**
+ * Holds the value "atom" or "rss" depending on the feed type set when
+ * when last exported.
+ *
+ * @var string
+ */
+ protected $_type = null;
+
+ /**
+ * @var DOMElement
+ */
+ protected $_rootElement = null;
+
+ /**
+ * Constructor
+ *
+ * @param mixed $container
+ * @return void
+ */
+ public function __construct($container)
+ {
+ $this->_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)) {
+ // require_once 'Zend/Feed/Exception.php';
+ 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/libs/Zend/Feed/Writer/Renderer/RendererInterface.php b/libs/Zend/Feed/Writer/Renderer/RendererInterface.php
new file mode 100644
index 0000000000..89b4294416
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Renderer/RendererInterface.php
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: RendererInterface.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+interface Zend_Feed_Writer_Renderer_RendererInterface
+{
+ /**
+ * Render feed/entry
+ *
+ * @return void
+ */
+ public function render();
+
+ /**
+ * Save feed and/or entry to XML and return string
+ *
+ * @return string
+ */
+ public function saveXml();
+
+ /**
+ * Get DOM document
+ *
+ * @return DOMDocument
+ */
+ public function getDomDocument();
+
+ /**
+ * Get document element from DOM
+ *
+ * @return DOMElement
+ */
+ public function getElement();
+
+ /**
+ * Get data container containing feed items
+ *
+ * @return mixed
+ */
+ public function getDataContainer();
+
+ /**
+ * Should exceptions be ignored?
+ *
+ * @return mixed
+ */
+ public function ignoreExceptions();
+
+ /**
+ * Get list of thrown exceptions
+ *
+ * @return array
+ */
+ public function getExceptions();
+
+ /**
+ * 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);
+
+ /**
+ * Retrieve the current or last feed type exported.
+ *
+ * @return string Value will be "rss" or "atom"
+ */
+ public function getType();
+
+ /**
+ * 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);
+
+ /**
+ * Retrieve the absolute root element for the XML feed being generated.
+ *
+ * @return DOMElement
+ */
+ public function getRootElement();
+}
diff --git a/libs/Zend/Feed/Writer/Source.php b/libs/Zend/Feed/Writer/Source.php
new file mode 100644
index 0000000000..3861fc77fc
--- /dev/null
+++ b/libs/Zend/Feed/Writer/Source.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+// require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php';
+
+ /**
+ * @category Zend
+ * @package Zend_Feed_Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Feed_Writer_Source extends Zend_Feed_Writer_Feed_FeedAbstract
+{
+
+}
diff --git a/libs/Zend/Http/Client.php b/libs/Zend/Http/Client.php
index 5596a190ce..1cd17e8da4 100644
--- a/libs/Zend/Http/Client.php
+++ b/libs/Zend/Http/Client.php
@@ -16,33 +16,38 @@
* @category Zend
* @package Zend_Http
* @subpackage Client
- * @version $Id: Client.php 17843 2009-08-27 14:40:35Z cogo $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Client.php 21952 2010-04-19 18:44:26Z shahar $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Loader
*/
-require_once 'Zend/Loader.php';
+// require_once 'Zend/Loader.php';
/**
* @see Zend_Uri
*/
-require_once 'Zend/Uri.php';
+// require_once 'Zend/Uri.php';
/**
* @see Zend_Http_Client_Adapter_Interface
*/
-require_once 'Zend/Http/Client/Adapter/Interface.php';
+// require_once 'Zend/Http/Client/Adapter/Interface.php';
/**
* @see Zend_Http_Response
*/
-require_once 'Zend/Http/Response.php';
+// require_once 'Zend/Http/Response.php';
+
+/**
+ * @see Zend_Http_Response_Stream
+ */
+// require_once 'Zend/Http/Response/Stream.php';
/**
* Zend_Http_Client is an implemetation of an HTTP client in PHP. The client
@@ -55,7 +60,7 @@ require_once 'Zend/Http/Response.php';
* @package Zend_Http
* @subpackage Client
* @throws Zend_Http_Client_Exception
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_Client
@@ -71,6 +76,7 @@ class Zend_Http_Client
const TRACE = 'TRACE';
const OPTIONS = 'OPTIONS';
const CONNECT = 'CONNECT';
+ const MERGE = 'MERGE';
/**
* Supported HTTP Authentication methods
@@ -110,7 +116,9 @@ class Zend_Http_Client
'httpversion' => self::HTTP_1,
'keepalive' => false,
'storeresponse' => true,
- 'strict' => true
+ 'strict' => true,
+ 'output_stream' => false,
+ 'encodecookies' => true,
);
/**
@@ -125,7 +133,7 @@ class Zend_Http_Client
*
* @var Zend_Uri_Http
*/
- protected $uri;
+ protected $uri = null;
/**
* Associative array of request headers
@@ -263,10 +271,15 @@ class Zend_Http_Client
if (!$uri instanceof Zend_Uri_Http) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
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));
@@ -306,7 +319,7 @@ class Zend_Http_Client
} elseif (! is_array($config)) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception('Array or Zend_Config object expected, got ' . gettype($config));
}
@@ -337,7 +350,7 @@ class Zend_Http_Client
{
if (! preg_match('/^[^\x00-\x1f\x7f-\xff\(\)<>@,;:\\\\"\/\[\]\?={}\s]+$/', $method)) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("'{$method}' is not a valid HTTP request method.");
}
@@ -389,7 +402,7 @@ class Zend_Http_Client
// Make sure the name is valid if we are in strict mode
if ($this->config['strict'] && (! preg_match('/^[a-zA-Z0-9-]+$/', $name))) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("{$name} is not a valid HTTP header name");
}
@@ -536,12 +549,17 @@ class Zend_Http_Client
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 */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '$type'");
}
@@ -568,7 +586,7 @@ class Zend_Http_Client
public function setCookieJar($cookiejar = true)
{
if (! class_exists('Zend_Http_CookieJar')) {
- require_once 'Zend/Http/CookieJar.php';
+ // require_once 'Zend/Http/CookieJar.php';
}
if ($cookiejar instanceof Zend_Http_CookieJar) {
@@ -579,7 +597,7 @@ class Zend_Http_Client
$this->cookiejar = null;
} else {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception('Invalid parameter type passed as CookieJar');
}
@@ -608,7 +626,7 @@ class Zend_Http_Client
public function setCookie($cookie, $value = null)
{
if (! class_exists('Zend_Http_Cookie')) {
- require_once 'Zend/Http/Cookie.php';
+ // require_once 'Zend/Http/Cookie.php';
}
if (is_array($cookie)) {
@@ -623,7 +641,7 @@ class Zend_Http_Client
return $this;
}
- if ($value !== null) {
+ if ($value !== null && $this->config['encodecookies']) {
$value = urlencode($value);
}
@@ -631,7 +649,9 @@ class Zend_Http_Client
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);
+ $cookie = Zend_Http_Cookie::fromString("{$cookie}={$value}",
+ $this->uri,
+ $this->config['encodecookies']);
$this->cookiejar->addCookie($cookie);
}
} else {
@@ -643,7 +663,7 @@ class Zend_Http_Client
if (preg_match("/[=,; \t\r\n\013\014]/", $cookie)) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("Cookie name cannot contain these characters: =,; \t\r\n\013\014 ({$cookie})");
}
@@ -683,7 +703,7 @@ class Zend_Http_Client
if ($data === null) {
if (($data = @file_get_contents($filename)) === false) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("Unable to read file '{$filename}' for upload");
}
@@ -726,7 +746,9 @@ class Zend_Http_Client
* 2. For backwards compatibilty: If someone uses the old post($data) method.
* this method will be used to set the encoded data.
*
- * @param string $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
*/
@@ -734,7 +756,13 @@ class Zend_Http_Client
{
$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;
}
@@ -744,9 +772,13 @@ class Zend_Http_Client
* 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()
+ public function resetParameters($clearAll = false)
{
// Reset parameter data
$this->paramsGet = array();
@@ -754,12 +786,18 @@ class Zend_Http_Client
$this->files = array();
$this->raw_post_data = null;
- // 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)]);
+ 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;
@@ -803,12 +841,12 @@ class Zend_Http_Client
if (is_string($adapter)) {
if (!class_exists($adapter)) {
try {
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
Zend_Loader::loadClass($adapter);
} catch (Zend_Exception $e) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}");
+ // require_once 'Zend/Http/Client/Exception.php';
+ throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}", 0, $e);
}
}
@@ -817,7 +855,7 @@ class Zend_Http_Client
if (! $adapter instanceof Zend_Http_Client_Adapter_Interface) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception('Passed adapter is not a HTTP connection adapter');
}
@@ -828,6 +866,62 @@ class Zend_Http_Client
}
/**
+ * Load the connection adapter
+ *
+ * @return Zend_Http_Client_Adapter_Interface $adapter
+ */
+ public function getAdapter()
+ {
+ 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();
+ }
+ // require_once 'Zend/Http/Client/Exception.php';
+ 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
@@ -838,7 +932,7 @@ class Zend_Http_Client
{
if (! $this->uri instanceof Zend_Uri_Http) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception('No valid URI has been passed to the client');
}
@@ -870,21 +964,52 @@ class Zend_Http_Client
$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 */
+ // require_once 'Zend/Http/Client/Exception.php';
+ 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 */
+ // require_once 'Zend/Http/Client/Exception.php';
+ 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 */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception('Unable to read response, or response is empty');
}
- $response = Zend_Http_Response::fromString($response);
+ if($this->config['output_stream']) {
+ 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;
}
@@ -1039,6 +1164,9 @@ class Zend_Http_Client
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') &&
@@ -1100,7 +1228,7 @@ class Zend_Http_Client
}
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("Cannot handle content type '{$this->enctype}' automatically." .
" Please use Zend_Http_Client::setRawData to send this kind of content.");
break;
@@ -1261,7 +1389,7 @@ class Zend_Http_Client
// In basic authentication, the user name cannot contain ":"
if (strpos($user, ':') !== false) {
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("The user name cannot contain ':' in 'Basic' HTTP authentication");
}
@@ -1276,7 +1404,7 @@ class Zend_Http_Client
default:
/** @see Zend_Http_Client_Exception */
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("Not a supported HTTP authentication type: '$type'");
}
diff --git a/libs/Zend/Http/Client/Adapter/Curl.php b/libs/Zend/Http/Client/Adapter/Curl.php
index 3335745c1f..4747bd898c 100644
--- a/libs/Zend/Http/Client/Adapter/Curl.php
+++ b/libs/Zend/Http/Client/Adapter/Curl.php
@@ -16,16 +16,24 @@
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @version $Id: Curl.php 17118 2009-07-26 09:41:41Z shahar $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Curl.php 22221 2010-05-21 07:00:58Z dragonbe $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-/** Zend_Uri_Http */
-require_once 'Zend/Uri/Http.php';
+/**
+ * @see Zend_Uri_Http
+ */
+// require_once 'Zend/Uri/Http.php';
-/** Zend_Http_Client_Adapter_Interface */
-require_once 'Zend/Http/Client/Adapter/Interface.php';
+/**
+ * @see Zend_Http_Client_Adapter_Interface
+ */
+// require_once 'Zend/Http/Client/Adapter/Interface.php';
+/**
+ * @see Zend_Http_Client_Adapter_Stream
+ */
+// require_once 'Zend/Http/Client/Adapter/Stream.php';
/**
* An adapter class for Zend_Http_Client based on the curl extension.
@@ -34,10 +42,10 @@ require_once 'Zend/Http/Client/Adapter/Interface.php';
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interface
+class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interface, Zend_Http_Client_Adapter_Stream
{
/**
* Parameters array
@@ -65,23 +73,7 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
*
* @var array
*/
- protected $_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_TIMEOUT,
- CURL_HTTP_VERSION_1_1,
- CURL_HTTP_VERSION_1_0,
- );
+ protected $_invalidOverwritableCurlOptions;
/**
* Response gotten from server
@@ -91,6 +83,13 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
protected $_response = null;
/**
+ * Stream for storing output
+ *
+ * @var resource
+ */
+ protected $out_stream;
+
+ /**
* Adapter constructor
*
* Config is set using setConfig()
@@ -101,9 +100,26 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
public function __construct()
{
if (!extension_loaded('curl')) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('cURL extension has to be loaded to use this Zend_Http_Client adapter.');
}
+ $this->_invalidOverwritableCurlOptions = 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,
+ );
}
/**
@@ -119,7 +135,7 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
$config = $config->toArray();
} elseif (! is_array($config)) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception(
'Array or Zend_Config object expected, got ' . gettype($config)
);
@@ -149,6 +165,16 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
}
/**
+ * 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
@@ -196,7 +222,7 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
}
// Set timeout
- curl_setopt($this->_curl, CURLOPT_TIMEOUT, $this->_config['timeout']);
+ curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']);
// Set Max redirects
curl_setopt($this->_curl, CURLOPT_MAXREDIRS, $this->_config['maxredirects']);
@@ -204,7 +230,7 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
if (!$this->_curl) {
$this->close();
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' . $host . ':' . $port);
}
@@ -233,16 +259,16 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
* @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, $http_ver = '1.1', $headers = array(), $body = '')
+ public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $body = '')
{
// Make sure we're properly connected
if (!$this->_curl) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are not connected");
}
if ($this->_connected_to[0] != $uri->getHost() || $this->_connected_to[1] != $uri->getPort()) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are connected to the wrong host");
}
@@ -263,20 +289,30 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
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])) {
- if (!isset($this->_config['curloptions'][CURLOPT_INFILESIZE])) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.");
- }
-
// 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 (stristr($header, "Content-Length:") !== false) {
+ 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])) {
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
+ throw new Zend_Http_Client_Adapter_Exception("Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.");
+ }
+
+ if(is_resource($body)) {
+ $body = '';
+ }
+
$curlMethod = CURLOPT_PUT;
} else {
$curlMethod = CURLOPT_CUSTOMREQUEST;
@@ -298,25 +334,43 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
$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
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Method currently not supported");
}
+ if(is_resource($body) && $curlMethod != CURLOPT_PUT) {
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
+ throw new Zend_Http_Client_Adapter_Exception("Streaming requests are allowed only with PUT");
+ }
+
// get http version to use
- $curlHttp = ($http_ver = 1.1) ? CURL_HTTP_VERSION_1_1 : CURL_HTTP_VERSION_1_0;
+ $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, $curlHttp, true);
curl_setopt($this->_curl, $curlMethod, $curlValue);
- // ensure headers are also returned
- curl_setopt($this->_curl, CURLOPT_HEADER, true);
-
- // ensure actual response is returned
- curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true);
+ 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);
+
+ // ensure actual response is returned
+ curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true);
+ }
// set additional headers
$headers['Accept'] = '';
@@ -346,7 +400,7 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
foreach ((array)$this->_config['curloptions'] as $k => $v) {
if (!in_array($k, $this->_invalidOverwritableCurlOptions)) {
if (curl_setopt($this->_curl, $k, $v) == false) {
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception(sprintf("Unknown or erroreous cURL option '%s' set", $k));
}
}
@@ -354,13 +408,18 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
}
// send the request
- $this->_response = curl_exec($this->_curl);
+ $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)) {
- require_once 'Zend/Http/Client/Exception.php';
+ // require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("Error in cURL request: " . curl_error($this->_curl));
}
@@ -420,4 +479,29 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac
{
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/libs/Zend/Http/Client/Adapter/Exception.php b/libs/Zend/Http/Client/Adapter/Exception.php
index b157e0facf..082c8af302 100644
--- a/libs/Zend/Http/Client/Adapter/Exception.php
+++ b/libs/Zend/Http/Client/Adapter/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter_Exception
- * @version $Id: Exception.php 17118 2009-07-26 09:41:41Z shahar $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Http_Client_Exception
*/
-require_once 'Zend/Http/Client/Exception.php';
+// require_once 'Zend/Http/Client/Exception.php';
/**
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_Client_Adapter_Exception extends Zend_Http_Client_Exception
diff --git a/libs/Zend/Http/Client/Adapter/Interface.php b/libs/Zend/Http/Client/Adapter/Interface.php
index 46b84accbf..be9d187947 100644
--- a/libs/Zend/Http/Client/Adapter/Interface.php
+++ b/libs/Zend/Http/Client/Adapter/Interface.php
@@ -16,8 +16,8 @@
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @version $Id: Interface.php 16214 2009-06-21 19:34:03Z thomas $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -30,7 +30,7 @@
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Http_Client_Adapter_Interface
diff --git a/libs/Zend/Http/Client/Adapter/Proxy.php b/libs/Zend/Http/Client/Adapter/Proxy.php
index 932b1b66b6..cda6d62dbb 100644
--- a/libs/Zend/Http/Client/Adapter/Proxy.php
+++ b/libs/Zend/Http/Client/Adapter/Proxy.php
@@ -16,23 +16,23 @@
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @version $Id: Proxy.php 17118 2009-07-26 09:41:41Z shahar $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Proxy.php 20947 2010-02-06 17:09:07Z padraic $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Uri_Http
*/
-require_once 'Zend/Uri/Http.php';
+// require_once 'Zend/Uri/Http.php';
/**
* @see Zend_Http_Client
*/
-require_once 'Zend/Http/Client.php';
+// require_once 'Zend/Http/Client.php';
/**
* @see Zend_Http_Client_Adapter_Socket
*/
-require_once 'Zend/Http/Client/Adapter/Socket.php';
+// require_once 'Zend/Http/Client/Adapter/Socket.php';
/**
* HTTP Proxy-supporting Zend_Http_Client adapter class, based on the default
@@ -46,7 +46,7 @@ require_once 'Zend/Http/Client/Adapter/Socket.php';
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
@@ -91,6 +91,11 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
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(
@@ -117,7 +122,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
// Make sure we're properly connected
if (! $this->socket) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are not connected");
}
@@ -125,7 +130,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
$port = $this->config['proxy_port'];
if ($this->connected_to[0] != "tcp://$host" || $this->connected_to[1] != $port) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are connected to the wrong proxy server");
}
@@ -167,7 +172,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
// Send the request
if (! @fwrite($this->socket, $request)) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Error writing request to proxy server");
}
@@ -203,7 +208,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
// Send the request
if (! @fwrite($this->socket, $request)) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Error writing request to proxy server");
}
@@ -220,7 +225,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
// Check that the response from the proxy is 200
if (Zend_Http_Response::extractCode($response) != 200) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Unable to connect to HTTPS proxy. Server response: " . $response);
}
@@ -240,7 +245,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
}
if (! $success) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception("Unable to connect to" .
" HTTPS server through proxy: could not negotiate secure connection.");
}
diff --git a/libs/Zend/Http/Client/Adapter/Socket.php b/libs/Zend/Http/Client/Adapter/Socket.php
index 13427c749f..4f3d41722d 100644
--- a/libs/Zend/Http/Client/Adapter/Socket.php
+++ b/libs/Zend/Http/Client/Adapter/Socket.php
@@ -16,19 +16,23 @@
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @version $Id: Socket.php 17124 2009-07-26 09:46:42Z shahar $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Socket.php 21778 2010-04-06 11:19:35Z shahar $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Uri_Http
*/
-require_once 'Zend/Uri/Http.php';
+// require_once 'Zend/Uri/Http.php';
/**
* @see Zend_Http_Client_Adapter_Interface
*/
-require_once 'Zend/Http/Client/Adapter/Interface.php';
+// require_once 'Zend/Http/Client/Adapter/Interface.php';
+/**
+ * @see Zend_Http_Client_Adapter_Stream
+ */
+// require_once 'Zend/Http/Client/Adapter/Stream.php';
/**
* A sockets based (stream_socket_client) adapter class for Zend_Http_Client. Can be used
@@ -37,10 +41,10 @@ require_once 'Zend/Http/Client/Adapter/Interface.php';
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interface
+class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interface, Zend_Http_Client_Adapter_Stream
{
/**
* The socket for server connection
@@ -57,6 +61,13 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
protected $connected_to = array(null, null);
/**
+ * Stream for storing output
+ *
+ * @var resource
+ */
+ protected $out_stream = null;
+
+ /**
* Parameters array
*
* @var array
@@ -65,7 +76,8 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
'persistent' => false,
'ssltransport' => 'ssl',
'sslcert' => null,
- 'sslpassphrase' => null
+ 'sslpassphrase' => null,
+ 'sslusecontext' => false
);
/**
@@ -101,7 +113,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
$config = $config->toArray();
} elseif (! is_array($config)) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception(
'Array or Zend_Config object expected, got ' . gettype($config)
);
@@ -112,7 +124,17 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
}
}
- /**
+ /**
+ * 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
@@ -135,7 +157,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
} else {
// Invalid parameter
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception(
"Expecting either a stream context resource or array, got " . gettype($context)
);
@@ -180,18 +202,18 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
// Now, if we are not connected, connect
if (! is_resource($this->socket) || ! $this->config['keepalive']) {
$context = $this->getStreamContext();
- if ($secure) {
+ if ($secure || $this->config['sslusecontext']) {
if ($this->config['sslcert'] !== null) {
if (! stream_context_set_option($context, 'ssl', 'local_cert',
$this->config['sslcert'])) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('Unable to set sslcert option');
}
}
if ($this->config['sslpassphrase'] !== null) {
if (! stream_context_set_option($context, 'ssl', 'passphrase',
$this->config['sslpassphrase'])) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('Unable to set sslpassphrase option');
}
}
@@ -209,14 +231,14 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
if (! $this->socket) {
$this->close();
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
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'])) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('Unable to set the connection timeout');
}
@@ -239,14 +261,14 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
{
// Make sure we're properly connected
if (! $this->socket) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected');
}
$host = $uri->getHost();
$host = (strtolower($uri->getScheme()) == 'https' ? $this->config['ssltransport'] : 'tcp') . '://' . $host;
if ($this->connected_to[0] != $host || $this->connected_to[1] != $uri->getPort()) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host');
}
@@ -262,14 +284,25 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
$request .= "$v\r\n";
}
- // Add the request body
- $request .= "\r\n" . $body;
-
+ if(is_resource($body)) {
+ $request .= "\r\n";
+ } else {
+ // Add the request body
+ $request .= "\r\n" . $body;
+ }
+
// Send the request
if (! @fwrite($this->socket, $request)) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('Error writing request to server');
}
+
+ if(is_resource($body)) {
+ if(stream_copy_to_stream($body, $this->socket) == 0) {
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
+ throw new Zend_Http_Client_Adapter_Exception('Error writing request to server');
+ }
+ }
return $request;
}
@@ -284,6 +317,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
// First, read headers only
$response = '';
$gotStatus = false;
+ $stream = !empty($this->config['stream']);
while (($line = @fgets($this->socket)) !== false) {
$gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false);
@@ -292,7 +326,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
if (rtrim($line) === '') break;
}
}
-
+
$this->_checkSocketReadTimeout();
$statusCode = Zend_Http_Response::extractCode($response);
@@ -319,7 +353,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
// If we got a 'transfer-encoding: chunked' header
if (isset($headers['transfer-encoding'])) {
-
+
if (strtolower($headers['transfer-encoding']) == 'chunked') {
do {
@@ -332,7 +366,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
$chunksize = trim($line);
if (! ctype_xdigit($chunksize)) {
$this->close();
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception('Invalid chunk size "' .
$chunksize . '" unable to read chunked body');
}
@@ -347,45 +381,71 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
$current_pos = ftell($this->socket);
if ($current_pos >= $read_to) break;
- $line = @fread($this->socket, $read_to - $current_pos);
- if ($line === false || strlen($line) === 0) {
- $this->_checkSocketReadTimeout();
- break;
+ if($this->out_stream) {
+ if(stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) {
+ $this->_checkSocketReadTimeout();
+ break;
+ }
} else {
- $chunk .= $line;
+ $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();
- $response .= $chunk;
+ 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 + $headers['content-length'];
+ for ($read_to = $current_pos + $contentLength;
$read_to > $current_pos;
$current_pos = ftell($this->socket)) {
- $chunk = @fread($this->socket, $read_to - $current_pos);
- if ($chunk === false || strlen($chunk) === 0) {
- $this->_checkSocketReadTimeout();
- break;
- }
+ 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;
+ $response .= $chunk;
+ }
// Break if the connection ended prematurely
if (feof($this->socket)) break;
@@ -395,12 +455,19 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
} else {
do {
- $buff = @fread($this->socket, 8192);
- if ($buff === false || strlen($buff) === 0) {
- $this->_checkSocketReadTimeout();
- break;
- } else {
- $response .= $buff;
+ 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);
@@ -440,7 +507,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
$timedout = $info['timed_out'];
if ($timedout) {
$this->close();
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception(
"Read timed out after {$this->config['timeout']} seconds",
Zend_Http_Client_Adapter_Exception::READ_TIMEOUT
@@ -448,7 +515,19 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
}
}
}
-
+
+ /**
+ * 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
*
diff --git a/libs/Zend/Http/Client/Adapter/Stream.php b/libs/Zend/Http/Client/Adapter/Stream.php
new file mode 100644
index 0000000000..58dd921f20
--- /dev/null
+++ b/libs/Zend/Http/Client/Adapter/Stream.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Http
+ * @subpackage Client_Adapter
+ * @version $Id: Interface.php 16214 2009-06-21 19:34:03Z thomas $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * An interface description for Zend_Http_Client_Adapter_Stream classes.
+ *
+ * This interface decribes Zend_Http_Client_Adapter which supports streaming.
+ *
+ * @category Zend
+ * @package Zend_Http
+ * @subpackage Client_Adapter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+interface Zend_Http_Client_Adapter_Stream
+{
+ /**
+ * Set output stream
+ *
+ * This function sets output stream where the result will be stored.
+ *
+ * @param resource $stream Stream to write the output to
+ *
+ */
+ function setOutputStream($stream);
+}
diff --git a/libs/Zend/Http/Client/Adapter/Test.php b/libs/Zend/Http/Client/Adapter/Test.php
index e36f43ee84..f974400868 100644
--- a/libs/Zend/Http/Client/Adapter/Test.php
+++ b/libs/Zend/Http/Client/Adapter/Test.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @version $Id: Test.php 17869 2009-08-28 10:37:13Z cogo $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Test.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Uri_Http
*/
-require_once 'Zend/Uri/Http.php';
+// require_once 'Zend/Uri/Http.php';
/**
* @see Zend_Http_Response
*/
-require_once 'Zend/Http/Response.php';
+// require_once 'Zend/Http/Response.php';
/**
* @see Zend_Http_Client_Adapter_Interface
*/
-require_once 'Zend/Http/Client/Adapter/Interface.php';
+// require_once 'Zend/Http/Client/Adapter/Interface.php';
/**
* A testing-purposes adapter.
@@ -44,7 +44,7 @@ require_once 'Zend/Http/Client/Adapter/Interface.php';
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interface
@@ -72,6 +72,13 @@ class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interfac
protected $responseIndex = 0;
/**
+ * Wether or not the next request will fail with an exception
+ *
+ * @var boolean
+ */
+ protected $_nextRequestWillFail = false;
+
+ /**
* Adapter constructor, currently empty. Config is set using setConfig()
*
*/
@@ -79,6 +86,19 @@ class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interfac
{ }
/**
+ * Set the nextRequestWillFail flag
+ *
+ * @param boolean $flag
+ * @return Zend_Http_Client_Adapter_Test
+ */
+ public function setNextRequestWillFail($flag)
+ {
+ $this->_nextRequestWillFail = (bool) $flag;
+
+ return $this;
+ }
+
+ /**
* Set the configuration array for the adapter
*
* @param Zend_Config | array $config
@@ -89,7 +109,7 @@ class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interfac
$config = $config->toArray();
} elseif (! is_array($config)) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception(
'Array or Zend_Config object expected, got ' . gettype($config)
);
@@ -108,9 +128,16 @@ class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interfac
* @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;
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
+ throw new Zend_Http_Client_Adapter_Exception('Request failed');
+ }
+ }
/**
* Send request to the remote server
@@ -202,7 +229,7 @@ class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interfac
public function setResponseIndex($index)
{
if ($index < 0 || $index >= count($this->responses)) {
- require_once 'Zend/Http/Client/Adapter/Exception.php';
+ // require_once 'Zend/Http/Client/Adapter/Exception.php';
throw new Zend_Http_Client_Adapter_Exception(
'Index out of range of response buffer size');
}
diff --git a/libs/Zend/Http/Client/Exception.php b/libs/Zend/Http/Client/Exception.php
index 6d5efdf27e..dc35e3a0e2 100644
--- a/libs/Zend/Http/Client/Exception.php
+++ b/libs/Zend/Http/Client/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Http
* @subpackage Client_Exception
- * @version $Id: Exception.php 16872 2009-07-20 11:47:08Z mikaelkael $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Http_Exception
*/
-require_once 'Zend/Http/Exception.php';
+// require_once 'Zend/Http/Exception.php';
/**
* @category Zend
* @package Zend_Http
* @subpackage Client
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_Client_Exception extends Zend_Http_Exception
diff --git a/libs/Zend/Http/Cookie.php b/libs/Zend/Http/Cookie.php
index d8e278898a..49d2ff6ad8 100644
--- a/libs/Zend/Http/Cookie.php
+++ b/libs/Zend/Http/Cookie.php
@@ -16,15 +16,15 @@
* @category Zend
* @package Zend_Http
* @subpackage Cookie
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- * @version $Id: Cookie.php 17124 2009-07-26 09:46:42Z shahar $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Cookie.php 21020 2010-02-11 17:27:23Z shahar $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Uri_Http
*/
-require_once 'Zend/Uri/Http.php';
+// require_once 'Zend/Uri/Http.php';
/**
@@ -41,7 +41,7 @@ require_once 'Zend/Uri/Http.php';
*
* @category Zend
* @package Zend_Http
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_Cookie
@@ -89,6 +89,13 @@ class Zend_Http_Cookie
protected $secure;
/**
+ * Whether the cookie value has been encoded/decoded
+ *
+ * @var boolean
+ */
+ protected $encodeValue;
+
+ /**
* Cookie object constructor
*
* @todo Add validation of each one of the parameters (legal domain, etc.)
@@ -103,17 +110,17 @@ class Zend_Http_Cookie
public function __construct($name, $value, $domain, $expires = null, $path = null, $secure = false)
{
if (preg_match("/[=,; \t\r\n\013\014]/", $name)) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("Cookie name cannot contain these characters: =,; \\t\\r\\n\\013\\014 ({$name})");
}
if (! $this->name = (string) $name) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception('Cookies must have a name');
}
if (! $this->domain = (string) $domain) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception('Cookies must have a domain');
}
@@ -227,7 +234,7 @@ class Zend_Http_Cookie
// Make sure we have a valid Zend_Uri_Http object
if (! ($uri->valid() && ($uri->getScheme() == 'http' || $uri->getScheme() =='https'))) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception('Passed URI is not a valid HTTP or HTTPS URI');
}
@@ -258,7 +265,10 @@ class Zend_Http_Cookie
*/
public function __toString()
{
- return $this->name . '=' . urlencode($this->value) . ';';
+ if ($this->encodeValue) {
+ return $this->name . '=' . urlencode($this->value) . ';';
+ }
+ return $this->name . '=' . $this->value . ';';
}
/**
@@ -266,14 +276,16 @@ class Zend_Http_Cookie
* (for example the value of the Set-Cookie HTTP header)
*
* @param string $cookieStr
- * @param Zend_Uri_Http|string $ref_uri Reference URI for default values (domain, path)
+ * @param Zend_Uri_Http|string $refUri Reference URI for default values (domain, path)
+ * @param boolean $encodeValue Weither 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, $ref_uri = null)
+ public static function fromString($cookieStr, $refUri = null, $encodeValue = true)
{
// Set default values
- if (is_string($ref_uri)) {
- $ref_uri = Zend_Uri_Http::factory($ref_uri);
+ if (is_string($refUri)) {
+ $refUri = Zend_Uri_Http::factory($refUri);
}
$name = '';
@@ -290,12 +302,14 @@ class Zend_Http_Cookie
// Get the name and value of the cookie
list($name, $value) = explode('=', trim(array_shift($parts)), 2);
$name = trim($name);
- $value = urldecode(trim($value));
+ if ($encodeValue) {
+ $value = urldecode(trim($value));
+ }
// Set default domain and path
- if ($ref_uri instanceof Zend_Uri_Http) {
- $domain = $ref_uri->getHost();
- $path = $ref_uri->getPath();
+ if ($refUri instanceof Zend_Uri_Http) {
+ $domain = $refUri->getHost();
+ $path = $refUri->getPath();
$path = substr($path, 0, strrpos($path, '/'));
}
@@ -320,7 +334,7 @@ class Zend_Http_Cookie
*
* @see Zend_Date
*/
- require_once 'Zend/Date.php';
+ // require_once 'Zend/Date.php';
$expireDate = new Zend_Date($v);
$expires = $expireDate->getTimestamp();
@@ -342,7 +356,9 @@ class Zend_Http_Cookie
}
if ($name !== '') {
- return new self($name, $value, $domain, $expires, $path, $secure);
+ $ret = new self($name, $value, $domain, $expires, $path, $secure);
+ $ret->encodeValue = ($encodeValue) ? true : false;
+ return $ret;
} else {
return false;
}
@@ -361,12 +377,12 @@ class Zend_Http_Cookie
public static function matchCookieDomain($cookieDomain, $host)
{
if (! $cookieDomain) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("\$cookieDomain is expected to be a cookie domain");
}
if (! $host) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("\$host is expected to be a host name");
}
@@ -394,12 +410,12 @@ class Zend_Http_Cookie
public static function matchCookiePath($cookiePath, $path)
{
if (! $cookiePath) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("\$cookiePath is expected to be a cookie path");
}
if (! $path) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("\$path is expected to be a host name");
}
diff --git a/libs/Zend/Http/CookieJar.php b/libs/Zend/Http/CookieJar.php
index 59afdfbd52..3d00a8e0af 100644
--- a/libs/Zend/Http/CookieJar.php
+++ b/libs/Zend/Http/CookieJar.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Http
* @subpackage CookieJar
- * @version $Id: CookieJar.php 17124 2009-07-26 09:46:42Z shahar $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: CookieJar.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Uri
*/
-require_once "Zend/Uri.php";
+// require_once "Zend/Uri.php";
/**
* @see Zend_Http_Cookie
*/
-require_once "Zend/Http/Cookie.php";
+// require_once "Zend/Http/Cookie.php";
/**
* @see Zend_Http_Response
*/
-require_once "Zend/Http/Response.php";
+// require_once "Zend/Http/Response.php";
/**
* A Zend_Http_CookieJar object is designed to contain and maintain HTTP cookies, and should
@@ -54,7 +54,7 @@ require_once "Zend/Http/Response.php";
* @category Zend
* @package Zend_Http
* @subpackage CookieJar
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_CookieJar implements Countable, IteratorAggregate
@@ -131,7 +131,7 @@ class Zend_Http_CookieJar implements Countable, IteratorAggregate
$this->cookies[$domain][$path][$cookie->getName()] = $cookie;
$this->_rawCookies[] = $cookie;
} else {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception('Supplient argument is not a valid cookie string or object');
}
}
@@ -146,7 +146,7 @@ class Zend_Http_CookieJar implements Countable, IteratorAggregate
public function addCookiesFromResponse($response, $ref_uri)
{
if (! $response instanceof Zend_Http_Response) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception('$response is expected to be a Response object, ' .
gettype($response) . ' was passed');
}
@@ -190,7 +190,7 @@ class Zend_Http_CookieJar implements Countable, IteratorAggregate
{
if (is_string($uri)) $uri = Zend_Uri::factory($uri);
if (! $uri instanceof Zend_Uri_Http) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("Invalid URI string or object passed");
}
@@ -226,7 +226,7 @@ class Zend_Http_CookieJar implements Countable, IteratorAggregate
}
if (! $uri instanceof Zend_Uri_Http) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception('Invalid URI specified');
}
@@ -249,7 +249,7 @@ class Zend_Http_CookieJar implements Countable, IteratorAggregate
break;
default:
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("Invalid value passed for \$ret_as: {$ret_as}");
break;
}
diff --git a/libs/Zend/Http/Exception.php b/libs/Zend/Http/Exception.php
index 93a3869153..230c9c0a77 100644
--- a/libs/Zend/Http/Exception.php
+++ b/libs/Zend/Http/Exception.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Http
* @subpackage Exception
- * @version $Id: Exception.php 16872 2009-07-20 11:47:08Z mikaelkael $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Http
* @subpackage Client
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_Exception extends Zend_Exception
diff --git a/libs/Zend/Http/Response.php b/libs/Zend/Http/Response.php
index 9db70f4e25..decb5f357e 100644
--- a/libs/Zend/Http/Response.php
+++ b/libs/Zend/Http/Response.php
@@ -16,8 +16,8 @@
* @category Zend
* @package Zend_Http
* @subpackage Response
- * @version $Id: Response.php 17124 2009-07-26 09:46:42Z shahar $
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Response.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -28,7 +28,7 @@
*
* @package Zend_Http
* @subpackage Response
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_Response
@@ -152,7 +152,7 @@ class Zend_Http_Response
{
// Make sure the response code is valid and set it
if (self::responseCodeAsText($code) === null) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("{$code} is not a valid HTTP response code");
}
@@ -160,7 +160,7 @@ class Zend_Http_Response
// Make sure we got valid headers and set them
if (! is_array($headers)) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception('No valid headers were passed');
}
@@ -176,7 +176,7 @@ class Zend_Http_Response
// Set the HTTP version
if (! preg_match('|^\d\.\d$|', $version)) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("Invalid HTTP response version: $version");
}
@@ -572,7 +572,7 @@ class Zend_Http_Response
while (trim($body)) {
if (! preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("Error parsing body - doesn't seem to be a chunked message");
}
@@ -600,7 +600,7 @@ class Zend_Http_Response
public static function decodeGzip($body)
{
if (! function_exists('gzinflate')) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception(
'zlib extension is required in order to decode "gzip" encoding'
);
@@ -620,7 +620,7 @@ class Zend_Http_Response
public static function decodeDeflate($body)
{
if (! function_exists('gzuncompress')) {
- require_once 'Zend/Http/Exception.php';
+ // require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception(
'zlib extension is required in order to decode "deflate" encoding'
);
diff --git a/libs/Zend/Http/Response/Stream.php b/libs/Zend/Http/Response/Stream.php
new file mode 100644
index 0000000000..667ca321ab
--- /dev/null
+++ b/libs/Zend/Http/Response/Stream.php
@@ -0,0 +1,235 @@
+<?php
+
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Http
+ * @subpackage Response
+ * @version $Id: Response.php 17131 2009-07-26 10:03:39Z shahar $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * Zend_Http_Response represents an HTTP 1.0 / 1.1 response message. It
+ * includes easy access to all the response's different elemts, as well as some
+ * convenience methods for parsing and validating HTTP responses.
+ *
+ * @package Zend_Http
+ * @subpackage Response
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Http_Response_Stream extends Zend_Http_Response
+{
+ /**
+ * Response as stream
+ *
+ * @var resource
+ */
+ protected $stream;
+
+ /**
+ * The name of the file containing the stream
+ *
+ * Will be empty if stream is not file-based.
+ *
+ * @var string
+ */
+ protected $stream_name;
+
+ /**
+ * Should we clean up the stream file when this response is closed?
+ *
+ * @var boolean
+ */
+ protected $_cleanup;
+
+ /**
+ * Get the response as stream
+ *
+ * @return resourse
+ */
+ public function getStream()
+ {
+ return $this->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 $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/libs/Zend/Loader.php b/libs/Zend/Loader.php
index bfa962a62d..b5ae731ef0 100644
--- a/libs/Zend/Loader.php
+++ b/libs/Zend/Loader.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Loader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Loader.php 16206 2009-06-21 19:15:37Z thomas $
+ * @version $Id: Loader.php 22020 2010-04-27 16:35:56Z matthew $
*/
/**
@@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_Loader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Loader
@@ -56,12 +56,24 @@ class Zend_Loader
}
if ((null !== $dirs) && !is_string($dirs) && !is_array($dirs)) {
- require_once 'Zend/Exception.php';
+ // require_once 'Zend/Exception.php';
throw new Zend_Exception('Directory argument must be a string or an array');
}
- // autodiscover the path from the class name
- $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
+ // Autodiscover the path from the class name
+ // Implementation is PHP namespace-aware, and based on
+ // Framework Interop Group reference implementation:
+ // http://groups.google.com/group/php-standards/web/psr-0-final-proposal
+ $className = ltrim($class, '\\');
+ $file = '';
+ $namespace = '';
+ if ($lastNsPos = strripos($className, '\\')) {
+ $namespace = substr($className, 0, $lastNsPos);
+ $className = substr($className, $lastNsPos + 1);
+ $file = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
+ }
+ $file .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
+
if (!empty($dirs)) {
// use the autodiscovered path
$dirPath = dirname($file);
@@ -79,12 +91,11 @@ class Zend_Loader
$file = basename($file);
self::loadFile($file, $dirs, true);
} else {
- self::_securityCheck($file);
- include $file;
+ self::loadFile($file, null, true);
}
if (!class_exists($class, false) && !interface_exists($class, false)) {
- require_once 'Zend/Exception.php';
+ // require_once 'Zend/Exception.php';
throw new Zend_Exception("File \"$file\" does not exist or class \"$class\" was not found in the file");
}
}
@@ -162,11 +173,59 @@ class Zend_Loader
*/
public static function isReadable($filename)
{
- if (!$fh = @fopen($filename, 'r', true)) {
+ if (is_readable($filename)) {
+ // Return early if the filename is readable without needing the
+ // include_path
+ return true;
+ }
+
+ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'
+ && preg_match('/^[a-z]:/i', $filename)
+ ) {
+ // If on windows, and path provided is clearly an absolute path,
+ // return false immediately
return false;
}
- @fclose($fh);
- return true;
+
+ foreach (self::explodeIncludePath() as $path) {
+ if ($path == '.') {
+ if (is_readable($filename)) {
+ return true;
+ }
+ continue;
+ }
+ $file = $path . '/' . $filename;
+ if (is_readable($file)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Explode an include path into an array
+ *
+ * If no path provided, uses current include_path. Works around issues that
+ * occur when the path includes stream schemas.
+ *
+ * @param string|null $path
+ * @return array
+ */
+ public static function explodeIncludePath($path = null)
+ {
+ if (null === $path) {
+ $path = get_include_path();
+ }
+
+ if (PATH_SEPARATOR == ':') {
+ // On *nix systems, include_paths which include paths with a stream
+ // schema cannot be safely explode'd, so we have to be a bit more
+ // intelligent in the approach.
+ $paths = preg_split('#:(?!//)#', $path);
+ } else {
+ $paths = explode(PATH_SEPARATOR, $path);
+ }
+ return $paths;
}
/**
@@ -205,7 +264,7 @@ class Zend_Loader
public static function registerAutoload($class = 'Zend_Loader', $enabled = true)
{
trigger_error(__CLASS__ . '::' . __METHOD__ . ' is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead', E_USER_NOTICE);
- require_once 'Zend/Loader/Autoloader.php';
+ // require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
@@ -213,7 +272,7 @@ class Zend_Loader
self::loadClass($class);
$methods = get_class_methods($class);
if (!in_array('autoload', (array) $methods)) {
- require_once 'Zend/Exception.php';
+ // require_once 'Zend/Exception.php';
throw new Zend_Exception("The class \"$class\" does not have an autoload() method");
}
@@ -240,7 +299,7 @@ class Zend_Loader
* Security check
*/
if (preg_match('/[^a-z0-9\\/\\\\_.:-]/i', $filename)) {
- require_once 'Zend/Exception.php';
+ // require_once 'Zend/Exception.php';
throw new Zend_Exception('Security check: Illegal character in filename');
}
}
diff --git a/libs/Zend/Loader/Autoloader.php b/libs/Zend/Loader/Autoloader.php
index d218331444..11ddf6eca4 100644
--- a/libs/Zend/Loader/Autoloader.php
+++ b/libs/Zend/Loader/Autoloader.php
@@ -15,8 +15,8 @@
* @category Zend
* @package Zend_Loader
* @subpackage Autoloader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- * @version $Id: Autoloader.php 18339 2009-09-21 15:05:25Z matthew $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Autoloader.php 20096 2010-01-06 02:05:09Z bkarwin $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -25,11 +25,11 @@ require_once 'Zend/Loader.php';
/**
* Autoloader stack and namespace autoloader
- *
+ *
* @uses Zend_Loader_Autoloader
* @package Zend_Loader
* @subpackage Autoloader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Loader_Autoloader
@@ -84,7 +84,7 @@ class Zend_Loader_Autoloader
/**
* Retrieve singleton instance
- *
+ *
* @return Zend_Loader_Autoloader
*/
public static function getInstance()
@@ -97,7 +97,7 @@ class Zend_Loader_Autoloader
/**
* Reset the singleton instance
- *
+ *
* @return void
*/
public static function resetInstance()
@@ -107,8 +107,8 @@ class Zend_Loader_Autoloader
/**
* Autoload a class
- *
- * @param string $class
+ *
+ * @param string $class
* @return bool
*/
public static function autoload($class)
@@ -138,7 +138,7 @@ class Zend_Loader_Autoloader
/**
* Set the default autoloader implementation
- *
+ *
* @param string|array $callback PHP callback
* @return void
*/
@@ -154,7 +154,7 @@ class Zend_Loader_Autoloader
/**
* Retrieve the default autoloader callback
- *
+ *
* @return string|array PHP Callback
*/
public function getDefaultAutoloader()
@@ -164,7 +164,7 @@ class Zend_Loader_Autoloader
/**
* Set several autoloader callbacks at once
- *
+ *
* @param array $autoloaders Array of PHP callbacks (or Zend_Loader_Autoloader_Interface implementations) to act as autoloaders
* @return Zend_Loader_Autoloader
*/
@@ -176,7 +176,7 @@ class Zend_Loader_Autoloader
/**
* Get attached autoloader implementations
- *
+ *
* @return array
*/
public function getAutoloaders()
@@ -186,7 +186,7 @@ class Zend_Loader_Autoloader
/**
* Return all autoloaders for a given namespace
- *
+ *
* @param string $namespace
* @return array
*/
@@ -201,8 +201,8 @@ class Zend_Loader_Autoloader
/**
* Register a namespace to autoload
- *
- * @param string|array $namespace
+ *
+ * @param string|array $namespace
* @return Zend_Loader_Autoloader
*/
public function registerNamespace($namespace)
@@ -223,8 +223,8 @@ class Zend_Loader_Autoloader
/**
* Unload a registered autoload namespace
- *
- * @param string|array $namespace
+ *
+ * @param string|array $namespace
* @return Zend_Loader_Autoloader
*/
public function unregisterNamespace($namespace)
@@ -245,7 +245,7 @@ class Zend_Loader_Autoloader
/**
* Get a list of registered autoload namespaces
- *
+ *
* @return array
*/
public function getRegisteredNamespaces()
@@ -281,8 +281,8 @@ class Zend_Loader_Autoloader
/**
* Get or set the value of the "suppress not found warnings" flag
- *
- * @param null|bool $flag
+ *
+ * @param null|bool $flag
* @return bool|Zend_Loader_Autoloader Returns boolean if no argument is passed, object instance otherwise
*/
public function suppressNotFoundWarnings($flag = null)
@@ -296,8 +296,8 @@ class Zend_Loader_Autoloader
/**
* Indicate whether or not this autoloader should be a fallback autoloader
- *
- * @param bool $flag
+ *
+ * @param bool $flag
* @return Zend_Loader_Autoloader
*/
public function setFallbackAutoloader($flag)
@@ -308,7 +308,7 @@ class Zend_Loader_Autoloader
/**
* Is this instance acting as a fallback autoloader?
- *
+ *
* @return bool
*/
public function isFallbackAutoloader()
@@ -319,11 +319,11 @@ class Zend_Loader_Autoloader
/**
* Get autoloaders to use when matching class
*
- * Determines if the class matches a registered namespace, and, if so,
- * returns only the autoloaders for that namespace. Otherwise, it returns
+ * Determines if the class matches a registered namespace, and, if so,
+ * returns only the autoloaders for that namespace. Otherwise, it returns
* all non-namespaced autoloaders.
*
- * @param string $class
+ * @param string $class
* @return array Array of autoloaders to use
*/
public function getClassAutoloaders($class)
@@ -365,7 +365,7 @@ class Zend_Loader_Autoloader
/**
* Add an autoloader to the beginning of the stack
- *
+ *
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param string|array $namespace Specific namespace(s) under which to register callback
* @return Zend_Loader_Autoloader
@@ -388,7 +388,7 @@ class Zend_Loader_Autoloader
/**
* Append an autoloader to the autoloader stack
- *
+ *
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param string|array $namespace Specific namespace(s) under which to register callback
* @return Zend_Loader_Autoloader
@@ -411,7 +411,7 @@ class Zend_Loader_Autoloader
/**
* Remove an autoloader from the autoloader stack
- *
+ *
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param null|string|array $namespace Specific namespace(s) from which to remove autoloader
* @return Zend_Loader_Autoloader
@@ -449,7 +449,7 @@ class Zend_Loader_Autoloader
* Constructor
*
* Registers instance with spl_autoload stack
- *
+ *
* @return void
*/
protected function __construct()
@@ -460,8 +460,8 @@ class Zend_Loader_Autoloader
/**
* Internal autoloader implementation
- *
- * @param string $class
+ *
+ * @param string $class
* @return bool
*/
protected function _autoload($class)
@@ -481,9 +481,9 @@ class Zend_Loader_Autoloader
/**
* Set autoloaders for a specific namespace
- *
- * @param array $autoloaders
- * @param string $namespace
+ *
+ * @param array $autoloaders
+ * @param string $namespace
* @return Zend_Loader_Autoloader
*/
protected function _setNamespaceAutoloaders(array $autoloaders, $namespace = '')
@@ -495,15 +495,15 @@ class Zend_Loader_Autoloader
/**
* Retrieve the filesystem path for the requested ZF version
- *
- * @param string $path
- * @param string $version
+ *
+ * @param string $path
+ * @param string $version
* @return void
*/
protected function _getVersionPath($path, $version)
{
$type = $this->_getVersionType($version);
-
+
if ($type == 'latest') {
$version = 'latest';
}
@@ -519,8 +519,8 @@ class Zend_Loader_Autoloader
/**
* Retrieve the ZF version type
- *
- * @param string $version
+ *
+ * @param string $version
* @return string "latest", "major", "minor", or "specific"
* @throws Zend_Loader_Exception if version string contains too many dots
*/
@@ -546,9 +546,9 @@ class Zend_Loader_Autoloader
/**
* Get available versions for the version type requested
- *
- * @param string $path
- * @param string $version
+ *
+ * @param string $path
+ * @param string $version
* @return array
*/
protected function _getAvailableVersions($path, $version)
diff --git a/libs/Zend/Loader/Autoloader/Interface.php b/libs/Zend/Loader/Autoloader/Interface.php
index 09983ae188..8bcaf14fb2 100644
--- a/libs/Zend/Loader/Autoloader/Interface.php
+++ b/libs/Zend/Loader/Autoloader/Interface.php
@@ -15,17 +15,17 @@
* @category Zend
* @package Zend_Loader
* @subpackage Autoloader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- * @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Autoloader interface
- *
+ *
* @package Zend_Loader
* @subpackage Autoloader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Loader_Autoloader_Interface
diff --git a/libs/Zend/Loader/Autoloader/Resource.php b/libs/Zend/Loader/Autoloader/Resource.php
index 15ae74c9a0..cd0a7fe7fc 100644
--- a/libs/Zend/Loader/Autoloader/Resource.php
+++ b/libs/Zend/Loader/Autoloader/Resource.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Loader
* @subpackage Autoloader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- * @version $Id: Resource.php 18173 2009-09-17 15:35:05Z padraic $
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Loader_Autoloader_Interface */
-require_once 'Zend/Loader/Autoloader/Interface.php';
+// require_once 'Zend/Loader/Autoloader/Interface.php';
/**
* Resource loader
- *
+ *
* @uses Zend_Loader_Autoloader_Interface
* @package Zend_Loader
* @subpackage Autoloader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interface
@@ -61,7 +61,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Constructor
- *
+ *
* @param array|Zend_Config $options Configuration options for resource autoloader
* @return void
*/
@@ -71,7 +71,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
$options = $options->toArray();
}
if (!is_array($options)) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception('Options must be passed to resource loader constructor');
}
@@ -81,7 +81,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
if ((null === $namespace)
|| (null === $this->getBasePath())
) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception('Resource loader requires both a namespace and a base path for initialization');
}
@@ -94,7 +94,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Overloading: methods
*
- * Allow retrieving concrete resource object instances using 'get<Resourcename>()'
+ * Allow retrieving concrete resource object instances using 'get<Resourcename>()'
* syntax. Example:
* <code>
* $loader = new Zend_Loader_Autoloader_Resource(array(
@@ -105,9 +105,9 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
*
* $foo = $loader->getModel('Foo'); // get instance of Stuff_Model_Foo class
* </code>
- *
- * @param string $method
- * @param array $args
+ *
+ * @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
*/
@@ -116,28 +116,28 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
if ('get' == substr($method, 0, 3)) {
$type = strtolower(substr($method, 3));
if (!$this->hasResourceType($type)) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception("Invalid resource type $type; cannot load resource");
}
if (empty($args)) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception("Cannot load resources; no resource specified");
}
$resource = array_shift($args);
return $this->load($resource, $type);
}
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception("Method '$method' is not supported");
}
/**
- * Attempt to autoload a class
- *
- * @param string $class
- * @return mixed False if not matched, otherwise result if include operation
+ * Helper method to calculate the correct class path
+ *
+ * @param string $class
+ * @return False if not matched other wise the correct path
*/
- public function autoload($class)
+ public function getClassPath($class)
{
$segments = explode('_', $class);
$namespaceTopLevel = $this->getNamespace();
@@ -171,15 +171,36 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
return false;
}
- $final = substr($class, strlen($lastMatch));
+ $final = substr($class, strlen($lastMatch) + 1);
$path = $this->_components[$lastMatch];
- return include $path . '/' . str_replace('_', '/', $final) . '.php';
+ $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
+ *
+ * @param array $options
* @return Zend_Loader_Autoloader_Resource
*/
public function setOptions(array $options)
@@ -196,8 +217,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Set namespace that this autoloader handles
- *
- * @param string $namespace
+ *
+ * @param string $namespace
* @return Zend_Loader_Autoloader_Resource
*/
public function setNamespace($namespace)
@@ -208,7 +229,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Get namespace this autoloader handles
- *
+ *
* @return string
*/
public function getNamespace()
@@ -218,8 +239,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Set base path for this set of resources
- *
- * @param string $path
+ *
+ * @param string $path
* @return Zend_Loader_Autoloader_Resource
*/
public function setBasePath($path)
@@ -227,10 +248,10 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
$this->_basePath = (string) $path;
return $this;
}
-
+
/**
* Get base path to this set of resources
- *
+ *
* @return string
*/
public function getBasePath()
@@ -240,7 +261,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* 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
@@ -251,7 +272,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
$type = strtolower($type);
if (!isset($this->_resourceTypes[$type])) {
if (null === $namespace) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception('Initial definition of a resource type must include a namespace');
}
$namespaceTopLevel = $this->getNamespace();
@@ -261,7 +282,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
);
}
if (!is_string($path)) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception('Invalid path specification provided; must be string');
}
$this->_resourceTypes[$type]['path'] = $this->getBasePath() . '/' . rtrim($path, '\/');
@@ -274,10 +295,10 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* 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
+ * $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:
@@ -293,19 +314,19 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
* ),
* ));
* </code>
- *
- * @param array $types
+ *
+ * @param array $types
* @return Zend_Loader_Autoloader_Resource
*/
public function addResourceTypes(array $types)
{
foreach ($types as $type => $spec) {
if (!is_array($spec)) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception('addResourceTypes() expects an array of arrays');
}
if (!isset($spec['path'])) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception('addResourceTypes() expects each array to include a paths element');
}
$paths = $spec['path'];
@@ -320,9 +341,9 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Overwrite existing and set multiple resource types at once
- *
+ *
* @see Zend_Loader_Autoloader_Resource::addResourceTypes()
- * @param array $types
+ * @param array $types
* @return Zend_Loader_Autoloader_Resource
*/
public function setResourceTypes(array $types)
@@ -333,7 +354,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Retrieve resource type mappings
- *
+ *
* @return array
*/
public function getResourceTypes()
@@ -343,8 +364,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Is the requested resource type defined?
- *
- * @param string $type
+ *
+ * @param string $type
* @return bool
*/
public function hasResourceType($type)
@@ -354,8 +375,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Remove the requested resource type
- *
- * @param string $type
+ *
+ * @param string $type
* @return Zend_Loader_Autoloader_Resource
*/
public function removeResourceType($type)
@@ -370,7 +391,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Clear all resource types
- *
+ *
* @return Zend_Loader_Autoloader_Resource
*/
public function clearResourceTypes()
@@ -382,8 +403,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Set default resource type to use when calling load()
- *
- * @param string $type
+ *
+ * @param string $type
* @return Zend_Loader_Autoloader_Resource
*/
public function setDefaultResourceType($type)
@@ -396,7 +417,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* Get default resource type to use when calling load()
- *
+ *
* @return string|null
*/
public function getDefaultResourceType()
@@ -407,12 +428,12 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
/**
* 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,
+ * 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
+ *
+ * @param string $resource
+ * @param string $type
* @return object
* @throws Zend_Loader_Exception if resource type not specified or invalid
*/
@@ -421,12 +442,12 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
if (null === $type) {
$type = $this->getDefaultResourceType();
if (empty($type)) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception('No resource type specified');
}
}
if (!$this->hasResourceType($type)) {
- require_once 'Zend/Loader/Exception.php';
+ // require_once 'Zend/Loader/Exception.php';
throw new Zend_Loader_Exception('Invalid resource type specified');
}
$namespace = $this->_resourceTypes[$type]['namespace'];
diff --git a/libs/Zend/Loader/Exception.php b/libs/Zend/Loader/Exception.php
index 99ad35db7b..84d40420ef 100644
--- a/libs/Zend/Loader/Exception.php
+++ b/libs/Zend/Loader/Exception.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Loader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Loader
* @uses Zend_Exception
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Loader_Exception extends Zend_Exception
-{}
+class Zend_Loader_Exception extends Zend_Exception
+{} \ No newline at end of file
diff --git a/libs/Zend/Loader/PluginLoader.php b/libs/Zend/Loader/PluginLoader.php
index 39ff94cfe5..f3f6170c67 100644
--- a/libs/Zend/Loader/PluginLoader.php
+++ b/libs/Zend/Loader/PluginLoader.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Loader
* @subpackage PluginLoader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: PluginLoader.php 18207 2009-09-17 22:29:50Z beberlei $
+ * @version $Id: PluginLoader.php 21170 2010-02-23 19:50:16Z matthew $
*/
/** Zend_Loader_PluginLoader_Interface */
-require_once 'Zend/Loader/PluginLoader/Interface.php';
+// require_once 'Zend/Loader/PluginLoader/Interface.php';
/** Zend_Loader */
-require_once 'Zend/Loader.php';
+// require_once 'Zend/Loader.php';
/**
* Generic plugin class loader
@@ -32,7 +32,7 @@ require_once 'Zend/Loader.php';
* @category Zend
* @package Zend_Loader
* @subpackage PluginLoader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
@@ -123,9 +123,15 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
*/
protected function _formatPrefix($prefix)
{
- if($prefix == "") {
- return $prefix;
- }
+ if($prefix == "") {
+ return $prefix;
+ }
+
+ $last = strlen($prefix) - 1;
+ if ($prefix{$last} == '\\') {
+ return $prefix;
+ }
+
return rtrim($prefix, '_') . '_';
}
@@ -139,7 +145,7 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
public function addPrefixPath($prefix, $path)
{
if (!is_string($prefix) || !is_string($path)) {
- require_once 'Zend/Loader/PluginLoader/Exception.php';
+ // require_once 'Zend/Loader/PluginLoader/Exception.php';
throw new Zend_Loader_PluginLoader_Exception('Zend_Loader_PluginLoader::addPrefixPath() method only takes strings for prefix and path.');
}
@@ -244,14 +250,14 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
}
if (!isset($registry[$prefix])) {
- require_once 'Zend/Loader/PluginLoader/Exception.php';
+ // require_once 'Zend/Loader/PluginLoader/Exception.php';
throw new Zend_Loader_PluginLoader_Exception('Prefix ' . $prefix . ' was not found in the PluginLoader.');
}
if ($path != null) {
$pos = array_search($path, $registry[$prefix]);
if ($pos === null) {
- require_once 'Zend/Loader/PluginLoader/Exception.php';
+ // require_once 'Zend/Loader/PluginLoader/Exception.php';
throw new Zend_Loader_PluginLoader_Exception('Prefix ' . $prefix . ' / Path ' . $path . ' was not found in the PluginLoader.');
}
unset($registry[$prefix][$pos]);
@@ -298,7 +304,7 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
public function getClassName($name)
{
$name = $this->_formatName($name);
- if ($this->_useStaticRegistry
+ if ($this->_useStaticRegistry
&& isset(self::$_staticLoadedPlugins[$this->_useStaticRegistry][$name])
) {
return self::$_staticLoadedPlugins[$this->_useStaticRegistry][$name];
@@ -311,14 +317,14 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
/**
* Get path to plugin class
- *
- * @param mixed $name
+ *
+ * @param mixed $name
* @return string|false False if not found
*/
public function getClassPath($name)
{
$name = $this->_formatName($name);
- if ($this->_useStaticRegistry
+ if ($this->_useStaticRegistry
&& !empty(self::$_staticLoadedPluginPaths[$this->_useStaticRegistry][$name])
) {
return self::$_staticLoadedPluginPaths[$this->_useStaticRegistry][$name];
@@ -345,9 +351,9 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
* Load a plugin via the name provided
*
* @param string $name
- * @param bool $throwExceptions Whether or not to throw exceptions if the
+ * @param bool $throwExceptions Whether or not to throw exceptions if the
* class is not resolved
- * @return string|false Class name of loaded class; false if $throwExceptions
+ * @return string|false Class name of loaded class; false if $throwExceptions
* if false and no class found
* @throws Zend_Loader_Exception if class not found
*/
@@ -402,16 +408,14 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
foreach ($registry as $prefix => $paths) {
$message .= "\n$prefix: " . implode(PATH_SEPARATOR, $paths);
}
- require_once 'Zend/Loader/PluginLoader/Exception.php';
+ // require_once 'Zend/Loader/PluginLoader/Exception.php';
throw new Zend_Loader_PluginLoader_Exception($message);
}
if ($this->_useStaticRegistry) {
self::$_staticLoadedPlugins[$this->_useStaticRegistry][$name] = $className;
- self::$_staticLoadedPluginPaths[$this->_useStaticRegistry][$name] = (isset($loadFile) ? $loadFile : '');
} else {
$this->_loadedPlugins[$name] = $className;
- $this->_loadedPluginPaths[$name] = (isset($loadFile) ? $loadFile : '');
}
return $className;
}
@@ -419,10 +423,10 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
/**
* Set path to class file cache
*
- * Specify a path to a file that will add include_once statements for each
+ * Specify a path to a file that will add include_once statements for each
* plugin class loaded. This is an opt-in feature for performance purposes.
- *
- * @param string $file
+ *
+ * @param string $file
* @return void
* @throws Zend_Loader_PluginLoader_Exception if file is not writeable or path does not exist
*/
@@ -434,15 +438,15 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
}
if (!file_exists($file) && !file_exists(dirname($file))) {
- require_once 'Zend/Loader/PluginLoader/Exception.php';
+ // require_once 'Zend/Loader/PluginLoader/Exception.php';
throw new Zend_Loader_PluginLoader_Exception('Specified file does not exist and/or directory does not exist (' . $file . ')');
}
if (file_exists($file) && !is_writable($file)) {
- require_once 'Zend/Loader/PluginLoader/Exception.php';
+ // require_once 'Zend/Loader/PluginLoader/Exception.php';
throw new Zend_Loader_PluginLoader_Exception('Specified file is not writeable (' . $file . ')');
}
if (!file_exists($file) && file_exists(dirname($file)) && !is_writable(dirname($file))) {
- require_once 'Zend/Loader/PluginLoader/Exception.php';
+ // require_once 'Zend/Loader/PluginLoader/Exception.php';
throw new Zend_Loader_PluginLoader_Exception('Specified file is not writeable (' . $file . ')');
}
@@ -451,7 +455,7 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
/**
* Retrieve class file cache path
- *
+ *
* @return string|null
*/
public static function getIncludeFileCache()
@@ -461,8 +465,8 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
/**
* Append an include_once statement to the class file cache
- *
- * @param string $incFile
+ *
+ * @param string $incFile
* @return void
*/
protected static function _appendIncFile($incFile)
diff --git a/libs/Zend/Loader/PluginLoader/Exception.php b/libs/Zend/Loader/PluginLoader/Exception.php
index 9e0a744e5f..7db26ae6be 100644
--- a/libs/Zend/Loader/PluginLoader/Exception.php
+++ b/libs/Zend/Loader/PluginLoader/Exception.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Loader
* @subpackage PluginLoader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Loader_Exception
*/
-require_once 'Zend/Loader/Exception.php';
+// require_once 'Zend/Loader/Exception.php';
/**
* Plugin class loader exceptions
@@ -31,7 +31,7 @@ require_once 'Zend/Loader/Exception.php';
* @category Zend
* @package Zend_Loader
* @subpackage PluginLoader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Loader_PluginLoader_Exception extends Zend_Loader_Exception
diff --git a/libs/Zend/Loader/PluginLoader/Interface.php b/libs/Zend/Loader/PluginLoader/Interface.php
index 67da668506..bfbbe50e3c 100644
--- a/libs/Zend/Loader/PluginLoader/Interface.php
+++ b/libs/Zend/Loader/PluginLoader/Interface.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Loader
* @subpackage PluginLoader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
@@ -26,7 +26,7 @@
* @category Zend
* @package Zend_Loader
* @subpackage PluginLoader
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Loader_PluginLoader_Interface
@@ -39,7 +39,7 @@ interface Zend_Loader_PluginLoader_Interface
* @return Zend_Loader_PluginLoader
*/
public function addPrefixPath($prefix, $path);
-
+
/**
* Remove a prefix (or prefixed-path) from the registry
*
@@ -48,7 +48,7 @@ interface Zend_Loader_PluginLoader_Interface
* @return Zend_Loader_PluginLoader
*/
public function removePrefixPath($prefix, $path = null);
-
+
/**
* Whether or not a Helper by a specific name
*
@@ -64,7 +64,7 @@ interface Zend_Loader_PluginLoader_Interface
* @return string
*/
public function getClassName($name);
-
+
/**
* Load a helper via the name provided
*
diff --git a/libs/Zend/Log.php b/libs/Zend/Log.php
index 04b7ebb85a..471c0e3cf4 100644
--- a/libs/Zend/Log.php
+++ b/libs/Zend/Log.php
@@ -14,17 +14,17 @@
*
* @category Zend
* @package Zend_Log
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Log.php 16207 2009-06-21 19:17:51Z thomas $
+ * @version $Id: Log.php 20893 2010-02-03 22:59:25Z yoshida@zend.co.jp $
*/
/**
* @category Zend
* @package Zend_Log
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Log.php 16207 2009-06-21 19:17:51Z thomas $
+ * @version $Id: Log.php 20893 2010-02-03 22:59:25Z yoshida@zend.co.jp $
*/
class Zend_Log
{
@@ -59,6 +59,19 @@ class Zend_Log
protected $_extras = array();
/**
+ *
+ * @var string
+ */
+ protected $_defaultWriterNamespace = 'Zend_Log_Writer';
+
+ /**
+ *
+ * @var string
+ */
+ protected $_defaultFilterNamespace = 'Zend_Log_Filter';
+
+
+ /**
* Class constructor. Create a new logger
*
* @param Zend_Log_Writer_Abstract|null $writer default writer
@@ -74,6 +87,146 @@ class Zend_Log
}
/**
+ * Factory to construct the logger and one or more writers
+ * based on the configuration array
+ *
+ * @param array|Zend_Config Array or instance of Zend_Config
+ * @return Zend_Log
+ */
+ static public function factory($config = array())
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config) || empty($config)) {
+ /** @see Zend_Log_Exception */
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception('Configuration must be an array or instance of Zend_Config');
+ }
+
+ $log = new Zend_Log;
+
+ if (!is_array(current($config))) {
+ $log->addWriter(current($config));
+ } else {
+ foreach($config as $writer) {
+ $log->addWriter($writer);
+ }
+ }
+
+ return $log;
+ }
+
+
+ /**
+ * Construct a writer object based on a configuration array
+ *
+ * @param array $spec config array with writer spec
+ * @return Zend_Log_Writer_Abstract
+ */
+ protected function _constructWriterFromConfig($config)
+ {
+ $writer = $this->_constructFromConfig('writer', $config, $this->_defaultWriterNamespace);
+
+ if (!$writer instanceof Zend_Log_Writer_Abstract) {
+ /** @see Zend_Log_Exception */
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception("{$writerName} does not extend Zend_Log_Writer_Abstract!");
+ }
+
+ if (isset($config['filterName'])) {
+ $filter = $this->_constructFilterFromConfig($config);
+ $writer->addFilter($filter);
+ }
+
+ return $writer;
+ }
+
+ /**
+ * Construct filter object from configuration array or Zend_Config object
+ *
+ * @param array|Zend_Config $config Zend_Config or Array
+ * @return Zend_Log_Filter_Interface
+ */
+ protected function _constructFilterFromConfig($config)
+ {
+ $filter = $this->_constructFromConfig('filter', $config, $this->_defaultFilterNamespace);
+
+ if (!$filter instanceof Zend_Log_Filter_Interface) {
+ /** @see Zend_Log_Exception */
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception("{$filterName} does not implement Zend_Log_Filter_Interface");
+ }
+
+ return $filter;
+ }
+
+ /**
+ * Construct a filter or writer from config
+ *
+ * @param string $type 'writer' of 'filter'
+ * @param mixed $config Zend_Config or Array
+ * @param string $namespace
+ * @return object
+ */
+ protected function _constructFromConfig($type, $config, $namespace)
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config) || empty($config)) {
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception(
+ 'Configuration must be an array or instance of Zend_Config'
+ );
+ }
+
+ $params = isset($config[ $type .'Params' ]) ? $config[ $type .'Params' ] : array();
+ $className = $this->getClassName($config, $type, $namespace);
+ // if (!class_exists($className)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($className);
+ // }
+
+ $reflection = new ReflectionClass($className);
+ if (!$reflection->implementsInterface('Zend_Log_FactoryInterface')) {
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception(
+ 'Driver does not implement Zend_Log_FactoryInterface and can not be constructed from config.'
+ );
+ }
+
+ return call_user_func(array($className, 'factory'), $params);
+ }
+
+ /**
+ * Get the writer or filter full classname
+ *
+ * @param array $config
+ * @param string $type filter|writer
+ * @param string $defaultNamespace
+ * @return string full classname
+ */
+ protected function getClassName($config, $type, $defaultNamespace)
+ {
+ if (!isset($config[ $type . 'Name' ])) {
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception("Specify {$type}Name in the configuration array");
+ }
+ $className = $config[ $type . 'Name' ];
+
+ $namespace = $defaultNamespace;
+ if (isset($config[ $type . 'Namespace' ])) {
+ $namespace = $config[ $type . 'Namespace' ];
+ }
+
+ $fullClassName = $namespace . '_' . $className;
+ return $fullClassName;
+ }
+
+ /**
* Class destructor. Shutdown log writers
*
* @return void
@@ -100,10 +253,24 @@ class Zend_Log
{
$priority = strtoupper($method);
if (($priority = array_search($priority, $this->_priorities)) !== false) {
- $this->log(array_shift($params), $priority);
+ switch (count($params)) {
+ case 0:
+ /** @see Zend_Log_Exception */
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception('Missing log message');
+ case 1:
+ $message = array_shift($params);
+ $extras = null;
+ break;
+ default:
+ $message = array_shift($params);
+ $extras = array_shift($params);
+ break;
+ }
+ $this->log($message, $priority, $extras);
} else {
/** @see Zend_Log_Exception */
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Bad log priority');
}
}
@@ -113,21 +280,22 @@ class Zend_Log
*
* @param string $message Message to log
* @param integer $priority Priority of message
+ * @param mixed $extras Extra information to log in event
* @return void
* @throws Zend_Log_Exception
*/
- public function log($message, $priority)
+ public function log($message, $priority, $extras = null)
{
// sanity checks
if (empty($this->_writers)) {
/** @see Zend_Log_Exception */
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('No writers were added');
}
if (! isset($this->_priorities[$priority])) {
/** @see Zend_Log_Exception */
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Bad log priority');
}
@@ -138,6 +306,25 @@ class Zend_Log
'priorityName' => $this->_priorities[$priority]),
$this->_extras);
+ // Check to see if any extra information was passed
+ if (!empty($extras)) {
+ $info = array();
+ if (is_array($extras)) {
+ foreach ($extras as $key => $value) {
+ if (is_string($key)) {
+ $event[$key] = $value;
+ } else {
+ $info[] = $value;
+ }
+ }
+ } else {
+ $info = $extras;
+ }
+ if (!empty($info)) {
+ $event['info'] = $info;
+ }
+ }
+
// abort if rejected by the global filters
foreach ($this->_filters as $filter) {
if (! $filter->accept($event)) {
@@ -166,7 +353,7 @@ class Zend_Log
if (isset($this->_priorities[$priority])
|| array_search($name, $this->_priorities)) {
/** @see Zend_Log_Exception */
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Existing priorities cannot be overwritten');
}
@@ -184,12 +371,16 @@ class Zend_Log
public function addFilter($filter)
{
if (is_integer($filter)) {
- /** @see Zend_Log_Filter_Priority */
- require_once 'Zend/Log/Filter/Priority.php';
+ /** @see Zend_Log_Filter_Priority */
+ // require_once 'Zend/Log/Filter/Priority.php';
$filter = new Zend_Log_Filter_Priority($filter);
- } elseif(!is_object($filter) || ! $filter instanceof Zend_Log_Filter_Interface) {
+
+ } elseif ($filter instanceof Zend_Config || is_array($filter)) {
+ $filter = $this->_constructFilterFromConfig($filter);
+
+ } elseif(! $filter instanceof Zend_Log_Filter_Interface) {
/** @see Zend_Log_Exception */
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Invalid filter provided');
}
@@ -200,11 +391,24 @@ class Zend_Log
* Add a writer. A writer is responsible for taking a log
* message and writing it out to storage.
*
- * @param Zend_Log_Writer_Abstract $writer
+ * @param mixed $writer Zend_Log_Writer_Abstract or Config array
* @return void
*/
- public function addWriter(Zend_Log_Writer_Abstract $writer)
+ public function addWriter($writer)
{
+ if (is_array($writer) || $writer instanceof Zend_Config) {
+ $writer = $this->_constructWriterFromConfig($writer);
+ }
+
+ if (!$writer instanceof Zend_Log_Writer_Abstract) {
+ /** @see Zend_Log_Exception */
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception(
+ 'Writer must be an instance of Zend_Log_Writer_Abstract'
+ . ' or you should pass a configuration array'
+ );
+ }
+
$this->_writers[] = $writer;
}
@@ -218,5 +422,4 @@ class Zend_Log
public function setEventItem($name, $value) {
$this->_extras = array_merge($this->_extras, array($name => $value));
}
-
}
diff --git a/libs/Zend/Log/Exception.php b/libs/Zend/Log/Exception.php
index 4290898cdd..b4bd50b5bb 100644
--- a/libs/Zend/Log/Exception.php
+++ b/libs/Zend/Log/Exception.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Log
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Exception */
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Log
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Exception extends Zend_Exception
{}
diff --git a/libs/Zend/Log/FactoryInterface.php b/libs/Zend/Log/FactoryInterface.php
new file mode 100644
index 0000000000..20a270747f
--- /dev/null
+++ b/libs/Zend/Log/FactoryInterface.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Log
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Log
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+interface Zend_Log_FactoryInterface
+{
+ /**
+ * Construct a Zend_Log driver
+ *
+ * @param array|Zen_Config $config
+ * @return Zend_Log_FactoryInterface
+ */
+ static public function factory($config);
+}
diff --git a/libs/Zend/Log/Filter/Abstract.php b/libs/Zend/Log/Filter/Abstract.php
new file mode 100644
index 0000000000..e0e97b89f2
--- /dev/null
+++ b/libs/Zend/Log/Filter/Abstract.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/** @see Zend_Log_Filter_Interface */
+// require_once 'Zend/Log/Filter/Interface.php';
+
+/** @see Zend_Log_FactoryInterface */
+// require_once 'Zend/Log/FactoryInterface.php';
+
+/**
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+abstract class Zend_Log_Filter_Abstract
+ implements Zend_Log_Filter_Interface, Zend_Log_FactoryInterface
+{
+ /**
+ * Validate and optionally convert the config to array
+ *
+ * @param array|Zend_Config $config Zend_Config or Array
+ * @return array
+ * @throws Zend_Log_Exception
+ */
+ static protected function _parseConfig($config)
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config)) {
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception('Configuration must be an array or instance of Zend_Config');
+ }
+
+ return $config;
+ }
+}
diff --git a/libs/Zend/Log/Filter/Interface.php b/libs/Zend/Log/Filter/Interface.php
index 104b578f91..c2165d2ba6 100644
--- a/libs/Zend/Log/Filter/Interface.php
+++ b/libs/Zend/Log/Filter/Interface.php
@@ -15,18 +15,18 @@
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
interface Zend_Log_Filter_Interface
{
@@ -37,5 +37,4 @@ interface Zend_Log_Filter_Interface
* @return boolean accepted?
*/
public function accept($event);
-
}
diff --git a/libs/Zend/Log/Filter/Message.php b/libs/Zend/Log/Filter/Message.php
index 9a05deaedf..4510888610 100644
--- a/libs/Zend/Log/Filter/Message.php
+++ b/libs/Zend/Log/Filter/Message.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Message.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Message.php 20982 2010-02-08 15:51:36Z matthew $
*/
-/** Zend_Log_Filter_Interface */
-require_once 'Zend/Log/Filter/Interface.php';
+/** Zend_Log_Filter_Abstract */
+// require_once 'Zend/Log/Filter/Abstract.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Message.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Message.php 20982 2010-02-08 15:51:36Z matthew $
*/
-class Zend_Log_Filter_Message implements Zend_Log_Filter_Interface
+class Zend_Log_Filter_Message extends Zend_Log_Filter_Abstract
{
/**
* @var string
@@ -47,13 +47,32 @@ class Zend_Log_Filter_Message implements Zend_Log_Filter_Interface
public function __construct($regexp)
{
if (@preg_match($regexp, '') === false) {
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception("Invalid regular expression '$regexp'");
}
$this->_regexp = $regexp;
}
/**
+ * Create a new instance of Zend_Log_Filter_Message
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Filter_Message
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'regexp' => null
+ ), $config);
+
+ return new self(
+ $config['regexp']
+ );
+ }
+
+ /**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
@@ -63,5 +82,4 @@ class Zend_Log_Filter_Message implements Zend_Log_Filter_Interface
{
return preg_match($this->_regexp, $event['message']) > 0;
}
-
}
diff --git a/libs/Zend/Log/Filter/Priority.php b/libs/Zend/Log/Filter/Priority.php
index d19c3f9ec6..45ba7c953b 100644
--- a/libs/Zend/Log/Filter/Priority.php
+++ b/libs/Zend/Log/Filter/Priority.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Priority.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Priority.php 20260 2010-01-13 18:29:22Z ralph $
*/
-/** Zend_Log_Filter_Interface */
-require_once 'Zend/Log/Filter/Interface.php';
+/** Zend_Log_Filter_Abstract */
+// require_once 'Zend/Log/Filter/Abstract.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Priority.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Priority.php 20260 2010-01-13 18:29:22Z ralph $
*/
-class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
+class Zend_Log_Filter_Priority extends Zend_Log_Filter_Abstract
{
/**
* @var integer
@@ -51,15 +51,41 @@ class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
* @param string $operator Comparison operator
* @throws Zend_Log_Exception
*/
- public function __construct($priority, $operator = '<=')
+ public function __construct($priority, $operator = NULL)
{
if (! is_integer($priority)) {
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Priority must be an integer');
}
$this->_priority = $priority;
- $this->_operator = $operator;
+ $this->_operator = is_null($operator) ? '<=' : $operator;
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Filter_Priority
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Filter_Priority
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'priority' => null,
+ 'operator' => null,
+ ), $config);
+
+ // Add support for constants
+ if (!is_numeric($config['priority']) && isset($config['priority']) && defined($config['priority'])) {
+ $config['priority'] = constant($config['priority']);
+ }
+
+ return new self(
+ (int) $config['priority'],
+ $config['operator']
+ );
}
/**
@@ -72,5 +98,4 @@ class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
{
return version_compare($event['priority'], $this->_priority, $this->_operator);
}
-
}
diff --git a/libs/Zend/Log/Filter/Suppress.php b/libs/Zend/Log/Filter/Suppress.php
index 026db36727..d87d2720a2 100644
--- a/libs/Zend/Log/Filter/Suppress.php
+++ b/libs/Zend/Log/Filter/Suppress.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Suppress.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Suppress.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Filter_Interface */
-require_once 'Zend/Log/Filter/Interface.php';
+// require_once 'Zend/Log/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Suppress.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Suppress.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-class Zend_Log_Filter_Suppress implements Zend_Log_Filter_Interface
+class Zend_Log_Filter_Suppress extends Zend_Log_Filter_Abstract
{
/**
* @var boolean
@@ -63,4 +63,15 @@ class Zend_Log_Filter_Suppress implements Zend_Log_Filter_Interface
return $this->_accept;
}
+ /**
+ * Create a new instance of Zend_Log_Filter_Suppress
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Filter_Suppress
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
}
diff --git a/libs/Zend/Log/Formatter/Firebug.php b/libs/Zend/Log/Formatter/Firebug.php
index 2d348d0c78..a0238935ec 100644
--- a/libs/Zend/Log/Formatter/Firebug.php
+++ b/libs/Zend/Log/Formatter/Firebug.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Firebug.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Formatter_Interface */
-require_once 'Zend/Log/Formatter/Interface.php';
+// require_once 'Zend/Log/Formatter/Interface.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Log_Formatter_Firebug implements Zend_Log_Formatter_Interface
{
/**
* This method formats the event for the firebug writer.
- *
- * The default is to just send the message parameter, but through
+ *
+ * The default is to just send the message parameter, but through
* extension of this class and calling the
* {@see Zend_Log_Writer_Firebug::setFormatter()} method you can
* pass as much of the event data as you are interested in.
diff --git a/libs/Zend/Log/Formatter/Interface.php b/libs/Zend/Log/Formatter/Interface.php
index 000734f393..2d05145a3f 100644
--- a/libs/Zend/Log/Formatter/Interface.php
+++ b/libs/Zend/Log/Formatter/Interface.php
@@ -15,18 +15,18 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
interface Zend_Log_Formatter_Interface
{
diff --git a/libs/Zend/Log/Formatter/Simple.php b/libs/Zend/Log/Formatter/Simple.php
index 0761404742..22f5a116fc 100644
--- a/libs/Zend/Log/Formatter/Simple.php
+++ b/libs/Zend/Log/Formatter/Simple.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Simple.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Formatter_Interface */
-require_once 'Zend/Log/Formatter/Interface.php';
+// require_once 'Zend/Log/Formatter/Interface.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Simple.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
{
@@ -53,7 +53,7 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
}
if (! is_string($format)) {
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Format must be a string');
}
diff --git a/libs/Zend/Log/Formatter/Xml.php b/libs/Zend/Log/Formatter/Xml.php
index ce0edb1301..ebf3c29e97 100644
--- a/libs/Zend/Log/Formatter/Xml.php
+++ b/libs/Zend/Log/Formatter/Xml.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xml.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Xml.php 20104 2010-01-06 21:26:01Z matthew $
*/
/** Zend_Log_Formatter_Interface */
-require_once 'Zend/Log/Formatter/Interface.php';
+// require_once 'Zend/Log/Formatter/Interface.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xml.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Xml.php 20104 2010-01-06 21:26:01Z matthew $
*/
class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
{
@@ -44,14 +44,44 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
protected $_elementMap;
/**
+ * @var string Encoding to use in XML
+ */
+ protected $_encoding;
+
+ /**
* Class constructor
*
+ * @param string $rootElement Name of root element
* @param array $elementMap
+ * @param string $encoding Encoding to use (defaults to UTF-8)
*/
- public function __construct($rootElement = 'logEntry', $elementMap = null)
+ public function __construct($rootElement = 'logEntry', $elementMap = null, $encoding = 'UTF-8')
{
$this->_rootElement = $rootElement;
$this->_elementMap = $elementMap;
+ $this->setEncoding($encoding);
+ }
+
+ /**
+ * Get encoding
+ *
+ * @return string
+ */
+ public function getEncoding()
+ {
+ return $this->_encoding;
+ }
+
+ /**
+ * Set encoding
+ *
+ * @param string $value
+ * @return Zend_Log_Formatter_Xml
+ */
+ public function setEncoding($value)
+ {
+ $this->_encoding = (string) $value;
+ return $this;
}
/**
@@ -71,12 +101,13 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
}
}
- $dom = new DOMDocument();
+ $enc = $this->getEncoding();
+ $dom = new DOMDocument('1.0', $enc);
$elt = $dom->appendChild(new DOMElement($this->_rootElement));
foreach ($dataToInsert as $key => $value) {
if($key == "message") {
- $value = htmlspecialchars($value);
+ $value = htmlspecialchars($value, ENT_COMPAT, $enc);
}
$elt->appendChild(new DOMElement($key, $value));
}
diff --git a/libs/Zend/Log/Writer/Abstract.php b/libs/Zend/Log/Writer/Abstract.php
index 3e3be2d6cd..80b939db18 100644
--- a/libs/Zend/Log/Writer/Abstract.php
+++ b/libs/Zend/Log/Writer/Abstract.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Filter_Priority */
-require_once 'Zend/Log/Filter/Priority.php';
+// require_once 'Zend/Log/Filter/Priority.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-abstract class Zend_Log_Writer_Abstract
+abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface
{
/**
* @var array of Zend_Log_Filter_Interface
@@ -104,4 +104,26 @@ abstract class Zend_Log_Writer_Abstract
*/
abstract protected function _write($event);
-} \ No newline at end of file
+ /**
+ * Validate and optionally convert the config to array
+ *
+ * @param array|Zend_Config $config Zend_Config or Array
+ * @return array
+ * @throws Zend_Log_Exception
+ */
+ static protected function _parseConfig($config)
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config)) {
+ // require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception(
+ 'Configuration must be an array or instance of Zend_Config'
+ );
+ }
+
+ return $config;
+ }
+}
diff --git a/libs/Zend/Log/Writer/Db.php b/libs/Zend/Log/Writer/Db.php
index 2130efe28e..6f77a12cb7 100644
--- a/libs/Zend/Log/Writer/Db.php
+++ b/libs/Zend/Log/Writer/Db.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Db.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Db.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
-require_once 'Zend/Log/Writer/Abstract.php';
+// require_once 'Zend/Log/Writer/Abstract.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Db.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Db.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
{
@@ -67,11 +67,38 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
}
/**
+ * Create a new instance of Zend_Log_Writer_Db
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Db
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'db' => null,
+ 'table' => null,
+ 'columnMap' => null,
+ ), $config);
+
+ if (isset($config['columnmap'])) {
+ $config['columnMap'] = $config['columnmap'];
+ }
+
+ return new self(
+ $config['db'],
+ $config['table'],
+ $config['columnMap']
+ );
+ }
+
+ /**
* Formatting is not possible on this writer
*/
public function setFormatter($formatter)
{
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception(get_class() . ' does not support formatting');
}
@@ -94,7 +121,7 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
protected function _write($event)
{
if ($this->_db === null) {
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Database adapter is null');
}
@@ -109,5 +136,4 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
$this->_db->insert($this->_table, $dataToInsert);
}
-
}
diff --git a/libs/Zend/Log/Writer/Firebug.php b/libs/Zend/Log/Writer/Firebug.php
index 49eeae9a2d..585f6a3dc1 100644
--- a/libs/Zend/Log/Writer/Firebug.php
+++ b/libs/Zend/Log/Writer/Firebug.php
@@ -15,30 +15,30 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Firebug.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log */
-require_once 'Zend/Log.php';
+// require_once 'Zend/Log.php';
/** Zend_Log_Writer_Abstract */
-require_once 'Zend/Log/Writer/Abstract.php';
+// require_once 'Zend/Log/Writer/Abstract.php';
/** Zend_Log_Formatter_Firebug */
-require_once 'Zend/Log/Formatter/Firebug.php';
+// require_once 'Zend/Log/Formatter/Firebug.php';
/** Zend_Wildfire_Plugin_FirePhp */
-require_once 'Zend/Wildfire/Plugin/FirePhp.php';
+// require_once 'Zend/Wildfire/Plugin/FirePhp.php';
/**
* Writes log messages to the Firebug Console via FirePHP.
- *
+ *
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
@@ -56,35 +56,47 @@ class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
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
*/
public function __construct()
{
- if (php_sapi_name()=='cli') {
+ if (php_sapi_name() == 'cli') {
$this->setEnabled(false);
}
-
+
$this->_formatter = new Zend_Log_Formatter_Firebug();
}
-
+
/**
- * Enable or disable the log writer.
+ * Create a new instance of Zend_Log_Writer_Firebug
*
- * @param boolean $enabled Set to TRUE to enable the log writer
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Firebug
+ * @throws Zend_Log_Exception
+ */
+ 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)
@@ -93,43 +105,43 @@ class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
$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
@@ -146,7 +158,7 @@ class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
/**
* 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
*/
@@ -169,15 +181,15 @@ class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
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,
diff --git a/libs/Zend/Log/Writer/Mail.php b/libs/Zend/Log/Writer/Mail.php
index 068bd33dc1..70f57b8616 100644
--- a/libs/Zend/Log/Writer/Mail.php
+++ b/libs/Zend/Log/Writer/Mail.php
@@ -15,19 +15,19 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mail.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Mail.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
-require_once 'Zend/Log/Writer/Abstract.php';
+// require_once 'Zend/Log/Writer/Abstract.php';
/** Zend_Log_Exception */
-require_once 'Zend/Log/Exception.php';
+// require_once 'Zend/Log/Exception.php';
/** Zend_Log_Formatter_Simple*/
-require_once 'Zend/Log/Formatter/Simple.php';
+// require_once 'Zend/Log/Formatter/Simple.php';
/**
* Class used for writing log messages to email via Zend_Mail.
@@ -39,9 +39,9 @@ require_once 'Zend/Log/Formatter/Simple.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mail.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Mail.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
{
@@ -117,6 +117,18 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
$this->_layout = $layout;
$this->_formatter = new Zend_Log_Formatter_Simple();
}
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Mail
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Mail
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ throw new Zend_Exception('Zend_Log_Writer_Mail does not currently implement a factory');
+ }
/**
* Places event line into array of lines to be used as message body.
diff --git a/libs/Zend/Log/Writer/Mock.php b/libs/Zend/Log/Writer/Mock.php
index 2a593c0d9e..1e14a2f00e 100644
--- a/libs/Zend/Log/Writer/Mock.php
+++ b/libs/Zend/Log/Writer/Mock.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mock.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Mock.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
-require_once 'Zend/Log/Writer/Abstract.php';
+// require_once 'Zend/Log/Writer/Abstract.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mock.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Mock.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract
{
@@ -63,4 +63,16 @@ class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract
{
$this->shutdown = true;
}
-} \ No newline at end of file
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Mock
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Mock
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
+}
diff --git a/libs/Zend/Log/Writer/Null.php b/libs/Zend/Log/Writer/Null.php
index de791d3a99..f281883fbb 100644
--- a/libs/Zend/Log/Writer/Null.php
+++ b/libs/Zend/Log/Writer/Null.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Null.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Null.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
-require_once 'Zend/Log/Writer/Abstract.php';
+// require_once 'Zend/Log/Writer/Abstract.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Null.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Null.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Null extends Zend_Log_Writer_Abstract
{
@@ -42,5 +42,16 @@ class Zend_Log_Writer_Null extends Zend_Log_Writer_Abstract
protected function _write($event)
{
}
-
-} \ No newline at end of file
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Null
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Null
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
+}
diff --git a/libs/Zend/Log/Writer/Stream.php b/libs/Zend/Log/Writer/Stream.php
index 99b050ad6b..b722dbb4bd 100644
--- a/libs/Zend/Log/Writer/Stream.php
+++ b/libs/Zend/Log/Writer/Stream.php
@@ -15,24 +15,24 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Stream.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Stream.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
-require_once 'Zend/Log/Writer/Abstract.php';
+// require_once 'Zend/Log/Writer/Abstract.php';
/** Zend_Log_Formatter_Simple */
-require_once 'Zend/Log/Formatter/Simple.php';
+// require_once 'Zend/Log/Formatter/Simple.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Stream.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Stream.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
{
@@ -48,23 +48,32 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
* @param streamOrUrl Stream or URL to open as a stream
* @param mode Mode, only applicable if a URL is given
*/
- public function __construct($streamOrUrl, $mode = 'a')
+ public function __construct($streamOrUrl, $mode = NULL)
{
+ // Setting the default
+ if ($mode === NULL) {
+ $mode = 'a';
+ }
+
if (is_resource($streamOrUrl)) {
if (get_resource_type($streamOrUrl) != 'stream') {
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Resource is not a stream');
}
if ($mode != 'a') {
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Mode cannot be changed on existing streams');
}
$this->_stream = $streamOrUrl;
} else {
+ if (is_array($streamOrUrl) && isset($streamOrUrl['stream'])) {
+ $streamOrUrl = $streamOrUrl['stream'];
+ }
+
if (! $this->_stream = @fopen($streamOrUrl, $mode, false)) {
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
$msg = "\"$streamOrUrl\" cannot be opened with mode \"$mode\"";
throw new Zend_Log_Exception($msg);
}
@@ -72,7 +81,30 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
$this->_formatter = new Zend_Log_Formatter_Simple();
}
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Mock
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Mock
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'stream' => null,
+ 'mode' => null,
+ ), $config);
+ $streamOrUrl = isset($config['url']) ? $config['url'] : $config['stream'];
+
+ return new self(
+ $streamOrUrl,
+ $config['mode']
+ );
+ }
+
/**
* Close the stream resource.
*
@@ -96,9 +128,8 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
$line = $this->_formatter->format($event);
if (false === @fwrite($this->_stream, $line)) {
- require_once 'Zend/Log/Exception.php';
+ // require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception("Unable to write to stream");
}
}
-
}
diff --git a/libs/Zend/Log/Writer/Syslog.php b/libs/Zend/Log/Writer/Syslog.php
index 3409ae56dc..310bcf54ec 100644
--- a/libs/Zend/Log/Writer/Syslog.php
+++ b/libs/Zend/Log/Writer/Syslog.php
@@ -15,13 +15,13 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Syslog.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Syslog.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
-require_once 'Zend/Log/Writer/Abstract.php';
+// require_once 'Zend/Log/Writer/Abstract.php';
/**
* Writes log messages to syslog
@@ -29,7 +29,7 @@ require_once 'Zend/Log/Writer/Abstract.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
@@ -95,6 +95,18 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
}
$this->_initializeSyslog();
}
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Syslog
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Syslog
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self(self::_parseConfig($config));
+ }
/**
* Initialize syslog / set application name and facility
diff --git a/libs/Zend/Log/Writer/ZendMonitor.php b/libs/Zend/Log/Writer/ZendMonitor.php
new file mode 100644
index 0000000000..59a648fa8b
--- /dev/null
+++ b/libs/Zend/Log/Writer/ZendMonitor.php
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/** Zend_Log_Writer_Abstract */
+// require_once 'Zend/Log/Writer/Abstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Writer
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract
+{
+ /**
+ * Is Zend Monitor enabled?
+ * @var bool
+ */
+ protected $_isEnabled = true;
+
+ /**
+ * @throws Zend_Log_Exception if Zend Monitor extension not present
+ */
+ public function __construct()
+ {
+ if (!function_exists('monitor_custom_event')) {
+ $this->_isEnabled = false;
+ }
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Writer_ZendMonitor
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Syslog
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
+
+ /**
+ * Is logging to this writer enabled?
+ *
+ * If the Zend Monitor extension is not enabled, this log writer will
+ * fail silently. You can query this method to determine if the log
+ * writer is enabled.
+ *
+ * @return bool
+ */
+ public function isEnabled()
+ {
+ return $this->_isEnabled;
+ }
+
+ /**
+ * Log a message to this writer.
+ *
+ * @param array $event log data event
+ * @return void
+ */
+ public function write($event)
+ {
+ if (!$this->isEnabled()) {
+ return;
+ }
+
+ parent::write($event);
+ }
+
+ /**
+ * Write a message to the log.
+ *
+ * @param array $event log data event
+ * @return void
+ */
+ protected function _write($event)
+ {
+ $priority = $event['priority'];
+ $message = $event['message'];
+ unset($event['priority'], $event['message']);
+
+ if (!empty($event)) {
+ monitor_custom_event($priority, $message, $event);
+ } else {
+ monitor_custom_event($priority, $message);
+ }
+ }
+}
diff --git a/libs/Zend/Mail.php b/libs/Zend/Mail.php
index ca3641ea81..81d1b5051d 100644
--- a/libs/Zend/Mail.php
+++ b/libs/Zend/Mail.php
@@ -14,31 +14,31 @@
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mail.php 16207 2009-06-21 19:17:51Z thomas $
+ * @version $Id: Mail.php 20783 2010-01-31 08:06:30Z yoshida@zend.co.jp $
*/
/**
* @see Zend_Mail_Transport_Abstract
*/
-require_once 'Zend/Mail/Transport/Abstract.php';
+// require_once 'Zend/Mail/Transport/Abstract.php';
/**
* @see Zend_Mime
*/
-require_once 'Zend/Mime.php';
+// require_once 'Zend/Mime.php';
/**
* @see Zend_Mime_Message
*/
-require_once 'Zend/Mime/Message.php';
+// require_once 'Zend/Mime/Message.php';
/**
* @see Zend_Mime_Part
*/
-require_once 'Zend/Mime/Part.php';
+// require_once 'Zend/Mime/Part.php';
/**
@@ -46,7 +46,7 @@ require_once 'Zend/Mime/Part.php';
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail extends Zend_Mime_Message
@@ -62,6 +62,18 @@ class Zend_Mail extends Zend_Mime_Message
protected static $_defaultTransport = null;
/**
+ * @var array
+ * @static
+ */
+ protected static $_defaultFrom;
+
+ /**
+ * @var array
+ * @static
+ */
+ protected static $_defaultReplyTo;
+
+ /**
* Mail character set
* @var string
*/
@@ -98,6 +110,12 @@ class Zend_Mail extends Zend_Mime_Message
protected $_recipients = array();
/**
+ * Reply-To header
+ * @var string
+ */
+ protected $_replyTo = null;
+
+ /**
* Return-Path header
* @var string
*/
@@ -168,6 +186,26 @@ class Zend_Mail extends Zend_Mime_Message
}
/**
+ * Gets the default mail transport for all following uses of
+ * unittests
+ *
+ * @todo Allow passing a string to indicate the transport to load
+ * @todo Allow passing in optional options for the transport to load
+ */
+ public static function getDefaultTransport()
+ {
+ return self::$_defaultTransport;
+ }
+
+ /**
+ * Clear the default transport property
+ */
+ public static function clearDefaultTransport()
+ {
+ self::$_defaultTransport = null;
+ }
+
+ /**
* Public constructor
*
* @param string $charset
@@ -207,7 +245,7 @@ class Zend_Mail extends Zend_Mime_Message
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Invalid content type "' . $type . '"');
}
@@ -301,7 +339,7 @@ class Zend_Mail extends Zend_Mime_Message
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Invalid encoding "' . $encoding . '"');
}
$this->_headerEncoding = $encoding;
@@ -458,7 +496,7 @@ class Zend_Mail extends Zend_Mime_Message
*/
protected function _encodeHeader($value)
{
- if (Zend_Mime::isPrintable($value) === false) {
+ if (Zend_Mime::isPrintable($value) === false) {
if ($this->getHeaderEncoding() === Zend_Mime::ENCODING_QUOTEDPRINTABLE) {
$value = Zend_Mime::encodeQuotedPrintableHeader($value, $this->getCharset(), Zend_Mime::LINELENGTH, Zend_Mime::LINEEND);
} else {
@@ -522,41 +560,62 @@ class Zend_Mail extends Zend_Mime_Message
}
/**
- * Adds To-header and recipient
+ * Adds To-header and recipient, $email can be an array, or a single string address
*
- * @param string $email
+ * @param string|array $email
* @param string $name
* @return Zend_Mail Provides fluent interface
*/
public function addTo($email, $name='')
{
- $this->_addRecipientAndHeader('To', $email, $name);
- $this->_to[] = $email;
+ if (!is_array($email)) {
+ $email = array($name => $email);
+ }
+
+ foreach ($email as $n => $recipient) {
+ $this->_addRecipientAndHeader('To', $recipient, is_int($n) ? '' : $n);
+ $this->_to[] = $recipient;
+ }
+
return $this;
}
/**
- * Adds Cc-header and recipient
+ * Adds Cc-header and recipient, $email can be an array, or a single string address
*
- * @param string $email
+ * @param string|array $email
* @param string $name
* @return Zend_Mail Provides fluent interface
*/
public function addCc($email, $name='')
{
- $this->_addRecipientAndHeader('Cc', $email, $name);
+ if (!is_array($email)) {
+ $email = array($name => $email);
+ }
+
+ foreach ($email as $n => $recipient) {
+ $this->_addRecipientAndHeader('Cc', $recipient, is_int($n) ? '' : $n);
+ }
+
return $this;
}
/**
- * Adds Bcc recipient
+ * Adds Bcc recipient, $email can be an array, or a single string address
*
- * @param string $email
+ * @param string|array $email
* @return Zend_Mail Provides fluent interface
*/
public function addBcc($email)
{
- $this->_addRecipientAndHeader('Bcc', $email, '');
+ if (!is_array($email)) {
+ $email = array($email);
+ }
+
+ foreach ($email as $recipient) {
+ $this->_addRecipientAndHeader('Bcc', $recipient, '');
+ }
+
return $this;
}
@@ -597,18 +656,19 @@ class Zend_Mail extends Zend_Mime_Message
*/
public function setFrom($email, $name = null)
{
- if ($this->_from === null) {
- $email = $this->_filterEmail($email);
- $name = $this->_filterName($name);
- $this->_from = $email;
- $this->_storeHeader('From', $this->_formatAddress($email, $name), true);
- } else {
+ if (null !== $this->_from) {
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('From Header set twice');
}
+
+ $email = $this->_filterEmail($email);
+ $name = $this->_filterName($name);
+ $this->_from = $email;
+ $this->_storeHeader('From', $this->_formatAddress($email, $name), true);
+
return $this;
}
@@ -618,10 +678,23 @@ class Zend_Mail extends Zend_Mime_Message
* @param string $email
* @param string $name
* @return Zend_Mail
+ * @throws Zend_Mail_Exception if called more than one time
*/
- public function setReplyTo($email, $name=null)
+ public function setReplyTo($email, $name = null)
{
- $this->_addRecipientAndHeader('Reply-To', $email, $name);
+ if (null !== $this->_replyTo) {
+ /**
+ * @see Zend_Mail_Exception
+ */
+ // require_once 'Zend/Mail/Exception.php';
+ throw new Zend_Mail_Exception('Reply-To Header set twice');
+ }
+
+ $email = $this->_filterEmail($email);
+ $name = $this->_filterName($name);
+ $this->_replyTo = $email;
+ $this->_storeHeader('Reply-To', $this->_formatAddress($email, $name), true);
+
return $this;
}
@@ -636,6 +709,16 @@ class Zend_Mail extends Zend_Mime_Message
}
/**
+ * Returns the current Reply-To address of the message
+ *
+ * @return string|null Reply-To address, null when not set
+ */
+ public function getReplyTo()
+ {
+ return $this->_replyTo;
+ }
+
+ /**
* Clears the sender from the mail
*
* @return Zend_Mail Provides fluent interface
@@ -648,6 +731,119 @@ class Zend_Mail extends Zend_Mime_Message
return $this;
}
+ /**
+ * Clears the current Reply-To address from the message
+ *
+ * @return Zend_Mail Provides fluent interface
+ */
+ public function clearReplyTo()
+ {
+ $this->_replyTo = null;
+ $this->_clearHeader('Reply-To');
+
+ return $this;
+ }
+
+ /**
+ * Sets Default From-email and name of the message
+ *
+ * @param string $email
+ * @param string Optional $name
+ * @return void
+ */
+ public static function setDefaultFrom($email, $name = null)
+ {
+ self::$_defaultFrom = array('email' => $email, 'name' => $name);
+ }
+
+ /**
+ * Returns the default sender of the mail
+ *
+ * @return null|array Null if none was set.
+ */
+ public static function getDefaultFrom()
+ {
+ return self::$_defaultFrom;
+ }
+
+ /**
+ * Clears the default sender from the mail
+ *
+ * @return void
+ */
+ public static function clearDefaultFrom()
+ {
+ self::$_defaultFrom = null;
+ }
+
+ /**
+ * Sets From-name and -email based on the defaults
+ *
+ * @return Zend_Mail Provides fluent interface
+ */
+ public function setFromToDefaultFrom() {
+ $from = self::getDefaultFrom();
+ if($from === null) {
+ // require_once 'Zend/Mail/Exception.php';
+ throw new Zend_Mail_Exception(
+ 'No default From Address set to use');
+ }
+
+ $this->setFrom($from['email'], $from['name']);
+
+ return $this;
+ }
+
+ /**
+ * Sets Default ReplyTo-address and -name of the message
+ *
+ * @param string $email
+ * @param string Optional $name
+ * @return void
+ */
+ public static function setDefaultReplyTo($email, $name = null)
+ {
+ self::$_defaultReplyTo = array('email' => $email, 'name' => $name);
+ }
+
+ /**
+ * Returns the default Reply-To Address and Name of the mail
+ *
+ * @return null|array Null if none was set.
+ */
+ public static function getDefaultReplyTo()
+ {
+ return self::$_defaultReplyTo;
+ }
+
+ /**
+ * Clears the default ReplyTo-address and -name from the mail
+ *
+ * @return void
+ */
+ public static function clearDefaultReplyTo()
+ {
+ self::$_defaultReplyTo = null;
+ }
+
+ /**
+ * Sets ReplyTo-name and -email based on the defaults
+ *
+ * @return Zend_Mail Provides fluent interface
+ */
+ public function setReplyToFromDefault() {
+ $replyTo = self::getDefaultReplyTo();
+ if($replyTo === null) {
+ // require_once 'Zend/Mail/Exception.php';
+ throw new Zend_Mail_Exception(
+ 'No default Reply-To Address set to use');
+ }
+
+ $this->setReplyTo($replyTo['email'], $replyTo['name']);
+
+ return $this;
+ }
+
/**
* Sets the Return-Path header of the message
*
@@ -665,7 +861,7 @@ class Zend_Mail extends Zend_Mime_Message
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Return-Path Header set twice');
}
return $this;
@@ -717,7 +913,7 @@ class Zend_Mail extends Zend_Mime_Message
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Subject set twice');
}
return $this;
@@ -749,9 +945,9 @@ class Zend_Mail extends Zend_Mime_Message
/**
* Sets Date-header
*
- * @param string $date
+ * @param timestamp|string|Zend_Date $date
* @return Zend_Mail Provides fluent interface
- * @throws Zend_Mail_Exception if called subsequent times
+ * @throws Zend_Mail_Exception if called subsequent times or wrong date format.
*/
public function setDate($date = null)
{
@@ -763,22 +959,22 @@ class Zend_Mail extends Zend_Mime_Message
} else if (is_string($date)) {
$date = strtotime($date);
if ($date === false || $date < 0) {
- /**
- * @see Zend_Mail_Exception
- */
- require_once 'Zend/Mail/Exception.php';
- throw new Zend_Mail_Exception('String representations of Date Header must be ' .
+ /**
+ * @see Zend_Mail_Exception
+ */
+ // require_once 'Zend/Mail/Exception.php';
+ throw new Zend_Mail_Exception('String representations of Date Header must be ' .
'strtotime()-compatible');
}
$date = date('r', $date);
} else if ($date instanceof Zend_Date) {
$date = $date->get(Zend_Date::RFC_2822);
} else {
- /**
- * @see Zend_Mail_Exception
- */
- require_once 'Zend/Mail/Exception.php';
- throw new Zend_Mail_Exception(__METHOD__ . ' only accepts UNIX timestamps, Zend_Date objects, ' .
+ /**
+ * @see Zend_Mail_Exception
+ */
+ // require_once 'Zend/Mail/Exception.php';
+ throw new Zend_Mail_Exception(__METHOD__ . ' only accepts UNIX timestamps, Zend_Date objects, ' .
' and strtotime()-compatible strings');
}
$this->_date = $date;
@@ -787,8 +983,8 @@ class Zend_Mail extends Zend_Mime_Message
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
- throw new Zend_Mail_Exception('Date Header set twice');
+ // require_once 'Zend/Mail/Exception.php';
+ throw new Zend_Mail_Exception('Date Header set twice');
}
return $this;
}
@@ -823,27 +1019,27 @@ class Zend_Mail extends Zend_Mime_Message
* true :Auto
* false :No set
* null :No set
- * string:Sets string
+ * string:Sets given string (Angle brackets is not necessary)
* @return Zend_Mail Provides fluent interface
* @throws Zend_Mail_Exception
*/
public function setMessageId($id = true)
{
- if ($id === null || $id === false) {
- return $this;
- } elseif ($id === true) {
+ if ($id === null || $id === false) {
+ return $this;
+ } elseif ($id === true) {
$id = $this->createMessageId();
- }
+ }
if ($this->_messageId === null) {
- $id = $this->_filterOther($id);
+ $id = $this->_filterOther($id);
$this->_messageId = $id;
- $this->_storeHeader('Message-Id', $this->_messageId);
+ $this->_storeHeader('Message-Id', '<' . $this->_messageId . '>');
} else {
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Message-ID set twice');
}
@@ -884,25 +1080,25 @@ class Zend_Mail extends Zend_Mime_Message
$time = time();
if ($this->_from !== null) {
- $user = $this->_from;
+ $user = $this->_from;
} elseif (isset($_SERVER['REMOTE_ADDR'])) {
- $user = $_SERVER['REMOTE_ADDR'];
+ $user = $_SERVER['REMOTE_ADDR'];
} else {
- $user = getmypid();
+ $user = getmypid();
}
- $rand = mt_rand();
+ $rand = mt_rand();
- if ($this->_recipients !== array()) {
+ if ($this->_recipients !== array()) {
$recipient = array_rand($this->_recipients);
- } else {
- $recipient = 'unknown';
- }
+ } else {
+ $recipient = 'unknown';
+ }
- if (isset($_SERVER["SERVER_NAME"])) {
+ if (isset($_SERVER["SERVER_NAME"])) {
$hostName = $_SERVER["SERVER_NAME"];
} else {
- $hostName = php_uname('n');
+ $hostName = php_uname('n');
}
return sha1($time . $user . $rand . $recipient) . '@' . $hostName;
@@ -920,13 +1116,14 @@ class Zend_Mail extends Zend_Mime_Message
public function addHeader($name, $value, $append = false)
{
$prohibit = array('to', 'cc', 'bcc', 'from', 'subject',
- 'return-path', 'date', 'message-id',
+ 'reply-to', 'return-path',
+ 'date', 'message-id',
);
if (in_array(strtolower($name), $prohibit)) {
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Cannot set standard header from addHeader()');
}
@@ -959,7 +1156,7 @@ class Zend_Mail extends Zend_Mime_Message
{
if ($transport === null) {
if (! self::$_defaultTransport instanceof Zend_Mail_Transport_Abstract) {
- require_once 'Zend/Mail/Transport/Sendmail.php';
+ // require_once 'Zend/Mail/Transport/Sendmail.php';
$transport = new Zend_Mail_Transport_Sendmail();
} else {
$transport = self::$_defaultTransport;
@@ -970,6 +1167,14 @@ class Zend_Mail extends Zend_Mime_Message
$this->setDate();
}
+ if(null === $this->_from && null !== self::getDefaultFrom()) {
+ $this->setFromToDefaultFrom();
+ }
+
+ if(null === $this->_replyTo && null !== self::getDefaultReplyTo()) {
+ $this->setReplyToFromDefault();
+ }
+
$transport->send($this);
return $this;
@@ -983,14 +1188,14 @@ class Zend_Mail extends Zend_Mime_Message
*/
protected function _filterEmail($email)
{
- $rule = array("\r" => '',
- "\n" => '',
- "\t" => '',
+ $rule = array("\r" => '',
+ "\n" => '',
+ "\t" => '',
'"' => '',
- ',' => '',
+ ',' => '',
'<' => '',
'>' => '',
- );
+ );
return strtr($email, $rule);
}
@@ -1003,13 +1208,13 @@ class Zend_Mail extends Zend_Mime_Message
*/
protected function _filterName($name)
{
- $rule = array("\r" => '',
+ $rule = array("\r" => '',
"\n" => '',
"\t" => '',
'"' => "'",
'<' => '[',
- '>' => ']',
- );
+ '>' => ']',
+ );
return trim(strtr($name, $rule));
}
@@ -1043,7 +1248,8 @@ class Zend_Mail extends Zend_Mime_Message
return $email;
} else {
$encodedName = $this->_encodeHeader($name);
- if ($encodedName === $name && strpos($name, ',') !== false) {
+ if ($encodedName === $name &&
+ ((strpos($name, '@') !== false) || (strpos($name, ',') !== false))) {
$format = '"%s" <%s>';
} else {
$format = '%s <%s>';
diff --git a/libs/Zend/Mail/Exception.php b/libs/Zend/Mail/Exception.php
index 864d1ca932..c912769ee4 100644
--- a/libs/Zend/Mail/Exception.php
+++ b/libs/Zend/Mail/Exception.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Exception extends Zend_Exception
diff --git a/libs/Zend/Mail/Message.php b/libs/Zend/Mail/Message.php
index 5b35ab2f67..bff51340d2 100644
--- a/libs/Zend/Mail/Message.php
+++ b/libs/Zend/Mail/Message.php
@@ -14,26 +14,26 @@
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Message.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Message.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Mail_Part
*/
-require_once 'Zend/Mail/Part.php';
+// require_once 'Zend/Mail/Part.php';
/**
* Zend_Mail_Message_Interface
*/
-require_once 'Zend/Mail/Message/Interface.php';
+// require_once 'Zend/Mail/Message/Interface.php';
/**
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Message extends Zend_Mail_Part implements Zend_Mail_Message_Interface
@@ -63,7 +63,7 @@ class Zend_Mail_Message extends Zend_Mail_Part implements Zend_Mail_Message_Inte
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('could not open file');
}
} else {
diff --git a/libs/Zend/Mail/Message/File.php b/libs/Zend/Mail/Message/File.php
index 6d621ae39c..7857c743d6 100644
--- a/libs/Zend/Mail/Message/File.php
+++ b/libs/Zend/Mail/Message/File.php
@@ -14,26 +14,26 @@
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: File.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Mail_Part
*/
-require_once 'Zend/Mail/Part/File.php';
+// require_once 'Zend/Mail/Part/File.php';
/**
* Zend_Mail_Message_Interface
*/
-require_once 'Zend/Mail/Message/Interface.php';
+// require_once 'Zend/Mail/Message/Interface.php';
/**
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Message_File extends Zend_Mail_Part_File implements Zend_Mail_Message_Interface
@@ -59,7 +59,7 @@ class Zend_Mail_Message_File extends Zend_Mail_Part_File implements Zend_Mail_Me
// set key and value to the same value for easy lookup
$this->_flags = array_combine($params['flags'], $params['flags']);
}
-
+
parent::__construct($params);
}
diff --git a/libs/Zend/Mail/Message/Interface.php b/libs/Zend/Mail/Message/Interface.php
index a9752a3230..833be6b44a 100644
--- a/libs/Zend/Mail/Message/Interface.php
+++ b/libs/Zend/Mail/Message/Interface.php
@@ -11,13 +11,13 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
diff --git a/libs/Zend/Mail/Part.php b/libs/Zend/Mail/Part.php
index 4541a5acc1..bb7b38e447 100644
--- a/libs/Zend/Mail/Part.php
+++ b/libs/Zend/Mail/Part.php
@@ -14,27 +14,27 @@
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Part.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Part.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mime_Decode
*/
-require_once 'Zend/Mime/Decode.php';
+// require_once 'Zend/Mime/Decode.php';
/**
* @see Zend_Mail_Part_Interface
*/
-require_once 'Zend/Mail/Part/Interface.php';
+// require_once 'Zend/Mail/Part/Interface.php';
/**
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
@@ -108,14 +108,14 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('handler is not a valid mail handler');
}
if (!isset($params['id'])) {
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('need a message id with a handler');
}
@@ -176,7 +176,7 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('no content');
}
}
@@ -216,7 +216,7 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('no boundary found in content type to split message');
}
$parts = Zend_Mime_Decode::splitMessageStruct($this->_content, $boundary);
@@ -246,7 +246,7 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('part not found');
}
@@ -261,7 +261,7 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('part not found');
}
@@ -343,7 +343,7 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception("no Header with Name $name or $lowerName found");
}
}
@@ -381,7 +381,7 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
return false;
}
}
-
+
/**
* Get a specific field from a header like content type or all fields as array
*
diff --git a/libs/Zend/Mail/Part/File.php b/libs/Zend/Mail/Part/File.php
index efa0538b4d..581195bcc0 100644
--- a/libs/Zend/Mail/Part/File.php
+++ b/libs/Zend/Mail/Part/File.php
@@ -14,27 +14,27 @@
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: File.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mime_Decode
*/
-require_once 'Zend/Mime/Decode.php';
+// require_once 'Zend/Mime/Decode.php';
/**
* @see Zend_Mail_Part
*/
-require_once 'Zend/Mail/Part.php';
+// require_once 'Zend/Mail/Part.php';
/**
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Part_File extends Zend_Mail_Part
@@ -60,10 +60,10 @@ class Zend_Mail_Part_File extends Zend_Mail_Part
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('no file given in params');
}
-
+
if (!is_resource($params['file'])) {
$this->_fh = fopen($params['file'], 'r');
} else {
@@ -73,7 +73,7 @@ class Zend_Mail_Part_File extends Zend_Mail_Part
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('could not open file');
}
if (isset($params['startPos'])) {
@@ -86,7 +86,7 @@ class Zend_Mail_Part_File extends Zend_Mail_Part
}
Zend_Mime_Decode::splitMessage($header, $this->_headers, $null);
-
+
$this->_contentPos[0] = ftell($this->_fh);
if ($endPos !== null) {
$this->_contentPos[1] = $endPos;
@@ -97,16 +97,16 @@ class Zend_Mail_Part_File extends Zend_Mail_Part
if (!$this->isMultipart()) {
return;
}
-
+
$boundary = $this->getHeaderField('content-type', 'boundary');
if (!$boundary) {
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('no boundary found in content type to split message');
}
-
+
$part = array();
$pos = $this->_contentPos[0];
fseek($this->_fh, $pos);
@@ -119,7 +119,7 @@ class Zend_Mail_Part_File extends Zend_Mail_Part
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('error reading file');
}
@@ -141,7 +141,7 @@ class Zend_Mail_Part_File extends Zend_Mail_Part
}
}
$this->_countParts = count($this->_partPos);
-
+
}
@@ -157,7 +157,7 @@ class Zend_Mail_Part_File extends Zend_Mail_Part
{
fseek($this->_fh, $this->_contentPos[0]);
if ($stream !== null) {
- return stream_copy_to_stream($this->_fh, $stream, $this->_contentPos[1] - $this->_contentPos[0]);
+ return stream_copy_to_stream($this->_fh, $stream, $this->_contentPos[1] - $this->_contentPos[0]);
}
$length = $this->_contentPos[1] - $this->_contentPos[0];
return $length < 1 ? '' : fread($this->_fh, $length);
@@ -188,11 +188,11 @@ class Zend_Mail_Part_File extends Zend_Mail_Part
/**
* @see Zend_Mail_Exception
*/
- require_once 'Zend/Mail/Exception.php';
+ // require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('part not found');
}
- return new self(array('file' => $this->_fh, 'startPos' => $this->_partPos[$num][0],
+ return new self(array('file' => $this->_fh, 'startPos' => $this->_partPos[$num][0],
'endPos' => $this->_partPos[$num][1]));
}
}
diff --git a/libs/Zend/Mail/Part/Interface.php b/libs/Zend/Mail/Part/Interface.php
index 46cc4b0843..2d8f6f8943 100644
--- a/libs/Zend/Mail/Part/Interface.php
+++ b/libs/Zend/Mail/Part/Interface.php
@@ -11,13 +11,13 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -95,7 +95,7 @@ interface Zend_Mail_Part_Interface extends RecursiveIterator
* @throws Zend_Mail_Exception
*/
public function getHeader($name, $format = null);
-
+
/**
* Get a specific field from a header like content type or all fields as array
*
diff --git a/libs/Zend/Mail/Protocol/Abstract.php b/libs/Zend/Mail/Protocol/Abstract.php
index 4ef5792b11..cbfeaa8946 100644
--- a/libs/Zend/Mail/Protocol/Abstract.php
+++ b/libs/Zend/Mail/Protocol/Abstract.php
@@ -12,39 +12,39 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Abstract.php 21635 2010-03-24 15:25:13Z yoshida@zend.co.jp $
*/
/**
* @see Zend_Validate
*/
-require_once 'Zend/Validate.php';
+// require_once 'Zend/Validate.php';
/**
* @see Zend_Validate_Hostname
*/
-require_once 'Zend/Validate/Hostname.php';
+// require_once 'Zend/Validate/Hostname.php';
/**
* Zend_Mail_Protocol_Abstract
*
* Provides low-level methods for concrete adapters to communicate with a remote mail server and track requests and responses.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Abstract.php 21635 2010-03-24 15:25:13Z yoshida@zend.co.jp $
* @todo Implement proxy settings
*/
abstract class Zend_Mail_Protocol_Abstract
@@ -60,6 +60,11 @@ abstract class Zend_Mail_Protocol_Abstract
*/
const TIMEOUT_CONNECTION = 30;
+ /**
+ * Maximum of the transaction log
+ */
+ const MAXIMUM_LOG = 64;
+
/**
* Hostname or IP address of remote server
@@ -106,15 +111,16 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* String template for parsing server responses using sscanf (default: 3 digit code and response string)
* @var resource
+ * @deprecated Since 1.10.3
*/
protected $_template = '%d%s';
/**
* Log of mail requests and server responses for a session
- * @var string
+ * @var array
*/
- private $_log;
+ private $_log = array();
/**
@@ -134,7 +140,7 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception(join(', ', $this->_validHost->getMessages()));
}
@@ -191,7 +197,7 @@ abstract class Zend_Mail_Protocol_Abstract
*/
public function getLog()
{
- return $this->_log;
+ return implode('', $this->_log);
}
@@ -202,9 +208,23 @@ abstract class Zend_Mail_Protocol_Abstract
*/
public function resetLog()
{
- $this->_log = '';
+ $this->_log = array();
}
+ /**
+ * Add the transaction log
+ *
+ * @param string new transaction
+ * @return void
+ */
+ protected function _addLog($value)
+ {
+ if (count($this->_log) >= self::MAXIMUM_LOG) {
+ array_shift($this->_log);
+ }
+
+ $this->_log[] = $value;
+ }
/**
* Connect to the server using the supplied transport and target
@@ -230,7 +250,7 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception($errorStr);
}
@@ -238,7 +258,7 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('Could not set stream timeout');
}
@@ -272,7 +292,7 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('No connection has been established to ' . $this->_host);
}
@@ -281,13 +301,13 @@ abstract class Zend_Mail_Protocol_Abstract
$result = fwrite($this->_socket, $request . self::EOL);
// Save request to internal log
- $this->_log .= $request . self::EOL;
+ $this->_addLog($request . self::EOL);
if ($result === false) {
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('Could not send request to ' . $this->_host);
}
@@ -308,7 +328,7 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('No connection has been established to ' . $this->_host);
}
@@ -321,7 +341,7 @@ abstract class Zend_Mail_Protocol_Abstract
$reponse = fgets($this->_socket, 1024);
// Save request to internal log
- $this->_log .= $reponse;
+ $this->_addLog($reponse);
// Check meta data to ensure connection is still valid
$info = stream_get_meta_data($this->_socket);
@@ -330,7 +350,7 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception($this->_host . ' has timed out');
}
@@ -338,7 +358,7 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('Could not read from ' . $this->_host);
}
@@ -359,8 +379,10 @@ abstract class Zend_Mail_Protocol_Abstract
protected function _expect($code, $timeout = null)
{
$this->_response = array();
- $cmd = '';
- $msg = '';
+ $cmd = '';
+ $more = '';
+ $msg = '';
+ $errMsg = '';
if (!is_array($code)) {
$code = array($code);
@@ -368,17 +390,23 @@ abstract class Zend_Mail_Protocol_Abstract
do {
$this->_response[] = $result = $this->_receive($timeout);
- sscanf($result, $this->_template, $cmd, $msg);
-
- if ($cmd === null || !in_array($cmd, $code)) {
- /**
- * @see Zend_Mail_Protocol_Exception
- */
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception($result);
+ list($cmd, $more, $msg) = preg_split('/([\s-]+)/', $result, 2, PREG_SPLIT_DELIM_CAPTURE);
+
+ if ($errMsg !== '') {
+ $errMsg .= ' ' . $msg;
+ } elseif ($cmd === null || !in_array($cmd, $code)) {
+ $errMsg = $msg;
}
- } while (strpos($msg, '-') === 0); // The '-' message prefix indicates an information string instead of a response string.
+ } while (strpos($more, '-') === 0); // The '-' message prefix indicates an information string instead of a response string.
+
+ if ($errMsg !== '') {
+ /**
+ * @see Zend_Mail_Protocol_Exception
+ */
+ // require_once 'Zend/Mail/Protocol/Exception.php';
+ throw new Zend_Mail_Protocol_Exception($errMsg);
+ }
return $msg;
}
diff --git a/libs/Zend/Mail/Protocol/Exception.php b/libs/Zend/Mail/Protocol/Exception.php
index 117cafb56e..30999c2d14 100644
--- a/libs/Zend/Mail/Protocol/Exception.php
+++ b/libs/Zend/Mail/Protocol/Exception.php
@@ -11,27 +11,27 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Mail/Exception.php';
+// require_once 'Zend/Mail/Exception.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Protocol_Exception extends Zend_Mail_Exception
diff --git a/libs/Zend/Mail/Protocol/Imap.php b/libs/Zend/Mail/Protocol/Imap.php
index 2adc9efb14..286642fb48 100644
--- a/libs/Zend/Mail/Protocol/Imap.php
+++ b/libs/Zend/Mail/Protocol/Imap.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Imap.php 18499 2009-10-08 22:24:02Z yoshida@zend.co.jp $
+ * @version $Id: Imap.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Protocol_Imap
@@ -50,7 +50,7 @@ class Zend_Mail_Protocol_Imap
/**
* Public constructor
*
- * @param string $host hostname of IP address of IMAP server, if given connect() is called
+ * @param string $host hostname or IP address of IMAP server, if given connect() is called
* @param int|null $port port of IMAP server, null for default (143 or 993 for ssl)
* @param bool $ssl use ssl? 'SSL', 'TLS' or false
* @throws Zend_Mail_Protocol_Exception
@@ -71,9 +71,9 @@ class Zend_Mail_Protocol_Imap
}
/**
- * Open connection to POP3 server
+ * Open connection to IMAP server
*
- * @param string $host hostname of IP address of POP3 server
+ * @param string $host hostname or IP address of IMAP server
* @param int|null $port of IMAP server, default is 143 (993 for ssl)
* @param string|bool $ssl use 'SSL', 'TLS' or false
* @return string welcome message
@@ -96,15 +96,16 @@ class Zend_Mail_Protocol_Imap
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('cannot connect to host : ' . $errno . ' : ' . $errstr);
+ // require_once 'Zend/Mail/Protocol/Exception.php';
+ throw new Zend_Mail_Protocol_Exception('cannot connect to host; error = ' . $errstr .
+ ' (errno = ' . $errno . ' )');
}
if (!$this->_assumedNextLine('* OK')) {
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('host doesn\'t allow connection');
}
@@ -115,7 +116,7 @@ class Zend_Mail_Protocol_Imap
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('cannot enable TLS');
}
}
@@ -134,7 +135,7 @@ class Zend_Mail_Protocol_Imap
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('cannot read - connection closed?');
}
@@ -208,7 +209,7 @@ class Zend_Mail_Protocol_Imap
$token = substr($token, 1);
}
if ($token[0] == '"') {
- if (preg_match('%^"((.|\\\\|\\")*?)" *%', $line, $matches)) {
+ if (preg_match('%^\(*"((.|\\\\|\\")*?)" *%', $line, $matches)) {
$tokens[] = $matches[1];
$line = substr($line, strlen($matches[0]));
continue;
@@ -347,14 +348,14 @@ class Zend_Mail_Protocol_Imap
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?');
}
if (!$this->_assumedNextLine('+ ')) {
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('cannot send literal string');
}
$line = $token[1];
@@ -367,7 +368,7 @@ class Zend_Mail_Protocol_Imap
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?');
}
}
@@ -628,7 +629,7 @@ class Zend_Mail_Protocol_Imap
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('the single id was not found in response');
}
diff --git a/libs/Zend/Mail/Protocol/Pop3.php b/libs/Zend/Mail/Protocol/Pop3.php
index cc7d5b2f09..78f01fe376 100644
--- a/libs/Zend/Mail/Protocol/Pop3.php
+++ b/libs/Zend/Mail/Protocol/Pop3.php
@@ -11,13 +11,13 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Pop3.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Pop3.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Protocol_Pop3
@@ -34,7 +34,7 @@ class Zend_Mail_Protocol_Pop3
* Default timeout in seconds for initiating session
*/
const TIMEOUT_CONNECTION = 30;
-
+
/**
* saves if server supports top
* @var null|bool
@@ -57,7 +57,7 @@ class Zend_Mail_Protocol_Pop3
/**
* Public constructor
*
- * @param string $host hostname of IP address of POP3 server, if given connect() is called
+ * @param string $host hostname or IP address of POP3 server, if given connect() is called
* @param int|null $port port of POP3 server, null for default (110 or 995 for ssl)
* @param bool|string $ssl use ssl? 'SSL', 'TLS' or false
* @throws Zend_Mail_Protocol_Exception
@@ -82,7 +82,7 @@ class Zend_Mail_Protocol_Pop3
/**
* Open connection to POP3 server
*
- * @param string $host hostname of IP address of POP3 server
+ * @param string $host hostname or IP address of POP3 server
* @param int|null $port of POP3 server, default is 110 (995 for ssl)
* @param string|bool $ssl use 'SSL', 'TLS' or false
* @return string welcome message
@@ -105,8 +105,9 @@ class Zend_Mail_Protocol_Pop3
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('cannot connect to host : ' . $errno . ' : ' . $errstr);
+ // require_once 'Zend/Mail/Protocol/Exception.php';
+ throw new Zend_Mail_Protocol_Exception('cannot connect to host; error = ' . $errstr .
+ ' (errno = ' . $errno . ' )');
}
$welcome = $this->readResponse();
@@ -126,7 +127,7 @@ class Zend_Mail_Protocol_Pop3
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('cannot enable TLS');
}
}
@@ -149,7 +150,7 @@ class Zend_Mail_Protocol_Pop3
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('send failed - connection closed?');
}
}
@@ -169,7 +170,7 @@ class Zend_Mail_Protocol_Pop3
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('read failed - connection closed?');
}
@@ -185,7 +186,7 @@ class Zend_Mail_Protocol_Pop3
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('last request failed');
}
@@ -384,7 +385,7 @@ class Zend_Mail_Protocol_Pop3
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('top not supported and no fallback wanted');
}
}
diff --git a/libs/Zend/Mail/Protocol/Smtp.php b/libs/Zend/Mail/Protocol/Smtp.php
index 819b89551c..a7d8153fa2 100644
--- a/libs/Zend/Mail/Protocol/Smtp.php
+++ b/libs/Zend/Mail/Protocol/Smtp.php
@@ -12,37 +12,37 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Smtp.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Smtp.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mime
*/
-require_once 'Zend/Mime.php';
+// require_once 'Zend/Mime.php';
/**
* @see Zend_Mail_Protocol_Abstract
*/
-require_once 'Zend/Mail/Protocol/Abstract.php';
+// require_once 'Zend/Mail/Protocol/Abstract.php';
/**
* Smtp implementation of Zend_Mail_Protocol_Abstract
*
* Minimum implementation according to RFC2821: EHLO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
@@ -140,7 +140,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception($config['ssl'] . ' is unsupported SSL type');
break;
}
@@ -182,7 +182,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('Cannot issue HELO to existing session');
}
@@ -191,7 +191,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception(join(', ', $this->_validHost->getMessages()));
}
@@ -207,7 +207,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('Unable to connect via TLS');
}
$this->_ehlo($host);
@@ -253,7 +253,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('A valid session has not been started');
}
@@ -280,7 +280,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('No sender reverse path has been supplied');
}
@@ -305,7 +305,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('No recipient forward path has been supplied');
}
@@ -403,7 +403,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
/**
* @see Zend_Mail_Protocol_Exception
*/
- require_once 'Zend/Mail/Protocol/Exception.php';
+ // require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception('Already authenticated for this session');
}
}
diff --git a/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php b/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php
index ec5594e067..523d383e23 100644
--- a/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php
+++ b/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php
@@ -11,20 +11,20 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Crammd5.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Crammd5.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Protocol_Smtp
*/
-require_once 'Zend/Mail/Protocol/Smtp.php';
+// require_once 'Zend/Mail/Protocol/Smtp.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Mail/Protocol/Smtp.php';
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Protocol_Smtp_Auth_Crammd5 extends Zend_Mail_Protocol_Smtp
diff --git a/libs/Zend/Mail/Protocol/Smtp/Auth/Login.php b/libs/Zend/Mail/Protocol/Smtp/Auth/Login.php
index a624792f4d..892f6724ec 100644
--- a/libs/Zend/Mail/Protocol/Smtp/Auth/Login.php
+++ b/libs/Zend/Mail/Protocol/Smtp/Auth/Login.php
@@ -11,20 +11,20 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Login.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Login.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Protocol_Smtp
*/
-require_once 'Zend/Mail/Protocol/Smtp.php';
+// require_once 'Zend/Mail/Protocol/Smtp.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Mail/Protocol/Smtp.php';
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Protocol_Smtp_Auth_Login extends Zend_Mail_Protocol_Smtp
diff --git a/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php b/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php
index 26e65d3009..02784cb9d3 100644
--- a/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php
+++ b/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php
@@ -11,20 +11,20 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Plain.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Plain.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Protocol_Smtp
*/
-require_once 'Zend/Mail/Protocol/Smtp.php';
+// require_once 'Zend/Mail/Protocol/Smtp.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Mail/Protocol/Smtp.php';
* @category Zend
* @package Zend_Mail
* @subpackage Protocol
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Protocol_Smtp_Auth_Plain extends Zend_Mail_Protocol_Smtp
diff --git a/libs/Zend/Mail/Storage.php b/libs/Zend/Mail/Storage.php
index 4c1a321962..771f7ae23b 100644
--- a/libs/Zend/Mail/Storage.php
+++ b/libs/Zend/Mail/Storage.php
@@ -14,15 +14,15 @@
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Storage.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Storage.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage
diff --git a/libs/Zend/Mail/Storage/Abstract.php b/libs/Zend/Mail/Storage/Abstract.php
index 052654b706..0d5f1ed1e7 100644
--- a/libs/Zend/Mail/Storage/Abstract.php
+++ b/libs/Zend/Mail/Storage/Abstract.php
@@ -11,13 +11,13 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, SeekableIterator
@@ -78,11 +78,11 @@ abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, See
$var = strtolower(substr($var, 3));
return isset($this->_has[$var]) ? $this->_has[$var] : null;
}
-
+
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception($var . ' not found');
}
@@ -264,7 +264,7 @@ abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, See
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot write mail messages via array access');
}
diff --git a/libs/Zend/Mail/Storage/Exception.php b/libs/Zend/Mail/Storage/Exception.php
index 497ab2c7ce..29cbc26981 100644
--- a/libs/Zend/Mail/Storage/Exception.php
+++ b/libs/Zend/Mail/Storage/Exception.php
@@ -11,27 +11,27 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Exception
*/
-require_once 'Zend/Mail/Exception.php';
+// require_once 'Zend/Mail/Exception.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Exception extends Zend_Mail_Exception
diff --git a/libs/Zend/Mail/Storage/Folder.php b/libs/Zend/Mail/Storage/Folder.php
index 1fc9641fdf..51d8a61a5d 100644
--- a/libs/Zend/Mail/Storage/Folder.php
+++ b/libs/Zend/Mail/Storage/Folder.php
@@ -11,13 +11,13 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Folder.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Folder.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Folder implements RecursiveIterator
@@ -154,7 +154,7 @@ class Zend_Mail_Storage_Folder implements RecursiveIterator
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("no subfolder named $name");
}
diff --git a/libs/Zend/Mail/Storage/Folder/Interface.php b/libs/Zend/Mail/Storage/Folder/Interface.php
index 683dc22e43..b5c89ac917 100644
--- a/libs/Zend/Mail/Storage/Folder/Interface.php
+++ b/libs/Zend/Mail/Storage/Folder/Interface.php
@@ -11,13 +11,13 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Mail_Storage_Folder_Interface
diff --git a/libs/Zend/Mail/Storage/Folder/Maildir.php b/libs/Zend/Mail/Storage/Folder/Maildir.php
index c2bf340c7d..228465a9e3 100644
--- a/libs/Zend/Mail/Storage/Folder/Maildir.php
+++ b/libs/Zend/Mail/Storage/Folder/Maildir.php
@@ -11,37 +11,37 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Maildir.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Maildir.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Storage_Folder
*/
-require_once 'Zend/Mail/Storage/Folder.php';
+// require_once 'Zend/Mail/Storage/Folder.php';
/**
* @see Zend_Mail_Storage_Folder_Interface
*/
-require_once 'Zend/Mail/Storage/Folder/Interface.php';
+// require_once 'Zend/Mail/Storage/Folder/Interface.php';
/**
* @see Zend_Mail_Storage_Maildir
*/
-require_once 'Zend/Mail/Storage/Maildir.php';
+// require_once 'Zend/Mail/Storage/Maildir.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir implements Zend_Mail_Storage_Folder_Interface
@@ -90,7 +90,7 @@ class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir impleme
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('no valid dirname given in params');
}
@@ -123,7 +123,7 @@ class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir impleme
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("can't read folders in maildir");
}
$dirs = array();
@@ -152,7 +152,7 @@ class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir impleme
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while reading maildir');
}
array_push($stack, $parent);
@@ -171,7 +171,7 @@ class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir impleme
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while reading maildir');
}
}
@@ -208,7 +208,7 @@ class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir impleme
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("folder $rootFolder not found");
}
return $currentFolder;
@@ -238,17 +238,17 @@ class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir impleme
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
- throw new Zend_Mail_Storage_Exception("{$this->_currentFolder} is not selectable");
+ // require_once 'Zend/Mail/Storage/Exception.php';
+ throw new Zend_Mail_Storage_Exception("{$this->_currentFolder} is not selectable", 0, $e);
}
// seems like file has vanished; rebuilding folder tree - but it's still an exception
$this->_buildFolderTree($this->_rootdir);
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('seems like the maildir has vanished, I\'ve rebuild the ' .
- 'folder tree, search for an other folder and try again');
+ 'folder tree, search for an other folder and try again', 0, $e);
}
}
diff --git a/libs/Zend/Mail/Storage/Folder/Mbox.php b/libs/Zend/Mail/Storage/Folder/Mbox.php
index e942322980..fc1d50b2a0 100644
--- a/libs/Zend/Mail/Storage/Folder/Mbox.php
+++ b/libs/Zend/Mail/Storage/Folder/Mbox.php
@@ -11,37 +11,37 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mbox.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Mbox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Storage_Folder
*/
-require_once 'Zend/Mail/Storage/Folder.php';
+// require_once 'Zend/Mail/Storage/Folder.php';
/**
* @see Zend_Mail_Storage_Folder_Interface
*/
-require_once 'Zend/Mail/Storage/Folder/Interface.php';
+// require_once 'Zend/Mail/Storage/Folder/Interface.php';
/**
* @see Zend_Mail_Storage_Mbox
*/
-require_once 'Zend/Mail/Storage/Mbox.php';
+// require_once 'Zend/Mail/Storage/Mbox.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Zend_Mail_Storage_Folder_Interface
@@ -86,7 +86,7 @@ class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Ze
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('use Zend_Mail_Storage_Mbox for a single file');
}
@@ -94,7 +94,7 @@ class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Ze
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('no valid dirname given in params');
}
@@ -130,7 +130,7 @@ class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Ze
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("can't read dir $currentDir");
}
while (($entry = readdir($dh)) !== false) {
@@ -182,7 +182,7 @@ class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Ze
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("folder $rootFolder not found");
}
return $currentFolder;
@@ -212,17 +212,17 @@ class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Ze
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
- throw new Zend_Mail_Storage_Exception("{$this->_currentFolder} is not selectable");
+ // require_once 'Zend/Mail/Storage/Exception.php';
+ throw new Zend_Mail_Storage_Exception("{$this->_currentFolder} is not selectable", 0, $e);
}
// seems like file has vanished; rebuilding folder tree - but it's still an exception
$this->_buildFolderTree($this->_rootdir);
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('seems like the mbox file has vanished, I\'ve rebuild the ' .
- 'folder tree, search for an other folder and try again');
+ 'folder tree, search for an other folder and try again', 0, $e);
}
}
diff --git a/libs/Zend/Mail/Storage/Imap.php b/libs/Zend/Mail/Storage/Imap.php
index 2495e90782..2efc5b856b 100644
--- a/libs/Zend/Mail/Storage/Imap.php
+++ b/libs/Zend/Mail/Storage/Imap.php
@@ -11,56 +11,56 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Imap.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Imap.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Storage_Abstract
*/
-require_once 'Zend/Mail/Storage/Abstract.php';
+// require_once 'Zend/Mail/Storage/Abstract.php';
/**
* @see Zend_Mail_Protocol_Imap
*/
-require_once 'Zend/Mail/Protocol/Imap.php';
+// require_once 'Zend/Mail/Protocol/Imap.php';
/**
* @see Zend_Mail_Storage_Writable_Interface
*/
-require_once 'Zend/Mail/Storage/Writable/Interface.php';
+// require_once 'Zend/Mail/Storage/Writable/Interface.php';
/**
* @see Zend_Mail_Storage_Folder_Interface
*/
-require_once 'Zend/Mail/Storage/Folder/Interface.php';
+// require_once 'Zend/Mail/Storage/Folder/Interface.php';
/**
* @see Zend_Mail_Storage_Folder
*/
-require_once 'Zend/Mail/Storage/Folder.php';
+// require_once 'Zend/Mail/Storage/Folder.php';
/**
* @see Zend_Mail_Message
*/
-require_once 'Zend/Mail/Message.php';
+// require_once 'Zend/Mail/Message.php';
/**
* @see Zend_Mail_Storage
*/
-require_once 'Zend/Mail/Storage.php';
+// require_once 'Zend/Mail/Storage.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
@@ -116,14 +116,14 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('No selected folder to count');
}
if ($flags === null) {
return count($this->_protocol->search(array('ALL')));
}
-
+
$params = array();
foreach ((array)$flags as $flag) {
if (isset(self::$_searchFlags[$flag])) {
@@ -189,7 +189,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
@@ -213,7 +213,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
@@ -250,8 +250,8 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
- throw new Zend_Mail_Storage_Exception('cannot select INBOX, is this a valid transport?');
+ // require_once 'Zend/Mail/Storage/Exception.php';
+ throw new Zend_Mail_Storage_Exception('cannot select INBOX, is this a valid transport?', 0, $e);
}
return;
}
@@ -260,7 +260,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('need at least user in params');
}
@@ -275,7 +275,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot login, user or password wrong');
}
$this->selectFolder(isset($params->folder) ? $params->folder : 'INBOX');
@@ -305,7 +305,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('could not do nothing');
}
}
@@ -325,7 +325,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot set deleted flag');
}
// TODO: expunge here or at close? we can handle an error here better and are more fail safe
@@ -333,7 +333,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('message marked as deleted, but could not expunge');
}
}
@@ -379,7 +379,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('unique id not found');
}
@@ -399,7 +399,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('folder not found');
}
@@ -437,7 +437,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while constructing folder tree');
}
}
@@ -463,7 +463,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot change folder, maybe it does not exist');
}
}
@@ -506,7 +506,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot create folder');
}
}
@@ -528,7 +528,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot delete folder');
}
}
@@ -553,7 +553,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot rename folder');
}
}
@@ -582,7 +582,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot create message, please check if the folder exists and your flags');
}
}
@@ -601,7 +601,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot copy message, does the folder exist?');
}
}
@@ -636,7 +636,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot set flags, have you tried to set the recent flag or special chars?');
}
}
diff --git a/libs/Zend/Mail/Storage/Maildir.php b/libs/Zend/Mail/Storage/Maildir.php
index 3954db4a1c..736b70cc66 100644
--- a/libs/Zend/Mail/Storage/Maildir.php
+++ b/libs/Zend/Mail/Storage/Maildir.php
@@ -11,37 +11,37 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Maildir.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Maildir.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Storage_Abstract
*/
-require_once 'Zend/Mail/Storage/Abstract.php';
+// require_once 'Zend/Mail/Storage/Abstract.php';
/**
* @see Zend_Mail_Message_File
*/
-require_once 'Zend/Mail/Message/File.php';
+// require_once 'Zend/Mail/Message/File.php';
/**
* @see Zend_Mail_Storage
*/
-require_once 'Zend/Mail/Storage.php';
+// require_once 'Zend/Mail/Storage.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
@@ -71,7 +71,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
'R' => Zend_Mail_Storage::FLAG_ANSWERED,
'S' => Zend_Mail_Storage::FLAG_SEEN,
'T' => Zend_Mail_Storage::FLAG_DELETED);
-
+
// TODO: getFlags($id) for fast access if headers are not needed (i.e. just setting flags)?
/**
@@ -86,7 +86,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
return count($this->_files);
}
- $count = 0;
+ $count = 0;
if (!is_array($flags)) {
foreach ($this->_files as $file) {
if (isset($file['flaglookup'][$flags])) {
@@ -95,7 +95,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
}
return $count;
}
-
+
$flags = array_flip($flags);
foreach ($this->_files as $file) {
foreach ($flags as $flag => $v) {
@@ -122,7 +122,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('id does not exist');
}
@@ -134,7 +134,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('field does not exist');
}
@@ -179,7 +179,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
return new $this->_messageClass(array('file' => $this->_getFileData($id, 'filename'),
'flags' => $this->_getFileData($id, 'flags')));
}
-
+
return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $this->getRawHeader($id),
'flags' => $this->_getFileData($id, 'flags')));
}
@@ -200,7 +200,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
@@ -234,7 +234,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
@@ -270,7 +270,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('no valid dirname given in params');
}
@@ -278,7 +278,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('invalid maildir given');
}
@@ -322,7 +322,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot open maildir');
}
$this->_getMaildirFiles($dh, $dirname . '/cur/');
@@ -336,7 +336,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot read recent mails in maildir');
}
}
@@ -422,7 +422,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('maildir is (currently) read-only');
}
@@ -469,7 +469,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('unique id not found');
}
}
diff --git a/libs/Zend/Mail/Storage/Mbox.php b/libs/Zend/Mail/Storage/Mbox.php
index 8fad784c5d..97bc56e394 100644
--- a/libs/Zend/Mail/Storage/Mbox.php
+++ b/libs/Zend/Mail/Storage/Mbox.php
@@ -11,13 +11,13 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mbox.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Mbox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,24 +25,24 @@
* @see Zend_Loader
* May be used in constructor, but commented out for now
*/
-// require_once 'Zend/Loader.php';
+// // require_once 'Zend/Loader.php';
/**
* @see Zend_Mail_Storage_Abstract
*/
-require_once 'Zend/Mail/Storage/Abstract.php';
+// require_once 'Zend/Mail/Storage/Abstract.php';
/**
* @see Zend_Mail_Message_File
*/
-require_once 'Zend/Mail/Message/File.php';
+// require_once 'Zend/Mail/Message/File.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
@@ -124,7 +124,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('id does not exist');
}
@@ -180,7 +180,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
$messagePos = $this->_getPos($id);
@@ -204,7 +204,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
$messagePos = $this->_getPos($id);
@@ -224,12 +224,12 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
if (is_array($params)) {
$params = (object)$params;
}
-
+
if (!isset($params->filename) /* || Zend_Loader::isReadable($params['filename']) */) {
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('no valid filename given in params');
}
@@ -290,7 +290,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot open mbox file');
}
$this->_filename = $filename;
@@ -301,7 +301,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('file is not a valid mbox format');
}
@@ -362,7 +362,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('mbox is read-only');
}
@@ -438,7 +438,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot open mbox file');
}
}
diff --git a/libs/Zend/Mail/Storage/Pop3.php b/libs/Zend/Mail/Storage/Pop3.php
index b3ea092032..0841c3c352 100644
--- a/libs/Zend/Mail/Storage/Pop3.php
+++ b/libs/Zend/Mail/Storage/Pop3.php
@@ -11,37 +11,37 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Pop3.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Pop3.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Storage_Abstract
*/
-require_once 'Zend/Mail/Storage/Abstract.php';
+// require_once 'Zend/Mail/Storage/Abstract.php';
/**
* @see Zend_Mail_Protocol_Pop3
*/
-require_once 'Zend/Mail/Protocol/Pop3.php';
+// require_once 'Zend/Mail/Protocol/Pop3.php';
/**
* @see Zend_Mail_Message
*/
-require_once 'Zend/Mail/Message.php';
+// require_once 'Zend/Mail/Message.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract
@@ -112,7 +112,7 @@ class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
@@ -135,7 +135,7 @@ class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
@@ -177,7 +177,7 @@ class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('need at least user in params');
}
@@ -244,7 +244,7 @@ class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract
}
$count = $this->countMessages();
if ($count < 1) {
- return array();
+ return array();
}
$range = range(1, $count);
return array_combine($range, $range);
@@ -279,7 +279,7 @@ class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('unique id not found');
}
diff --git a/libs/Zend/Mail/Storage/Writable/Interface.php b/libs/Zend/Mail/Storage/Writable/Interface.php
index fd73380df7..982b44eeb9 100644
--- a/libs/Zend/Mail/Storage/Writable/Interface.php
+++ b/libs/Zend/Mail/Storage/Writable/Interface.php
@@ -11,13 +11,13 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
diff --git a/libs/Zend/Mail/Storage/Writable/Maildir.php b/libs/Zend/Mail/Storage/Writable/Maildir.php
index 303b86066d..3519a4b411 100644
--- a/libs/Zend/Mail/Storage/Writable/Maildir.php
+++ b/libs/Zend/Mail/Storage/Writable/Maildir.php
@@ -11,32 +11,32 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Maildir.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Maildir.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Storage_Folder_Maildir
*/
-require_once 'Zend/Mail/Storage/Folder/Maildir.php';
+// require_once 'Zend/Mail/Storage/Folder/Maildir.php';
/**
* @see Zend_Mail_Storage_Writable_Interface
*/
-require_once 'Zend/Mail/Storage/Writable/Interface.php';
+// require_once 'Zend/Mail/Storage/Writable/Interface.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Storage
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Maildir
@@ -49,7 +49,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
* @var bool|int
*/
protected $_quota;
-
+
/**
* create a new maildir
*
@@ -66,7 +66,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('maildir must be a directory if already exists');
}
} else {
@@ -74,7 +74,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
$dir = dirname($dir);
if (!file_exists($dir)) {
throw new Zend_Mail_Storage_Exception("parent $dir not found");
@@ -85,7 +85,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
}
}
}
-
+
foreach (array('cur', 'tmp', 'new') as $subdir) {
if (!@mkdir($dir . DIRECTORY_SEPARATOR . $subdir)) {
// ignore if dir exists (i.e. was already valid maildir or two processes try to create one)
@@ -93,13 +93,13 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('could not create subdir ' . $subdir);
}
}
}
}
-
+
/**
* Create instance with parameters
* Additional parameters are (see parent for more):
@@ -112,11 +112,11 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
if (is_array($params)) {
$params = (object)$params;
}
-
+
if (!empty($params->create) && isset($params->dirname) && !file_exists($params->dirname . DIRECTORY_SEPARATOR . 'cur')) {
self::initMaildir($params->dirname);
}
-
+
parent::__construct($params);
}
@@ -154,7 +154,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('folder already exists');
}
@@ -162,7 +162,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('invalid name - folder parts may not be empty');
}
@@ -178,7 +178,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('invalid name - no directory seprator allowed in folder name');
}
@@ -199,7 +199,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while creating new folder, may be created incompletly');
}
@@ -241,7 +241,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('delete children first');
}
@@ -249,7 +249,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('wont delete INBOX');
}
@@ -257,7 +257,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('wont delete selected folder');
}
@@ -271,7 +271,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("error opening $subdir");
}
while (($entry = readdir($dh)) !== false) {
@@ -282,7 +282,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("error cleaning $subdir");
}
}
@@ -292,7 +292,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("error removing $subdir");
}
}
@@ -304,7 +304,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("error removing maindir");
}
@@ -345,7 +345,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('new folder cannot be a child of old folder');
}
@@ -356,7 +356,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('wont rename INBOX');
}
@@ -364,7 +364,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('wont rename selected folder');
}
@@ -387,7 +387,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while moving ' . $subdir);
}
}
@@ -442,7 +442,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('problems creating tmp dir');
}
}
@@ -464,7 +464,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('could not open temp file');
}
break;
@@ -476,7 +476,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception("tried $max_tries unique ids for a temp file, but all were taken"
. ' - giving up');
}
@@ -500,7 +500,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('recent flag may not be set');
}
@@ -520,7 +520,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('unknown flag(s): ' . $wanted_flags);
}
@@ -545,8 +545,8 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
- throw new Zend_Mail_Storage_Exception('storage is over quota!');
+ // require_once 'Zend/Mail/Storage/Exception.php';
+ throw new Zend_Mail_Storage_Exception('storage is over quota!');
}
if ($folder === null) {
@@ -587,7 +587,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
$exception = new Zend_Mail_Storage_Exception('cannot link message file to final dir');
}
@unlink($temp_file['filename']);
@@ -618,10 +618,10 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
- throw new Zend_Mail_Storage_Exception('storage is over quota!');
+ // require_once 'Zend/Mail/Storage/Exception.php';
+ throw new Zend_Mail_Storage_Exception('storage is over quota!');
}
-
+
if (!($folder instanceof Zend_Mail_Storage_Folder)) {
$folder = $this->getFolders($folder);
}
@@ -656,13 +656,13 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
$exception = new Zend_Mail_Storage_Exception('cannot copy message file');
} else if (!link($temp_file['filename'], $new_file)) {
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
$exception = new Zend_Mail_Storage_Exception('cannot link message file to final dir');
}
@unlink($temp_file['filename']);
@@ -677,7 +677,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
'flags' => $flags,
'filename' => $new_file);
}
-
+
if ($this->_quota) {
$this->_addQuotaEntry((int)$size, 1);
}
@@ -695,16 +695,16 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
if (!($folder instanceof Zend_Mail_Storage_Folder)) {
$folder = $this->getFolders($folder);
}
-
+
if ($folder->getGlobalName() == $this->_currentFolder
|| ($this->_currentFolder == 'INBOX' && $folder->getGlobalName() == '/')) {
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('target is current folder');
}
-
+
$filedata = $this->_getFileData($id);
$old_file = $filedata['filename'];
$flags = $filedata['flags'];
@@ -734,7 +734,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
$exception = new Zend_Mail_Storage_Exception('cannot move message file');
}
@unlink($temp_file['filename']);
@@ -770,7 +770,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot rename file');
}
@@ -790,16 +790,16 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
public function removeMessage($id)
{
$filename = $this->_getFileData($id, 'filename');
-
+
if ($this->_quota) {
$size = filesize($filename);
}
-
+
if (!@unlink($filename)) {
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot remove message');
}
unset($this->_files[$id - 1]);
@@ -809,7 +809,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
$this->_addQuotaEntry(0 - (int)$size, -1);
}
}
-
+
/**
* enable/disable quota and set a quota value if wanted or needed
*
@@ -824,7 +824,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
public function setQuota($value) {
$this->_quota = $value;
}
-
+
/**
* get currently set quota
*
@@ -839,7 +839,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
/**
* @see Zend_Mail_Storage_Exception
*/
- require_once 'Zend/Mail/Storage/Exception.php';
+ // require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot open maildirsize');
}
$definition = fgets($fh);
@@ -855,10 +855,10 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
}
return $quota;
}
-
+
return $this->_quota;
}
-
+
/**
* @see http://www.inter7.com/courierimap/README.maildirquota.html "Calculating maildirsize"
*/
@@ -873,10 +873,10 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
try {
$quota = $this->getQuota(true);
} catch (Zend_Mail_Storage_Exception $e) {
- throw new Zend_Mail_Storage_Exception('no quota defintion found');
+ throw new Zend_Mail_Storage_Exception('no quota definition found', 0, $e);
}
}
-
+
$folders = new RecursiveIteratorIterator($this->getFolders(), RecursiveIteratorIterator::SELF_FIRST);
foreach ($folders as $folder) {
$subdir = $folder->getGlobalName();
@@ -888,29 +888,29 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
if ($subdir == 'Trash') {
continue;
}
-
+
foreach (array('cur', 'new') as $subsubdir) {
$dirname = $this->_rootdir . $subdir . DIRECTORY_SEPARATOR . $subsubdir . DIRECTORY_SEPARATOR;
if (!file_exists($dirname)) {
continue;
}
// NOTE: we are using mtime instead of "the latest timestamp". The latest would be atime
- // and as we are accessing the directory it would make the whole calculation useless.
+ // and as we are accessing the directory it would make the whole calculation useless.
$timestamps[$dirname] = filemtime($dirname);
$dh = opendir($dirname);
- // NOTE: Should have been checked in constructor. Not throwing an exception here, quotas will
+ // NOTE: Should have been checked in constructor. Not throwing an exception here, quotas will
// therefore not be fully enforeced, but next request will fail anyway, if problem persists.
if (!$dh) {
continue;
}
-
-
+
+
while (($entry = readdir()) !== false) {
if ($entry[0] == '.' || !is_file($dirname . $entry)) {
continue;
}
-
+
if (strpos($entry, ',S=')) {
strtok($entry, '=');
$filesize = strtok(':');
@@ -930,7 +930,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
}
}
}
-
+
$tmp = $this->_createTmpFile();
$fh = $tmp['handle'];
$definition = array();
@@ -951,10 +951,10 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
break;
}
}
-
+
return array('size' => $total_size, 'count' => $messages, 'quota' => $quota);
}
-
+
/**
* @see http://www.inter7.com/courierimap/README.maildirquota.html "Calculating the quota for a Maildir++"
*/
@@ -1001,9 +1001,9 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
$messages += $count;
}
}
-
+
$over_quota = false;
- $over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']);
+ $over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']);
$over_quota = $over_quota || (isset($quota['count']) && $messages > $quota['count']);
// NOTE: $maildirsize equals false if it wasn't set (AKA we recalculated) or it's only
// one line, because $maildirsize[0] gets unsetted.
@@ -1015,18 +1015,18 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
$messages = $result['count'];
$quota = $result['quota'];
$over_quota = false;
- $over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']);
+ $over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']);
$over_quota = $over_quota || (isset($quota['count']) && $messages > $quota['count']);
}
-
+
if ($fh) {
// TODO is there a safe way to keep the handle open for writing?
fclose($fh);
}
-
+
return array('size' => $total_size, 'count' => $messages, 'quota' => $quota, 'over_quota' => $over_quota);
}
-
+
protected function _addQuotaEntry($size, $count = 1) {
if (!file_exists($this->_rootdir . 'maildirsize')) {
// TODO: should get file handler from _calculateQuota
@@ -1035,7 +1035,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
$count = (int)$count;
file_put_contents($this->_rootdir . 'maildirsize', "$size $count\n", FILE_APPEND);
}
-
+
/**
* check if storage is currently over quota
*
diff --git a/libs/Zend/Mail/Transport/Abstract.php b/libs/Zend/Mail/Transport/Abstract.php
index 5ef4b7019c..74d6ab005f 100644
--- a/libs/Zend/Mail/Transport/Abstract.php
+++ b/libs/Zend/Mail/Transport/Abstract.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Mail
* @subpackage Transport
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 17334 2009-08-01 01:25:22Z yoshida@zend.co.jp $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mime
*/
-require_once 'Zend/Mime.php';
+// require_once 'Zend/Mime.php';
/**
@@ -34,7 +34,7 @@ require_once 'Zend/Mime.php';
* @category Zend
* @package Zend_Mail
* @subpackage Transport
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Mail_Transport_Abstract
@@ -140,7 +140,7 @@ abstract class Zend_Mail_Transport_Abstract
}
$this->_headers['Content-Type'] = array(
- $type . '; charset=' . $this->_mail->getCharset() . ';'
+ $type . ';'
. $this->EOL
. " " . 'boundary="' . $boundary . '"'
);
@@ -184,7 +184,7 @@ abstract class Zend_Mail_Transport_Abstract
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
+ // require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('Missing Zend_Mail object in _mail property');
}
@@ -213,7 +213,7 @@ abstract class Zend_Mail_Transport_Abstract
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
+ // require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Exception('At least one mail header line is too long');
}
}
@@ -280,7 +280,7 @@ abstract class Zend_Mail_Transport_Abstract
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
+ // require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('No body specified');
}
@@ -319,7 +319,7 @@ abstract class Zend_Mail_Transport_Abstract
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
+ // require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent');
}
diff --git a/libs/Zend/Mail/Transport/Exception.php b/libs/Zend/Mail/Transport/Exception.php
index 9947f45a79..cf4165a886 100644
--- a/libs/Zend/Mail/Transport/Exception.php
+++ b/libs/Zend/Mail/Transport/Exception.php
@@ -11,27 +11,27 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Transport
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mail_Exception
*/
-require_once 'Zend/Mail/Exception.php';
+// require_once 'Zend/Mail/Exception.php';
/**
* @category Zend
* @package Zend_Mail
* @subpackage Transport
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Transport_Exception extends Zend_Mail_Exception
diff --git a/libs/Zend/Mail/Transport/Sendmail.php b/libs/Zend/Mail/Transport/Sendmail.php
index cef1e2091f..c12eb46a23 100644
--- a/libs/Zend/Mail/Transport/Sendmail.php
+++ b/libs/Zend/Mail/Transport/Sendmail.php
@@ -11,20 +11,20 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Transport
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Sendmail.php 18264 2009-09-18 18:25:38Z beberlei $
+ * @version $Id: Sendmail.php 21605 2010-03-22 15:09:03Z yoshida@zend.co.jp $
*/
/**
* @see Zend_Mail_Transport_Abstract
*/
-require_once 'Zend/Mail/Transport/Abstract.php';
+// require_once 'Zend/Mail/Transport/Abstract.php';
/**
@@ -33,7 +33,7 @@ require_once 'Zend/Mail/Transport/Abstract.php';
* @category Zend
* @package Zend_Mail
* @subpackage Transport
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
@@ -53,7 +53,6 @@ class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
*/
public $parameters;
-
/**
* EOL character string
* @var string
@@ -61,15 +60,28 @@ class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
*/
public $EOL = PHP_EOL;
+ /**
+ * error information
+ * @var string
+ */
+ protected $_errstr;
/**
* Constructor.
*
- * @param string $parameters OPTIONAL (Default: null)
+ * @param string|array|Zend_Config $parameters OPTIONAL (Default: null)
* @return void
*/
public function __construct($parameters = null)
{
+ if ($parameters instanceof Zend_Config) {
+ $parameters = $parameters->toArray();
+ }
+
+ if (is_array($parameters)) {
+ $parameters = implode(' ', $parameters);
+ }
+
$this->parameters = $parameters;
}
@@ -79,30 +91,50 @@ class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
*
* @access public
* @return void
+ * @throws Zend_Mail_Transport_Exception if parameters is set
+ * but not a string
* @throws Zend_Mail_Transport_Exception on mail() failure
*/
public function _sendMail()
{
if ($this->parameters === null) {
+ set_error_handler(array($this, '_handleMailErrors'));
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header);
+ restore_error_handler();
} else {
+ if(!is_string($this->parameters)) {
+ /**
+ * @see Zend_Mail_Transport_Exception
+ *
+ * Exception is thrown here because
+ * $parameters is a public property
+ */
+ // require_once 'Zend/Mail/Transport/Exception.php';
+ throw new Zend_Mail_Transport_Exception(
+ 'Parameters were set but are not a string'
+ );
+ }
+
+ set_error_handler(array($this, '_handleMailErrors'));
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header,
$this->parameters);
+ restore_error_handler();
}
- if (!$result) {
+
+ if ($this->_errstr !== null || !$result) {
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
- throw new Zend_Mail_Transport_Exception('Unable to send mail');
+ // require_once 'Zend/Mail/Transport/Exception.php';
+ throw new Zend_Mail_Transport_Exception('Unable to send mail. ' . $this->_errstr);
}
}
@@ -125,7 +157,7 @@ class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
+ // require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('_prepareHeaders requires a registered Zend_Mail object');
}
@@ -137,7 +169,7 @@ class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
+ // require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('Missing To addresses');
}
} else {
@@ -146,7 +178,7 @@ class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
+ // require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('Missing To header');
}
@@ -169,5 +201,20 @@ class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
$this->header = rtrim($this->header);
}
-}
+ /**
+ * Temporary error handler for PHP native mail().
+ *
+ * @param int $errno
+ * @param string $errstr
+ * @param string $errfile
+ * @param string $errline
+ * @param array $errcontext
+ * @return true
+ */
+ public function _handleMailErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null)
+ {
+ $this->_errstr = $errstr;
+ return true;
+ }
+}
diff --git a/libs/Zend/Mail/Transport/Smtp.php b/libs/Zend/Mail/Transport/Smtp.php
index 0c1f7cb0b9..288cb4644f 100644
--- a/libs/Zend/Mail/Transport/Smtp.php
+++ b/libs/Zend/Mail/Transport/Smtp.php
@@ -11,30 +11,30 @@
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
- *
+ *
* @category Zend
* @package Zend_Mail
* @subpackage Transport
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Smtp.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Smtp.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mime
*/
-require_once 'Zend/Mime.php';
+// require_once 'Zend/Mime.php';
/**
* @see Zend_Mail_Protocol_Smtp
*/
-require_once 'Zend/Mail/Protocol/Smtp.php';
+// require_once 'Zend/Mail/Protocol/Smtp.php';
/**
* @see Zend_Mail_Transport_Abstract
*/
-require_once 'Zend/Mail/Transport/Abstract.php';
+// require_once 'Zend/Mail/Transport/Abstract.php';
/**
@@ -45,7 +45,7 @@ require_once 'Zend/Mail/Transport/Abstract.php';
* @category Zend
* @package Zend_Mail
* @subpackage Transport
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
@@ -111,6 +111,9 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
* @param string $host OPTIONAL (Default: 127.0.0.1)
* @param array|null $config OPTIONAL (Default: null)
* @return void
+ *
+ * @todo Someone please make this compatible
+ * with the SendMail transport class.
*/
public function __construct($host = '127.0.0.1', Array $config = array())
{
@@ -177,6 +180,7 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
* developer to add a custom adapter if required before mail is sent.
*
* @return void
+ * @todo Rename this to sendMail, it's a public method...
*/
public function _sendMail()
{
@@ -187,10 +191,10 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
if ($this->_auth) {
$connectionClass .= '_Auth_' . ucwords($this->_auth);
}
- if (!class_exists($connectionClass)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($connectionClass);
- }
+ // if (!class_exists($connectionClass)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($connectionClass);
+ // }
$this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config));
$this->_connection->connect();
$this->_connection->helo($this->_name);
@@ -199,8 +203,8 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
$this->_connection->rset();
}
- // Set mail return path from sender email address
- $this->_connection->mail($this->_mail->getReturnPath());
+ // Set sender email address
+ $this->_connection->mail($this->_mail->getFrom());
// Set recipient forward paths
foreach ($this->_mail->getRecipients() as $recipient) {
@@ -227,7 +231,7 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
/**
* @see Zend_Mail_Transport_Exception
*/
- require_once 'Zend/Mail/Transport/Exception.php';
+ // require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('_prepareHeaders requires a registered Zend_Mail object');
}
diff --git a/libs/Zend/Mime.php b/libs/Zend/Mime.php
index 921cc1f16f..aa3582efe9 100644
--- a/libs/Zend/Mime.php
+++ b/libs/Zend/Mime.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Mime.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Mime.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
@@ -25,7 +25,7 @@
*
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mime
diff --git a/libs/Zend/Mime/Decode.php b/libs/Zend/Mime/Decode.php
index c50b495cfd..b996a4a028 100644
--- a/libs/Zend/Mime/Decode.php
+++ b/libs/Zend/Mime/Decode.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Decode.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Decode.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Mime
*/
-require_once 'Zend/Mime.php';
+// require_once 'Zend/Mime.php';
/**
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mime_Decode
diff --git a/libs/Zend/Mime/Exception.php b/libs/Zend/Mime/Exception.php
index 4d2811f048..cb76e79c50 100644
--- a/libs/Zend/Mime/Exception.php
+++ b/libs/Zend/Mime/Exception.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mime_Exception extends Zend_Exception
diff --git a/libs/Zend/Mime/Message.php b/libs/Zend/Mime/Message.php
index 537107d2c7..781ac99246 100644
--- a/libs/Zend/Mime/Message.php
+++ b/libs/Zend/Mime/Message.php
@@ -14,27 +14,27 @@
*
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Message.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Message.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Mime
*/
-require_once 'Zend/Mime.php';
+// require_once 'Zend/Mime.php';
/**
* Zend_Mime_Part
*/
-require_once 'Zend/Mime/Part.php';
+// require_once 'Zend/Mime/Part.php';
/**
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mime_Message
@@ -242,7 +242,7 @@ class Zend_Mime_Message
*/
public static function createFromMessage($message, $boundary, $EOL = Zend_Mime::LINEEND)
{
- require_once 'Zend/Mime/Decode.php';
+ // require_once 'Zend/Mime/Decode.php';
$parts = Zend_Mime_Decode::splitMessageStruct($message, $boundary, $EOL);
$res = new self();
diff --git a/libs/Zend/Mime/Part.php b/libs/Zend/Mime/Part.php
index 6609b51a76..96e20d09a3 100644
--- a/libs/Zend/Mime/Part.php
+++ b/libs/Zend/Mime/Part.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Part.php 16541 2009-07-07 06:59:03Z bkarwin $
+ * @version $Id: Part.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Mime
*/
-require_once 'Zend/Mime.php';
+// require_once 'Zend/Mime.php';
/**
* Class representing a MIME part.
*
* @category Zend
* @package Zend_Mime
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mime_Part {
@@ -92,7 +92,7 @@ class Zend_Mime_Part {
public function getEncodedStream()
{
if (!$this->_isStream) {
- require_once 'Zend/Mime/Exception.php';
+ // require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Attempt to get a stream from a string part');
}
@@ -109,7 +109,7 @@ class Zend_Mime_Part {
)
);
if (!is_resource($filter)) {
- require_once 'Zend/Mime/Exception.php';
+ // require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Failed to append quoted-printable filter');
}
break;
@@ -124,7 +124,7 @@ class Zend_Mime_Part {
)
);
if (!is_resource($filter)) {
- require_once 'Zend/Mime/Exception.php';
+ // require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Failed to append base64 filter');
}
break;
diff --git a/libs/Zend/Registry.php b/libs/Zend/Registry.php
index d801d1220b..845ef66bba 100644
--- a/libs/Zend/Registry.php
+++ b/libs/Zend/Registry.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Registry
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Registry.php 16207 2009-06-21 19:17:51Z thomas $
+ * @version $Id: Registry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
@@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_Registry
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Registry extends ArrayObject
@@ -66,7 +66,7 @@ class Zend_Registry extends ArrayObject
public static function setInstance(Zend_Registry $registry)
{
if (self::$_registry !== null) {
- require_once 'Zend/Exception.php';
+ // require_once 'Zend/Exception.php';
throw new Zend_Exception('Registry is already initialized');
}
@@ -97,22 +97,22 @@ class Zend_Registry extends ArrayObject
public static function setClassName($registryClassName = 'Zend_Registry')
{
if (self::$_registry !== null) {
- require_once 'Zend/Exception.php';
+ // require_once 'Zend/Exception.php';
throw new Zend_Exception('Registry is already initialized');
}
if (!is_string($registryClassName)) {
- require_once 'Zend/Exception.php';
+ // require_once 'Zend/Exception.php';
throw new Zend_Exception("Argument is not a class name");
}
/**
* @see Zend_Loader
*/
- if (!class_exists($registryClassName)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($registryClassName);
- }
+ // if (!class_exists($registryClassName)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($registryClassName);
+ // }
self::$_registryClassName = $registryClassName;
}
@@ -143,7 +143,7 @@ class Zend_Registry extends ArrayObject
$instance = self::getInstance();
if (!$instance->offsetExists($index)) {
- require_once 'Zend/Exception.php';
+ // require_once 'Zend/Exception.php';
throw new Zend_Exception("No entry is registered for key '$index'");
}
diff --git a/libs/Zend/Session.php b/libs/Zend/Session.php
index 31ab5a50a1..e361d15db2 100644
--- a/libs/Zend/Session.php
+++ b/libs/Zend/Session.php
@@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Session.php 18342 2009-09-21 16:31:18Z alexander $
+ * @version $Id: Session.php 20096 2010-01-06 02:05:09Z bkarwin $
* @since Preview Release 0.2
*/
@@ -25,17 +25,17 @@
/**
* @see Zend_Session_Abstract
*/
-require_once 'Zend/Session/Abstract.php';
+// require_once 'Zend/Session/Abstract.php';
/**
* @see Zend_Session_Namespace
*/
-require_once 'Zend/Session/Namespace.php';
+// require_once 'Zend/Session/Namespace.php';
/**
* @see Zend_Session_SaveHandler_Interface
*/
-require_once 'Zend/Session/SaveHandler/Interface.php';
+// require_once 'Zend/Session/SaveHandler/Interface.php';
/**
@@ -43,7 +43,7 @@ require_once 'Zend/Session/SaveHandler/Interface.php';
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Session extends Zend_Session_Abstract
@@ -62,7 +62,7 @@ class Zend_Session extends Zend_Session_Abstract
* @var bool|bitset This could also be a combiniation of error codes to catch
*/
protected static $_throwStartupExceptions = true;
-
+
/**
* Check whether or not the session was started
*
@@ -223,7 +223,7 @@ class Zend_Session extends Zend_Session_Abstract
}
else {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("Unknown option: $userOptionName = $userOptionValue");
}
}
@@ -244,14 +244,14 @@ class Zend_Session extends Zend_Session_Abstract
foreach (self::$_localOptions as $localOptionName => $localOptionMemberName) {
$options[$localOptionName] = self::${$localOptionMemberName};
}
-
+
if ($optionName) {
if (array_key_exists($optionName, $options)) {
return $options[$optionName];
}
return null;
}
-
+
return $options;
}
@@ -303,7 +303,7 @@ class Zend_Session extends Zend_Session_Abstract
{
if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("You must call " . __CLASS__ . '::' . __FUNCTION__ .
"() before any output has been sent to the browser; output started in {$filename}/{$linenum}");
}
@@ -427,7 +427,7 @@ class Zend_Session extends Zend_Session_Abstract
public static function start($options = false)
{
if (self::$_sessionStarted && self::$_destroyed) {
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('The session was explicitly destroyed during this request, attempting to re-start is not allowed.');
}
@@ -443,14 +443,14 @@ class Zend_Session extends Zend_Session_Abstract
// In strict mode, do not allow auto-starting Zend_Session, such as via "new Zend_Session_Namespace()"
if (self::$_strict && $options === true) {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('You must explicitly start the session with Zend_Session::start() when session options are set to strict.');
}
$filename = $linenum = null;
if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("Session must be started before any output has been sent to the browser;"
. " output started in {$filename}/{$linenum}");
}
@@ -458,7 +458,7 @@ class Zend_Session extends Zend_Session_Abstract
// See http://www.php.net/manual/en/ref.session.php for explanation
if (!self::$_unitTestEnabled && defined('SID')) {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('session has already been started by session.auto-start or session_start()');
}
@@ -466,23 +466,23 @@ class Zend_Session extends Zend_Session_Abstract
* Hack to throw exceptions on start instead of php errors
* @see http://framework.zend.com/issues/browse/ZF-1325
*/
-
+
$errorLevel = (is_int(self::$_throwStartupExceptions)) ? self::$_throwStartupExceptions : E_ALL;
-
+
/** @see Zend_Session_Exception */
if (!self::$_unitTestEnabled) {
-
+
if (self::$_throwStartupExceptions) {
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
set_error_handler(array('Zend_Session_Exception', 'handleSessionStartError'), $errorLevel);
}
-
+
$startedCleanly = session_start();
-
+
if (self::$_throwStartupExceptions) {
restore_error_handler();
}
-
+
if (!$startedCleanly || Zend_Session_Exception::$sessionStartError != null) {
if (self::$_throwStartupExceptions) {
set_error_handler(array('Zend_Session_Exception', 'handleSilentWriteClose'), $errorLevel);
@@ -528,7 +528,7 @@ class Zend_Session extends Zend_Session_Abstract
// Expire Namespace by Time (ENT)
if (isset($namespace_metadata['ENT']) && ($namespace_metadata['ENT'] > 0) && (time() > $namespace_metadata['ENT']) ) {
unset($_SESSION[$namespace]);
- unset($_SESSION['__ZF'][$namespace]['ENT']);
+ unset($_SESSION['__ZF'][$namespace]);
}
// Expire Namespace by Global Hop (ENGH)
@@ -540,7 +540,7 @@ class Zend_Session extends Zend_Session_Abstract
parent::$_expiringData[$namespace] = $_SESSION[$namespace];
unset($_SESSION[$namespace]);
}
- unset($_SESSION['__ZF'][$namespace]['ENGH']);
+ unset($_SESSION['__ZF'][$namespace]);
}
}
@@ -550,12 +550,11 @@ class Zend_Session extends Zend_Session_Abstract
if (time() > $time) {
unset($_SESSION[$namespace][$variable]);
unset($_SESSION['__ZF'][$namespace]['ENVT'][$variable]);
-
- if (empty($_SESSION['__ZF'][$namespace]['ENVT'])) {
- unset($_SESSION['__ZF'][$namespace]['ENVT']);
- }
}
}
+ if (empty($_SESSION['__ZF'][$namespace]['ENVT'])) {
+ unset($_SESSION['__ZF'][$namespace]['ENVT']);
+ }
}
// Expire Namespace Variables by Global Hop (ENVGH)
@@ -571,6 +570,9 @@ class Zend_Session extends Zend_Session_Abstract
unset($_SESSION['__ZF'][$namespace]['ENVGH'][$variable]);
}
}
+ if(empty($_SESSION['__ZF'][$namespace]['ENVGH'])) {
+ unset($_SESSION['__ZF'][$namespace]['ENVGH']);
+ }
}
}
@@ -630,20 +632,20 @@ class Zend_Session extends Zend_Session_Abstract
{
if (!self::$_unitTestEnabled && defined('SID')) {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('The session has already been started. The session id must be set first.');
}
if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("You must call ".__CLASS__.'::'.__FUNCTION__.
"() before any output has been sent to the browser; output started in {$filename}/{$linenum}");
}
if (!is_string($id) || $id === '') {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('You must provide a non-empty string as a session identifier.');
}
@@ -772,14 +774,14 @@ class Zend_Session extends Zend_Session_Abstract
private static function _processValidators()
{
foreach ($_SESSION['__ZF']['VALID'] as $validator_name => $valid_data) {
- if (!class_exists($validator_name)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($validator_name);
- }
+ // if (!class_exists($validator_name)) {
+ // require_once 'Zend/Loader.php';
+ // Zend_Loader::loadClass($validator_name);
+ // }
$validator = new $validator_name;
if ($validator->validate() === false) {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("This session is not valid according to {$validator_name}.");
}
}
@@ -836,7 +838,7 @@ class Zend_Session extends Zend_Session_Abstract
{
if (parent::$_readable === false) {
/** @see Zend_Session_Exception */
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception(parent::_THROW_NOT_READABLE_MSG);
}
diff --git a/libs/Zend/Session/Abstract.php b/libs/Zend/Session/Abstract.php
index 448afbf5c5..2c5b613e95 100644
--- a/libs/Zend/Session/Abstract.php
+++ b/libs/Zend/Session/Abstract.php
@@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16210 2009-06-21 19:22:17Z thomas $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
* @since Preview Release 0.2
*/
@@ -27,7 +27,7 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Session_Abstract
@@ -82,7 +82,7 @@ abstract class Zend_Session_Abstract
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG);
}
@@ -108,7 +108,7 @@ abstract class Zend_Session_Abstract
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception(self::_THROW_NOT_WRITABLE_MSG);
}
@@ -143,7 +143,7 @@ abstract class Zend_Session_Abstract
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG);
}
diff --git a/libs/Zend/Session/Exception.php b/libs/Zend/Session/Exception.php
index 29ca6aa954..dc8aa638ff 100644
--- a/libs/Zend/Session/Exception.php
+++ b/libs/Zend/Session/Exception.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16210 2009-06-21 19:22:17Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
* @since Preview Release 0.2
*/
@@ -24,7 +24,7 @@
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
@@ -32,7 +32,7 @@ require_once 'Zend/Exception.php';
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Session_Exception extends Zend_Exception
diff --git a/libs/Zend/Session/Namespace.php b/libs/Zend/Session/Namespace.php
index a18a66c99a..ef811a066b 100644
--- a/libs/Zend/Session/Namespace.php
+++ b/libs/Zend/Session/Namespace.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Namespace.php 16210 2009-06-21 19:22:17Z thomas $
+ * @version $Id: Namespace.php 20096 2010-01-06 02:05:09Z bkarwin $
* @since Preview Release 0.2
*/
@@ -24,13 +24,13 @@
/**
* @see Zend_Session
*/
-require_once 'Zend/Session.php';
+// require_once 'Zend/Session.php';
/**
* @see Zend_Session_Abstract
*/
-require_once 'Zend/Session/Abstract.php';
+// require_once 'Zend/Session/Abstract.php';
/**
@@ -38,7 +38,7 @@ require_once 'Zend/Session/Abstract.php';
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAggregate
@@ -84,11 +84,11 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
}
return;
}
-
+
self::$_singleInstances = array();
return;
}
-
+
/**
* __construct() - Returns an instance object bound to a particular, isolated section
* of the session, identified by $namespace name (defaulting to 'Default').
@@ -105,7 +105,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('Session namespace must be a non-empty string.');
}
@@ -113,7 +113,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('Session namespace must not start with an underscore.');
}
@@ -121,7 +121,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('Session namespace must not start with a number.');
}
@@ -129,7 +129,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("A session namespace object already exists for this namespace ('$namespace'), and no additional accessors (session namespace objects) for this namespace are permitted.");
}
@@ -146,7 +146,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG);
}
@@ -167,7 +167,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
self::$_expiringData[$namespace] = $_SESSION[$namespace];
unset($_SESSION[$namespace]);
}
- unset($_SESSION['__ZF'][$namespace]['ENNH']);
+ unset($_SESSION['__ZF'][$namespace]);
}
}
@@ -184,6 +184,9 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
unset($_SESSION['__ZF'][$namespace]['ENVNH'][$variable]);
}
}
+ if(empty($_SESSION['__ZF'][$namespace]['ENVNH'])) {
+ unset($_SESSION['__ZF'][$namespace]['ENVNH']);
+ }
}
}
@@ -277,7 +280,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("The '$name' key must be a non-empty string");
}
@@ -299,7 +302,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('This session/namespace has been marked as read-only.');
}
@@ -307,7 +310,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("The '$name' key must be a non-empty string");
}
@@ -315,7 +318,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG);
}
@@ -364,7 +367,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('Result must be an array. Got: ' . gettype($result));
}
$_SESSION[$this->_namespace] = $result;
@@ -384,7 +387,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("The '$name' key must be a non-empty string");
}
@@ -404,7 +407,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("The '$name' key must be a non-empty string");
}
@@ -427,7 +430,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG);
}
@@ -435,7 +438,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('Seconds must be positive.');
}
@@ -475,7 +478,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG);
}
@@ -483,7 +486,7 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
/**
* @see Zend_Session_Exception
*/
- require_once 'Zend/Session/Exception.php';
+ // require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('Hops must be positive number.');
}
@@ -514,4 +517,13 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
}
}
+ /**
+ * Returns the namespace name
+ *
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->_namespace;
+ }
}
diff --git a/libs/Zend/Session/SaveHandler/DbTable.php b/libs/Zend/Session/SaveHandler/DbTable.php
index 84a7f73180..b59526d3a9 100644
--- a/libs/Zend/Session/SaveHandler/DbTable.php
+++ b/libs/Zend/Session/SaveHandler/DbTable.php
@@ -15,30 +15,30 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: DbTable.php 16933 2009-07-21 20:24:35Z matthew $
+ * @version $Id: DbTable.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Session
*/
-require_once 'Zend/Session.php';
+// require_once 'Zend/Session.php';
/**
* @see Zend_Db_Table_Abstract
*/
-require_once 'Zend/Db/Table/Abstract.php';
+// require_once 'Zend/Db/Table/Abstract.php';
/**
* @see Zend_Db_Table_Row_Abstract
*/
-require_once 'Zend/Db/Table/Row/Abstract.php';
+// require_once 'Zend/Db/Table/Row/Abstract.php';
/**
* @see Zend_Config
*/
-require_once 'Zend/Config.php';
+// require_once 'Zend/Config.php';
/**
* Zend_Session_SaveHandler_DbTable
@@ -46,11 +46,11 @@ require_once 'Zend/Config.php';
* @category Zend
* @package Zend_Session
* @subpackage SaveHandler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Session_SaveHandler_DbTable
- extends Zend_Db_Table_Abstract
+class Zend_Session_SaveHandler_DbTable
+ extends Zend_Db_Table_Abstract
implements Zend_Session_SaveHandler_Interface
{
const PRIMARY_ASSIGNMENT = 'primaryAssignment';
@@ -168,7 +168,7 @@ class Zend_Session_SaveHandler_DbTable
/**
* @see Zend_Session_SaveHandler_Exception
*/
- require_once 'Zend/Session/SaveHandler/Exception.php';
+ // require_once 'Zend/Session/SaveHandler/Exception.php';
throw new Zend_Session_SaveHandler_Exception(
'$config must be an instance of Zend_Config or array of key/value pairs containing '
@@ -232,7 +232,7 @@ class Zend_Session_SaveHandler_DbTable
/**
* @see Zend_Session_SaveHandler_Exception
*/
- require_once 'Zend/Session/SaveHandler/Exception.php';
+ // require_once 'Zend/Session/SaveHandler/Exception.php';
throw new Zend_Session_SaveHandler_Exception();
} else if (empty($lifetime)) {
$this->_lifetime = (int) ini_get('session.gc_maxlifetime');
@@ -420,7 +420,7 @@ class Zend_Session_SaveHandler_DbTable
/**
* @see Zend_Session_SaveHandler_Exception
*/
- require_once 'Zend/Session/SaveHandler/Exception.php';
+ // require_once 'Zend/Session/SaveHandler/Exception.php';
throw new Zend_Session_SaveHandler_Exception('session.save_path is a path and not a table name.');
}
@@ -452,7 +452,7 @@ class Zend_Session_SaveHandler_DbTable
/**
* @see Zend_Session_SaveHandler_Exception
*/
- require_once 'Zend/Session/SaveHandler/Exception.php';
+ // require_once 'Zend/Session/SaveHandler/Exception.php';
throw new Zend_Session_SaveHandler_Exception(
"Value for configuration option '" . self::PRIMARY_ASSIGNMENT . "' must have an assignment "
@@ -461,7 +461,7 @@ class Zend_Session_SaveHandler_DbTable
/**
* @see Zend_Session_SaveHandler_Exception
*/
- require_once 'Zend/Session/SaveHandler/Exception.php';
+ // require_once 'Zend/Session/SaveHandler/Exception.php';
throw new Zend_Session_SaveHandler_Exception(
"Value for configuration option '" . self::PRIMARY_ASSIGNMENT . "' must have an assignment "
@@ -481,7 +481,7 @@ class Zend_Session_SaveHandler_DbTable
/**
* @see Zend_Session_SaveHandler_Exception
*/
- require_once 'Zend/Session/SaveHandler/Exception.php';
+ // require_once 'Zend/Session/SaveHandler/Exception.php';
throw new Zend_Session_SaveHandler_Exception(
"Configuration must define '" . self::MODIFIED_COLUMN . "' which names the "
@@ -490,7 +490,7 @@ class Zend_Session_SaveHandler_DbTable
/**
* @see Zend_Session_SaveHandler_Exception
*/
- require_once 'Zend/Session/SaveHandler/Exception.php';
+ // require_once 'Zend/Session/SaveHandler/Exception.php';
throw new Zend_Session_SaveHandler_Exception(
"Configuration must define '" . self::LIFETIME_COLUMN . "' which names the "
@@ -499,7 +499,7 @@ class Zend_Session_SaveHandler_DbTable
/**
* @see Zend_Session_SaveHandler_Exception
*/
- require_once 'Zend/Session/SaveHandler/Exception.php';
+ // require_once 'Zend/Session/SaveHandler/Exception.php';
throw new Zend_Session_SaveHandler_Exception(
"Configuration must define '" . self::DATA_COLUMN . "' which names the "
@@ -516,7 +516,7 @@ class Zend_Session_SaveHandler_DbTable
*/
protected function _getPrimary($id, $type = null)
{
- $this->_setupPrimaryKey();
+ $this->_setupPrimaryKey();
if ($type === null) {
$type = self::PRIMARY_TYPE_NUM;
diff --git a/libs/Zend/Session/SaveHandler/Exception.php b/libs/Zend/Session/SaveHandler/Exception.php
index bb2124702d..249dcfa930 100644
--- a/libs/Zend/Session/SaveHandler/Exception.php
+++ b/libs/Zend/Session/SaveHandler/Exception.php
@@ -15,22 +15,22 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16210 2009-06-21 19:22:17Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Session_Exception
*/
-require_once 'Zend/Session/Exception.php';
+// require_once 'Zend/Session/Exception.php';
/**
* Zend_Session_SaveHandler_Exception
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Session_SaveHandler_Exception extends Zend_Session_Exception
diff --git a/libs/Zend/Session/SaveHandler/Interface.php b/libs/Zend/Session/SaveHandler/Interface.php
index 2e4945a5d7..6e426974a7 100644
--- a/libs/Zend/Session/SaveHandler/Interface.php
+++ b/libs/Zend/Session/SaveHandler/Interface.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16210 2009-06-21 19:22:17Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
* @since Preview Release 0.2
*/
@@ -26,7 +26,7 @@
* @category Zend
* @package Zend_Session
* @subpackage SaveHandler
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see http://php.net/session_set_save_handler
*/
diff --git a/libs/Zend/Session/Validator/Abstract.php b/libs/Zend/Session/Validator/Abstract.php
index e1a53f971a..6c4caaeb94 100644
--- a/libs/Zend/Session/Validator/Abstract.php
+++ b/libs/Zend/Session/Validator/Abstract.php
@@ -14,16 +14,16 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 16210 2009-06-21 19:22:17Z thomas $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
* @since Preview Release 0.2
*/
/**
* @see Zend_Session_Validator_Interface
*/
-require_once 'Zend/Session/Validator/Interface.php';
+// require_once 'Zend/Session/Validator/Interface.php';
/**
* Zend_Session_Validator_Abstract
@@ -31,7 +31,7 @@ require_once 'Zend/Session/Validator/Interface.php';
* @category Zend
* @package Zend_Session
* @subpackage Validator
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Session_Validator_Abstract implements Zend_Session_Validator_Interface
diff --git a/libs/Zend/Session/Validator/HttpUserAgent.php b/libs/Zend/Session/Validator/HttpUserAgent.php
index 3dccf9e32f..fef7d33329 100644
--- a/libs/Zend/Session/Validator/HttpUserAgent.php
+++ b/libs/Zend/Session/Validator/HttpUserAgent.php
@@ -14,16 +14,16 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: HttpUserAgent.php 16210 2009-06-21 19:22:17Z thomas $
+ * @version $Id: HttpUserAgent.php 20096 2010-01-06 02:05:09Z bkarwin $
* @since Preview Release 0.2
*/
/**
* @see Zend_Session_Validator_Abstract
*/
-require_once 'Zend/Session/Validator/Abstract.php';
+// require_once 'Zend/Session/Validator/Abstract.php';
/**
* Zend_Session_Validator_HttpUserAgent
@@ -31,7 +31,7 @@ require_once 'Zend/Session/Validator/Abstract.php';
* @category Zend
* @package Zend_Session
* @subpackage Validator
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Session_Validator_HttpUserAgent extends Zend_Session_Validator_Abstract
diff --git a/libs/Zend/Session/Validator/Interface.php b/libs/Zend/Session/Validator/Interface.php
index b0d9825e90..eab9d186cd 100644
--- a/libs/Zend/Session/Validator/Interface.php
+++ b/libs/Zend/Session/Validator/Interface.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Session
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16210 2009-06-21 19:22:17Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
* @since Preview Release 0.2
*/
@@ -26,7 +26,7 @@
* @category Zend
* @package Zend_Session
* @subpackage Validator
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Session_Validator_Interface
diff --git a/libs/Zend/Uri.php b/libs/Zend/Uri.php
index abbe5a248c..ad4c43ee99 100644
--- a/libs/Zend/Uri.php
+++ b/libs/Zend/Uri.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Uri
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Uri.php 16207 2009-06-21 19:17:51Z thomas $
+ * @version $Id: Uri.php 22083 2010-05-03 18:49:28Z shahar $
*/
/**
@@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_Uri
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Uri
@@ -44,7 +44,7 @@ abstract class Zend_Uri
static protected $_config = array(
'allow_unwise' => false
);
-
+
/**
* Return a string representation of this URI.
*
@@ -79,14 +79,16 @@ abstract class Zend_Uri
* Create a new Zend_Uri object for a URI. If building a new URI, then $uri should contain
* only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.
*
- * @param string $uri The URI form which a Zend_Uri instance is created
+ * @param string $uri The URI form which a Zend_Uri instance is created
+ * @param string $className The name of the class to use in order to manipulate URI
* @throws Zend_Uri_Exception When an empty string was supplied for the scheme
* @throws Zend_Uri_Exception When an illegal scheme is supplied
* @throws Zend_Uri_Exception When the scheme is not supported
+ * @throws Zend_Uri_Exception When $className doesn't exist or doesn't implements Zend_Uri
* @return Zend_Uri
* @link http://www.faqs.org/rfcs/rfc2396.html
*/
- public static function factory($uri = 'http')
+ public static function factory($uri = 'http', $className = null)
{
// Separate the scheme from the scheme-specific parts
$uri = explode(':', $uri, 2);
@@ -94,41 +96,54 @@ abstract class Zend_Uri
$schemeSpecific = isset($uri[1]) === true ? $uri[1] : '';
if (strlen($scheme) === 0) {
- require_once 'Zend/Uri/Exception.php';
+ // 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';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Illegal scheme supplied, only alphanumeric characters are permitted');
}
- /**
- * Create a new Zend_Uri object for the $uri. If a subclass of Zend_Uri exists for the
- * scheme, return an instance of that class. Otherwise, a Zend_Uri_Exception is thrown.
- */
- switch ($scheme) {
- case 'http':
- // Break intentionally omitted
- case 'https':
- $className = 'Zend_Uri_Http';
- break;
-
- case 'mailto':
- // TODO
- default:
- require_once 'Zend/Uri/Exception.php';
- throw new Zend_Uri_Exception("Scheme \"$scheme\" is not supported");
- break;
- }
+ if ($className === null) {
+ /**
+ * Create a new Zend_Uri object for the $uri. If a subclass of Zend_Uri exists for the
+ * scheme, return an instance of that class. Otherwise, a Zend_Uri_Exception is thrown.
+ */
+ switch ($scheme) {
+ case 'http':
+ // Break intentionally omitted
+ case 'https':
+ $className = 'Zend_Uri_Http';
+ break;
- if (!class_exists($className)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($className);
+ case 'mailto':
+ // TODO
+ default:
+ // require_once 'Zend/Uri/Exception.php';
+ throw new Zend_Uri_Exception("Scheme \"$scheme\" is not supported");
+ break;
+ }
}
+
+ // if (!class_exists($className)) {
+ // 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");
+ }
+
return $schemeHandler;
}
@@ -149,15 +164,21 @@ abstract class Zend_Uri
/**
* Set global configuration options
*
- * @param array $config
+ * @param Zend_Config|array $config
*/
- static public function setConfig(array $config)
+ static public function setConfig($config)
{
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ } elseif (!is_array($config)) {
+ throw new Zend_Uri_Exception("Config must be an array or an instance of Zend_Config.");
+ }
+
foreach ($config as $k => $v) {
self::$_config[$k] = $v;
}
}
-
+
/**
* Zend_Uri and its subclasses cannot be instantiated directly.
* Use Zend_Uri::factory() to return a new Zend_Uri object.
diff --git a/libs/Zend/Uri/Exception.php b/libs/Zend/Uri/Exception.php
index 5f68ac9f67..ba2f1a8342 100644
--- a/libs/Zend/Uri/Exception.php
+++ b/libs/Zend/Uri/Exception.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Uri
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16208 2009-06-21 19:19:26Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+// require_once 'Zend/Exception.php';
/**
* Exceptions for Zend_Uri
*
* @category Zend
* @package Zend_Uri
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Uri_Exception extends Zend_Exception
diff --git a/libs/Zend/Uri/Http.php b/libs/Zend/Uri/Http.php
index c8ef6ac360..48911dad64 100644
--- a/libs/Zend/Uri/Http.php
+++ b/libs/Zend/Uri/Http.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Uri
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Http.php 16208 2009-06-21 19:19:26Z thomas $
+ * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Uri
*/
-require_once 'Zend/Uri.php';
+// require_once 'Zend/Uri.php';
/**
* @see Zend_Validate_Hostname
*/
-require_once 'Zend/Validate/Hostname.php';
+// require_once 'Zend/Validate/Hostname.php';
/**
* HTTP(S) URI handler
@@ -35,7 +35,7 @@ require_once 'Zend/Validate/Hostname.php';
* @category Zend
* @package Zend_Uri
* @uses Zend_Uri
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Uri_Http extends Zend_Uri
@@ -152,7 +152,7 @@ class Zend_Uri_Http extends Zend_Uri
// Validate the URI
if ($this->valid() === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Invalid URI supplied');
}
}
@@ -170,7 +170,7 @@ class Zend_Uri_Http extends Zend_Uri
public static function fromString($uri)
{
if (is_string($uri) === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('$uri is not a string');
}
@@ -179,7 +179,7 @@ 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';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception("Invalid scheme: '$scheme'");
}
@@ -201,7 +201,7 @@ class Zend_Uri_Http extends Zend_Uri
$pattern = '~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~';
$status = @preg_match($pattern, $schemeSpecific, $matches);
if ($status === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Internal error: scheme-specific decomposition failed');
}
@@ -220,7 +220,7 @@ class Zend_Uri_Http extends Zend_Uri
$pattern = '~^(([^:@]*)(:([^@]*))?@)?([^:]+)(:(.*))?$~';
$status = @preg_match($pattern, $combo, $matches);
if ($status === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Internal error: authority decomposition failed');
}
@@ -247,7 +247,7 @@ class Zend_Uri_Http extends Zend_Uri
public function getUri()
{
if ($this->valid() === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('One or more parts of the URI are invalid');
}
@@ -320,7 +320,7 @@ class Zend_Uri_Http extends Zend_Uri
self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $username);
if ($status === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Internal error: username validation failed');
}
@@ -337,7 +337,7 @@ class Zend_Uri_Http extends Zend_Uri
public function setUsername($username)
{
if ($this->validateUsername($username) === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception("Username \"$username\" is not a valid HTTP username");
}
@@ -387,7 +387,7 @@ class Zend_Uri_Http extends Zend_Uri
self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $password);
if ($status === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Internal error: password validation failed.');
}
@@ -404,7 +404,7 @@ class Zend_Uri_Http extends Zend_Uri
public function setPassword($password)
{
if ($this->validatePassword($password) === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception("Password \"$password\" is not a valid HTTP password.");
}
@@ -459,7 +459,7 @@ class Zend_Uri_Http extends Zend_Uri
public function setHost($host)
{
if ($this->validateHost($host) === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception("Host \"$host\" is not a valid HTTP host");
}
@@ -511,7 +511,7 @@ class Zend_Uri_Http extends Zend_Uri
public function setPort($port)
{
if ($this->validatePort($port) === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception("Port \"$port\" is not a valid HTTP port.");
}
@@ -554,7 +554,7 @@ 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';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Internal error: path validation failed');
}
@@ -571,7 +571,7 @@ class Zend_Uri_Http extends Zend_Uri
public function setPath($path)
{
if ($this->validatePath($path) === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception("Path \"$path\" is not a valid HTTP path");
}
@@ -592,6 +592,23 @@ class Zend_Uri_Http extends Zend_Uri
}
/**
+ * Returns the query portion of the URL (after ?) as a
+ * key-value-array. If the query is empty an empty array
+ * is returned
+ *
+ * @return array
+ */
+ public function getQueryAsArray()
+ {
+ $query = $this->getQuery();
+ $querryArray = array();
+ if ($query !== false) {
+ parse_str($query, $querryArray);
+ }
+ return $querryArray;
+ }
+
+ /**
* Returns true if and only if the query string passes validation. If no query is passed,
* then the query string contained in the instance variable is used.
*
@@ -615,7 +632,7 @@ 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';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Internal error: query validation failed');
}
@@ -623,6 +640,32 @@ class Zend_Uri_Http extends Zend_Uri
}
/**
+ * Add or replace params in the query string for the current URI, and
+ * return the old query.
+ *
+ * @param array $queryParams
+ * @return string Old query string
+ */
+ public function addReplaceQueryParameters(array $queryParams)
+ {
+ $queryParams = array_merge($this->getQueryAsArray(), $queryParams);
+ return $this->setQuery($queryParams);
+ }
+
+ /**
+ * Remove params in the query string for the current URI, and
+ * return the old query.
+ *
+ * @param array $queryParamKeys
+ * @return string Old query string
+ */
+ public function removeQueryParameters(array $queryParamKeys)
+ {
+ $queryParams = array_diff_key($this->getQueryAsArray(), array_fill_keys($queryParamKeys, 0));
+ return $this->setQuery($queryParams);
+ }
+
+ /**
* Set the query string for the current URI, and return the old query
* string This method accepts both strings and arrays.
*
@@ -654,7 +697,7 @@ 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';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception("'$query' is not a valid query string");
}
@@ -697,7 +740,7 @@ 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';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception('Internal error: fragment validation failed');
}
@@ -714,7 +757,7 @@ class Zend_Uri_Http extends Zend_Uri
public function setFragment($fragment)
{
if ($this->validateFragment($fragment) === false) {
- require_once 'Zend/Uri/Exception.php';
+ // require_once 'Zend/Uri/Exception.php';
throw new Zend_Uri_Exception("Fragment \"$fragment\" is not a valid HTTP fragment");
}
diff --git a/libs/Zend/Validate.php b/libs/Zend/Validate.php
index cb87ba5120..f14eb671e7 100644
--- a/libs/Zend/Validate.php
+++ b/libs/Zend/Validate.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Validate.php 16286 2009-06-25 15:11:37Z thomas $
+ * @version $Id: Validate.php 21340 2010-03-05 15:33:49Z thomas $
*/
/**
* @see Zend_Validate_Interface
*/
-require_once 'Zend/Validate/Interface.php';
+// require_once 'Zend/Validate/Interface.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate implements Zend_Validate_Interface
@@ -195,30 +195,52 @@ class Zend_Validate implements Zend_Validate_Interface
public static function is($value, $classBaseName, array $args = array(), $namespaces = array())
{
$namespaces = array_merge((array) $namespaces, self::$_defaultNamespaces, array('Zend_Validate'));
- foreach ($namespaces as $namespace) {
- $className = $namespace . '_' . ucfirst($classBaseName);
- try {
- if (!class_exists($className)) {
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($className);
+ $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';
+ if (Zend_Loader::isReadable($file)) {
+ Zend_Loader::loadClass($class);
+ $className = $class;
+ break;
+ }
}
- $class = new ReflectionClass($className);
- if ($class->implementsInterface('Zend_Validate_Interface')) {
- if ($class->hasMethod('__construct')) {
+ }
+
+ $class = new ReflectionClass($className);
+ if ($class->implementsInterface('Zend_Validate_Interface')) {
+ if ($class->hasMethod('__construct')) {
+ $keys = array_keys($args);
+ $numeric = false;
+ foreach($keys as $key) {
+ if (is_numeric($key)) {
+ $numeric = true;
+ break;
+ }
+ }
+
+ if ($numeric) {
$object = $class->newInstanceArgs($args);
} else {
- $object = $class->newInstance();
+ $object = $class->newInstance($args);
}
- return $object->isValid($value);
+ } else {
+ $object = $class->newInstance();
}
- } catch (Zend_Validate_Exception $ze) {
- // if there is an exception while validating throw it
- throw $ze;
- } catch (Zend_Exception $ze) {
- // fallthrough and continue for missing validation classes
+
+ return $object->isValid($value);
}
+ } catch (Zend_Validate_Exception $ze) {
+ // if there is an exception while validating throw it
+ throw $ze;
+ } catch (Exception $e) {
+ // fallthrough and continue for missing validation classes
}
- require_once 'Zend/Validate/Exception.php';
+
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception("Validate class not found from basename '$classBaseName'");
}
@@ -229,7 +251,7 @@ class Zend_Validate implements Zend_Validate_Interface
*/
public static function getMessageLength()
{
- require_once 'Zend/Validate/Abstract.php';
+ // require_once 'Zend/Validate/Abstract.php';
return Zend_Validate_Abstract::getMessageLength();
}
@@ -240,7 +262,29 @@ class Zend_Validate implements Zend_Validate_Interface
*/
public static function setMessageLength($length = -1)
{
- require_once 'Zend/Validate/Abstract.php';
+ // require_once 'Zend/Validate/Abstract.php';
Zend_Validate_Abstract::setMessageLength($length);
}
+
+ /**
+ * Returns the default translation object
+ *
+ * @return Zend_Translate_Adapter|null
+ */
+ public static function getDefaultTranslator($translator = null)
+ {
+ // require_once 'Zend/Validate/Abstract.php';
+ return Zend_Validate_Abstract::getDefaultTranslator();
+ }
+
+ /**
+ * Sets a default translation object for all validation objects
+ *
+ * @param Zend_Translate|Zend_Translate_Adapter|null $translator
+ */
+ public static function setDefaultTranslator($translator = null)
+ {
+ // require_once 'Zend/Validate/Abstract.php';
+ Zend_Validate_Abstract::setDefaultTranslator($translator);
+ }
}
diff --git a/libs/Zend/Validate/Abstract.php b/libs/Zend/Validate/Abstract.php
index 3107360619..cbecc5eebf 100644
--- a/libs/Zend/Validate/Abstract.php
+++ b/libs/Zend/Validate/Abstract.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 18688 2009-10-25 16:08:24Z thomas $
+ * @version $Id: Abstract.php 21726 2010-03-31 19:57:27Z rob $
*/
/**
* @see Zend_Validate_Interface
*/
-require_once 'Zend/Validate/Interface.php';
+// require_once 'Zend/Validate/Interface.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
@@ -149,7 +149,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
}
if (!isset($this->_messageTemplates[$messageKey])) {
- require_once 'Zend/Validate/Exception.php';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception("No message template exists for key '$messageKey'");
}
@@ -191,7 +191,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
/**
* @see Zend_Validate_Exception
*/
- require_once 'Zend/Validate/Exception.php';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception("No property exists by the name '$property'");
}
@@ -251,11 +251,11 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
}
/**
- * @param string $messageKey OPTIONAL
+ * @param string $messageKey
* @param string $value OPTIONAL
* @return void
*/
- protected function _error($messageKey = null, $value = null)
+ protected function _error($messageKey, $value = null)
{
if ($messageKey === null) {
$keys = array_keys($this->_messageTemplates);
@@ -328,7 +328,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid translator specified');
}
return $this;
@@ -353,6 +353,16 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
}
/**
+ * Does this validator have its own specific translator?
+ *
+ * @return bool
+ */
+ public function hasTranslator()
+ {
+ return (bool)$this->_translator;
+ }
+
+ /**
* Set default translation object for all validate objects
*
* @param Zend_Translate|Zend_Translate_Adapter|null $translator
@@ -365,7 +375,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid translator specified');
}
}
@@ -378,7 +388,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
public static function getDefaultTranslator()
{
if (null === self::$_defaultTranslator) {
- require_once 'Zend/Registry.php';
+ // require_once 'Zend/Registry.php';
if (Zend_Registry::isRegistered('Zend_Translate')) {
$translator = Zend_Registry::get('Zend_Translate');
if ($translator instanceof Zend_Translate_Adapter) {
@@ -393,6 +403,16 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
}
/**
+ * Is there a default translation object set?
+ *
+ * @return boolean
+ */
+ public static function hasDefaultTranslator()
+ {
+ return (bool)self::$_defaultTranslator;
+ }
+
+ /**
* Indicate whether or not translation should be disabled
*
* @param bool $flag
diff --git a/libs/Zend/Validate/Alnum.php b/libs/Zend/Validate/Alnum.php
index c2f2f46642..9db12a3062 100644
--- a/libs/Zend/Validate/Alnum.php
+++ b/libs/Zend/Validate/Alnum.php
@@ -14,33 +14,33 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Alnum.php 17467 2009-08-08 18:06:55Z thomas $
+ * @version $Id: Alnum.php 20442 2010-01-20 15:15:40Z matthew $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Alnum extends Zend_Validate_Abstract
{
const INVALID = 'alnumInvalid';
const NOT_ALNUM = 'notAlnum';
- const STRING_EMPTY = 'stringEmpty';
+ const STRING_EMPTY = 'alnumStringEmpty';
/**
* Whether to allow white space characters; off by default
*
* @var boolean
- * @depreciated
+ * @deprecated
*/
public $allowWhiteSpace;
@@ -58,18 +58,30 @@ class Zend_Validate_Alnum extends Zend_Validate_Abstract
*/
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be float, string, or integer",
- self::NOT_ALNUM => "'%value%' has not only alphabetic and digit characters",
- self::STRING_EMPTY => "'%value%' is an empty string"
+ self::NOT_ALNUM => "'%value%' contains characters which are non alphabetic and no digits",
+ self::STRING_EMPTY => "'%value%' is an empty string",
);
/**
* Sets default option values for this instance
*
- * @param boolean $allowWhiteSpace
+ * @param boolean|Zend_Config $allowWhiteSpace
* @return void
*/
public function __construct($allowWhiteSpace = false)
{
+ if ($allowWhiteSpace instanceof Zend_Config) {
+ $allowWhiteSpace = $allowWhiteSpace->toArray();
+ }
+
+ if (is_array($allowWhiteSpace)) {
+ if (array_key_exists('allowWhiteSpace', $allowWhiteSpace)) {
+ $allowWhiteSpace = $allowWhiteSpace['allowWhiteSpace'];
+ } else {
+ $allowWhiteSpace = false;
+ }
+ }
+
$this->allowWhiteSpace = (boolean) $allowWhiteSpace;
}
@@ -121,7 +133,7 @@ class Zend_Validate_Alnum extends Zend_Validate_Abstract
/**
* @see Zend_Filter_Alnum
*/
- require_once 'Zend/Filter/Alnum.php';
+ // require_once 'Zend/Filter/Alnum.php';
self::$_filter = new Zend_Filter_Alnum();
}
diff --git a/libs/Zend/Validate/Alpha.php b/libs/Zend/Validate/Alpha.php
index ce1f01872f..42864fa561 100644
--- a/libs/Zend/Validate/Alpha.php
+++ b/libs/Zend/Validate/Alpha.php
@@ -14,33 +14,33 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Alpha.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: Alpha.php 20442 2010-01-20 15:15:40Z matthew $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Alpha extends Zend_Validate_Abstract
{
const INVALID = 'alphaInvalid';
const NOT_ALPHA = 'notAlpha';
- const STRING_EMPTY = 'stringEmpty';
+ const STRING_EMPTY = 'alphaStringEmpty';
/**
* Whether to allow white space characters; off by default
*
* @var boolean
- * @depreciated
+ * @deprecated
*/
public $allowWhiteSpace;
@@ -58,18 +58,30 @@ class Zend_Validate_Alpha extends Zend_Validate_Abstract
*/
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be a string",
- self::NOT_ALPHA => "'%value%' has not only alphabetic characters",
+ self::NOT_ALPHA => "'%value%' contains non alphabetic characters",
self::STRING_EMPTY => "'%value%' is an empty string"
);
/**
* Sets default option values for this instance
*
- * @param boolean $allowWhiteSpace
+ * @param boolean|Zend_Config $allowWhiteSpace
* @return void
*/
public function __construct($allowWhiteSpace = false)
{
+ if ($allowWhiteSpace instanceof Zend_Config) {
+ $allowWhiteSpace = $allowWhiteSpace->toArray();
+ }
+
+ if (is_array($allowWhiteSpace)) {
+ if (array_key_exists('allowWhiteSpace', $allowWhiteSpace)) {
+ $allowWhiteSpace = $allowWhiteSpace['allowWhiteSpace'];
+ } else {
+ $allowWhiteSpace = false;
+ }
+ }
+
$this->allowWhiteSpace = (boolean) $allowWhiteSpace;
}
@@ -121,7 +133,7 @@ class Zend_Validate_Alpha extends Zend_Validate_Abstract
/**
* @see Zend_Filter_Alpha
*/
- require_once 'Zend/Filter/Alpha.php';
+ // require_once 'Zend/Filter/Alpha.php';
self::$_filter = new Zend_Filter_Alpha();
}
diff --git a/libs/Zend/Validate/Barcode.php b/libs/Zend/Validate/Barcode.php
index 374a9e5449..111010880e 100644
--- a/libs/Zend/Validate/Barcode.php
+++ b/libs/Zend/Validate/Barcode.php
@@ -14,70 +14,164 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Barcode.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: Barcode.php 21748 2010-04-03 10:29:56Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
+
+/**
+ * @see Zend_Loader
+ */
+// require_once 'Zend/Loader.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Barcode extends Zend_Validate_Abstract
{
+ const INVALID = 'barcodeInvalid';
+ const FAILED = 'barcodeFailed';
+ const INVALID_CHARS = 'barcodeInvalidChars';
+ const INVALID_LENGTH = 'barcodeInvalidLength';
+
+ protected $_messageTemplates = array(
+ self::FAILED => "'%value%' failed checksum validation",
+ self::INVALID_CHARS => "'%value%' contains invalid characters",
+ self::INVALID_LENGTH => "'%value%' should have a length of %length% characters",
+ self::INVALID => "Invalid type given, value should be string",
+ );
+
+ /**
+ * Additional variables available for validation failure messages
+ *
+ * @var array
+ */
+ protected $_messageVariables = array(
+ 'length' => '_length'
+ );
+
+ /**
+ * Length for the set subtype
+ *
+ * @var integer
+ */
+ protected $_length;
+
/**
- * Barcode validator
+ * Barcode adapter
*
- * @var Zend_Validate_Abstract
+ * @var Zend_Validate_Barcode_BarcodeAdapter
*/
- protected $_barcodeValidator;
+ protected $_adapter;
/**
* Generates the standard validator object
*
- * @param string $barcodeType - Barcode validator to use
+ * @param string|Zend_Config|
+ * Zend_Validate_Barcode_BarcodeAdapter $adapter Barcode adapter to use
* @return void
* @throws Zend_Validate_Exception
*/
- public function __construct($barcodeType)
+ public function __construct($adapter)
+ {
+ if ($adapter instanceof Zend_Config) {
+ $adapter = $adapter->toArray();
+ }
+
+ $options = null;
+ $checksum = null;
+ if (is_array($adapter)) {
+ if (array_key_exists('options', $adapter)) {
+ $options = $adapter['options'];
+ }
+
+ if (array_key_exists('checksum', $adapter)) {
+ $checksum = $adapter['checksum'];
+ }
+
+ if (array_key_exists('adapter', $adapter)) {
+ $adapter = $adapter['adapter'];
+ } else {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception("Missing option 'adapter'");
+ }
+ }
+
+ $this->setAdapter($adapter, $options);
+ if ($checksum !== null) {
+ $this->setChecksum($checksum);
+ }
+ }
+
+ /**
+ * Returns the set adapter
+ *
+ * @return Zend_Validate_Barcode_BarcodeAdapter
+ */
+ public function getAdapter()
{
- $this->setType($barcodeType);
+ return $this->_adapter;
}
/**
- * Sets a new barcode validator
+ * Sets a new barcode adapter
*
- * @param string $barcodeType - Barcode validator to use
+ * @param string|Zend_Validate_Barcode $adapter Barcode adapter to use
+ * @param array $options Options for this adapter
* @return void
* @throws Zend_Validate_Exception
*/
- public function setType($barcodeType)
+ public function setAdapter($adapter, $options = null)
{
- switch (strtolower($barcodeType)) {
- case 'upc':
- case 'upc-a':
- require_once 'Zend/Validate/Barcode/UpcA.php';
- $class = 'Zend_Validate_Barcode_UpcA';
- break;
- case 'ean13':
- case 'ean-13':
- require_once 'Zend/Validate/Barcode/Ean13.php';
- $class = 'Zend_Validate_Barcode_Ean13';
- break;
- default:
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception("Barcode type '$barcodeType' is not supported'");
- break;
+ $adapter = ucfirst(strtolower($adapter));
+ // require_once 'Zend/Loader.php';
+ if (Zend_Loader::isReadable('Zend/Validate/Barcode/' . $adapter. '.php')) {
+ $adapter = 'Zend_Validate_Barcode_' . $adapter;
+ }
+
+ // if (!class_exists($adapter)) {
+ // Zend_Loader::loadClass($adapter);
+ // }
+
+ $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"
+ );
}
- $this->_barcodeValidator = new $class;
+ return $this;
+ }
+
+ /**
+ * Returns the checksum option
+ *
+ * @return boolean
+ */
+ public function getChecksum()
+ {
+ return $this->getAdapter()->getCheck();
+ }
+
+ /**
+ * Sets the checksum option
+ *
+ * @param boolean $checksum
+ * @return Zend_Validate_Barcode
+ */
+ public function setChecksum($checksum)
+ {
+ $this->getAdapter()->setCheck($checksum);
+ return $this;
}
/**
@@ -90,6 +184,34 @@ class Zend_Validate_Barcode extends Zend_Validate_Abstract
*/
public function isValid($value)
{
- return call_user_func(array($this->_barcodeValidator, 'isValid'), $value);
+ if (!is_string($value)) {
+ $this->_error(self::INVALID);
+ return false;
+ }
+
+ $this->_setValue($value);
+ $adapter = $this->getAdapter();
+ $this->_length = $adapter->getLength();
+ $result = $adapter->checkLength($value);
+ if (!$result) {
+ $this->_error(self::INVALID_LENGTH);
+ return false;
+ }
+
+ $result = $adapter->checkChars($value);
+ if (!$result) {
+ $this->_error(self::INVALID_CHARS);
+ return false;
+ }
+
+ if ($this->getChecksum()) {
+ $result = $adapter->checksum($value);
+ if (!$result) {
+ $this->_error(self::FAILED);
+ return false;
+ }
+ }
+
+ return true;
}
}
diff --git a/libs/Zend/Validate/Barcode/AdapterAbstract.php b/libs/Zend/Validate/Barcode/AdapterAbstract.php
new file mode 100644
index 0000000000..7cbb4644f8
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/AdapterAbstract.php
@@ -0,0 +1,315 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterInterface
+ */
+// require_once 'Zend/Validate/Barcode/AdapterInterface.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+abstract class Zend_Validate_Barcode_AdapterAbstract
+ implements Zend_Validate_Barcode_AdapterInterface
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer|array|string
+ */
+ protected $_length;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters;
+
+ /**
+ * Callback to checksum function
+ * @var string|array
+ */
+ protected $_checksum;
+
+ /**
+ * Is a checksum value included?
+ * @var boolean
+ */
+ protected $_hasChecksum = true;
+
+ /**
+ * Checks the length of a barcode
+ *
+ * @param string $value The barcode to check for proper length
+ * @return boolean
+ */
+ public function checkLength($value)
+ {
+ if (!is_string($value)) {
+ return false;
+ }
+
+ $fixum = strlen($value);
+ $found = false;
+ $length = $this->getLength();
+ if (is_array($length)) {
+ foreach ($length as $value) {
+ if ($fixum == $value) {
+ $found = true;
+ }
+
+ if ($value == -1) {
+ $found = true;
+ }
+ }
+ } elseif ($fixum == $length) {
+ $found = true;
+ } elseif ($length == -1) {
+ $found = true;
+ } elseif ($length == 'even') {
+ $count = $fixum % 2;
+ $found = ($count == 0) ? true : false;
+ } elseif ($length == 'odd') {
+ $count = $fixum % 2;
+ $found = ($count == 1) ? true : false;
+ }
+
+ return $found;
+ }
+
+ /**
+ * Checks for allowed characters within the barcode
+ *
+ * @param string $value The barcode to check for allowed characters
+ * @return boolean
+ */
+ public function checkChars($value)
+ {
+ if (!is_string($value)) {
+ return false;
+ }
+
+ $characters = $this->getCharacters();
+ if ($characters == 128) {
+ for ($x = 0; $x < 128; ++$x) {
+ $value = str_replace(chr($x), '', $value);
+ }
+ } else {
+ $chars = str_split($characters);
+ foreach ($chars as $char) {
+ $value = str_replace($char, '', $value);
+ }
+ }
+
+ if (strlen($value) > 0) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Validates the checksum
+ *
+ * @param string $value The barcode to check the checksum for
+ * @return boolean
+ */
+ public function checksum($value)
+ {
+ $checksum = $this->getChecksum();
+ if (!empty($checksum)) {
+ if (method_exists($this, $checksum)) {
+ return call_user_func(array($this, $checksum), $value);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the allowed barcode length
+ *
+ * @return string
+ */
+ public function getLength()
+ {
+ return $this->_length;
+ }
+
+ /**
+ * Returns the allowed characters
+ *
+ * @return integer|string
+ */
+ public function getCharacters()
+ {
+ return $this->_characters;
+ }
+
+ /**
+ * Returns the checksum function name
+ *
+ */
+ public function getChecksum()
+ {
+ return $this->_checksum;
+ }
+
+ /**
+ * Returns if barcode uses checksum
+ *
+ * @return boolean
+ */
+ public function getCheck()
+ {
+ return $this->_hasChecksum;
+ }
+
+ /**
+ * Sets the checksum validation
+ *
+ * @param boolean $check
+ * @return Zend_Validate_Barcode_AdapterAbstract
+ */
+ public function setCheck($check)
+ {
+ $this->_hasChecksum = (boolean) $check;
+ return $this;
+ }
+
+ /**
+ * Validates the checksum (Modulo 10)
+ * GTIN implementation factor 3
+ *
+ * @param string $value The barcode to validate
+ * @return boolean
+ */
+ protected function _gtin($value)
+ {
+ $barcode = substr($value, 0, -1);
+ $sum = 0;
+ $length = strlen($barcode) - 1;
+
+ for ($i = 0; $i <= $length; $i++) {
+ if (($i % 2) === 0) {
+ $sum += $barcode[$length - $i] * 3;
+ } else {
+ $sum += $barcode[$length - $i];
+ }
+ }
+
+ $calc = $sum % 10;
+ $checksum = ($calc === 0) ? 0 : (10 - $calc);
+ if ($value[$length + 1] != $checksum) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Validates the checksum (Modulo 10)
+ * IDENTCODE implementation factors 9 and 4
+ *
+ * @param string $value The barcode to validate
+ * @return boolean
+ */
+ protected function _identcode($value)
+ {
+ $barcode = substr($value, 0, -1);
+ $sum = 0;
+ $length = strlen($value) - 2;
+
+ for ($i = 0; $i <= $length; $i++) {
+ if (($i % 2) === 0) {
+ $sum += $barcode[$length - $i] * 4;
+ } else {
+ $sum += $barcode[$length - $i] * 9;
+ }
+ }
+
+ $calc = $sum % 10;
+ $checksum = ($calc === 0) ? 0 : (10 - $calc);
+ if ($value[$length + 1] != $checksum) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Validates the checksum (Modulo 10)
+ * CODE25 implementation factor 3
+ *
+ * @param string $value The barcode to validate
+ * @return boolean
+ */
+ protected function _code25($value)
+ {
+ $barcode = substr($value, 0, -1);
+ $sum = 0;
+ $length = strlen($barcode) - 1;
+
+ for ($i = 0; $i <= $length; $i++) {
+ if (($i % 2) === 0) {
+ $sum += $barcode[$i] * 3;
+ } else {
+ $sum += $barcode[$i];
+ }
+ }
+
+ $calc = $sum % 10;
+ $checksum = ($calc === 0) ? 0 : (10 - $calc);
+ if ($value[$length + 1] != $checksum) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Validates the checksum ()
+ * POSTNET implementation
+ *
+ * @param string $value The barcode to validate
+ * @return boolean
+ */
+ protected function _postnet($value)
+ {
+ $checksum = substr($value, -1, 1);
+ $values = str_split(substr($value, 0, -1));
+
+ $check = 0;
+ foreach($values as $row) {
+ $check += $row;
+ }
+
+ $check %= 10;
+ $check = 10 - $check;
+ if ($check == $checksum) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/AdapterInterface.php b/libs/Zend/Validate/Barcode/AdapterInterface.php
new file mode 100644
index 0000000000..325c6048f3
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/AdapterInterface.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+interface Zend_Validate_Barcode_AdapterInterface
+{
+ /**
+ * Checks the length of a barcode
+ *
+ * @param string $value The barcode to check for proper length
+ * @return boolean
+ */
+ public function checkLength($value);
+
+ /**
+ * Checks for allowed characters within the barcode
+ *
+ * @param string $value The barcode to check for allowed characters
+ * @return boolean
+ */
+ public function checkChars($value);
+
+ /**
+ * Validates the checksum
+ *
+ * @param string $value The barcode to check the checksum for
+ * @return boolean
+ */
+ public function checksum($value);
+
+ /**
+ * Returns if barcode uses a checksum
+ *
+ * @return boolean
+ */
+ public function getCheck();
+
+ /**
+ * Sets the checksum validation
+ *
+ * @param boolean $check
+ * @return Zend_Validate_Barcode_Adapter Provides fluid interface
+ */
+ public function setCheck($check);
+}
diff --git a/libs/Zend/Validate/Barcode/Code25.php b/libs/Zend/Validate/Barcode/Code25.php
new file mode 100644
index 0000000000..6d1525da4c
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Code25.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Code25 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = -1;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_code25';
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Code25interleaved.php b/libs/Zend/Validate/Barcode/Code25interleaved.php
new file mode 100644
index 0000000000..54fd90bd28
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Code25interleaved.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Code25interleaved extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 'even';
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_code25';
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Code39.php b/libs/Zend/Validate/Barcode/Code39.php
new file mode 100644
index 0000000000..8208cffb9e
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Code39.php
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Code39 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = -1;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -.$/+%';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_code39';
+
+ /**
+ * @var array
+ */
+ protected $_check = array(
+ '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6,
+ '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13,
+ 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20,
+ 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27,
+ 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34,
+ 'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41,
+ '%' => 42,
+ );
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+
+ /**
+ * Validates the checksum (Modulo 43)
+ *
+ * @param string $value The barcode to validate
+ * @return boolean
+ */
+ protected function _code39($value)
+ {
+ $checksum = substr($value, -1, 1);
+ $value = str_split(substr($value, 0, -1));
+ $count = 0;
+ foreach($value as $char) {
+ $count += $this->_check[$char];
+ }
+
+ $mod = $count % 43;
+ if ($mod == $this->_check[$checksum]) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Code39ext.php b/libs/Zend/Validate/Barcode/Code39ext.php
new file mode 100644
index 0000000000..5b90254c50
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Code39ext.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Code39ext extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = -1;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = 128;
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Code93.php b/libs/Zend/Validate/Barcode/Code93.php
new file mode 100644
index 0000000000..36a6567f36
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Code93.php
@@ -0,0 +1,120 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Code93 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = -1;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -.$/+%';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_code93';
+
+ /**
+ * Note that the characters !"§& are only synonyms
+ * @var array
+ */
+ protected $_check = array(
+ '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6,
+ '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13,
+ 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20,
+ 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27,
+ 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34,
+ 'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41,
+ '%' => 42, '!' => 43, '"' => 44, '§' => 45, '&' => 46,
+ );
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+
+ /**
+ * Validates the checksum (Modulo CK)
+ *
+ * @param string $value The barcode to validate
+ * @return boolean
+ */
+ protected function _code93($value)
+ {
+ $checksum = substr($value, -2, 2);
+ $value = str_split(substr($value, 0, -2));
+ $count = 0;
+ $length = count($value) % 20;
+ foreach($value as $char) {
+ if ($length == 0) {
+ $length = 20;
+ }
+
+ $count += $this->_check[$char] * $length;
+ --$length;
+ }
+
+ $check = array_search(($count % 47), $this->_check);
+ $value[] = $check;
+ $count = 0;
+ $length = count($value) % 15;
+ foreach($value as $char) {
+ if ($length == 0) {
+ $length = 15;
+ }
+
+ $count += $this->_check[$char] * $length;
+ --$length;
+ }
+ $check .= array_search(($count % 47), $this->_check);
+
+ if ($check == $checksum) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Code93ext.php b/libs/Zend/Validate/Barcode/Code93ext.php
new file mode 100644
index 0000000000..2aaf343162
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Code93ext.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Code93ext extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = -1;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = 128;
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Ean12.php b/libs/Zend/Validate/Barcode/Ean12.php
new file mode 100644
index 0000000000..26dee47fb5
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Ean12.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Ean12 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 12;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/Ean13.php b/libs/Zend/Validate/Barcode/Ean13.php
index 068809248c..d5387e52f9 100644
--- a/libs/Zend/Validate/Barcode/Ean13.php
+++ b/libs/Zend/Validate/Barcode/Ean13.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,96 +14,39 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ean13.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: Ean13.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-
/**
- * @see Zend_Validate_Abstract
+ * @see Zend_Validate_Barcode_AdapterAbstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Validate_Barcode_Ean13 extends Zend_Validate_Abstract
+class Zend_Validate_Barcode_Ean13 extends Zend_Validate_Barcode_AdapterAbstract
{
/**
- * Validation failure message key for when the value is
- * an invalid barcode
- */
- const INVALID = 'invalid';
-
- /**
- * Validation failure message key for when the value is
- * not 13 characters long
+ * Allowed barcode lengths
+ * @var integer
*/
- const INVALID_LENGTH = 'invalidLength';
+ protected $_length = 13;
/**
- * Validation failure message key for when the value
- * does not only contain numeric characters
+ * Allowed barcode characters
+ * @var string
*/
- const NOT_NUMERIC = 'ean13NotNumeric';
+ protected $_characters = '0123456789';
/**
- * Validation failure message template definitions
- *
- * @var array
+ * Checksum function
+ * @var string
*/
- protected $_messageTemplates = array(
- self::INVALID => "'%value%' is an invalid EAN-13 barcode",
- self::INVALID_LENGTH => "'%value%' should be 13 characters",
- self::NOT_NUMERIC => "'%value%' should contain only numeric characters",
- );
-
- /**
- * Defined by Zend_Validate_Interface
- *
- * Returns true if and only if $value contains a valid barcode
- *
- * @param string $value
- * @return boolean
- */
- public function isValid($value)
- {
- if (!is_string($value) || !ctype_digit($value)) {
- $this->_error(self::NOT_NUMERIC);
- return false;
- }
-
- $this->_setValue($value);
- if (strlen($value) !== 13) {
- $this->_error(self::INVALID_LENGTH);
- return false;
- }
-
- $barcode = strrev(substr($value, 0, -1));
- $oddSum = 0;
- $evenSum = 0;
-
- for ($i = 0; $i < 12; $i++) {
- if ($i % 2 === 0) {
- $oddSum += $barcode[$i] * 3;
- } elseif ($i % 2 === 1) {
- $evenSum += $barcode[$i];
- }
- }
-
- $calculation = ($oddSum + $evenSum) % 10;
- $checksum = ($calculation === 0) ? 0 : 10 - $calculation;
-
- if ($value[12] != $checksum) {
- $this->_error(self::INVALID);
- return false;
- }
-
- return true;
- }
+ protected $_checksum = '_gtin';
}
diff --git a/libs/Zend/Validate/Barcode/Ean14.php b/libs/Zend/Validate/Barcode/Ean14.php
new file mode 100644
index 0000000000..19756c8ee7
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Ean14.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Ean14 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 14;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/Ean18.php b/libs/Zend/Validate/Barcode/Ean18.php
new file mode 100644
index 0000000000..7c6519959f
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Ean18.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Ean18 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 18;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/Ean2.php b/libs/Zend/Validate/Barcode/Ean2.php
new file mode 100644
index 0000000000..009bfe5e57
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Ean2.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Ean2 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 2;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Ean5.php b/libs/Zend/Validate/Barcode/Ean5.php
new file mode 100644
index 0000000000..7574e897e4
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Ean5.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Ean5 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 5;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Ean8.php b/libs/Zend/Validate/Barcode/Ean8.php
new file mode 100644
index 0000000000..ca68fe45d9
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Ean8.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Ean8 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = array(7, 8);
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+
+ /**
+ * Overrides parent checkLength
+ *
+ * @param string $value Value
+ * @return boolean
+ */
+ public function checkLength($value)
+ {
+ if (strlen($value) == 7) {
+ $this->setCheck(false);
+ } else {
+ $this->setCheck(true);
+ }
+
+ return parent::checkLength($value);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Gtin12.php b/libs/Zend/Validate/Barcode/Gtin12.php
new file mode 100644
index 0000000000..7453e05f64
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Gtin12.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Gtin12 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 12;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/Gtin13.php b/libs/Zend/Validate/Barcode/Gtin13.php
new file mode 100644
index 0000000000..c466f5896a
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Gtin13.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Gtin13 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 13;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/Gtin14.php b/libs/Zend/Validate/Barcode/Gtin14.php
new file mode 100644
index 0000000000..7c5c1cdb5b
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Gtin14.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Gtin14 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 14;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/Identcode.php b/libs/Zend/Validate/Barcode/Identcode.php
new file mode 100644
index 0000000000..6899c17910
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Identcode.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Identcode extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 12;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_identcode';
+}
diff --git a/libs/Zend/Validate/Barcode/Intelligentmail.php b/libs/Zend/Validate/Barcode/Intelligentmail.php
new file mode 100644
index 0000000000..a0e81cfca6
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Intelligentmail.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_IntelligentMail extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = array(20, 25, 29, 31);
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Constructor
+ *
+ * Sets check flag to false.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->setCheck(false);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Issn.php b/libs/Zend/Validate/Barcode/Issn.php
new file mode 100644
index 0000000000..e9507c9a5f
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Issn.php
@@ -0,0 +1,119 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Issn extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = array(8, 13);
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789X';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+
+ /**
+ * Allows X on length of 8 chars
+ *
+ * @param string $value The barcode to check for allowed characters
+ * @return boolean
+ */
+ public function checkChars($value)
+ {
+ if (strlen($value) != 8) {
+ if (strpos($value, 'X') !== false) {
+ return false;
+ }
+ }
+
+ return parent::checkChars($value);
+ }
+
+ /**
+ * Validates the checksum
+ *
+ * @param string $value The barcode to check the checksum for
+ * @return boolean
+ */
+ public function checksum($value)
+ {
+ if (strlen($value) == 8) {
+ $this->_checksum = '_issn';
+ } else {
+ $this->_checksum = '_gtin';
+ }
+
+ return parent::checksum($value);
+ }
+
+ /**
+ * Validates the checksum ()
+ * ISSN implementation (reversed mod11)
+ *
+ * @param string $value The barcode to validate
+ * @return boolean
+ */
+ protected function _issn($value)
+ {
+ $checksum = substr($value, -1, 1);
+ $values = str_split(substr($value, 0, -1));
+ $check = 0;
+ $multi = 8;
+ foreach($values as $token) {
+ if ($token == 'X') {
+ $token = 10;
+ }
+
+ $check += ($token * $multi);
+ --$multi;
+ }
+
+ $check %= 11;
+ $check = 11 - $check;
+ if ($check == $checksum) {
+ return true;
+ } else if (($check == 10) && ($checksum == 'X')) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Itf14.php b/libs/Zend/Validate/Barcode/Itf14.php
new file mode 100644
index 0000000000..10cfeb761c
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Itf14.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Itf14 extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 14;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/Leitcode.php b/libs/Zend/Validate/Barcode/Leitcode.php
new file mode 100644
index 0000000000..52f1fc0428
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Leitcode.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Leitcode extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 14;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_identcode';
+}
diff --git a/libs/Zend/Validate/Barcode/Planet.php b/libs/Zend/Validate/Barcode/Planet.php
new file mode 100644
index 0000000000..b4eaf66cb9
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Planet.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Planet extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = array(12, 14);
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_postnet';
+}
diff --git a/libs/Zend/Validate/Barcode/Postnet.php b/libs/Zend/Validate/Barcode/Postnet.php
new file mode 100644
index 0000000000..9d2ff879b8
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Postnet.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Postnet extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = array(6, 7, 10, 12);
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_postnet';
+}
diff --git a/libs/Zend/Validate/Barcode/Royalmail.php b/libs/Zend/Validate/Barcode/Royalmail.php
new file mode 100644
index 0000000000..0bcdf1e16c
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Royalmail.php
@@ -0,0 +1,121 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id:$
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Royalmail extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = -1;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+
+ 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,
+ );
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_royalmail';
+
+ /**
+ * Validates the checksum ()
+ *
+ * @param string $value The barcode to validate
+ * @return boolean
+ */
+ protected function _royalmail($value)
+ {
+ $checksum = substr($value, -1, 1);
+ $values = str_split(substr($value, 0, -1));
+ $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);
+ $chkvalue = current(array_intersect($rowchkvalue, $colchkvalue));
+ if ($chkvalue == $checksum) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Allows start and stop tag within checked chars
+ *
+ * @param string $value The barcode to check for allowed characters
+ * @return boolean
+ */
+ public function checkChars($value)
+ {
+ if ($value[0] == '(') {
+ $value = substr($value, 1);
+
+ if ($value[strlen($value) - 1] == ')') {
+ $value = substr($value, 0, -1);
+ } else {
+ return false;
+ }
+ }
+
+ return parent::checkChars($value);
+ }
+}
diff --git a/libs/Zend/Validate/Barcode/Sscc.php b/libs/Zend/Validate/Barcode/Sscc.php
new file mode 100644
index 0000000000..b44b19a561
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Sscc.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Sscc extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 18;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/UpcA.php b/libs/Zend/Validate/Barcode/UpcA.php
deleted file mode 100644
index cf33f31fab..0000000000
--- a/libs/Zend/Validate/Barcode/UpcA.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: UpcA.php 16223 2009-06-21 20:04:53Z thomas $
- */
-
-
-/**
- * @see Zend_Validate_Abstract
- */
-require_once 'Zend/Validate/Abstract.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Barcode_UpcA extends Zend_Validate_Abstract
-{
- /**
- * Validation failure message key for when the value is
- * an invalid barcode
- */
- const INVALID = 'invalid';
-
- /**
- * Validation failure message key for when the value is
- * not 12 characters long
- */
- const INVALID_LENGTH = 'invalidLength';
-
- /**
- * Validation failure message template definitions
- *
- * @var array
- */
- protected $_messageTemplates = array(
- self::INVALID => "'%value%' is an invalid UPC-A barcode",
- self::INVALID_LENGTH => "'%value%' should be 12 characters",
- );
-
- /**
- * Defined by Zend_Validate_Interface
- *
- * Returns true if and only if $value contains a valid barcode
- *
- * @param string $value
- * @return boolean
- */
- public function isValid($value)
- {
- if (!is_string($value)) {
- $this->_error(self::INVALID);
- return false;
- }
-
- $this->_setValue($value);
- if (strlen($value) !== 12) {
- $this->_error(self::INVALID_LENGTH);
- return false;
- }
-
- $barcode = substr($value, 0, -1);
- $oddSum = 0;
- $evenSum = 0;
-
- for ($i = 0; $i < 11; $i++) {
- if ($i % 2 === 0) {
- $oddSum += $barcode[$i] * 3;
- } elseif ($i % 2 === 1) {
- $evenSum += $barcode[$i];
- }
- }
-
- $calculation = ($oddSum + $evenSum) % 10;
- $checksum = ($calculation === 0) ? 0 : 10 - $calculation;
-
- if ($value[11] != $checksum) {
- $this->_error(self::INVALID);
- return false;
- }
-
- return true;
- }
-}
diff --git a/libs/Zend/Validate/Barcode/Upca.php b/libs/Zend/Validate/Barcode/Upca.php
new file mode 100644
index 0000000000..2f0411ef95
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Upca.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Upca.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Upca extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = 12;
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+}
diff --git a/libs/Zend/Validate/Barcode/Upce.php b/libs/Zend/Validate/Barcode/Upce.php
new file mode 100644
index 0000000000..3199f19b90
--- /dev/null
+++ b/libs/Zend/Validate/Barcode/Upce.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: UpcA.php 18028 2009-09-08 20:52:23Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Barcode_AdapterAbstract
+ */
+// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Barcode_Upce extends Zend_Validate_Barcode_AdapterAbstract
+{
+ /**
+ * Allowed barcode lengths
+ * @var integer
+ */
+ protected $_length = array(6, 7, 8);
+
+ /**
+ * Allowed barcode characters
+ * @var string
+ */
+ protected $_characters = '0123456789';
+
+ /**
+ * Checksum function
+ * @var string
+ */
+ protected $_checksum = '_gtin';
+
+ /**
+ * Overrides parent checkLength
+ *
+ * @param string $value Value
+ * @return boolean
+ */
+ public function checkLength($value)
+ {
+ if (strlen($value) != 8) {
+ $this->setCheck(false);
+ } else {
+ $this->setCheck(true);
+ }
+
+ return parent::checkLength($value);
+ }
+}
diff --git a/libs/Zend/Validate/Between.php b/libs/Zend/Validate/Between.php
index b9fd7c2dc6..7245295dbb 100644
--- a/libs/Zend/Validate/Between.php
+++ b/libs/Zend/Validate/Between.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,22 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Between.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: Between.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Between extends Zend_Validate_Abstract
@@ -91,17 +88,44 @@ class Zend_Validate_Between extends Zend_Validate_Abstract
/**
* Sets validator options
+ * Accepts the following option keys:
+ * 'min' => scalar, minimum border
+ * 'max' => scalar, maximum border
+ * 'inclusive' => boolean, inclusive border values
*
- * @param mixed $min
- * @param mixed $max
- * @param boolean $inclusive
+ * @param array|Zend_Config $options
* @return void
*/
- public function __construct($min, $max, $inclusive = true)
+ public function __construct($options)
{
- $this->setMin($min)
- ->setMax($max)
- ->setInclusive($inclusive);
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (!is_array($options)) {
+ $options = func_get_args();
+ $temp['min'] = array_shift($options);
+ if (!empty($options)) {
+ $temp['max'] = array_shift($options);
+ }
+
+ if (!empty($options)) {
+ $temp['inclusive'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ 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");
+ }
+
+ if (!array_key_exists('inclusive', $options)) {
+ $options['inclusive'] = true;
+ }
+
+ $this->setMin($options['min'])
+ ->setMax($options['max'])
+ ->setInclusive($options['inclusive']);
}
/**
diff --git a/libs/Zend/Validate/Callback.php b/libs/Zend/Validate/Callback.php
new file mode 100644
index 0000000000..398e27324c
--- /dev/null
+++ b/libs/Zend/Validate/Callback.php
@@ -0,0 +1,174 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Callback.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * @see Zend_Validate_Abstract
+ */
+// require_once 'Zend/Validate/Abstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Callback extends Zend_Validate_Abstract
+{
+ /**
+ * Invalid callback
+ */
+ const INVALID_CALLBACK = 'callbackInvalid';
+
+ /**
+ * Invalid value
+ */
+ const INVALID_VALUE = 'callbackValue';
+
+ /**
+ * Validation failure message template definitions
+ *
+ * @var array
+ */
+ protected $_messageTemplates = array(
+ self::INVALID_VALUE => "'%value%' is not valid",
+ self::INVALID_CALLBACK => "Failure within the callback, exception returned",
+ );
+
+ /**
+ * Callback in a call_user_func format
+ *
+ * @var string|array
+ */
+ protected $_callback = null;
+
+ /**
+ * Default options to set for the filter
+ *
+ * @var mixed
+ */
+ protected $_options = array();
+
+ /**
+ * Sets validator options
+ *
+ * @param string|array $callback
+ * @param mixed $max
+ * @param boolean $inclusive
+ * @return void
+ */
+ public function __construct($callback = null)
+ {
+ if (is_callable($callback)) {
+ $this->setCallback($callback);
+ } elseif (is_array($callback)) {
+ if (isset($callback['callback'])) {
+ $this->setCallback($callback['callback']);
+ }
+ if (isset($callback['options'])) {
+ $this->setOptions($callback['options']);
+ }
+ }
+
+ if (null === ($initializedCallack = $this->getCallback())) {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception('No callback registered');
+ }
+ }
+
+ /**
+ * Returns the set callback
+ *
+ * @return mixed
+ */
+ public function getCallback()
+ {
+ return $this->_callback;
+ }
+
+ /**
+ * Sets the callback
+ *
+ * @param string|array $callback
+ * @return Zend_Validate_Callback Provides a fluent interface
+ */
+ 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;
+ return $this;
+ }
+
+ /**
+ * Returns the set options for the callback
+ *
+ * @return mixed
+ */
+ public function getOptions()
+ {
+ return $this->_options;
+ }
+
+ /**
+ * Sets options for the callback
+ *
+ * @param mixed $max
+ * @return Zend_Validate_Callback Provides a fluent interface
+ */
+ public function setOptions($options)
+ {
+ $this->_options = (array) $options;
+ return $this;
+ }
+
+ /**
+ * Defined by Zend_Validate_Interface
+ *
+ * Returns true if and only if the set callback returns
+ * for the provided $value
+ *
+ * @param mixed $value
+ * @return boolean
+ */
+ public function isValid($value)
+ {
+ $this->_setValue($value);
+
+ $options = $this->getOptions();
+ $callback = $this->getCallback();
+ $args = func_get_args();
+ $options = array_merge($args, $options);
+
+ try {
+ if (!call_user_func_array($callback, $options)) {
+ $this->_error(self::INVALID_VALUE);
+ return false;
+ }
+ } catch (Exception $e) {
+ $this->_error(self::INVALID_CALLBACK);
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/libs/Zend/Validate/Ccnum.php b/libs/Zend/Validate/Ccnum.php
index 489573c48d..8c2a8beb14 100644
--- a/libs/Zend/Validate/Ccnum.php
+++ b/libs/Zend/Validate/Ccnum.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,22 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ccnum.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: Ccnum.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Ccnum extends Zend_Validate_Abstract
@@ -62,6 +59,11 @@ class Zend_Validate_Ccnum extends Zend_Validate_Abstract
self::CHECKSUM => "Luhn algorithm (mod-10 checksum) failed on '%value%'"
);
+ public function __construct()
+ {
+ trigger_error('Using the Ccnum validator is deprecated in favor of the CreditCard validator');
+ }
+
/**
* Defined by Zend_Validate_Interface
*
@@ -78,7 +80,7 @@ class Zend_Validate_Ccnum extends Zend_Validate_Abstract
/**
* @see Zend_Filter_Digits
*/
- require_once 'Zend/Filter/Digits.php';
+ // require_once 'Zend/Filter/Digits.php';
self::$_filter = new Zend_Filter_Digits();
}
@@ -107,5 +109,4 @@ class Zend_Validate_Ccnum extends Zend_Validate_Abstract
return true;
}
-
}
diff --git a/libs/Zend/Validate/CreditCard.php b/libs/Zend/Validate/CreditCard.php
new file mode 100644
index 0000000000..9c8c039718
--- /dev/null
+++ b/libs/Zend/Validate/CreditCard.php
@@ -0,0 +1,317 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: CreditCard.php 21570 2010-03-19 19:00:50Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Abstract
+ */
+// require_once 'Zend/Validate/Abstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_CreditCard extends Zend_Validate_Abstract
+{
+ /**
+ * Detected CCI list
+ *
+ * @var string
+ */
+ const ALL = 'All';
+ const AMERICAN_EXPRESS = 'American_Express';
+ const UNIONPAY = 'Unionpay';
+ const DINERS_CLUB = 'Diners_Club';
+ const DINERS_CLUB_US = 'Diners_Club_US';
+ const DISCOVER = 'Discover';
+ const JCB = 'JCB';
+ const LASER = 'Laser';
+ const MAESTRO = 'Maestro';
+ const MASTERCARD = 'Mastercard';
+ const SOLO = 'Solo';
+ const VISA = 'Visa';
+
+ const CHECKSUM = 'creditcardChecksum';
+ const CONTENT = 'creditcardContent';
+ const INVALID = 'creditcardInvalid';
+ const LENGTH = 'creditcardLength';
+ const PREFIX = 'creditcardPrefix';
+ const SERVICE = 'creditcardService';
+ const SERVICEFAILURE = 'creditcardServiceFailure';
+
+ /**
+ * Validation failure message template definitions
+ *
+ * @var array
+ */
+ protected $_messageTemplates = array(
+ self::CHECKSUM => "Luhn algorithm (mod-10 checksum) failed on '%value%'",
+ self::CONTENT => "'%value%' must contain only digits",
+ self::INVALID => "Invalid type given, value should be a string",
+ self::LENGTH => "'%value%' contains an invalid amount of digits",
+ self::PREFIX => "'%value%' is not from an allowed institute",
+ self::SERVICE => "Validation of '%value%' has been failed by the service",
+ self::SERVICEFAILURE => "The service returned a failure while validating '%value%'",
+ );
+
+ /**
+ * List of allowed CCV lengths
+ *
+ * @var array
+ */
+ protected $_cardLength = array(
+ self::AMERICAN_EXPRESS => array(15),
+ self::DINERS_CLUB => array(14),
+ self::DINERS_CLUB_US => array(16),
+ self::DISCOVER => array(16),
+ self::JCB => array(16),
+ self::LASER => array(16, 17, 18, 19),
+ self::MAESTRO => array(12, 13, 14, 15, 16, 17, 18, 19),
+ self::MASTERCARD => array(16),
+ self::SOLO => array(16, 18, 19),
+ self::UNIONPAY => array(16, 17, 18, 19),
+ self::VISA => array(16),
+ );
+
+ /**
+ * List of accepted CCV provider tags
+ *
+ * @var array
+ */
+ protected $_cardType = array(
+ self::AMERICAN_EXPRESS => array('34', '37'),
+ self::DINERS_CLUB => array('300', '301', '302', '303', '304', '305', '36'),
+ self::DINERS_CLUB_US => array('54', '55'),
+ self::DISCOVER => array('6011', '622126', '622127', '622128', '622129', '62213',
+ '62214', '62215', '62216', '62217', '62218', '62219',
+ '6222', '6223', '6224', '6225', '6226', '6227', '6228',
+ '62290', '62291', '622920', '622921', '622922', '622923',
+ '622924', '622925', '644', '645', '646', '647', '648',
+ '649', '65'),
+ self::JCB => array('3528', '3529', '353', '354', '355', '356', '357', '358'),
+ self::LASER => array('6304', '6706', '6771', '6709'),
+ self::MAESTRO => array('5018', '5020', '5038', '6304', '6759', '6761', '6763'),
+ self::MASTERCARD => array('51', '52', '53', '54', '55'),
+ self::SOLO => array('6334', '6767'),
+ self::UNIONPAY => array('622126', '622127', '622128', '622129', '62213', '62214',
+ '62215', '62216', '62217', '62218', '62219', '6222', '6223',
+ '6224', '6225', '6226', '6227', '6228', '62290', '62291',
+ '622920', '622921', '622922', '622923', '622924', '622925'),
+ self::VISA => array('4'),
+ );
+
+ /**
+ * CCIs which are accepted by validation
+ *
+ * @var array
+ */
+ protected $_type = array();
+
+ /**
+ * Service callback for additional validation
+ *
+ * @var callback
+ */
+ protected $_service;
+
+ /**
+ * Constructor
+ *
+ * @param string|array $type OPTIONAL Type of CCI to allow
+ */
+ public function __construct($options = array())
+ {
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (!is_array($options)) {
+ $options = func_get_args();
+ $temp['type'] = array_shift($options);
+ if (!empty($options)) {
+ $temp['service'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ if (!array_key_exists('type', $options)) {
+ $options['type'] = self::ALL;
+ }
+
+ $this->setType($options['type']);
+ if (array_key_exists('service', $options)) {
+ $this->setService($options['service']);
+ }
+ }
+
+ /**
+ * Returns a list of accepted CCIs
+ *
+ * @return array
+ */
+ public function getType()
+ {
+ return $this->_type;
+ }
+
+ /**
+ * Sets CCIs which are accepted by validation
+ *
+ * @param string|array $type Type to allow for validation
+ * @return Zend_Validate_CreditCard Provides a fluid interface
+ */
+ public function setType($type)
+ {
+ $this->_type = array();
+ return $this->addType($type);
+ }
+
+ /**
+ * Adds a CCI to be accepted by validation
+ *
+ * @param string|array $type Type to allow for validation
+ * @return Zend_Validate_CreditCard Provides a fluid interface
+ */
+ public function addType($type)
+ {
+ if (is_string($type)) {
+ $type = array($type);
+ }
+
+ foreach($type as $typ) {
+ if (defined('self::' . strtoupper($typ)) && !in_array($typ, $this->_type)) {
+ $this->_type[] = $typ;
+ }
+
+ if (($typ == self::ALL)) {
+ $this->_type = array_keys($this->_cardLength);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the actual set service
+ *
+ * @return callback
+ */
+ public function getService()
+ {
+ return $this->_service;
+ }
+
+ /**
+ * Sets a new callback for service validation
+ *
+ * @param unknown_type $service
+ */
+ public function setService($service)
+ {
+ if (!is_callable($service)) {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception('Invalid callback given');
+ }
+
+ $this->_service = $service;
+ return $this;
+ }
+
+ /**
+ * Defined by Zend_Validate_Interface
+ *
+ * Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum)
+ *
+ * @param string $value
+ * @return boolean
+ */
+ public function isValid($value)
+ {
+ $this->_setValue($value);
+
+ if (!is_string($value)) {
+ $this->_error(self::INVALID, $value);
+ return false;
+ }
+
+ if (!ctype_digit($value)) {
+ $this->_error(self::CONTENT, $value);
+ return false;
+ }
+
+ $length = strlen($value);
+ $types = $this->getType();
+ $foundp = false;
+ $foundl = false;
+ foreach ($types as $type) {
+ foreach ($this->_cardType[$type] as $prefix) {
+ if (substr($value, 0, strlen($prefix)) == $prefix) {
+ $foundp = true;
+ if (in_array($length, $this->_cardLength[$type])) {
+ $foundl = true;
+ break 2;
+ }
+ }
+ }
+ }
+
+ if ($foundp == false){
+ $this->_error(self::PREFIX, $value);
+ return false;
+ }
+
+ if ($foundl == false) {
+ $this->_error(self::LENGTH, $value);
+ return false;
+ }
+
+ $sum = 0;
+ $weight = 2;
+
+ for ($i = $length - 2; $i >= 0; $i--) {
+ $digit = $weight * $value[$i];
+ $sum += floor($digit / 10) + $digit % 10;
+ $weight = $weight % 2 + 1;
+ }
+
+ if ((10 - $sum % 10) % 10 != $value[$length - 1]) {
+ $this->_error(self::CHECKSUM, $value);
+ return false;
+ }
+
+ 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)) {
+ $this->_error(self::SERVICE, $value);
+ return false;
+ }
+ } catch (Zend_Exception $e) {
+ $this->_error(self::SERVICEFAILURE, $value);
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/libs/Zend/Validate/Date.php b/libs/Zend/Validate/Date.php
index 5dbcc6d702..22e49b7aee 100644
--- a/libs/Zend/Validate/Date.php
+++ b/libs/Zend/Validate/Date.php
@@ -14,27 +14,26 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Date.php 17696 2009-08-20 20:12:33Z thomas $
+ * @version $Id: Date.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Date extends Zend_Validate_Abstract
{
const INVALID = 'dateInvalid';
- const NOT_YYYY_MM_DD = 'dateNotYYYY-MM-DD';
- const INVALID_DATE = 'dateInvalidDate';
+ const INVALID_DATE = 'dateInvalidDate';
const FALSEFORMAT = 'dateFalseFormat';
/**
@@ -44,9 +43,15 @@ class Zend_Validate_Date extends Zend_Validate_Abstract
*/
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be string, integer, array or Zend_Date",
- self::NOT_YYYY_MM_DD => "'%value%' is not of the format YYYY-MM-DD",
self::INVALID_DATE => "'%value%' does not appear to be a valid date",
- self::FALSEFORMAT => "'%value%' does not fit given date format"
+ self::FALSEFORMAT => "'%value%' does not fit the date format '%format%'",
+ );
+
+ /**
+ * @var array
+ */
+ protected $_messageVariables = array(
+ 'format' => '_format'
);
/**
@@ -66,22 +71,36 @@ class Zend_Validate_Date extends Zend_Validate_Abstract
/**
* Sets validator options
*
- * @param string $format OPTIONAL
- * @param string|Zend_Locale $locale OPTIONAL
+ * @param string|Zend_Config $options OPTIONAL
* @return void
*/
- public function __construct($format = null, $locale = null)
+ public function __construct($options = array())
{
- $this->setFormat($format);
- if ($locale === null) {
- require_once 'Zend/Registry.php';
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (!is_array($options)) {
+ $options = func_get_args();
+ $temp['format'] = array_shift($options);
+ if (!empty($options)) {
+ $temp['locale'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ if (array_key_exists('format', $options)) {
+ $this->setFormat($options['format']);
+ }
+
+ if (!array_key_exists('locale', $options)) {
+ // require_once 'Zend/Registry.php';
if (Zend_Registry::isRegistered('Zend_Locale')) {
- $locale = Zend_Registry::get('Zend_Locale');
+ $options['locale'] = Zend_Registry::get('Zend_Locale');
}
}
- if ($locale !== null) {
- $this->setLocale($locale);
+ if (array_key_exists('locale', $options)) {
+ $this->setLocale($options['locale']);
}
}
@@ -103,7 +122,7 @@ class Zend_Validate_Date extends Zend_Validate_Abstract
*/
public function setLocale($locale = null)
{
- require_once 'Zend/Locale.php';
+ // require_once 'Zend/Locale.php';
$this->_locale = Zend_Locale::findLocale($locale);
return $this;
}
@@ -152,7 +171,7 @@ 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';
+ // require_once 'Zend/Date.php';
if (!Zend_Date::isDate($value, $this->_format, $this->_locale)) {
if ($this->_checkFormat($value) === false) {
$this->_error(self::FALSEFORMAT);
@@ -163,7 +182,9 @@ class Zend_Validate_Date extends Zend_Validate_Abstract
}
} else {
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) {
- $this->_error(self::NOT_YYYY_MM_DD);
+ $this->_format = 'yyyy-MM-dd';
+ $this->_error(self::FALSEFORMAT);
+ $this->_format = null;
return false;
}
@@ -187,7 +208,7 @@ class Zend_Validate_Date extends Zend_Validate_Abstract
private function _checkFormat($value)
{
try {
- require_once 'Zend/Locale/Format.php';
+ // 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/libs/Zend/Validate/Db/Abstract.php b/libs/Zend/Validate/Db/Abstract.php
index e5103ff4ed..5811c495a9 100644
--- a/libs/Zend/Validate/Db/Abstract.php
+++ b/libs/Zend/Validate/Db/Abstract.php
@@ -1,5 +1,4 @@
-<?php
-
+<?php
/**
* Zend Framework
*
@@ -15,134 +14,285 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 17160 2009-07-26 19:46:24Z bittarman $
- */
-
+ * @version $Id: Abstract.php 22225 2010-05-21 09:12:52Z bittarman $
+ */
+
/**
* @see Zend_Validate_Abstract
- */
-require_once 'Zend/Validate/Abstract.php';
-
+ */
+// require_once 'Zend/Validate/Abstract.php';
+
/**
* Class for Database record validation
- *
+ *
* @category Zend
* @package Zend_Validate
* @uses Zend_Validate_Abstract
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_Validate_Db_Abstract extends Zend_Validate_Abstract
-{
+ */
+abstract class Zend_Validate_Db_Abstract extends Zend_Validate_Abstract
+{
/**
* Error constants
- */
- const ERROR_NO_RECORD_FOUND = 'noRecordFound';
- const ERROR_RECORD_FOUND = 'recordFound';
-
+ */
+ const ERROR_NO_RECORD_FOUND = 'noRecordFound';
+ const ERROR_RECORD_FOUND = 'recordFound';
+
/**
* @var array Message templates
- */
- protected $_messageTemplates = array(self::ERROR_NO_RECORD_FOUND => 'No record matching %value% was found',
- self::ERROR_RECORD_FOUND => 'A record matching %value% was found');
+ */
+ protected $_messageTemplates = array(
+ self::ERROR_NO_RECORD_FOUND => 'No record matching %value% was found',
+ self::ERROR_RECORD_FOUND => 'A record matching %value% was found',
+ );
/**
* @var string
- */
+ */
protected $_schema = null;
-
+
/**
* @var string
- */
- protected $_table = '';
-
+ */
+ protected $_table = '';
+
/**
* @var string
- */
- protected $_field = '';
-
+ */
+ protected $_field = '';
+
/**
* @var mixed
- */
- protected $_exclude = null;
-
+ */
+ protected $_exclude = null;
+
/**
* Database adapter to use. If null isValid() will use Zend_Db::getInstance instead
*
* @var unknown_type
- */
- protected $_adapter = null;
-
+ */
+ protected $_adapter = null;
+
/**
- * Provides basic configuration for use with Zend_Validate_Db Validators
+ * Provides basic configuration for use with Zend_Validate_Db Validators
* Setting $exclude allows a single record to be excluded from matching.
* Exclude can either be a String containing a where clause, or an array with `field` and `value` keys
- * to define the where clause added to the sql.
- * A database adapter may optionally be supplied to avoid using the registered default adapter.
- *
- * @param string||array $table The database table to validate against, or array with table and schema keys
- * @param string $field The field to check for a match
- * @param string||array $exclude An optional where clause or field/value pair to exclude from the query
- * @param Zend_Db_Adapter_Abstract $adapter An optional database adapter to use.
- */
- public function __construct($table, $field, $exclude = null, Zend_Db_Adapter_Abstract $adapter = null)
- {
- if ($adapter !== null) {
- $this->_adapter = $adapter;
- }
- $this->_exclude = $exclude;
- $this->_field = (string) $field;
-
- if (is_array($table)) {
- $this->_table = (isset($table['table'])) ? $table['table'] : '';
- $this->_schema = (isset($table['schema'])) ? $table['schema'] : null;
- } else {
- $this->_table = (string) $table;
+ * to define the where clause added to the sql.
+ * A database adapter may optionally be supplied to avoid using the registered default adapter.
+ *
+ * The following option keys are supported:
+ * 'table' => The database table to validate against
+ * 'schema' => The schema keys
+ * 'field' => The field to check for a match
+ * 'exclude' => An optional where clause or field/value pair to exclude from the query
+ * 'adapter' => An optional database adapter to use
+ *
+ * @param array|Zend_Config $options Options to use for this validator
+ */
+ public function __construct($options)
+ {
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (func_num_args() > 1) {
+ $options = func_get_args();
+ $temp['table'] = array_shift($options);
+ $temp['field'] = array_shift($options);
+ if (!empty($options)) {
+ $temp['exclude'] = array_shift($options);
+ }
+
+ if (!empty($options)) {
+ $temp['adapter'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ 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!');
+ }
+
+ if (array_key_exists('adapter', $options)) {
+ $this->setAdapter($options['adapter']);
+ }
+
+ if (array_key_exists('exclude', $options)) {
+ $this->setExclude($options['exclude']);
+ }
+
+ $this->setField($options['field']);
+ if (array_key_exists('table', $options)) {
+ $this->setTable($options['table']);
+ }
+
+ if (array_key_exists('schema', $options)) {
+ $this->setSchema($options['schema']);
}
+ }
+
+ /**
+ * Returns the set adapter
+ *
+ * @return Zend_Db_Adapter
+ */
+ public function getAdapter()
+ {
+ return $this->_adapter;
+ }
+
+ /**
+ * Sets a new database adapter
+ *
+ * @param Zend_Db_Adapter_Abstract $adapter
+ * @return Zend_Validate_Db_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!');
+ }
+
+ $this->_adapter = $adapter;
+ return $this;
+ }
+
+ /**
+ * Returns the set exclude clause
+ *
+ * @return string|array
+ */
+ public function getExclude()
+ {
+ return $this->_exclude;
+ }
+
+ /**
+ * Sets a new exclude clause
+ *
+ * @param string|array $exclude
+ * @return Zend_Validate_Db_Abstract
+ */
+ public function setExclude($exclude)
+ {
+ $this->_exclude = $exclude;
+ return $this;
+ }
+
+ /**
+ * Returns the set field
+ *
+ * @return string|array
+ */
+ public function getField()
+ {
+ return $this->_field;
+ }
+
+ /**
+ * Sets a new field
+ *
+ * @param string $field
+ * @return Zend_Validate_Db_Abstract
+ */
+ public function setField($field)
+ {
+ $this->_field = (string) $field;
+ return $this;
+ }
+
+ /**
+ * Returns the set table
+ *
+ * @return string
+ */
+ public function getTable()
+ {
+ return $this->_table;
+ }
+
+ /**
+ * Sets a new table
+ *
+ * @param string $table
+ * @return Zend_Validate_Db_Abstract
+ */
+ public function setTable($table)
+ {
+ $this->_table = (string) $table;
+ return $this;
+ }
+
+ /**
+ * Returns the set schema
+ *
+ * @return string
+ */
+ public function getSchema()
+ {
+ return $this->_schema;
+ }
+
+ /**
+ * Sets a new schema
+ *
+ * @param string $schema
+ * @return Zend_Validate_Db_Abstract
+ */
+ public function setSchema($schema)
+ {
+ $this->_schema = $schema;
+ return $this;
+ }
- }
-
/**
* Run query and returns matches, or null if no matches are found.
*
* @param String $value
* @return Array when matches are found.
- */
- protected function _query($value)
- {
+ */
+ protected function _query($value)
+ {
/**
* Check for an adapter being defined. if not, fetch the default adapter.
- */
+ */
if ($this->_adapter === null) {
$this->_adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
if (null === $this->_adapter) {
- require_once 'Zend/Validate/Exception.php';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('No database adapter present');
}
}
/**
* Build select object
- */
+ */
$select = new Zend_Db_Select($this->_adapter);
$select->from($this->_table, array($this->_field), $this->_schema)
- ->where($this->_adapter->quoteIdentifier($this->_field).' = ?', $value);
- if ($this->_exclude !== null) {
- if (is_array($this->_exclude)) {
- $select->where($this->_adapter->quoteIdentifier($this->_exclude['field']).' != ?', $this->_exclude['value']);
- } else {
- $select->where($this->_exclude);
- }
- }
- $select->limit(1);
-
+ ->where($this->_adapter->quoteIdentifier($this->_field, true).' = ?', $value);
+ if ($this->_exclude !== null) {
+ if (is_array($this->_exclude)) {
+ $select->where($this->_adapter->quoteIdentifier($this->_exclude['field'], true).' != ?', $this->_exclude['value']);
+ } else {
+ $select->where($this->_exclude);
+ }
+ }
+ $select->limit(1);
+
/**
* Run query
- */
- $result = $this->_adapter->fetchRow($select, array(), Zend_Db::FETCH_ASSOC);
-
- return $result;
- }
+ */
+ $result = $this->_adapter->fetchRow($select, array(), Zend_Db::FETCH_ASSOC);
+
+ return $result;
+ }
}
diff --git a/libs/Zend/Validate/Db/NoRecordExists.php b/libs/Zend/Validate/Db/NoRecordExists.php
index e9c0db49a8..700102e436 100644
--- a/libs/Zend/Validate/Db/NoRecordExists.php
+++ b/libs/Zend/Validate/Db/NoRecordExists.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,15 +14,15 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: NoRecordExists.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: NoRecordExists.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Validate_Db_Abstract
*/
-require_once 'Zend/Validate/Db/Abstract.php';
+// require_once 'Zend/Validate/Db/Abstract.php';
/**
* Confirms a record does not exist in a table.
@@ -31,7 +30,7 @@ require_once 'Zend/Validate/Db/Abstract.php';
* @category Zend
* @package Zend_Validate
* @uses Zend_Validate_Db_Abstract
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Db_NoRecordExists extends Zend_Validate_Db_Abstract
diff --git a/libs/Zend/Validate/Db/RecordExists.php b/libs/Zend/Validate/Db/RecordExists.php
index 2d753e4b0a..bf96b96f5c 100644
--- a/libs/Zend/Validate/Db/RecordExists.php
+++ b/libs/Zend/Validate/Db/RecordExists.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,39 +14,38 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: RecordExists.php 16971 2009-07-22 18:05:45Z mikaelkael $
- */
-
-
+ * @version $Id: RecordExists.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
/**
* @see Zend_Validate_Db_Abstract
- */
-require_once 'Zend/Validate/Db/Abstract.php';
-
+ */
+// require_once 'Zend/Validate/Db/Abstract.php';
+
/**
* Confirms a record exists in a table.
- *
+ *
* @category Zend
* @package Zend_Validate
* @uses Zend_Validate_Db_Abstract
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Db_RecordExists extends Zend_Validate_Db_Abstract
-{
- public function isValid($value)
- {
- $valid = true;
- $this->_setValue($value);
-
- $result = $this->_query($value);
- if (!$result) {
- $valid = false;
- $this->_error(self::ERROR_NO_RECORD_FOUND);
- }
-
- return $valid;
- }
+ */
+class Zend_Validate_Db_RecordExists extends Zend_Validate_Db_Abstract
+{
+ public function isValid($value)
+ {
+ $valid = true;
+ $this->_setValue($value);
+
+ $result = $this->_query($value);
+ if (!$result) {
+ $valid = false;
+ $this->_error(self::ERROR_NO_RECORD_FOUND);
+ }
+
+ return $valid;
+ }
}
diff --git a/libs/Zend/Validate/Digits.php b/libs/Zend/Validate/Digits.php
index 12e6c4e454..9194568e27 100644
--- a/libs/Zend/Validate/Digits.php
+++ b/libs/Zend/Validate/Digits.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,28 +14,26 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Digits.php 16933 2009-07-21 20:24:35Z matthew $
+ * @version $Id: Digits.php 21136 2010-02-22 22:30:50Z thomas $
*/
-
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Digits extends Zend_Validate_Abstract
{
const NOT_DIGITS = 'notDigits';
- const STRING_EMPTY = 'stringEmpty';
+ const STRING_EMPTY = 'digitsStringEmpty';
const INVALID = 'digitsInvalid';
/**
@@ -52,7 +49,7 @@ class Zend_Validate_Digits extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::NOT_DIGITS => "'%value%' contains not only digit characters",
+ self::NOT_DIGITS => "'%value%' contains characters which are not digits; but only digits are allowed",
self::STRING_EMPTY => "'%value%' is an empty string",
self::INVALID => "Invalid type given, value should be string, integer or float",
);
@@ -80,7 +77,7 @@ class Zend_Validate_Digits extends Zend_Validate_Abstract
}
if (null === self::$_filter) {
- require_once 'Zend/Filter/Digits.php';
+ // require_once 'Zend/Filter/Digits.php';
self::$_filter = new Zend_Filter_Digits();
}
@@ -91,5 +88,4 @@ class Zend_Validate_Digits extends Zend_Validate_Abstract
return true;
}
-
}
diff --git a/libs/Zend/Validate/EmailAddress.php b/libs/Zend/Validate/EmailAddress.php
index 4948bb83f3..c008dcfe9f 100644
--- a/libs/Zend/Validate/EmailAddress.php
+++ b/libs/Zend/Validate/EmailAddress.php
@@ -14,25 +14,25 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: EmailAddress.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: EmailAddress.php 21461 2010-03-10 22:34:03Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @see Zend_Validate_Hostname
*/
-require_once 'Zend/Validate/Hostname.php';
+// require_once 'Zend/Validate/Hostname.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
@@ -41,6 +41,7 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
const INVALID_FORMAT = 'emailAddressInvalidFormat';
const INVALID_HOSTNAME = 'emailAddressInvalidHostname';
const INVALID_MX_RECORD = 'emailAddressInvalidMxRecord';
+ const INVALID_SEGMENT = 'emailAddressInvalidSegment';
const DOT_ATOM = 'emailAddressDotAtom';
const QUOTED_STRING = 'emailAddressQuotedString';
const INVALID_LOCAL_PART = 'emailAddressInvalidLocalPart';
@@ -51,37 +52,47 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
*/
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be a string",
- self::INVALID_FORMAT => "'%value%' is not a valid email address in the basic format local-part@hostname",
- self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for email address '%value%'",
+ self::INVALID_FORMAT => "'%value%' is no valid email address in the basic format local-part@hostname",
+ self::INVALID_HOSTNAME => "'%hostname%' is no valid hostname for email address '%value%'",
self::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'",
- self::DOT_ATOM => "'%localPart%' not matched against dot-atom format",
- self::QUOTED_STRING => "'%localPart%' not matched against quoted-string format",
- self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for email address '%value%'",
- self::LENGTH_EXCEEDED => "'%value%' exceeds the allowed length"
+ self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network.",
+ self::DOT_ATOM => "'%localPart%' can not be matched against dot-atom format",
+ self::QUOTED_STRING => "'%localPart%' can not be matched against quoted-string format",
+ self::INVALID_LOCAL_PART => "'%localPart%' is no valid local part for email address '%value%'",
+ self::LENGTH_EXCEEDED => "'%value%' exceeds the allowed length",
);
/**
+ * @see http://en.wikipedia.org/wiki/IPv4
* @var array
*/
- protected $_messageVariables = array(
- 'hostname' => '_hostname',
- 'localPart' => '_localPart'
+ protected $_invalidIp = array(
+ '0' => '0.0.0.0/8',
+ '10' => '10.0.0.0/8',
+ '127' => '127.0.0.0/8',
+ '128' => '128.0.0.0/16',
+ '169' => '169.254.0.0/16',
+ '172' => '172.16.0.0/12',
+ '191' => '191.255.0.0/16',
+ '192' => array(
+ '192.0.0.0/24',
+ '192.0.2.0/24',
+ '192.88.99.0/24',
+ '192.168.0.0/16'
+ ),
+ '198' => '198.18.0.0/15',
+ '223' => '223.255.255.0/24',
+ '224' => '224.0.0.0/4',
+ '240' => '240.0.0.0/4'
);
/**
- * Local object for validating the hostname part of an email address
- *
- * @var Zend_Validate_Hostname
- * @depreciated
- */
- public $hostnameValidator;
-
- /**
- * Whether we check for a valid MX record via DNS
- *
- * @var boolean
+ * @var array
*/
- protected $_validateMx = false;
+ protected $_messageVariables = array(
+ 'hostname' => '_hostname',
+ 'localPart' => '_localPart'
+ );
/**
* @var string
@@ -94,21 +105,118 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
protected $_localPart;
/**
+ * Internal options array
+ */
+ protected $_options = array(
+ 'mx' => false,
+ 'deep' => false,
+ 'domain' => true,
+ 'allow' => Zend_Validate_Hostname::ALLOW_DNS,
+ 'hostname' => null
+ );
+
+ /**
* Instantiates hostname validator for local use
*
- * You can pass a bitfield to determine what types of hostnames are allowed.
- * These bitfields are defined by the ALLOW_* constants in Zend_Validate_Hostname
- * The default is to allow DNS hostnames only
+ * The following option keys are supported:
+ * 'hostname' => A hostname validator, see Zend_Validate_Hostname
+ * 'allow' => Options for the hostname validator, see Zend_Validate_Hostname::ALLOW_*
+ * 'mx' => If MX check should be enabled, boolean
+ * 'deep' => If a deep MX check should be done, boolean
*
- * @param integer $allow OPTIONAL
- * @param bool $validateMx OPTIONAL
- * @param Zend_Validate_Hostname $hostnameValidator OPTIONAL
+ * @param array|Zend_Config $options OPTIONAL
* @return void
*/
- public function __construct($allow = Zend_Validate_Hostname::ALLOW_DNS, $validateMx = false, Zend_Validate_Hostname $hostnameValidator = null)
+ public function __construct($options = array())
{
- $this->setValidateMx($validateMx);
- $this->setHostnameValidator($hostnameValidator, $allow);
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (!is_array($options)) {
+ $options = func_get_args();
+ $temp['allow'] = array_shift($options);
+ if (!empty($options)) {
+ $temp['mx'] = array_shift($options);
+ }
+
+ if (!empty($options)) {
+ $temp['hostname'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ $options += $this->_options;
+ $this->setOptions($options);
+ }
+
+ /**
+ * Returns all set Options
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ return $this->_options;
+ }
+
+ /**
+ * Set options for the email validator
+ *
+ * @param array $options
+ * @return Zend_Validate_EmailAddress fluid interface
+ */
+ public function setOptions(array $options = array())
+ {
+ if (array_key_exists('messages', $options)) {
+ $this->setMessages($options['messages']);
+ }
+
+ if (array_key_exists('hostname', $options)) {
+ if (array_key_exists('allow', $options)) {
+ $this->setHostnameValidator($options['hostname'], $options['allow']);
+ } else {
+ $this->setHostnameValidator($options['hostname']);
+ }
+ }
+
+ if (array_key_exists('mx', $options)) {
+ $this->setValidateMx($options['mx']);
+ }
+
+ if (array_key_exists('deep', $options)) {
+ $this->setDeepMxCheck($options['deep']);
+ }
+
+ if (array_key_exists('domain', $options)) {
+ $this->setDomainCheck($options['domain']);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Sets the validation failure message template for a particular key
+ * Adds the ability to set messages to the attached hostname validator
+ *
+ * @param string $messageString
+ * @param string $messageKey OPTIONAL
+ * @return Zend_Validate_Abstract Provides a fluent interface
+ * @throws Zend_Validate_Exception
+ */
+ public function setMessage($messageString, $messageKey = null)
+ {
+ $messageKeys = $messageKey;
+ if ($messageKey === null) {
+ $keys = array_keys($this->_messageTemplates);
+ $messageKeys = current($keys);
+ }
+
+ if (!isset($this->_messageTemplates[$messageKeys])) {
+ $this->_options['hostname']->setMessage($messageString, $messageKey);
+ }
+
+ $this->_messageTemplates[$messageKeys] = $messageString;
+ return $this;
}
/**
@@ -118,7 +226,7 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
*/
public function getHostnameValidator()
{
- return $this->hostnameValidator;
+ return $this->_options['hostname'];
}
/**
@@ -128,14 +236,17 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
*/
public function setHostnameValidator(Zend_Validate_Hostname $hostnameValidator = null, $allow = Zend_Validate_Hostname::ALLOW_DNS)
{
- if ($hostnameValidator === null) {
+ if (!$hostnameValidator) {
$hostnameValidator = new Zend_Validate_Hostname($allow);
}
- $this->hostnameValidator = $hostnameValidator;
+
+ $this->_options['hostname'] = $hostnameValidator;
+ $this->_options['allow'] = $allow;
+ return $this;
}
/**
- * Whether MX checking via dns_get_mx is supported or not
+ * Whether MX checking via getmxrr is supported or not
*
* This currently only works on UNIX systems
*
@@ -143,7 +254,17 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
*/
public function validateMxSupported()
{
- return function_exists('dns_get_mx');
+ return function_exists('getmxrr');
+ }
+
+ /**
+ * Returns the set validateMx option
+ *
+ * @return boolean
+ */
+ public function getValidateMx()
+ {
+ return $this->_options['mx'];
}
/**
@@ -151,11 +272,236 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
*
* This only applies when DNS hostnames are validated
*
- * @param boolean $allowed Set allowed to true to validate for MX records, and false to not validate them
+ * @param boolean $mx Set allowed to true to validate for MX records, and false to not validate them
+ * @return Zend_Validate_EmailAddress Fluid Interface
+ */
+ 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');
+ }
+
+ $this->_options['mx'] = (bool) $mx;
+ return $this;
+ }
+
+ /**
+ * Returns the set deepMxCheck option
+ *
+ * @return boolean
+ */
+ public function getDeepMxCheck()
+ {
+ return $this->_options['deep'];
+ }
+
+ /**
+ * Set whether we check MX record should be a deep validation
+ *
+ * @param boolean $deep Set deep to true to perform a deep validation process for MX records
+ * @return Zend_Validate_EmailAddress Fluid Interface
*/
- public function setValidateMx($allowed)
+ public function setDeepMxCheck($deep)
{
- $this->_validateMx = (bool) $allowed;
+ $this->_options['deep'] = (bool) $deep;
+ return $this;
+ }
+
+ /**
+ * Returns the set domainCheck option
+ *
+ * @return unknown
+ */
+ public function getDomainCheck()
+ {
+ return $this->_options['domain'];
+ }
+
+ /**
+ * Sets if the domain should also be checked
+ * or only the local part of the email address
+ *
+ * @param boolean $domain
+ * @return Zend_Validate_EmailAddress Fluid Interface
+ */
+ public function setDomainCheck($domain = true)
+ {
+ $this->_options['domain'] = (boolean) $domain;
+ return $this;
+ }
+
+ /**
+ * Returns if the given host is reserved
+ *
+ * @param string $host
+ * @return boolean
+ */
+ private function _isReserved($host){
+ if (!preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $host)) {
+ $host = gethostbyname($host);
+ }
+
+ $octet = explode('.',$host);
+ if ((int)$octet[0] >= 224) {
+ return true;
+ } else if (array_key_exists($octet[0], $this->_invalidIp)) {
+ foreach ((array)$this->_invalidIp[$octet[0]] as $subnetData) {
+ // we skip the first loop as we already know that octet matches
+ for ($i = 1; $i < 4; $i++) {
+ if (strpos($subnetData, $octet[$i]) !== $i * 4) {
+ break;
+ }
+ }
+
+ $host = explode("/", $subnetData);
+ $binaryHost = "";
+ $tmp = explode(".", $host[0]);
+ for ($i = 0; $i < 4 ; $i++) {
+ $binaryHost .= str_pad(decbin($tmp[$i]), 8, "0", STR_PAD_LEFT);
+ }
+
+ $segmentData = array(
+ 'network' => (int)$this->_toIp(str_pad(substr($binaryHost, 0, $host[1]), 32, 0)),
+ 'broadcast' => (int)$this->_toIp(str_pad(substr($binaryHost, 0, $host[1]), 32, 1))
+ );
+
+ for ($j = $i; $j < 4; $j++) {
+ if ((int)$octet[$j] < $segmentData['network'][$j] ||
+ (int)$octet[$j] > $segmentData['broadcast'][$j]) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Converts a binary string to an IP address
+ *
+ * @param string $binary
+ * @return mixed
+ */
+ private function _toIp($binary)
+ {
+ $ip = array();
+ $tmp = explode(".", chunk_split($binary, 8, "."));
+ for ($i = 0; $i < 4 ; $i++) {
+ $ip[$i] = bindec($tmp[$i]);
+ }
+
+ return $ip;
+ }
+
+ /**
+ * Internal method to validate the local part of the email address
+ *
+ * @return boolean
+ */
+ private function _validateLocalPart()
+ {
+ // First try to match the local part on the common dot-atom format
+ $result = false;
+
+ // Dot-atom characters are: 1*atext *("." 1*atext)
+ // atext: ALPHA / DIGIT / and "!", "#", "$", "%", "&", "'", "*",
+ // "+", "-", "/", "=", "?", "^", "_", "`", "{", "|", "}", "~"
+ $atext = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e';
+ if (preg_match('/^[' . $atext . ']+(\x2e+[' . $atext . ']+)*$/', $this->_localPart)) {
+ $result = true;
+ } else {
+ // Try quoted string format
+
+ // Quoted-string characters are: DQUOTE *([FWS] qtext/quoted-pair) [FWS] DQUOTE
+ // qtext: Non white space controls, and the rest of the US-ASCII characters not
+ // including "\" or the quote character
+ $noWsCtl = '\x01-\x08\x0b\x0c\x0e-\x1f\x7f';
+ $qtext = $noWsCtl . '\x21\x23-\x5b\x5d-\x7e';
+ $ws = '\x20\x09';
+ if (preg_match('/^\x22([' . $ws . $qtext . '])*[$ws]?\x22$/', $this->_localPart)) {
+ $result = true;
+ } else {
+ $this->_error(self::DOT_ATOM);
+ $this->_error(self::QUOTED_STRING);
+ $this->_error(self::INVALID_LOCAL_PART);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Internal method to validate the servers MX records
+ *
+ * @return boolean
+ */
+ private function _validateMXRecords()
+ {
+ $mxHosts = array();
+ $result = getmxrr($this->_hostname, $mxHosts);
+ if (!$result) {
+ $this->_error(self::INVALID_MX_RECORD);
+ } else if ($this->_options['deep'] && function_exists('checkdnsrr')) {
+ $validAddress = false;
+ $reserved = true;
+ foreach ($mxHosts as $hostname) {
+ $res = $this->_isReserved($hostname);
+ if (!$res) {
+ $reserved = false;
+ }
+
+ if (!$res
+ && (checkdnsrr($hostname, "A")
+ || checkdnsrr($hostname, "AAAA")
+ || checkdnsrr($hostname, "A6"))) {
+ $validAddress = true;
+ break;
+ }
+ }
+
+ if (!$validAddress) {
+ $result = false;
+ if ($reserved) {
+ $this->_error(self::INVALID_SEGMENT);
+ } else {
+ $this->_error(self::INVALID_MX_RECORD);
+ }
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Internal method to validate the hostname part of the email address
+ *
+ * @return boolean
+ */
+ private function _validateHostnamePart()
+ {
+ $hostname = $this->_options['hostname']->setTranslator($this->getTranslator())
+ ->isValid($this->_hostname);
+ if (!$hostname) {
+ $this->_error(self::INVALID_HOSTNAME);
+
+ // Get messages and errors from hostnameValidator
+ foreach ($this->_options['hostname']->getMessages() as $code => $message) {
+ $this->_messages[$code] = $message;
+ }
+
+ foreach ($this->_options['hostname']->getErrors() as $error) {
+ $this->_errors[] = $error;
+ }
+ } else if ($this->_options['mx']) {
+ // MX check on hostname
+ $hostname = $this->_validateMXRecords();
+ }
+
+ return $hostname;
}
/**
@@ -176,9 +522,8 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
return false;
}
- $matches = array();
- $length = true;
-
+ $matches = array();
+ $length = true;
$this->_setValue($value);
// Split email address up and disallow '..'
@@ -197,68 +542,19 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
}
// Match hostname part
- $hostnameResult = $this->hostnameValidator->setTranslator($this->getTranslator())
- ->isValid($this->_hostname);
- if (!$hostnameResult) {
- $this->_error(self::INVALID_HOSTNAME);
-
- // Get messages and errors from hostnameValidator
- foreach ($this->hostnameValidator->getMessages() as $code => $message) {
- $this->_messages[$code] = $message;
- }
- foreach ($this->hostnameValidator->getErrors() as $error) {
- $this->_errors[] = $error;
- }
- } else if ($this->_validateMx) {
- // MX check on hostname via dns_get_record()
- if ($this->validateMxSupported()) {
- $result = dns_get_mx($this->_hostname, $mxHosts);
- if (count($mxHosts) < 1) {
- $hostnameResult = false;
- $this->_error(self::INVALID_MX_RECORD);
- }
- } else {
- /**
- * MX checks are not supported by this system
- * @see Zend_Validate_Exception
- */
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception('Internal error: MX checking not available on this system');
- }
+ if ($this->_options['domain']) {
+ $hostname = $this->_validateHostnamePart();
}
- // First try to match the local part on the common dot-atom format
- $localResult = false;
-
- // Dot-atom characters are: 1*atext *("." 1*atext)
- // atext: ALPHA / DIGIT / and "!", "#", "$", "%", "&", "'", "*",
- // "+", "-", "/", "=", "?", "^", "_", "`", "{", "|", "}", "~"
- $atext = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e';
- if (preg_match('/^[' . $atext . ']+(\x2e+[' . $atext . ']+)*$/', $this->_localPart)) {
- $localResult = true;
- } else {
- // Try quoted string format
+ $local = $this->_validateLocalPart();
- // Quoted-string characters are: DQUOTE *([FWS] qtext/quoted-pair) [FWS] DQUOTE
- // qtext: Non white space controls, and the rest of the US-ASCII characters not
- // including "\" or the quote character
- $noWsCtl = '\x01-\x08\x0b\x0c\x0e-\x1f\x7f';
- $qtext = $noWsCtl . '\x21\x23-\x5b\x5d-\x7e';
- $ws = '\x20\x09';
- if (preg_match('/^\x22([' . $ws . $qtext . '])*[$ws]?\x22$/', $this->_localPart)) {
- $localResult = true;
- } else {
- $this->_error(self::DOT_ATOM);
- $this->_error(self::QUOTED_STRING);
- $this->_error(self::INVALID_LOCAL_PART);
+ // If both parts valid, return true
+ if ($local && $length) {
+ if (($this->_options['domain'] && $hostname) || !$this->_options['domain']) {
+ return true;
}
}
- // If both parts valid, return true
- if ($localResult && $hostnameResult && $length) {
- return true;
- } else {
- return false;
- }
+ return false;
}
}
diff --git a/libs/Zend/Validate/Exception.php b/libs/Zend/Validate/Exception.php
index d6b646f1cd..fd34efe0c1 100644
--- a/libs/Zend/Validate/Exception.php
+++ b/libs/Zend/Validate/Exception.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,22 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exception.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
-
+// require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Exception extends Zend_Exception
diff --git a/libs/Zend/Validate/File/Count.php b/libs/Zend/Validate/File/Count.php
index f2dfac7413..a4bff7ee8c 100644
--- a/libs/Zend/Validate/File/Count.php
+++ b/libs/Zend/Validate/File/Count.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Count.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: Count.php 21326 2010-03-04 20:32:39Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validator for counting all given files
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Count extends Zend_Validate_Abstract
@@ -37,16 +37,16 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
/**#@+
* @const string Error constants
*/
- const TOO_MUCH = 'fileCountTooMuch';
- const TOO_LESS = 'fileCountTooLess';
+ const TOO_MANY = 'fileCountTooMany';
+ const TOO_FEW = 'fileCountTooFew';
/**#@-*/
/**
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::TOO_MUCH => "Too much files, maximum '%max%' are allowed but '%count%' are given",
- self::TOO_LESS => "Too less files, minimum '%min%' are expected but '%count%' are given"
+ self::TOO_MANY => "Too many files, maximum '%max%' are allowed but '%count%' are given",
+ self::TOO_FEW => "Too few files, minimum '%min%' are expected but '%count%' are given",
);
/**
@@ -110,13 +110,11 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception ('Invalid options to validator provided');
}
if (1 < func_num_args()) {
-// @todo: Preperation for 2.0... needs to be cleared with the dev-team
-// trigger_error('Multiple arguments are deprecated in favor of an array of named arguments', E_USER_NOTICE);
$options['min'] = func_get_arg(0);
$options['max'] = func_get_arg(1);
}
@@ -154,13 +152,13 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
}
if (!is_string($min) and !is_numeric($min)) {
- require_once 'Zend/Validate/Exception.php';
+ // 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';
+ // 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}");
}
@@ -193,13 +191,13 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
}
if (!is_string($max) and !is_numeric($max)) {
- require_once 'Zend/Validate/Exception.php';
+ // 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';
+ // 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}");
}
@@ -243,14 +241,25 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
*/
public function isValid($value, $file = null)
{
- $this->addFile($value);
+ if (($file !== null) && !array_key_exists('destination', $file)) {
+ $file['destination'] = dirname($value);
+ }
+
+ if (($file !== null) && array_key_exists('tmp_name', $file)) {
+ $value = $file['destination'] . DIRECTORY_SEPARATOR . $file['name'];
+ }
+
+ if (($file === null) || !empty($file['tmp_name'])) {
+ $this->addFile($value);
+ }
+
$this->_count = count($this->_files);
if (($this->_max !== null) && ($this->_count > $this->_max)) {
- return $this->_throw($file, self::TOO_MUCH);
+ return $this->_throw($file, self::TOO_MANY);
}
if (($this->_min !== null) && ($this->_count < $this->_min)) {
- return $this->_throw($file, self::TOO_LESS);
+ return $this->_throw($file, self::TOO_FEW);
}
return true;
diff --git a/libs/Zend/Validate/File/Crc32.php b/libs/Zend/Validate/File/Crc32.php
index fd46d81b6b..31b420585e 100644
--- a/libs/Zend/Validate/File/Crc32.php
+++ b/libs/Zend/Validate/File/Crc32.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Crc32.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: Crc32.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_File_Hash
*/
-require_once 'Zend/Validate/File/Hash.php';
+// require_once 'Zend/Validate/File/Hash.php';
/**
* Validator for the crc32 hash of given files
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Crc32 extends Zend_Validate_File_Hash
@@ -45,9 +45,9 @@ class Zend_Validate_File_Crc32 extends Zend_Validate_File_Hash
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::DOES_NOT_MATCH => "The file '%value%' does not match the given crc32 hashes",
- self::NOT_DETECTED => "There was no crc32 hash detected for the given file",
- self::NOT_FOUND => "The file '%value%' could not be found"
+ self::DOES_NOT_MATCH => "File '%value%' does not match the given crc32 hashes",
+ self::NOT_DETECTED => "A crc32 hash could not be evaluated for the given file",
+ self::NOT_FOUND => "File '%value%' could not be found",
);
/**
@@ -70,7 +70,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid options to validator provided');
}
@@ -157,7 +157,7 @@ class Zend_Validate_File_Crc32 extends Zend_Validate_File_Hash
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
diff --git a/libs/Zend/Validate/File/ExcludeExtension.php b/libs/Zend/Validate/File/ExcludeExtension.php
index 74264de98c..94fb27bb6d 100644
--- a/libs/Zend/Validate/File/ExcludeExtension.php
+++ b/libs/Zend/Validate/File/ExcludeExtension.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ExcludeExtension.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: ExcludeExtension.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/File/Extension.php';
+// require_once 'Zend/Validate/File/Extension.php';
/**
* Validator for the excluding file extensions
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_ExcludeExtension extends Zend_Validate_File_Extension
@@ -44,8 +44,8 @@ class Zend_Validate_File_ExcludeExtension extends Zend_Validate_File_Extension
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::FALSE_EXTENSION => "The file '%value%' has a false extension",
- self::NOT_FOUND => "The file '%value%' was not found"
+ self::FALSE_EXTENSION => "File '%value%' has a false extension",
+ self::NOT_FOUND => "File '%value%' could not be found",
);
/**
@@ -61,7 +61,7 @@ class Zend_Validate_File_ExcludeExtension extends Zend_Validate_File_Extension
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
diff --git a/libs/Zend/Validate/File/ExcludeMimeType.php b/libs/Zend/Validate/File/ExcludeMimeType.php
index 4984b79cfb..436caa1f02 100644
--- a/libs/Zend/Validate/File/ExcludeMimeType.php
+++ b/libs/Zend/Validate/File/ExcludeMimeType.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ExcludeMimeType.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: ExcludeMimeType.php 21936 2010-04-18 16:23:34Z thomas $
*/
/**
* @see Zend_Validate_File_MimeType
*/
-require_once 'Zend/Validate/File/MimeType.php';
+// require_once 'Zend/Validate/File/MimeType.php';
/**
* Validator for the mime type of a file
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_ExcludeMimeType extends Zend_Validate_File_MimeType
@@ -59,7 +59,7 @@ class Zend_Validate_File_ExcludeMimeType extends Zend_Validate_File_MimeType
}
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_READABLE);
}
@@ -73,7 +73,7 @@ class Zend_Validate_File_ExcludeMimeType extends Zend_Validate_File_MimeType
$mime = new finfo($const);
}
- if ($mime !== false) {
+ if (!empty($mime)) {
$this->_type = $mime->file($value);
}
unset($mime);
diff --git a/libs/Zend/Validate/File/Exists.php b/libs/Zend/Validate/File/Exists.php
index 835b4c2c70..6ecd11f1f0 100644
--- a/libs/Zend/Validate/File/Exists.php
+++ b/libs/Zend/Validate/File/Exists.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Exists.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: Exists.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validator which checks if the file already exists in the directory
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Exists extends Zend_Validate_Abstract
@@ -43,7 +43,7 @@ class Zend_Validate_File_Exists extends Zend_Validate_Abstract
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::DOES_NOT_EXIST => "The file '%value%' does not exist"
+ self::DOES_NOT_EXIST => "File '%value%' does not exist",
);
/**
@@ -72,7 +72,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception ('Invalid options to validator provided');
}
@@ -122,7 +122,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception ('Invalid options to validator provided');
}
diff --git a/libs/Zend/Validate/File/Extension.php b/libs/Zend/Validate/File/Extension.php
index 58ab0b21af..8d903e4093 100644
--- a/libs/Zend/Validate/File/Extension.php
+++ b/libs/Zend/Validate/File/Extension.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Extension.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: Extension.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validator for the file extension of a file
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Extension extends Zend_Validate_Abstract
@@ -44,8 +44,8 @@ class Zend_Validate_File_Extension extends Zend_Validate_Abstract
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::FALSE_EXTENSION => "The file '%value%' has a false extension",
- self::NOT_FOUND => "The file '%value%' was not found"
+ self::FALSE_EXTENSION => "File '%value%' has a false extension",
+ self::NOT_FOUND => "File '%value%' could not be found",
);
/**
@@ -81,8 +81,6 @@ class Zend_Validate_File_Extension extends Zend_Validate_Abstract
}
if (1 < func_num_args()) {
-// @todo: Preperation for 2.0... needs to be cleared with the dev-team
-// trigger_error('Multiple arguments to constructor are deprecated in favor of options array', E_USER_NOTICE);
$case = func_get_arg(1);
$this->setCase($case);
}
@@ -189,7 +187,7 @@ class Zend_Validate_File_Extension extends Zend_Validate_Abstract
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
diff --git a/libs/Zend/Validate/File/FilesSize.php b/libs/Zend/Validate/File/FilesSize.php
index 167304b771..ca20ad50af 100644
--- a/libs/Zend/Validate/File/FilesSize.php
+++ b/libs/Zend/Validate/File/FilesSize.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: FilesSize.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: FilesSize.php 20455 2010-01-20 22:54:18Z thomas $
*/
/**
* @see Zend_Validate_File_Size
*/
-require_once 'Zend/Validate/File/Size.php';
+// require_once 'Zend/Validate/File/Size.php';
/**
* Validator for the size of all files which will be validated in sum
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size
@@ -47,7 +47,7 @@ class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size
protected $_messageTemplates = array(
self::TOO_BIG => "All files in sum should have a maximum size of '%max%' but '%size%' were detected",
self::TOO_SMALL => "All files in sum should have a minimum size of '%min%' but '%size%' were detected",
- self::NOT_READABLE => "One or more files can not be read"
+ self::NOT_READABLE => "One or more files can not be read",
);
/**
@@ -76,14 +76,11 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid options to validator provided');
}
if (1 < func_num_args()) {
-// @todo: Preperation for 2.0... needs to be cleared with the dev-team
-// trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
-
$argv = func_get_args();
array_shift($argv);
$options['max'] = array_shift($argv);
@@ -107,7 +104,7 @@ class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size
*/
public function isValid($value, $file = null)
{
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (is_string($value)) {
$value = array($value);
}
@@ -131,12 +128,14 @@ class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size
// limited to 2GB files
$size += @filesize($files);
- $this->_setSize($size);
+ $this->_size = $size;
if (($max !== null) && ($max < $size)) {
if ($this->useByteString()) {
- $this->setMax($this->_toByteString($max));
+ $this->_max = $this->_toByteString($max);
+ $this->_size = $this->_toByteString($size);
$this->_throw($file, self::TOO_BIG);
- $this->setMax($max);
+ $this->_max = $max;
+ $this->_size = $size;
} else {
$this->_throw($file, self::TOO_BIG);
}
@@ -146,9 +145,11 @@ class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size
// Check that aggregate files are >= minimum size
if (($min !== null) && ($size < $min)) {
if ($this->useByteString()) {
- $this->setMin($this->_toByteString($min));
+ $this->_min = $this->_toByteString($min);
+ $this->_size = $this->_toByteString($size);
$this->_throw($file, self::TOO_SMALL);
- $this->setMin($min);
+ $this->_min = $min;
+ $this->_size = $size;
} else {
$this->_throw($file, self::TOO_SMALL);
}
diff --git a/libs/Zend/Validate/File/Hash.php b/libs/Zend/Validate/File/Hash.php
index d2e8c2c645..6ade30cf41 100644
--- a/libs/Zend/Validate/File/Hash.php
+++ b/libs/Zend/Validate/File/Hash.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Hash.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: Hash.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validator for the hash of given files
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Hash extends Zend_Validate_Abstract
@@ -45,9 +45,9 @@ class Zend_Validate_File_Hash extends Zend_Validate_Abstract
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::DOES_NOT_MATCH => "The file '%value%' does not match the given hashes",
- self::NOT_DETECTED => "There was no hash detected for the given file",
- self::NOT_FOUND => "The file '%value%' could not be found"
+ self::DOES_NOT_MATCH => "File '%value%' does not match the given hashes",
+ self::NOT_DETECTED => "A hash could not be evaluated for the given file",
+ self::NOT_FOUND => "File '%value%' could not be found"
);
/**
@@ -70,13 +70,11 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid options to validator provided');
}
if (1 < func_num_args()) {
-// @todo: Preperation for 2.0... needs to be cleared with the dev-team
-// trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
$options['algorithm'] = func_get_arg(1);
}
@@ -118,7 +116,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception("False parameter given");
}
@@ -131,7 +129,7 @@ class Zend_Validate_File_Hash extends Zend_Validate_Abstract
}
if (!in_array($algorithm, $known)) {
- require_once 'Zend/Validate/Exception.php';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception("Unknown algorithm '{$algorithm}'");
}
@@ -154,7 +152,7 @@ class Zend_Validate_File_Hash extends Zend_Validate_Abstract
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
diff --git a/libs/Zend/Validate/File/ImageSize.php b/libs/Zend/Validate/File/ImageSize.php
index c01ec97341..54c1457500 100644
--- a/libs/Zend/Validate/File/ImageSize.php
+++ b/libs/Zend/Validate/File/ImageSize.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ImageSize.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: ImageSize.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validator for the image size of a image file
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract
@@ -53,7 +53,7 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract
self::HEIGHT_TOO_BIG => "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected",
self::HEIGHT_TOO_SMALL => "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected",
self::NOT_DETECTED => "The size of image '%value%' could not be detected",
- self::NOT_READABLE => "The image '%value%' can not be read"
+ self::NOT_READABLE => "File '%value%' can not be read",
);
/**
@@ -127,8 +127,6 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract
if ($options instanceof Zend_Config) {
$options = $options->toArray();
} elseif (1 < func_num_args()) {
-// @todo: Preperation for 2.0... needs to be cleared with the dev-team
-// trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
if (!is_array($options)) {
$options = array('minwidth' => $options);
}
@@ -142,7 +140,7 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract
}
}
} else if (!is_array($options)) {
- require_once 'Zend/Validate/Exception.php';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception ('Invalid options to validator provided');
}
@@ -207,7 +205,7 @@ 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';
+ // 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}");
}
@@ -215,7 +213,7 @@ 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';
+ // 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}");
}
@@ -244,7 +242,7 @@ 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';
+ // 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}");
}
@@ -252,7 +250,7 @@ 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';
+ // 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}");
}
@@ -310,7 +308,7 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_READABLE);
}
diff --git a/libs/Zend/Validate/File/IsCompressed.php b/libs/Zend/Validate/File/IsCompressed.php
index 3254d57341..dc0d99abb5 100644
--- a/libs/Zend/Validate/File/IsCompressed.php
+++ b/libs/Zend/Validate/File/IsCompressed.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: IsCompressed.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: IsCompressed.php 21138 2010-02-22 22:37:11Z thomas $
*/
/**
* @see Zend_Validate_File_MimeType
*/
-require_once 'Zend/Validate/File/MimeType.php';
+// require_once 'Zend/Validate/File/MimeType.php';
/**
* Validator which checks if the file already exists in the directory
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_IsCompressed extends Zend_Validate_File_MimeType
@@ -45,9 +45,9 @@ class Zend_Validate_File_IsCompressed extends Zend_Validate_File_MimeType
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::FALSE_TYPE => "The file '%value%' is not compressed, '%type%' detected",
- self::NOT_DETECTED => "The mimetype of file '%value%' has not been detected",
- self::NOT_READABLE => "The file '%value%' can not be read"
+ self::FALSE_TYPE => "File '%value%' is not compressed, '%type%' detected",
+ self::NOT_DETECTED => "The mimetype of file '%value%' could not been detected",
+ self::NOT_READABLE => "File '%value%' can not be read",
);
/**
@@ -60,27 +60,90 @@ class Zend_Validate_File_IsCompressed extends Zend_Validate_File_MimeType
{
if ($mimetype instanceof Zend_Config) {
$mimetype = $mimetype->toArray();
- } else if (empty($mimetype)) {
- $mimetype = array(
- 'application/x-tar',
- 'application/x-cpio',
- 'application/x-debian-package',
- 'application/x-archive',
- 'application/x-arc',
- 'application/x-arj',
- 'application/x-lharc',
- 'application/x-lha',
- 'application/x-rar',
- 'application/zip',
- 'application/zoo',
- 'application/x-eet',
- 'application/x-java-pack200',
- 'application/x-compress',
- 'application/x-gzip',
- 'application/x-bzip2'
- );
}
- $this->setMimeType($mimetype);
+ $temp = array();
+ // http://de.wikipedia.org/wiki/Liste_von_Dateiendungen
+ $default = array(
+ 'application/arj',
+ 'application/gnutar',
+ 'application/lha',
+ 'application/lzx',
+ 'application/vnd.ms-cab-compressed',
+ 'application/x-ace-compressed',
+ 'application/x-arc',
+ 'application/x-archive',
+ 'application/x-arj',
+ 'application/x-bzip',
+ 'application/x-bzip2',
+ 'application/x-cab-compressed',
+ 'application/x-compress',
+ 'application/x-compressed',
+ 'application/x-cpio',
+ 'application/x-debian-package',
+ 'application/x-eet',
+ 'application/x-gzip',
+ 'application/x-java-pack200',
+ 'application/x-lha',
+ 'application/x-lharc',
+ 'application/x-lzh',
+ 'application/x-lzma',
+ 'application/x-lzx',
+ 'application/x-rar',
+ 'application/x-sit',
+ 'application/x-stuffit',
+ 'application/x-tar',
+ 'application/zip',
+ 'application/zoo',
+ 'multipart/x-gzip',
+ );
+
+ if (is_array($mimetype)) {
+ $temp = $mimetype;
+ if (array_key_exists('magicfile', $temp)) {
+ unset($temp['magicfile']);
+ }
+
+ if (array_key_exists('headerCheck', $temp)) {
+ unset($temp['headerCheck']);
+ }
+
+ if (empty($temp)) {
+ $mimetype += $default;
+ }
+ }
+
+ if (empty($mimetype)) {
+ $mimetype = $default;
+ }
+
+ parent::__construct($mimetype);
+ }
+
+ /**
+ * Throws an error of the given type
+ * Duplicates parent method due to OOP Problem with late static binding in PHP 5.2
+ *
+ * @param string $file
+ * @param string $errorType
+ * @return false
+ */
+ protected function _throw($file, $errorType)
+ {
+ $this->_value = $file['name'];
+ switch($errorType) {
+ case Zend_Validate_File_MimeType::FALSE_TYPE :
+ $errorType = self::FALSE_TYPE;
+ break;
+ case Zend_Validate_File_MimeType::NOT_DETECTED :
+ $errorType = self::NOT_DETECTED;
+ break;
+ case Zend_Validate_File_MimeType::NOT_READABLE :
+ $errorType = self::NOT_READABLE;
+ break;
+ }
+
+ $this->_error($errorType);
+ return false;
}
}
diff --git a/libs/Zend/Validate/File/IsImage.php b/libs/Zend/Validate/File/IsImage.php
index 3904af1f90..d602ebe763 100644
--- a/libs/Zend/Validate/File/IsImage.php
+++ b/libs/Zend/Validate/File/IsImage.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: IsImage.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: IsImage.php 21138 2010-02-22 22:37:11Z thomas $
*/
/**
* @see Zend_Validate_File_MimeType
*/
-require_once 'Zend/Validate/File/MimeType.php';
+// require_once 'Zend/Validate/File/MimeType.php';
/**
* Validator which checks if the file already exists in the directory
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_IsImage extends Zend_Validate_File_MimeType
@@ -45,9 +45,9 @@ class Zend_Validate_File_IsImage extends Zend_Validate_File_MimeType
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::FALSE_TYPE => "The file '%value%' is no image, '%type%' detected",
- self::NOT_DETECTED => "The mimetype of file '%value%' has not been detected",
- self::NOT_READABLE => "The file '%value%' can not be read"
+ self::FALSE_TYPE => "File '%value%' is no image, '%type%' detected",
+ self::NOT_DETECTED => "The mimetype of file '%value%' could not be detected",
+ self::NOT_READABLE => "File '%value%' can not be read",
);
/**
@@ -60,31 +60,114 @@ class Zend_Validate_File_IsImage extends Zend_Validate_File_MimeType
{
if ($mimetype instanceof Zend_Config) {
$mimetype = $mimetype->toArray();
- } else if (empty($mimetype)) {
- $mimetype = array(
- 'image/x-quicktime',
- 'image/jp2',
- 'image/x-xpmi',
- 'image/x-portable-bitmap',
- 'image/x-portable-greymap',
- 'image/x-portable-pixmap',
- 'image/x-niff',
- 'image/tiff',
- 'image/png',
- 'image/x-unknown',
- 'image/gif',
- 'image/x-ms-bmp',
- 'application/dicom',
- 'image/vnd.adobe.photoshop',
- 'image/vnd.djvu',
- 'image/x-cpi',
- 'image/jpeg',
- 'image/x-ico',
- 'image/x-coreldraw',
- 'image/svg+xml'
- );
}
- $this->setMimeType($mimetype);
+ $temp = array();
+ // http://de.wikipedia.org/wiki/Liste_von_Dateiendungen
+ // http://www.iana.org/assignments/media-types/image/
+ $default = array(
+ 'application/cdf',
+ 'application/dicom',
+ 'application/fractals',
+ 'application/postscript',
+ 'application/vnd.hp-hpgl',
+ 'application/vnd.oasis.opendocument.graphics',
+ 'application/x-cdf',
+ 'application/x-cmu-raster',
+ 'application/x-ima',
+ 'application/x-inventor',
+ 'application/x-koan',
+ 'application/x-portable-anymap',
+ 'application/x-world-x-3dmf',
+ 'image/bmp',
+ 'image/c',
+ 'image/cgm',
+ 'image/fif',
+ 'image/gif',
+ 'image/jpeg',
+ 'image/jpm',
+ 'image/jpx',
+ 'image/jp2',
+ 'image/naplps',
+ 'image/pjpeg',
+ 'image/png',
+ 'image/svg',
+ 'image/svg+xml',
+ 'image/tiff',
+ 'image/vnd.adobe.photoshop',
+ 'image/vnd.djvu',
+ 'image/vnd.fpx',
+ 'image/vnd.net-fpx',
+ 'image/x-cmu-raster',
+ 'image/x-cmx',
+ 'image/x-coreldraw',
+ 'image/x-cpi',
+ 'image/x-emf',
+ 'image/x-ico',
+ 'image/x-icon',
+ 'image/x-jg',
+ 'image/x-ms-bmp',
+ 'image/x-niff',
+ 'image/x-pict',
+ 'image/x-pcx',
+ 'image/x-portable-anymap',
+ 'image/x-portable-bitmap',
+ 'image/x-portable-greymap',
+ 'image/x-portable-pixmap',
+ 'image/x-quicktime',
+ 'image/x-rgb',
+ 'image/x-tiff',
+ 'image/x-unknown',
+ 'image/x-windows-bmp',
+ 'image/x-xpmi',
+ );
+
+ if (is_array($mimetype)) {
+ $temp = $mimetype;
+ if (array_key_exists('magicfile', $temp)) {
+ unset($temp['magicfile']);
+ }
+
+ if (array_key_exists('headerCheck', $temp)) {
+ unset($temp['headerCheck']);
+ }
+
+ if (empty($temp)) {
+ $mimetype += $default;
+ }
+ }
+
+ if (empty($mimetype)) {
+ $mimetype = $default;
+ }
+
+ parent::__construct($mimetype);
+ }
+
+ /**
+ * Throws an error of the given type
+ * Duplicates parent method due to OOP Problem with late static binding in PHP 5.2
+ *
+ * @param string $file
+ * @param string $errorType
+ * @return false
+ */
+ protected function _throw($file, $errorType)
+ {
+ $this->_value = $file['name'];
+ switch($errorType) {
+ case Zend_Validate_File_MimeType::FALSE_TYPE :
+ $errorType = self::FALSE_TYPE;
+ break;
+ case Zend_Validate_File_MimeType::NOT_DETECTED :
+ $errorType = self::NOT_DETECTED;
+ break;
+ case Zend_Validate_File_MimeType::NOT_READABLE :
+ $errorType = self::NOT_READABLE;
+ break;
+ }
+
+ $this->_error($errorType);
+ return false;
}
}
diff --git a/libs/Zend/Validate/File/Md5.php b/libs/Zend/Validate/File/Md5.php
index cfbd83fb53..e76df71917 100644
--- a/libs/Zend/Validate/File/Md5.php
+++ b/libs/Zend/Validate/File/Md5.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Md5.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Md5.php 20442 2010-01-20 15:15:40Z matthew $
*/
/**
* @see Zend_Validate_File_Hash
*/
-require_once 'Zend/Validate/File/Hash.php';
+// require_once 'Zend/Validate/File/Hash.php';
/**
* Validator for the md5 hash of given files
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Md5 extends Zend_Validate_File_Hash
@@ -45,9 +45,9 @@ class Zend_Validate_File_Md5 extends Zend_Validate_File_Hash
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::DOES_NOT_MATCH => "The file '%value%' does not match the given md5 hashes",
- self::NOT_DETECTED => "There was no md5 hash detected for the given file",
- self::NOT_FOUND => "The file '%value%' could not be found"
+ self::DOES_NOT_MATCH => "File '%value%' does not match the given md5 hashes",
+ self::NOT_DETECTED => "A md5 hash could not be evaluated for the given file",
+ self::NOT_FOUND => "File '%value%' could not be found",
);
/**
@@ -72,7 +72,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid options to validator provided');
}
@@ -123,7 +123,7 @@ class Zend_Validate_File_Md5 extends Zend_Validate_File_Hash
* Adds the md5 hash for one or multiple files
*
* @param string|array $options
- * @param string $algorithm (Depreciated) Algorithm to use, fixed to md5
+ * @param string $algorithm (Deprecated) Algorithm to use, fixed to md5
* @return Zend_Validate_File_Hash Provides a fluent interface
*/
public function addHash($options)
@@ -161,7 +161,7 @@ class Zend_Validate_File_Md5 extends Zend_Validate_File_Hash
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
diff --git a/libs/Zend/Validate/File/MimeType.php b/libs/Zend/Validate/File/MimeType.php
index 2bf372c4fc..a31a7d35a3 100644
--- a/libs/Zend/Validate/File/MimeType.php
+++ b/libs/Zend/Validate/File/MimeType.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: MimeType.php 18513 2009-10-12 16:17:35Z matthew $
+ * @version $Id: MimeType.php 21936 2010-04-18 16:23:34Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validator for the mime type of a file
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
@@ -46,9 +46,9 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::FALSE_TYPE => "The file '%value%' has a false mimetype of '%type%'",
- self::NOT_DETECTED => "The mimetype of file '%value%' could not been detected",
- self::NOT_READABLE => "The file '%value%' can not be read"
+ self::FALSE_TYPE => "File '%value%' has a false mimetype of '%type%'",
+ self::NOT_DETECTED => "The mimetype of file '%value%' could not be detected",
+ self::NOT_READABLE => "File '%value%' can not be read",
);
/**
@@ -80,6 +80,13 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
protected $_magicfile;
/**
+ * Finfo object to use
+ *
+ * @var resource
+ */
+ protected $_finfo;
+
+ /**
* If no $_ENV['MAGIC'] is set, try and autodiscover it based on common locations
* @var array
*/
@@ -117,16 +124,18 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception("Invalid options to validator provided");
}
if (isset($mimetype['magicfile'])) {
$this->setMagicFile($mimetype['magicfile']);
+ unset($mimetype['magicfile']);
}
if (isset($mimetype['headerCheck'])) {
- $this->enableHeaderCheck(true);
+ $this->enableHeaderCheck($mimetype['headerCheck']);
+ unset($mimetype['headerCheck']);
}
$this->setMimeType($mimetype);
@@ -139,33 +148,62 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
*/
public function getMagicFile()
{
- if (null === $this->_magicfile && empty($_ENV['MAGIC'])) {
- foreach ($this->_magicFiles as $file) {
- if (file_exists($file)) {
- $this->setMagicFile($file);
- break;
+ if (null === $this->_magicfile) {
+ if (!empty($_ENV['MAGIC'])) {
+ $this->setMagicFile($_ENV['MAGIC']);
+ } elseif (!(@ini_get("safe_mode") == 'On' || @ini_get("safe_mode") === 1)) {
+ // require_once 'Zend/Validate/Exception.php';
+ foreach ($this->_magicFiles as $file) {
+ // supressing errors which are thrown due to openbase_dir restrictions
+ try {
+ $this->setMagicFile($file);
+ if ($this->_magicfile !== null) {
+ break;
+ }
+ } catch (Zend_Validate_Exception $e) {
+ // Intentionally, catch and fall through
+ }
}
}
+
+ if ($this->_magicfile === null) {
+ $this->_magicfile = false;
+ }
}
+
return $this->_magicfile;
}
/**
* Sets the magicfile to use
* if null, the MAGIC constant from php is used
+ * if the MAGIC file is errorous, no file will be set
*
* @param string $file
+ * @throws Zend_Validate_Exception When finfo can not read the magicfile
* @return Zend_Validate_File_MimeType Provides fluid interface
*/
public function setMagicFile($file)
{
if (empty($file)) {
$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_readable($file)) {
- require_once 'Zend/Validate/Exception.php';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('The given magicfile can not be read');
} else {
- $this->_magicfile = (string) $file;
+ $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
+ $this->_finfo = @finfo_open($const, $file);
+ if (empty($this->_finfo)) {
+ $this->_finfo = null;
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception('The given magicfile is not accepted by finfo');
+ } else {
+ $this->_magicfile = $file;
+ }
}
return $this;
@@ -237,7 +275,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception("Invalid options to validator provided");
}
@@ -286,7 +324,7 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
}
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_READABLE);
}
@@ -294,24 +332,27 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
$mimefile = $this->getMagicFile();
if (class_exists('finfo', false)) {
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
- if (!empty($mimefile)) {
- $mime = new finfo($const, $mimefile);
- } else {
- $mime = new finfo($const);
+ if (!empty($mimefile) && empty($this->_finfo)) {
+ $this->_finfo = @finfo_open($const, $mimefile);
+ }
+
+ if (empty($this->_finfo)) {
+ $this->_finfo = @finfo_open($const);
}
- if ($mime !== false) {
- $this->_type = $mime->file($value);
+ $this->_type = null;
+ if (!empty($this->_finfo)) {
+ $this->_type = finfo_file($this->_finfo, $value);
}
- unset($mime);
}
- if (empty($this->_type)) {
- if (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
+ if (empty($this->_type) &&
+ (function_exists('mime_content_type') && ini_get('mime_magic.magicfile'))) {
$this->_type = mime_content_type($value);
- } elseif ($this->_headerCheck) {
- $this->_type = $file['type'];
- }
+ }
+
+ if (empty($this->_type) && $this->_headerCheck) {
+ $this->_type = $file['type'];
}
if (empty($this->_type)) {
@@ -325,6 +366,7 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
$types = explode('/', $this->_type);
$types = array_merge($types, explode('-', $this->_type));
+ $types = array_merge($types, explode(';', $this->_type));
foreach($mimetype as $mime) {
if (in_array($mime, $types)) {
return true;
diff --git a/libs/Zend/Validate/File/NotExists.php b/libs/Zend/Validate/File/NotExists.php
index 0cc3c87ac9..a5afe94686 100644
--- a/libs/Zend/Validate/File/NotExists.php
+++ b/libs/Zend/Validate/File/NotExists.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: NotExists.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: NotExists.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_File_Exists
*/
-require_once 'Zend/Validate/File/Exists.php';
+// require_once 'Zend/Validate/File/Exists.php';
/**
* Validator which checks if the destination file does not exist
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_NotExists extends Zend_Validate_File_Exists
@@ -43,7 +43,7 @@ class Zend_Validate_File_NotExists extends Zend_Validate_File_Exists
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::DOES_EXIST => "The file '%value%' does exist"
+ self::DOES_EXIST => "File '%value%' exists",
);
/**
diff --git a/libs/Zend/Validate/File/Sha1.php b/libs/Zend/Validate/File/Sha1.php
index 9dd4418d71..1b5f8ee622 100644
--- a/libs/Zend/Validate/File/Sha1.php
+++ b/libs/Zend/Validate/File/Sha1.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Sha1.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Sha1.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_File_Hash
*/
-require_once 'Zend/Validate/File/Hash.php';
+// require_once 'Zend/Validate/File/Hash.php';
/**
* Validator for the sha1 hash of given files
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Sha1 extends Zend_Validate_File_Hash
@@ -45,9 +45,9 @@ class Zend_Validate_File_Sha1 extends Zend_Validate_File_Hash
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::DOES_NOT_MATCH => "The file '%value%' does not match the given sha1 hashes",
- self::NOT_DETECTED => "There was no sha1 hash detected for the given file",
- self::NOT_FOUND => "The file '%value%' could not be found"
+ self::DOES_NOT_MATCH => "File '%value%' does not match the given sha1 hashes",
+ self::NOT_DETECTED => "A sha1 hash could not be evaluated for the given file",
+ self::NOT_FOUND => "File '%value%' could not be found",
);
/**
@@ -72,7 +72,7 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid options to validator provided');
}
@@ -159,7 +159,7 @@ class Zend_Validate_File_Sha1 extends Zend_Validate_File_Hash
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
diff --git a/libs/Zend/Validate/File/Size.php b/libs/Zend/Validate/File/Size.php
index 4c41178966..a3431cfae1 100644
--- a/libs/Zend/Validate/File/Size.php
+++ b/libs/Zend/Validate/File/Size.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Size.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: Size.php 20455 2010-01-20 22:54:18Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validator for the maximum size of a file up to a max of 2GB
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Size extends Zend_Validate_Abstract
@@ -48,7 +48,7 @@ class Zend_Validate_File_Size extends Zend_Validate_Abstract
protected $_messageTemplates = array(
self::TOO_BIG => "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected",
self::TOO_SMALL => "Minimum expected size for file '%value%' is '%min%' but '%size%' detected",
- self::NOT_FOUND => "The file '%value%' could not be found"
+ self::NOT_FOUND => "File '%value%' could not be found",
);
/**
@@ -107,13 +107,11 @@ 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';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception ('Invalid options to validator provided');
}
if (1 < func_num_args()) {
-// @todo: Preperation for 2.0... needs to be cleared with the dev-team
-// trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
$argv = func_get_args();
array_shift($argv);
$options['max'] = array_shift($argv);
@@ -183,14 +181,14 @@ 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';
+ // 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';
+ // 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");
}
@@ -225,14 +223,14 @@ 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';
+ // 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';
+ // 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");
}
@@ -276,13 +274,14 @@ class Zend_Validate_File_Size extends Zend_Validate_Abstract
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
// limited to 4GB files
- $size = sprintf("%u", @filesize($value));
+ $size = sprintf("%u", @filesize($value));
+ $this->_size = $size;
// Check to see if it's smaller than min size
$min = $this->getMin(true);
diff --git a/libs/Zend/Validate/File/Upload.php b/libs/Zend/Validate/File/Upload.php
index fd1bdfe754..9a12f301d1 100644
--- a/libs/Zend/Validate/File/Upload.php
+++ b/libs/Zend/Validate/File/Upload.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Upload.php 18148 2009-09-16 19:27:43Z thomas $
+ * @version $Id: Upload.php 20431 2010-01-19 21:36:05Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validator for the maximum size of a file up to a max of 2GB
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_Upload extends Zend_Validate_Abstract
@@ -53,16 +53,16 @@ class Zend_Validate_File_Upload extends Zend_Validate_Abstract
* @var array Error message templates
*/
protected $_messageTemplates = array(
- self::INI_SIZE => "The file '%value%' exceeds the defined ini size",
- self::FORM_SIZE => "The file '%value%' exceeds the defined form size",
- self::PARTIAL => "The file '%value%' was only partially uploaded",
- self::NO_FILE => "The file '%value%' was not uploaded",
- self::NO_TMP_DIR => "No temporary directory was found for the file '%value%'",
- self::CANT_WRITE => "The file '%value%' can't be written",
- self::EXTENSION => "The extension returned an error while uploading the file '%value%'",
- self::ATTACK => "The file '%value%' was illegal uploaded, possible attack",
- self::FILE_NOT_FOUND => "The file '%value%' was not found",
- self::UNKNOWN => "Unknown error while uploading the file '%value%'"
+ self::INI_SIZE => "File '%value%' exceeds the defined ini size",
+ self::FORM_SIZE => "File '%value%' exceeds the defined form size",
+ self::PARTIAL => "File '%value%' was only partially uploaded",
+ self::NO_FILE => "File '%value%' was not uploaded",
+ self::NO_TMP_DIR => "No temporary directory was found for file '%value%'",
+ self::CANT_WRITE => "File '%value%' can't be written",
+ self::EXTENSION => "A PHP extension returned an error while uploading the file '%value%'",
+ self::ATTACK => "File '%value%' was illegally uploaded. This could be a possible attack",
+ self::FILE_NOT_FOUND => "File '%value%' was not found",
+ self::UNKNOWN => "Unknown error while uploading file '%value%'"
);
/**
@@ -112,7 +112,7 @@ class Zend_Validate_File_Upload extends Zend_Validate_Abstract
}
if (count($return) === 0) {
- require_once 'Zend/Validate/Exception.php';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception("The file '$file' was not found");
}
diff --git a/libs/Zend/Validate/File/WordCount.php b/libs/Zend/Validate/File/WordCount.php
index b5249532d3..e69bf1db79 100644
--- a/libs/Zend/Validate/File/WordCount.php
+++ b/libs/Zend/Validate/File/WordCount.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: WordCount.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: WordCount.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_File_Count
*/
-require_once 'Zend/Validate/File/Count.php';
+// require_once 'Zend/Validate/File/Count.php';
/**
* Validator for counting all words in a file
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_File_WordCount extends Zend_Validate_File_Count
@@ -48,7 +48,7 @@ class Zend_Validate_File_WordCount extends Zend_Validate_File_Count
protected $_messageTemplates = array(
self::TOO_MUCH => "Too much words, maximum '%max%' are allowed but '%count%' were counted",
self::TOO_LESS => "Too less words, minimum '%min%' are expected but '%count%' were counted",
- self::NOT_FOUND => "The file '%value%' could not be found"
+ self::NOT_FOUND => "File '%value%' could not be found",
);
/**
@@ -64,7 +64,7 @@ class Zend_Validate_File_WordCount extends Zend_Validate_File_Count
public function isValid($value, $file = null)
{
// Is file readable ?
- require_once 'Zend/Loader.php';
+ // require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
diff --git a/libs/Zend/Validate/Float.php b/libs/Zend/Validate/Float.php
index bfa5e62c14..37755a8ab7 100644
--- a/libs/Zend/Validate/Float.php
+++ b/libs/Zend/Validate/Float.php
@@ -14,25 +14,25 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Float.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: Float.php 21664 2010-03-27 21:39:38Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @see Zend_Locale_Format
*/
-require_once 'Zend/Locale/Format.php';
+// require_once 'Zend/Locale/Format.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Float extends Zend_Validate_Abstract
@@ -45,7 +45,7 @@ class Zend_Validate_Float extends Zend_Validate_Abstract
*/
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be float, string, or integer",
- self::NOT_FLOAT => "'%value%' does not appear to be a float"
+ self::NOT_FLOAT => "'%value%' does not appear to be a float",
);
protected $_locale;
@@ -53,13 +53,30 @@ class Zend_Validate_Float extends Zend_Validate_Abstract
/**
* Constructor for the float validator
*
- * @param string|Zend_Locale $locale
+ * @param string|Zend_Config|Zend_Locale $locale
*/
public function __construct($locale = null)
{
- if ($locale !== null) {
- $this->setLocale($locale);
+ if ($locale instanceof Zend_Config) {
+ $locale = $locale->toArray();
+ }
+
+ if (is_array($locale)) {
+ if (array_key_exists('locale', $locale)) {
+ $locale = $locale['locale'];
+ } else {
+ $locale = null;
+ }
}
+
+ if (empty($locale)) {
+ // require_once 'Zend/Registry.php';
+ if (Zend_Registry::isRegistered('Zend_Locale')) {
+ $locale = Zend_Registry::get('Zend_Locale');
+ }
+ }
+
+ $this->setLocale($locale);
}
/**
@@ -77,7 +94,7 @@ class Zend_Validate_Float extends Zend_Validate_Abstract
*/
public function setLocale($locale = null)
{
- require_once 'Zend/Locale.php';
+ // require_once 'Zend/Locale.php';
$this->_locale = Zend_Locale::findLocale($locale);
return $this;
}
@@ -97,28 +114,19 @@ class Zend_Validate_Float extends Zend_Validate_Abstract
return false;
}
- $this->_setValue($value);
- if ($this->_locale === null) {
- $locale = localeconv();
- $valueFiltered = str_replace($locale['thousands_sep'], '', (string) $value);
- $valueFiltered = str_replace($locale['decimal_point'], '.', $valueFiltered);
-
- if (strval(floatval($valueFiltered)) != $valueFiltered) {
- $this->_error(self::NOT_FLOAT);
- return false;
- }
+ if (is_float($value)) {
+ return true;
+ }
- } else {
- try {
- if (!Zend_Locale_Format::isFloat($value, array('locale' => 'en')) &&
- !Zend_Locale_Format::isFloat($value, array('locale' => $this->_locale))) {
- $this->_error(self::NOT_FLOAT);
- return false;
- }
- } catch (Zend_Locale_Exception $e) {
+ $this->_setValue($value);
+ try {
+ if (!Zend_Locale_Format::isFloat($value, array('locale' => $this->_locale))) {
$this->_error(self::NOT_FLOAT);
return false;
}
+ } catch (Zend_Locale_Exception $e) {
+ $this->_error(self::NOT_FLOAT);
+ return false;
}
return true;
diff --git a/libs/Zend/Validate/GreaterThan.php b/libs/Zend/Validate/GreaterThan.php
index 3c7b7931c9..a9b7a21879 100644
--- a/libs/Zend/Validate/GreaterThan.php
+++ b/libs/Zend/Validate/GreaterThan.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,22 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: GreaterThan.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: GreaterThan.php 20358 2010-01-17 19:03:49Z thomas $
*/
-
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_GreaterThan extends Zend_Validate_Abstract
@@ -42,7 +39,7 @@ class Zend_Validate_GreaterThan extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::NOT_GREATER => "'%value%' is not greater than '%min%'"
+ self::NOT_GREATER => "'%value%' is not greater than '%min%'",
);
/**
@@ -62,11 +59,24 @@ class Zend_Validate_GreaterThan extends Zend_Validate_Abstract
/**
* Sets validator options
*
- * @param mixed $min
+ * @param mixed|Zend_Config $min
* @return void
*/
public function __construct($min)
{
+ if ($min instanceof Zend_Config) {
+ $min = $min->toArray();
+ }
+
+ if (is_array($min)) {
+ if (array_key_exists('min', $min)) {
+ $min = $min['min'];
+ } else {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception("Missing option 'min'");
+ }
+ }
+
$this->setMin($min);
}
diff --git a/libs/Zend/Validate/Hex.php b/libs/Zend/Validate/Hex.php
index 85d3e3a7a2..b2080d3aaa 100644
--- a/libs/Zend/Validate/Hex.php
+++ b/libs/Zend/Validate/Hex.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,22 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Hex.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: Hex.php 20358 2010-01-17 19:03:49Z thomas $
*/
-
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Hex extends Zend_Validate_Abstract
@@ -45,7 +42,7 @@ class Zend_Validate_Hex extends Zend_Validate_Abstract
*/
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be a string",
- self::NOT_HEX => "'%value%' has not only hexadecimal digit characters"
+ self::NOT_HEX => "'%value%' has not only hexadecimal digit characters",
);
/**
diff --git a/libs/Zend/Validate/Hostname.php b/libs/Zend/Validate/Hostname.php
index dd254d5596..1732e69c77 100644
--- a/libs/Zend/Validate/Hostname.php
+++ b/libs/Zend/Validate/Hostname.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Hostname.php 17141 2009-07-26 12:49:17Z thomas $
+ * @version $Id: Hostname.php 21063 2010-02-15 23:00:17Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @see Zend_Validate_Ip
*/
-require_once 'Zend/Validate/Ip.php';
+// require_once 'Zend/Validate/Ip.php';
/**
* Please note there are two standalone test scripts for testing IDN characters due to problems
@@ -41,7 +41,7 @@ require_once 'Zend/Validate/Ip.php';
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Hostname extends Zend_Validate_Abstract
@@ -64,13 +64,13 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
self::INVALID => "Invalid type given, value should be a string",
self::IP_ADDRESS_NOT_ALLOWED => "'%value%' appears to be an IP address, but IP addresses are not allowed",
self::UNKNOWN_TLD => "'%value%' appears to be a DNS hostname but cannot match TLD against known list",
- self::INVALID_DASH => "'%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position",
+ self::INVALID_DASH => "'%value%' appears to be a DNS hostname but contains a dash in an invalid position",
self::INVALID_HOSTNAME_SCHEMA => "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'",
self::UNDECIPHERABLE_TLD => "'%value%' appears to be a DNS hostname but cannot extract TLD part",
self::INVALID_HOSTNAME => "'%value%' does not match the expected structure for a DNS hostname",
self::INVALID_LOCAL_NAME => "'%value%' does not appear to be a valid local network name",
self::LOCAL_NAME_NOT_ALLOWED => "'%value%' appears to be a local network name but local network names are not allowed",
- self::CANNOT_DECODE_PUNYCODE => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded"
+ self::CANNOT_DECODE_PUNYCODE => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded",
);
/**
@@ -101,27 +101,6 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
const ALLOW_ALL = 7;
/**
- * Whether IDN domains are validated
- *
- * @var boolean
- */
- private $_validateIdn = true;
-
- /**
- * Whether TLDs are validated against a known list
- *
- * @var boolean
- */
- private $_validateTld = true;
-
- /**
- * Bit field of ALLOW constants; determines which types of hostnames are allowed
- *
- * @var integer
- */
- protected $_allow;
-
- /**
* Array of valid top-level-domains
*
* @see ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain
@@ -221,6 +200,12 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
'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',
+ 2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu',
+ 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu',
+ 4 => '/^[\x{002d}0-9a-zΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ]{1,63}$/iu',
+ 5 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]{1,63}$/iu',
+ 6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu'),
'FI' => array(1 => '/^[\x{002d}0-9a-zäåö]{1,63}$/iu'),
'GR' => array(1 => '/^[\x{002d}0-9a-zΆΈΉΊΌΎ-ΡΣ-ώἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼῂῃῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲῳῴῶ-ῼ]{1,63}$/iu'),
'HK' => 'Zend/Validate/Hostname/Cn.php',
@@ -320,6 +305,13 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
'网络' => array(1 => 20),
);
+ protected $_options = array(
+ 'allow' => self::ALLOW_DNS,
+ 'idn' => true,
+ 'tld' => true,
+ 'ip' => null
+ );
+
/**
* Sets validator options
*
@@ -330,16 +322,77 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
* @return void
* @see http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs
*/
- public function __construct($allow = self::ALLOW_DNS, $validateIdn = true, $validateTld = true, Zend_Validate_Ip $ipValidator = null)
+ public function __construct($options = array())
{
- // Set allow options
- $this->setAllow($allow);
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (!is_array($options)) {
+ $options = func_get_args();
+ $temp['allow'] = array_shift($options);
+ if (!empty($options)) {
+ $temp['idn'] = array_shift($options);
+ }
+
+ if (!empty($options)) {
+ $temp['tld'] = array_shift($options);
+ }
+
+ if (!empty($options)) {
+ $temp['ip'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ $options += $this->_options;
+ $this->setOptions($options);
+ }
+
+ /**
+ * Returns all set options
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ return $this->_options;
+ }
+
+ /**
+ * Sets the options for this validator
+ *
+ * @param array $options
+ * @return Zend_Validate_Hostname
+ */
+ public function setOptions($options)
+ {
+ if (array_key_exists('allow', $options)) {
+ $this->setAllow($options['allow']);
+ }
- // Set validation options
- $this->_validateIdn = $validateIdn;
- $this->_validateTld = $validateTld;
+ if (array_key_exists('idn', $options)) {
+ $this->setValidateIdn($options['idn']);
+ }
+
+ if (array_key_exists('tld', $options)) {
+ $this->setValidateTld($options['tld']);
+ }
+
+ if (array_key_exists('ip', $options)) {
+ $this->setIpValidator($options['ip']);
+ }
- $this->setIpValidator($ipValidator);
+ return $this;
+ }
+
+ /**
+ * Returns the set ip validator
+ *
+ * @return Zend_Validate_Ip
+ */
+ public function getIpValidator()
+ {
+ return $this->_options['ip'];
}
/**
@@ -351,7 +404,9 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
if ($ipValidator === null) {
$ipValidator = new Zend_Validate_Ip();
}
- $this->_ipValidator = $ipValidator;
+
+ $this->_options['ip'] = $ipValidator;
+ return $this;
}
/**
@@ -361,7 +416,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
*/
public function getAllow()
{
- return $this->_allow;
+ return $this->_options['allow'];
}
/**
@@ -372,11 +427,21 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
*/
public function setAllow($allow)
{
- $this->_allow = $allow;
+ $this->_options['allow'] = $allow;
return $this;
}
/**
+ * Returns the set idn option
+ *
+ * @return boolean
+ */
+ public function getValidateIdn()
+ {
+ return $this->_options['idn'];
+ }
+
+ /**
* Set whether IDN domains are validated
*
* This only applies when DNS hostnames are validated
@@ -385,7 +450,18 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
*/
public function setValidateIdn ($allowed)
{
- $this->_validateIdn = (bool) $allowed;
+ $this->_options['idn'] = (bool) $allowed;
+ return $this;
+ }
+
+ /**
+ * Returns the set tld option
+ *
+ * @return boolean
+ */
+ public function getValidateTld()
+ {
+ return $this->_options['tld'];
}
/**
@@ -397,7 +473,8 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
*/
public function setValidateTld ($allowed)
{
- $this->_validateTld = (bool) $allowed;
+ $this->_options['tld'] = (bool) $allowed;
+ return $this;
}
/**
@@ -417,11 +494,10 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
}
$this->_setValue($value);
-
// Check input against IP address schema
if (preg_match('/^[0-9.a-e:.]*$/i', $value) &&
- $this->_ipValidator->setTranslator($this->getTranslator())->isValid($value)) {
- if (!($this->_allow & self::ALLOW_IP)) {
+ $this->_options['ip']->setTranslator($this->getTranslator())->isValid($value)) {
+ if (!($this->_options['allow'] & self::ALLOW_IP)) {
$this->_error(self::IP_ADDRESS_NOT_ALLOWED);
return false;
} else {
@@ -452,7 +528,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
// Match TLD against known list
$this->_tld = strtolower($matches[1]);
- if ($this->_validateTld) {
+ if ($this->_options['tld']) {
if (!in_array($this->_tld, $this->_validTlds)) {
$this->_error(self::UNKNOWN_TLD);
$status = false;
@@ -466,18 +542,17 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
* @see Zend_Validate_Hostname_Interface
*/
$regexChars = array(0 => '/^[a-z0-9\x2d]{1,63}$/i');
- if ($this->_validateIdn && isset($this->_validIdns[strtoupper($this->_tld)])) {
+ if ($this->_options['idn'] && isset($this->_validIdns[strtoupper($this->_tld)])) {
if (is_string($this->_validIdns[strtoupper($this->_tld)])) {
- $regexChars += include($this->_validIdns[strtoupper($this->_tld)]);
+ $regexChars += include(dirname(__FILE__) . '/../../' . $this->_validIdns[strtoupper($this->_tld)]);
} else {
$regexChars += $this->_validIdns[strtoupper($this->_tld)];
}
}
// Check each hostname part
- $valid = true;
+ $check = 0;
foreach ($domainParts as $domainPart) {
-
// Decode Punycode domainnames to IDN
if (strpos($domainPart, 'xn--') === 0) {
$domainPart = $this->decodePunycode(substr($domainPart, 4));
@@ -490,20 +565,16 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
if ((strpos($domainPart, '-') === 0)
|| ((strlen($domainPart) > 2) && (strpos($domainPart, '-', 2) == 2) && (strpos($domainPart, '-', 3) == 3))
|| (strpos($domainPart, '-') === (strlen($domainPart) - 1))) {
- $this->_error(self::INVALID_DASH);
+ $this->_error(self::INVALID_DASH);
$status = false;
break 2;
}
// Check each domain part
- $check = false;
+ $checked = false;
foreach($regexChars as $regexKey => $regexChar) {
$status = @preg_match($regexChar, $domainPart);
- if ($status === false) {
- iconv_set_encoding('internal_encoding', $origenc);
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception('Internal error: DNS validation failed');
- } elseif ($status !== 0) {
+ if ($status > 0) {
$length = 63;
if (array_key_exists(strtoupper($this->_tld), $this->_idnLength)
&& (array_key_exists($regexKey, $this->_idnLength[strtoupper($this->_tld)]))) {
@@ -513,23 +584,22 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
if (iconv_strlen($domainPart, 'UTF-8') > $length) {
$this->_error(self::INVALID_HOSTNAME);
} else {
- $check = true;
- break 2;
+ $checked = true;
+ break;
}
}
}
- if (!$check) {
- $valid = false;
+ if ($checked) {
+ ++$check;
}
}
- // If all labels didn't match, the hostname is invalid
- if (!$valid) {
+ // If one of the labels doesn't match, the hostname is invalid
+ if ($check !== count($domainParts)) {
$this->_error(self::INVALID_HOSTNAME_SCHEMA);
$status = false;
}
-
} else {
// Hostname not long enough
$this->_error(self::UNDECIPHERABLE_TLD);
@@ -540,28 +610,20 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
iconv_set_encoding('internal_encoding', $origenc);
// If the input passes as an Internet domain name, and domain names are allowed, then the hostname
// passes validation
- if ($status && ($this->_allow & self::ALLOW_DNS)) {
+ if ($status && ($this->_options['allow'] & self::ALLOW_DNS)) {
return true;
}
- } else {
+ } else if ($this->_options['allow'] & self::ALLOW_DNS) {
$this->_error(self::INVALID_HOSTNAME);
}
// Check input against local network name schema; last chance to pass validation
$regexLocal = '/^(([a-zA-Z0-9\x2d]{1,63}\x2e)*[a-zA-Z0-9\x2d]{1,63}){1,254}$/';
$status = @preg_match($regexLocal, $value);
- if (false === $status) {
- /**
- * Regex error
- * @see Zend_Validate_Exception
- */
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception('Internal error: local network name validation failed');
- }
// If the input passes as a local network name, and local network names are allowed, then the
// hostname passes validation
- $allowLocal = $this->_allow & self::ALLOW_LOCAL;
+ $allowLocal = $this->_options['allow'] & self::ALLOW_LOCAL;
if ($status && $allowLocal) {
return true;
}
diff --git a/libs/Zend/Validate/Hostname/Biz.php b/libs/Zend/Validate/Hostname/Biz.php
index f2e3e7a009..38762217d8 100644
--- a/libs/Zend/Validate/Hostname/Biz.php
+++ b/libs/Zend/Validate/Hostname/Biz.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Biz.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Biz.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
@@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
return array(
diff --git a/libs/Zend/Validate/Hostname/Cn.php b/libs/Zend/Validate/Hostname/Cn.php
index 1bcd91eb95..feee54ade2 100644
--- a/libs/Zend/Validate/Hostname/Cn.php
+++ b/libs/Zend/Validate/Hostname/Cn.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Cn.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Cn.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
@@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
return array(
diff --git a/libs/Zend/Validate/Hostname/Com.php b/libs/Zend/Validate/Hostname/Com.php
index 19290b300f..413971fec5 100644
--- a/libs/Zend/Validate/Hostname/Com.php
+++ b/libs/Zend/Validate/Hostname/Com.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Com.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Com.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
@@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
return array(
diff --git a/libs/Zend/Validate/Hostname/Jp.php b/libs/Zend/Validate/Hostname/Jp.php
index 0888472e61..02f278e2bd 100644
--- a/libs/Zend/Validate/Hostname/Jp.php
+++ b/libs/Zend/Validate/Hostname/Jp.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Jp.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Jp.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
@@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
return array(
diff --git a/libs/Zend/Validate/Iban.php b/libs/Zend/Validate/Iban.php
index 071651fd96..097cd32cbd 100644
--- a/libs/Zend/Validate/Iban.php
+++ b/libs/Zend/Validate/Iban.php
@@ -14,22 +14,22 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Iban.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Iban.php 21563 2010-03-19 10:10:45Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validates IBAN Numbers (International Bank Account Numbers)
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Iban extends Zend_Validate_Abstract
@@ -44,9 +44,9 @@ class Zend_Validate_Iban extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::NOTSUPPORTED => "'%value%' does not have IBAN",
- self::FALSEFORMAT => "'%value%' has a false format",
- self::CHECKFAILED => "'%value%' has failed the IBAN check"
+ self::NOTSUPPORTED => "Unknown country within the IBAN '%value%'",
+ self::FALSEFORMAT => "'%value%' has a false IBAN format",
+ self::CHECKFAILED => "'%value%' has failed the IBAN check",
);
/**
@@ -106,12 +106,31 @@ class Zend_Validate_Iban extends Zend_Validate_Abstract
/**
* Sets validator options
*
- * @param string|Zend_Locale $locale OPTIONAL
+ * @param string|Zend_Config|Zend_Locale $locale OPTIONAL
* @return void
*/
public function __construct($locale = null)
{
- if ($locale !== null) {
+ if ($locale instanceof Zend_Config) {
+ $locale = $locale->toArray();
+ }
+
+ if (is_array($locale)) {
+ if (array_key_exists('locale', $locale)) {
+ $locale = $locale['locale'];
+ } else {
+ $locale = null;
+ }
+ }
+
+ if ($locale !== false) {
+ // require_once 'Zend/Registry.php';
+ if (Zend_Registry::isRegistered('Zend_Locale')) {
+ $locale = Zend_Registry::get('Zend_Locale');
+ }
+ }
+
+ if (!empty($locale)) {
$this->setLocale($locale);
}
}
@@ -134,11 +153,13 @@ class Zend_Validate_Iban extends Zend_Validate_Abstract
*/
public function setLocale($locale = null)
{
- require_once 'Zend/Locale.php';
- $locale = Zend_Locale::findLocale($locale);
- if (strlen($locale) < 4) {
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception('Region must be given for IBAN validation');
+ 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');
+ }
}
$this->_locale = $locale;
diff --git a/libs/Zend/Validate/Identical.php b/libs/Zend/Validate/Identical.php
index d1a046ea9f..7b37574050 100644
--- a/libs/Zend/Validate/Identical.php
+++ b/libs/Zend/Validate/Identical.php
@@ -14,18 +14,18 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Identical.php 17684 2009-08-20 09:20:36Z yoshida@zend.co.jp $
+ * @version $Id: Identical.php 22077 2010-05-02 13:44:46Z thomas $
*/
/** @see Zend_Validate_Abstract */
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Identical extends Zend_Validate_Abstract
@@ -42,7 +42,7 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::NOT_SAME => "The token '%token%' does not match the given token '%value%'",
+ self::NOT_SAME => "The two given tokens do not match",
self::MISSING_TOKEN => 'No token was provided to match against',
);
@@ -59,6 +59,7 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract
*/
protected $_tokenString;
protected $_token;
+ protected $_strict = true;
/**
* Sets validator options
@@ -68,12 +69,32 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract
*/
public function __construct($token = null)
{
- if (null !== $token) {
+ if ($token instanceof Zend_Config) {
+ $token = $token->toArray();
+ }
+
+ if (is_array($token) && array_key_exists('token', $token)) {
+ if (array_key_exists('strict', $token)) {
+ $this->setStrict($token['strict']);
+ }
+
+ $this->setToken($token['token']);
+ } else if (null !== $token) {
$this->setToken($token);
}
}
/**
+ * Retrieve token
+ *
+ * @return string
+ */
+ public function getToken()
+ {
+ return $this->_token;
+ }
+
+ /**
* Set token against which to compare
*
* @param mixed $token
@@ -87,13 +108,24 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract
}
/**
- * Retrieve token
+ * Returns the strict parameter
*
- * @return string
+ * @return boolean
*/
- public function getToken()
+ public function getStrict()
{
- return $this->_token;
+ return $this->_strict;
+ }
+
+ /**
+ * Sets the strict parameter
+ *
+ * @param Zend_Validate_Identical
+ */
+ public function setStrict($strict)
+ {
+ $this->_strict = (boolean) $strict;
+ return $this;
}
/**
@@ -103,19 +135,26 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract
* matches that token.
*
* @param mixed $value
+ * @param array $context
* @return boolean
*/
- public function isValid($value)
+ public function isValid($value, $context = null)
{
$this->_setValue((string) $value);
- $token = $this->getToken();
+
+ if (($context !== null) && isset($context) && array_key_exists($this->getToken(), $context)) {
+ $token = $context[$this->getToken()];
+ } else {
+ $token = $this->getToken();
+ }
if ($token === null) {
$this->_error(self::MISSING_TOKEN);
return false;
}
- if ($value !== $token) {
+ $strict = $this->getStrict();
+ if (($strict && ($value !== $token)) || (!$strict && ($value != $token))) {
$this->_error(self::NOT_SAME);
return false;
}
diff --git a/libs/Zend/Validate/InArray.php b/libs/Zend/Validate/InArray.php
index 56940eb1aa..3b1870543c 100644
--- a/libs/Zend/Validate/InArray.php
+++ b/libs/Zend/Validate/InArray.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,34 +14,31 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: InArray.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: InArray.php 20358 2010-01-17 19:03:49Z thomas $
*/
-
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_InArray extends Zend_Validate_Abstract
{
-
const NOT_IN_ARRAY = 'notInArray';
/**
* @var array
*/
protected $_messageTemplates = array(
- self::NOT_IN_ARRAY => "'%value%' was not found in the haystack"
+ self::NOT_IN_ARRAY => "'%value%' was not found in the haystack",
);
/**
@@ -57,19 +53,54 @@ class Zend_Validate_InArray extends Zend_Validate_Abstract
*
* @var boolean
*/
- protected $_strict;
+ protected $_strict = false;
+
+ /**
+ * Whether a recursive search should be done
+ *
+ * @var boolean
+ */
+ protected $_recursive = false;
/**
* Sets validator options
*
- * @param array $haystack
- * @param boolean $strict
+ * @param array|Zend_Config $haystack
* @return void
*/
- public function __construct(array $haystack, $strict = false)
+ public function __construct($options)
{
- $this->setHaystack($haystack)
- ->setStrict($strict);
+ 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();
+ $temp = array();
+ if ($count > 1) {
+ $temp['haystack'] = func_get_arg(0);
+ $temp['strict'] = func_get_arg(1);
+ $options = $temp;
+ } else {
+ $temp = func_get_arg(0);
+ if (!array_key_exists('haystack', $options)) {
+ $options = array();
+ $options['haystack'] = $temp;
+ } else {
+ $options = $temp;
+ }
+ }
+ }
+
+ $this->setHaystack($options['haystack']);
+ if (array_key_exists('strict', $options)) {
+ $this->setStrict($options['strict']);
+ }
+
+ if (array_key_exists('recursive', $options)) {
+ $this->setRecursive($options['recursive']);
+ }
}
/**
@@ -112,7 +143,29 @@ class Zend_Validate_InArray extends Zend_Validate_Abstract
*/
public function setStrict($strict)
{
- $this->_strict = $strict;
+ $this->_strict = (boolean) $strict;
+ return $this;
+ }
+
+ /**
+ * Returns the recursive option
+ *
+ * @return boolean
+ */
+ public function getRecursive()
+ {
+ return $this->_recursive;
+ }
+
+ /**
+ * Sets the recursive option
+ *
+ * @param boolean $recursive
+ * @return Zend_Validate_InArray Provides a fluent interface
+ */
+ public function setRecursive($recursive)
+ {
+ $this->_recursive = (boolean) $recursive;
return $this;
}
@@ -128,11 +181,24 @@ class Zend_Validate_InArray extends Zend_Validate_Abstract
public function isValid($value)
{
$this->_setValue($value);
- if (!in_array($value, $this->_haystack, $this->_strict)) {
- $this->_error(self::NOT_IN_ARRAY);
- return false;
+ if ($this->getRecursive()) {
+ $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($this->_haystack));
+ foreach($iterator as $element) {
+ if ($this->_strict) {
+ if ($element === $value) {
+ return true;
+ }
+ } else if ($element == $value) {
+ return true;
+ }
+ }
+ } else {
+ if (in_array($value, $this->_haystack, $this->_strict)) {
+ return true;
+ }
}
- return true;
- }
+ $this->_error(self::NOT_IN_ARRAY);
+ return false;
+ }
}
diff --git a/libs/Zend/Validate/Int.php b/libs/Zend/Validate/Int.php
index 1e34ee3427..89fa168627 100644
--- a/libs/Zend/Validate/Int.php
+++ b/libs/Zend/Validate/Int.php
@@ -14,25 +14,25 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Int.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: Int.php 20532 2010-01-22 20:18:23Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @see Zend_Locale_Format
*/
-require_once 'Zend/Locale/Format.php';
+// require_once 'Zend/Locale/Format.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Int extends Zend_Validate_Abstract
@@ -44,8 +44,8 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::INVALID => "Invalid type given, value should be a string or a integer",
- self::NOT_INT => "'%value%' does not appear to be an integer"
+ self::INVALID => "Invalid type given, value should be string or integer",
+ self::NOT_INT => "'%value%' does not appear to be an integer",
);
protected $_locale;
@@ -53,10 +53,29 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
/**
* Constructor for the integer validator
*
- * @param string|Zend_Locale $locale
+ * @param string|Zend_Config|Zend_Locale $locale
*/
public function __construct($locale = null)
{
+ if ($locale instanceof Zend_Config) {
+ $locale = $locale->toArray();
+ }
+
+ if (is_array($locale)) {
+ if (array_key_exists('locale', $locale)) {
+ $locale = $locale['locale'];
+ } else {
+ $locale = null;
+ }
+ }
+
+ if (empty($locale)) {
+ // require_once 'Zend/Registry.php';
+ if (Zend_Registry::isRegistered('Zend_Locale')) {
+ $locale = Zend_Registry::get('Zend_Locale');
+ }
+ }
+
if ($locale !== null) {
$this->setLocale($locale);
}
@@ -77,7 +96,7 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
*/
public function setLocale($locale = null)
{
- require_once 'Zend/Locale.php';
+ // require_once 'Zend/Locale.php';
$this->_locale = Zend_Locale::findLocale($locale);
return $this;
}
@@ -97,6 +116,10 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
return false;
}
+ if (is_int($value)) {
+ return true;
+ }
+
$this->_setValue($value);
if ($this->_locale === null) {
$locale = localeconv();
@@ -110,8 +133,7 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
} else {
try {
- if (!Zend_Locale_Format::isInteger($value, array('locale' => 'en')) &&
- !Zend_Locale_Format::isInteger($value, array('locale' => $this->_locale))) {
+ if (!Zend_Locale_Format::isInteger($value, array('locale' => $this->_locale))) {
$this->_error(self::NOT_INT);
return false;
}
diff --git a/libs/Zend/Validate/Interface.php b/libs/Zend/Validate/Interface.php
index 842a57a8d1..9dfca94219 100644
--- a/libs/Zend/Validate/Interface.php
+++ b/libs/Zend/Validate/Interface.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,16 +14,15 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: Interface.php 20358 2010-01-17 19:03:49Z thomas $
*/
-
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Validate_Interface
@@ -53,19 +51,4 @@ interface Zend_Validate_Interface
* @return array
*/
public function getMessages();
-
- /**
- * Returns an array of message codes that explain why a previous isValid() call
- * returned false.
- *
- * If isValid() was never called or if the most recent isValid() call
- * returned true, then this method returns an empty array.
- *
- * This is now the same as calling array_keys() on the return value from getMessages().
- *
- * @return array
- * @deprecated Since 1.5.0
- */
- public function getErrors();
-
}
diff --git a/libs/Zend/Validate/Ip.php b/libs/Zend/Validate/Ip.php
index a89bb36fe7..992e60a787 100644
--- a/libs/Zend/Validate/Ip.php
+++ b/libs/Zend/Validate/Ip.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ip.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: Ip.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Ip extends Zend_Validate_Abstract
@@ -40,10 +40,78 @@ class Zend_Validate_Ip extends Zend_Validate_Abstract
*/
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be a string",
- self::NOT_IP_ADDRESS => "'%value%' does not appear to be a valid IP address"
+ self::NOT_IP_ADDRESS => "'%value%' does not appear to be a valid IP address",
);
/**
+ * internal options
+ *
+ * @var array
+ */
+ protected $_options = array(
+ 'allowipv6' => true,
+ 'allowipv4' => true
+ );
+
+ /**
+ * Sets validator options
+ *
+ * @param array $options OPTIONAL Options to set, see the manual for all available options
+ * @return void
+ */
+ public function __construct($options = array())
+ {
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (!is_array($options)) {
+ $options = func_get_args();
+ $temp['allowipv6'] = array_shift($options);
+ if (!empty($options)) {
+ $temp['allowipv4'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ $options += $this->_options;
+ $this->setOptions($options);
+ }
+
+ /**
+ * Returns all set options
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ return $this->_options;
+ }
+
+ /**
+ * Sets the options for this validator
+ *
+ * @param array $options
+ * @return Zend_Validate_Ip
+ */
+ public function setOptions($options)
+ {
+ if (array_key_exists('allowipv6', $options)) {
+ $this->_options['allowipv6'] = (boolean) $options['allowipv6'];
+ }
+
+ if (array_key_exists('allowipv4', $options)) {
+ $this->_options['allowipv4'] = (boolean) $options['allowipv4'];
+ }
+
+ if (!$this->_options['allowipv4'] && !$this->_options['allowipv6']) {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception('Nothing to validate. Check your options');
+ }
+
+ return $this;
+ }
+
+ /**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value is a valid IP address
@@ -59,18 +127,65 @@ class Zend_Validate_Ip extends Zend_Validate_Abstract
}
$this->_setValue($value);
+ if (($this->_options['allowipv4'] && !$this->_options['allowipv6'] && !$this->_validateIPv4($value)) ||
+ (!$this->_options['allowipv4'] && $this->_options['allowipv6'] && !$this->_validateIPv6($value)) ||
+ ($this->_options['allowipv4'] && $this->_options['allowipv6'] && !$this->_validateIPv4($value) && !$this->_validateIPv6($value))) {
+ $this->_error(self::NOT_IP_ADDRESS);
+ return false;
+ }
- if ((ip2long($value) === false) || (long2ip(ip2long($value)) !== $value)) {
- if (!function_exists('inet_pton')) {
- $this->_error(self::NOT_IP_ADDRESS);
- return false;
- } else if ((@inet_pton($value) === false) ||(inet_ntop(@inet_pton($value)) !== $value)) {
- $this->_error(self::NOT_IP_ADDRESS);
+ return true;
+ }
+
+ /**
+ * Validates an IPv4 address
+ *
+ * @param string $value
+ */
+ protected function _validateIPv4($value) {
+ $ip2long = ip2long($value);
+ if($ip2long === false) {
+ return false;
+ }
+
+ return $value == long2ip($ip2long);
+ }
+
+ /**
+ * Validates an IPv6 address
+ *
+ * @param string $value Value to check against
+ * @return boolean True when $value is a valid ipv6 address
+ * False otherwise
+ */
+ protected function _validateIPv6($value) {
+ if (strlen($value) < 3) {
+ return $value == '::';
+ }
+
+ if (strpos($value, '.')) {
+ $lastcolon = strrpos($value, ':');
+ if (!($lastcolon && $this->_validateIPv4(substr($value, $lastcolon + 1)))) {
return false;
}
+
+ $value = substr($value, 0, $lastcolon) . ':0:0';
}
- return true;
- }
+ if (strpos($value, '::') === false) {
+ return preg_match('/\A(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}\z/i', $value);
+ }
+
+ $colonCount = substr_count($value, ':');
+ if ($colonCount < 8) {
+ return preg_match('/\A(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?\z/i', $value);
+ }
+ // special case with ending or starting double colon
+ if ($colonCount == 8) {
+ return preg_match('/\A(?:::)?(?:[a-f0-9]{1,4}:){6}[a-f0-9]{1,4}(?:::)?\z/i', $value);
+ }
+
+ return false;
+ }
}
diff --git a/libs/Zend/Validate/Isbn.php b/libs/Zend/Validate/Isbn.php
new file mode 100644
index 0000000000..e977871b20
--- /dev/null
+++ b/libs/Zend/Validate/Isbn.php
@@ -0,0 +1,279 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Isbn.php 21761 2010-04-04 21:37:18Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Abstract
+ */
+// require_once 'Zend/Validate/Abstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_Isbn extends Zend_Validate_Abstract
+{
+ const AUTO = 'auto';
+ const ISBN10 = '10';
+ const ISBN13 = '13';
+ const INVALID = 'isbnInvalid';
+ const NO_ISBN = 'isbnNoIsbn';
+
+ /**
+ * Validation failure message template definitions.
+ *
+ * @var array
+ */
+ protected $_messageTemplates = array(
+ self::INVALID => "Invalid type given, value should be string or integer",
+ self::NO_ISBN => "'%value%' is no valid ISBN number",
+ );
+
+ /**
+ * Allowed type.
+ *
+ * @var string
+ */
+ protected $_type = self::AUTO;
+
+ /**
+ * Separator character.
+ *
+ * @var string
+ */
+ protected $_separator = '';
+
+ /**
+ * Set up options.
+ *
+ * @param Zend_Config|array $options
+ * @throws Zend_Validate_Exception When $options is not valid
+ * @return void
+ */
+ public function __construct($options = array())
+ {
+ // prepare options
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ }
+ if (!is_array($options)) {
+ /**
+ * @see Zend_Validate_Exception
+ */
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception('Invalid options provided.');
+ }
+
+ // set type
+ if (array_key_exists('type', $options)) {
+ $this->setType($options['type']);
+ }
+
+ // set separator
+ if (array_key_exists('separator', $options)) {
+ $this->setSeparator($options['separator']);
+ }
+ }
+
+ /**
+ * Detect input format.
+ *
+ * @return string
+ */
+ protected function _detectFormat()
+ {
+ // prepare separator and pattern list
+ $sep = quotemeta($this->_separator);
+ $patterns = array();
+ $lengths = array();
+
+ // check for ISBN-10
+ if ($this->_type == self::ISBN10 || $this->_type == self::AUTO) {
+ if (empty($sep)) {
+ $pattern = '/^[0-9]{9}[0-9X]{1}$/';
+ $length = 10;
+ } else {
+ $pattern = "/^[0-9]{1,7}[{$sep}]{1}[0-9]{1,7}[{$sep}]{1}[0-9]{1,7}[{$sep}]{1}[0-9X]{1}$/";
+ $length = 13;
+ }
+
+ $patterns[$pattern] = self::ISBN10;
+ $lengths[$pattern] = $length;
+ }
+
+ // check for ISBN-13
+ if ($this->_type == self::ISBN13 || $this->_type == self::AUTO) {
+ if (empty($sep)) {
+ $pattern = '/^[0-9]{13}$/';
+ $length = 13;
+ } else {
+ $pattern = "/^[0-9]{1,9}[{$sep}]{1}[0-9]{1,5}[{$sep}]{1}[0-9]{1,9}[{$sep}]{1}[0-9]{1,9}[{$sep}]{1}[0-9]{1}$/";
+ $length = 17;
+ }
+
+ $patterns[$pattern] = self::ISBN13;
+ $lengths[$pattern] = $length;
+ }
+
+ // check pattern list
+ foreach ($patterns as $pattern => $type) {
+ if ((strlen($this->_value) == $lengths[$pattern]) && preg_match($pattern, $this->_value)) {
+ return $type;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Defined by Zend_Validate_Interface.
+ *
+ * Returns true if and only if $value is a valid ISBN.
+ *
+ * @param string $value
+ * @return boolean
+ */
+ public function isValid($value)
+ {
+ if (!is_string($value) && !is_int($value)) {
+ $this->_error(self::INVALID);
+ return false;
+ }
+
+ $value = (string) $value;
+ $this->_setValue($value);
+
+ switch ($this->_detectFormat()) {
+ case self::ISBN10:
+ // sum
+ $isbn10 = str_replace($this->_separator, '', $value);
+ $sum = 0;
+ for ($i = 0; $i < 9; $i++) {
+ $sum += (10 - $i) * $isbn10{$i};
+ }
+
+ // checksum
+ $checksum = 11 - ($sum % 11);
+ if ($checksum == 11) {
+ $checksum = '0';
+ } elseif ($checksum == 10) {
+ $checksum = 'X';
+ }
+ break;
+
+ case self::ISBN13:
+ // sum
+ $isbn13 = str_replace($this->_separator, '', $value);
+ $sum = 0;
+ for ($i = 0; $i < 12; $i++) {
+ if ($i % 2 == 0) {
+ $sum += $isbn13{$i};
+ } else {
+ $sum += 3 * $isbn13{$i};
+ }
+ }
+ // checksum
+ $checksum = 10 - ($sum % 10);
+ if ($checksum == 10) {
+ $checksum = '0';
+ }
+ break;
+
+ default:
+ $this->_error(self::NO_ISBN);
+ return false;
+ }
+
+ // validate
+ if (substr($this->_value, -1) != $checksum) {
+ $this->_error(self::NO_ISBN);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Set separator characters.
+ *
+ * It is allowed only empty string, hyphen and space.
+ *
+ * @param string $separator
+ * @throws Zend_Validate_Exception When $separator is not valid
+ * @return Zend_Validate_Isbn Provides a fluent interface
+ */
+ public function setSeparator($separator)
+ {
+ // check separator
+ if (!in_array($separator, array('-', ' ', ''))) {
+ /**
+ * @see Zend_Validate_Exception
+ */
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception('Invalid ISBN separator.');
+ }
+
+ $this->_separator = $separator;
+ return $this;
+ }
+
+ /**
+ * Get separator characters.
+ *
+ * @return string
+ */
+ public function getSeparator()
+ {
+ return $this->_separator;
+ }
+
+ /**
+ * Set allowed ISBN type.
+ *
+ * @param string $type
+ * @throws Zend_Validate_Exception When $type is not valid
+ * @return Zend_Validate_Isbn Provides a fluent interface
+ */
+ public function setType($type)
+ {
+ // check type
+ if (!in_array($type, array(self::AUTO, self::ISBN10, self::ISBN13))) {
+ /**
+ * @see Zend_Validate_Exception
+ */
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception('Invalid ISBN type');
+ }
+
+ $this->_type = $type;
+ return $this;
+ }
+
+ /**
+ * Get allowed ISBN type.
+ *
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->_type;
+ }
+}
diff --git a/libs/Zend/Validate/LessThan.php b/libs/Zend/Validate/LessThan.php
index 5d4e155559..213c766f88 100644
--- a/libs/Zend/Validate/LessThan.php
+++ b/libs/Zend/Validate/LessThan.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,27 +14,24 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: LessThan.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: LessThan.php 20182 2010-01-10 21:12:01Z thomas $
*/
-
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_LessThan extends Zend_Validate_Abstract
{
-
const NOT_LESS = 'notLessThan';
/**
@@ -62,11 +58,24 @@ class Zend_Validate_LessThan extends Zend_Validate_Abstract
/**
* Sets validator options
*
- * @param mixed $max
+ * @param mixed|Zend_Config $max
* @return void
*/
public function __construct($max)
{
+ if ($max instanceof Zend_Config) {
+ $max = $max->toArray();
+ }
+
+ if (is_array($max)) {
+ if (array_key_exists('max', $max)) {
+ $max = $max['max'];
+ } else {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception("Missing option 'max'");
+ }
+ }
+
$this->setMax($max);
}
diff --git a/libs/Zend/Validate/NotEmpty.php b/libs/Zend/Validate/NotEmpty.php
index 304cf4fe70..e370459cf9 100644
--- a/libs/Zend/Validate/NotEmpty.php
+++ b/libs/Zend/Validate/NotEmpty.php
@@ -14,27 +14,51 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: NotEmpty.php 18186 2009-09-17 18:57:00Z matthew $
+ * @version $Id: NotEmpty.php 20193 2010-01-11 10:40:43Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_NotEmpty extends Zend_Validate_Abstract
{
+ const BOOLEAN = 1;
+ const INTEGER = 2;
+ const FLOAT = 4;
+ const STRING = 8;
+ const ZERO = 16;
+ const EMPTY_ARRAY = 32;
+ const NULL = 64;
+ const PHP = 127;
+ const SPACE = 128;
+ const ALL = 255;
+
const INVALID = 'notEmptyInvalid';
const IS_EMPTY = 'isEmpty';
+ protected $_constants = array(
+ self::BOOLEAN => 'boolean',
+ self::INTEGER => 'integer',
+ self::FLOAT => 'float',
+ self::STRING => 'string',
+ self::ZERO => 'zero',
+ self::EMPTY_ARRAY => 'array',
+ self::NULL => 'null',
+ self::PHP => 'php',
+ self::SPACE => 'space',
+ self::ALL => 'all'
+ );
+
/**
* @var array
*/
@@ -44,6 +68,80 @@ class Zend_Validate_NotEmpty extends Zend_Validate_Abstract
);
/**
+ * Internal type to detect
+ *
+ * @var integer
+ */
+ protected $_type = 237;
+
+ /**
+ * Constructor
+ *
+ * @param string|array|Zend_Config $options OPTIONAL
+ */
+ public function __construct($options = null)
+ {
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (!is_array($options)) {
+ $options = func_get_args();
+ $temp = array();
+ if (!empty($options)) {
+ $temp['type'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ if (is_array($options) && array_key_exists('type', $options)) {
+ $this->setType($options['type']);
+ }
+ }
+
+ /**
+ * Returns the set types
+ *
+ * @return array
+ */
+ public function getType()
+ {
+ return $this->_type;
+ }
+
+ /**
+ * Set the types
+ *
+ * @param integer|array $type
+ * @throws Zend_Validate_Exception
+ * @return Zend_Validate_NotEmpty
+ */
+ public function setType($type = null)
+ {
+ if (is_array($type)) {
+ $detected = 0;
+ foreach($type as $value) {
+ if (is_int($value)) {
+ $detected += $value;
+ } else if (in_array($value, $this->_constants)) {
+ $detected += array_search($value, $this->_constants);
+ }
+ }
+
+ $type = $detected;
+ } else if (is_string($type) && in_array($type, $this->_constants)) {
+ $type = array_search($type, $this->_constants);
+ }
+
+ if (!is_int($type) || ($type < 0) || ($type > self::ALL)) {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception('Unknown type');
+ }
+
+ $this->_type = $type;
+ return $this;
+ }
+
+ /**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value is not an empty value.
@@ -59,21 +157,81 @@ class Zend_Validate_NotEmpty extends Zend_Validate_Abstract
return false;
}
+ $type = $this->getType();
$this->_setValue($value);
- if (is_string($value)
- && (('' === $value)
- || preg_match('/^\s+$/s', $value))
- ) {
- $this->_error(self::IS_EMPTY);
- return false;
- } elseif (is_int($value) && (0 === $value)) {
- return true;
- } elseif (!is_string($value) && empty($value)) {
- $this->_error(self::IS_EMPTY);
- return false;
+
+ // SPACE (' ')
+ if ($type >= self::SPACE) {
+ $type -= self::SPACE;
+ if (is_string($value) && (preg_match('/^\s+$/s', $value))) {
+ $this->_error(self::IS_EMPTY);
+ return false;
+ }
+ }
+
+ // NULL (null)
+ if ($type >= self::NULL) {
+ $type -= self::NULL;
+ if (is_null($value)) {
+ $this->_error(self::IS_EMPTY);
+ return false;
+ }
+ }
+
+ // EMPTY_ARRAY (array())
+ if ($type >= self::EMPTY_ARRAY) {
+ $type -= self::EMPTY_ARRAY;
+ if (is_array($value) && ($value == array())) {
+ $this->_error(self::IS_EMPTY);
+ return false;
+ }
+ }
+
+ // ZERO ('0')
+ if ($type >= self::ZERO) {
+ $type -= self::ZERO;
+ if (is_string($value) && ($value == '0')) {
+ $this->_error(self::IS_EMPTY);
+ return false;
+ }
+ }
+
+ // STRING ('')
+ if ($type >= self::STRING) {
+ $type -= self::STRING;
+ if (is_string($value) && ($value == '')) {
+ $this->_error(self::IS_EMPTY);
+ return false;
+ }
+ }
+
+ // FLOAT (0.0)
+ if ($type >= self::FLOAT) {
+ $type -= self::FLOAT;
+ if (is_float($value) && ($value == 0.0)) {
+ $this->_error(self::IS_EMPTY);
+ return false;
+ }
+ }
+
+ // INTEGER (0)
+ if ($type >= self::INTEGER) {
+ $type -= self::INTEGER;
+ if (is_int($value) && ($value == 0)) {
+ $this->_error(self::IS_EMPTY);
+ return false;
+ }
+ }
+
+ // BOOLEAN (false)
+ if ($type >= self::BOOLEAN) {
+ $type -= self::BOOLEAN;
+ if (is_bool($value) && ($value == false)) {
+ $this->_error(self::IS_EMPTY);
+ return false;
+ }
}
return true;
}
-
}
diff --git a/libs/Zend/Validate/PostCode.php b/libs/Zend/Validate/PostCode.php
new file mode 100644
index 0000000000..1ba58a996b
--- /dev/null
+++ b/libs/Zend/Validate/PostCode.php
@@ -0,0 +1,210 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: PostCode.php 21487 2010-03-14 10:17:35Z thomas $
+ */
+
+/**
+ * @see Zend_Validate_Abstract
+ */
+// require_once 'Zend/Validate/Abstract.php';
+
+/**
+ * @see Zend_Locale_Format
+ */
+// require_once 'Zend/Locale/Format.php';
+
+/**
+ * @category Zend
+ * @package Zend_Validate
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Validate_PostCode extends Zend_Validate_Abstract
+{
+ const INVALID = 'postcodeInvalid';
+ const NO_MATCH = 'postcodeNoMatch';
+
+ /**
+ * @var array
+ */
+ protected $_messageTemplates = array(
+ self::INVALID => "Invalid type given. The value should be a string or a integer",
+ self::NO_MATCH => "'%value%' does not appear to be a postal code",
+ );
+
+ /**
+ * Locale to use
+ *
+ * @var string
+ */
+ protected $_locale;
+
+ /**
+ * Manual postal code format
+ *
+ * @var unknown_type
+ */
+ protected $_format;
+
+ /**
+ * Constructor for the integer validator
+ *
+ * Accepts either a string locale, a Zend_Locale object, or an array or
+ * Zend_Config object containing the keys "locale" and/or "format".
+ *
+ * @param string|Zend_Locale|array|Zend_Config $options
+ * @throws Zend_Validate_Exception On empty format
+ */
+ public function __construct($options = null)
+ {
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ }
+
+ if (empty($options)) {
+ // require_once 'Zend/Registry.php';
+ if (Zend_Registry::isRegistered('Zend_Locale')) {
+ $this->setLocale(Zend_Registry::get('Zend_Locale'));
+ }
+ } elseif (is_array($options)) {
+ // Received
+ if (array_key_exists('locale', $options)) {
+ $this->setLocale($options['locale']);
+ }
+
+ if (array_key_exists('format', $options)) {
+ $this->setFormat($options['format']);
+ }
+ } elseif ($options instanceof Zend_Locale || is_string($options)) {
+ // Received Locale object or string locale
+ $this->setLocale($options);
+ }
+
+ $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");
+ }
+ }
+
+ /**
+ * Returns the set locale
+ *
+ * @return string|Zend_Locale The set locale
+ */
+ public function getLocale()
+ {
+ return $this->_locale;
+ }
+
+ /**
+ * Sets the locale to use
+ *
+ * @param string|Zend_Locale $locale
+ * @throws Zend_Validate_Exception On unrecognised region
+ * @throws Zend_Validate_Exception On not detected format
+ * @return Zend_Validate_PostCode Provides fluid interface
+ */
+ 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'");
+ }
+
+ $format = Zend_Locale::getTranslation(
+ $locale->getRegion(),
+ 'postaltoterritory',
+ $this->_locale
+ );
+
+ 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()}'");
+ }
+
+ $this->setFormat($format);
+ return $this;
+ }
+
+ /**
+ * Returns the set postal code format
+ *
+ * @return string
+ */
+ public function getFormat()
+ {
+ return $this->_format;
+ }
+
+ /**
+ * Sets a self defined postal format as regex
+ *
+ * @param string $format
+ * @throws Zend_Validate_Exception On empty format
+ * @return Zend_Validate_PostCode Provides fluid interface
+ */
+ 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");
+ }
+
+ if ($format[0] !== '/') {
+ $format = '/^' . $format;
+ }
+
+ if ($format[strlen($format) - 1] !== '/') {
+ $format .= '$/';
+ }
+
+ $this->_format = $format;
+ return $this;
+ }
+
+ /**
+ * Defined by Zend_Validate_Interface
+ *
+ * Returns true if and only if $value is a valid postalcode
+ *
+ * @param string $value
+ * @return boolean
+ */
+ public function isValid($value)
+ {
+ $this->_setValue($value);
+ if (!is_string($value) && !is_int($value)) {
+ $this->_error(self::INVALID);
+ return false;
+ }
+
+ $format = $this->getFormat();
+ if (!preg_match($format, $value)) {
+ $this->_error(self::NO_MATCH);
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/libs/Zend/Validate/Regex.php b/libs/Zend/Validate/Regex.php
index e4707f5f60..e46143287f 100644
--- a/libs/Zend/Validate/Regex.php
+++ b/libs/Zend/Validate/Regex.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework
*
@@ -15,35 +14,35 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Regex.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: Regex.php 21574 2010-03-19 20:00:37Z thomas $
*/
-
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
-
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Regex extends Zend_Validate_Abstract
{
const INVALID = 'regexInvalid';
const NOT_MATCH = 'regexNotMatch';
+ const ERROROUS = 'regexErrorous';
/**
* @var array
*/
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be string, integer or float",
- self::NOT_MATCH => "'%value%' does not match against pattern '%pattern%'"
+ self::NOT_MATCH => "'%value%' does not match against pattern '%pattern%'",
+ self::ERROROUS => "There was an internal error while using the pattern '%pattern%'",
);
/**
@@ -63,11 +62,25 @@ class Zend_Validate_Regex extends Zend_Validate_Abstract
/**
* Sets validator options
*
- * @param string $pattern
+ * @param string|Zend_Config $pattern
+ * @throws Zend_Validate_Exception On missing 'pattern' parameter
* @return void
*/
public function __construct($pattern)
{
+ if ($pattern instanceof Zend_Config) {
+ $pattern = $pattern->toArray();
+ }
+
+ if (is_array($pattern)) {
+ if (array_key_exists('pattern', $pattern)) {
+ $pattern = $pattern['pattern'];
+ } else {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception("Missing option 'pattern'");
+ }
+ }
+
$this->setPattern($pattern);
}
@@ -85,11 +98,19 @@ class Zend_Validate_Regex extends Zend_Validate_Abstract
* Sets the pattern option
*
* @param string $pattern
+ * @throws Zend_Validate_Exception if there is a fatal error in pattern matching
* @return Zend_Validate_Regex Provides a fluent interface
*/
public function setPattern($pattern)
{
$this->_pattern = (string) $pattern;
+ $status = @preg_match($this->_pattern, "Test");
+
+ if (false === $status) {
+ // require_once 'Zend/Validate/Exception.php';
+ throw new Zend_Validate_Exception("Internal error while using the pattern '$this->_pattern'");
+ }
+
return $this;
}
@@ -99,7 +120,6 @@ class Zend_Validate_Regex extends Zend_Validate_Abstract
* Returns true if and only if $value matches against the pattern option
*
* @param string $value
- * @throws Zend_Validate_Exception if there is a fatal error in pattern matching
* @return boolean
*/
public function isValid($value)
@@ -113,14 +133,15 @@ class Zend_Validate_Regex extends Zend_Validate_Abstract
$status = @preg_match($this->_pattern, $value);
if (false === $status) {
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception("Internal error matching pattern '$this->_pattern' against value '$value'");
+ $this->_error(self::ERROROUS);
+ return false;
}
+
if (!$status) {
$this->_error(self::NOT_MATCH);
return false;
}
+
return true;
}
-
}
diff --git a/libs/Zend/Validate/Sitemap/Changefreq.php b/libs/Zend/Validate/Sitemap/Changefreq.php
index 9ff2715d20..6f023856dc 100644
--- a/libs/Zend/Validate/Sitemap/Changefreq.php
+++ b/libs/Zend/Validate/Sitemap/Changefreq.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Validate
* @subpackage Sitemap
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Changefreq.php 17470 2009-08-08 22:27:09Z thomas $
+ * @version $Id: Changefreq.php 21365 2010-03-07 09:38:41Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validates whether a given value is valid as a sitemap <changefreq> value
@@ -33,7 +33,7 @@ require_once 'Zend/Validate/Abstract.php';
* @category Zend
* @package Zend_Validate
* @subpackage Sitemap
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract
@@ -42,7 +42,8 @@ class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract
* Validation key for not valid
*
*/
- const NOT_VALID = 'invalidSitemapChangefreq';
+ const NOT_VALID = 'sitemapChangefreqNotValid';
+ const INVALID = 'sitemapChangefreqInvalid';
/**
* Validation failure message template definitions
@@ -50,7 +51,8 @@ class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::NOT_VALID => "'%value%' is not a valid sitemap changefreq",
+ self::NOT_VALID => "'%value%' is no valid sitemap changefreq",
+ self::INVALID => "Invalid type given, the value should be a string",
);
/**
@@ -73,8 +75,12 @@ class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract
*/
public function isValid($value)
{
- $this->_setValue($value);
+ if (!is_string($value)) {
+ $this->_error(self::INVALID);
+ return false;
+ }
+ $this->_setValue($value);
if (!is_string($value)) {
return false;
}
diff --git a/libs/Zend/Validate/Sitemap/Lastmod.php b/libs/Zend/Validate/Sitemap/Lastmod.php
index 4f01d1a781..aa2266ecd9 100644
--- a/libs/Zend/Validate/Sitemap/Lastmod.php
+++ b/libs/Zend/Validate/Sitemap/Lastmod.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Validate
* @subpackage Sitemap
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Lastmod.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Lastmod.php 21365 2010-03-07 09:38:41Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validates whether a given value is valid as a sitemap <lastmod> value
@@ -33,7 +33,7 @@ require_once 'Zend/Validate/Abstract.php';
* @category Zend
* @package Zend_Validate
* @subpackage Sitemap
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract
@@ -42,13 +42,14 @@ class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract
* Regular expression to use when validating
*
*/
- const LASTMOD_REGEX = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3])(:[0-5][0-9]){2}(\\+|-)([0-1][0-9]|2[0-3]):[0-5][0-9])?$/m';
+ const LASTMOD_REGEX = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3])(:[0-5][0-9])(:[0-5][0-9])?(\\+|-)([0-1][0-9]|2[0-3]):[0-5][0-9])?$/';
/**
* Validation key for not valid
*
*/
- const NOT_VALID = 'invalidSitemapLastmod';
+ const NOT_VALID = 'sitemapLastmodNotValid';
+ const INVALID = 'sitemapLastmodInvalid';
/**
* Validation failure message template definitions
@@ -56,7 +57,8 @@ class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::NOT_VALID => "'%value%' is not a valid sitemap lastmod",
+ self::NOT_VALID => "'%value%' is no valid sitemap lastmod",
+ self::INVALID => "Invalid type given, the value should be a string",
);
/**
@@ -69,13 +71,18 @@ class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract
*/
public function isValid($value)
{
- $this->_setValue($value);
-
if (!is_string($value)) {
+ $this->_error(self::INVALID);
return false;
}
- return @preg_match(self::LASTMOD_REGEX, $value) == 1;
- }
+ $this->_setValue($value);
+ $result = @preg_match(self::LASTMOD_REGEX, $value);
+ if ($result != 1) {
+ $this->_error(self::NOT_VALID);
+ return false;
+ }
+ return true;
+ }
}
diff --git a/libs/Zend/Validate/Sitemap/Loc.php b/libs/Zend/Validate/Sitemap/Loc.php
index 92d5272030..180f669a01 100644
--- a/libs/Zend/Validate/Sitemap/Loc.php
+++ b/libs/Zend/Validate/Sitemap/Loc.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Validate
* @subpackage Sitemap
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Loc.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Loc.php 21365 2010-03-07 09:38:41Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @see Zend_Uri
*/
-require_once 'Zend/Uri.php';
+// require_once 'Zend/Uri.php';
/**
* Validates whether a given value is valid as a sitemap <loc> value
@@ -38,7 +38,7 @@ require_once 'Zend/Uri.php';
* @category Zend
* @package Zend_Validate
* @subpackage Sitemap
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract
@@ -47,7 +47,8 @@ class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract
* Validation key for not valid
*
*/
- const NOT_VALID = 'invalidSitemapLoc';
+ const NOT_VALID = 'sitemapLocNotValid';
+ const INVALID = 'sitemapLocInvalid';
/**
* Validation failure message template definitions
@@ -55,7 +56,8 @@ class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::NOT_VALID => "'%value%' is not a valid sitemap location",
+ self::NOT_VALID => "'%value%' is no valid sitemap location",
+ self::INVALID => "Invalid type given, the value should be a string",
);
/**
@@ -68,12 +70,18 @@ class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract
*/
public function isValid($value)
{
- $this->_setValue($value);
-
if (!is_string($value)) {
+ $this->_error(self::INVALID);
+ return false;
+ }
+
+ $this->_setValue($value);
+ $result = Zend_Uri::check($value);
+ if ($result !== true) {
+ $this->_error(self::NOT_VALID);
return false;
}
- return Zend_Uri::check($value);
+ return true;
}
}
diff --git a/libs/Zend/Validate/Sitemap/Priority.php b/libs/Zend/Validate/Sitemap/Priority.php
index 3568a9fc0f..58772d5b2d 100644
--- a/libs/Zend/Validate/Sitemap/Priority.php
+++ b/libs/Zend/Validate/Sitemap/Priority.php
@@ -15,15 +15,15 @@
* @category Zend
* @package Zend_Validate
* @subpackage Sitemap
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Priority.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Priority.php 21365 2010-03-07 09:38:41Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* Validates whether a given value is valid as a sitemap <priority> value
@@ -33,7 +33,7 @@ require_once 'Zend/Validate/Abstract.php';
* @category Zend
* @package Zend_Validate
* @subpackage Sitemap
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract
@@ -42,7 +42,8 @@ class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract
* Validation key for not valid
*
*/
- const NOT_VALID = 'invalidSitemapPriority';
+ const NOT_VALID = 'sitemapPriorityNotValid';
+ const INVALID = 'sitemapPriorityInvalid';
/**
* Validation failure message template definitions
@@ -50,7 +51,8 @@ class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::NOT_VALID => "'%value%' is not a valid sitemap priority",
+ self::NOT_VALID => "'%value%' is no valid sitemap priority",
+ self::INVALID => "Invalid type given, the value should be a integer, a float or a numeric string",
);
/**
@@ -63,13 +65,18 @@ class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract
*/
public function isValid($value)
{
- $this->_setValue($value);
-
if (!is_numeric($value)) {
+ $this->_error(self::INVALID);
+ return false;
+ }
+
+ $this->_setValue($value);
+ $value = (float) $value;
+ if ($value < 0 || $value > 1) {
+ $this->_error(self::NOT_VALID);
return false;
}
- $value = (float)$value;
- return $value >= 0 && $value <= 1;
+ return true;
}
}
diff --git a/libs/Zend/Validate/StringLength.php b/libs/Zend/Validate/StringLength.php
index 7ec9125f92..c9362ace22 100644
--- a/libs/Zend/Validate/StringLength.php
+++ b/libs/Zend/Validate/StringLength.php
@@ -14,20 +14,20 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: StringLength.php 16223 2009-06-21 20:04:53Z thomas $
+ * @version $Id: StringLength.php 20358 2010-01-17 19:03:49Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-require_once 'Zend/Validate/Abstract.php';
+// require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_StringLength extends Zend_Validate_Abstract
@@ -42,7 +42,7 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract
protected $_messageTemplates = array(
self::INVALID => "Invalid type given, value should be a string",
self::TOO_SHORT => "'%value%' is less than %min% characters long",
- self::TOO_LONG => "'%value%' is greater than %max% characters long"
+ self::TOO_LONG => "'%value%' is more than %max% characters long",
);
/**
@@ -79,15 +79,39 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract
/**
* Sets validator options
*
- * @param integer $min
- * @param integer $max
+ * @param integer|array|Zend_Config $options
* @return void
*/
- public function __construct($min = 0, $max = null, $encoding = null)
+ public function __construct($options = array())
{
- $this->setMin($min);
- $this->setMax($max);
- $this->setEncoding($encoding);
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } else if (!is_array($options)) {
+ $options = func_get_args();
+ $temp['min'] = array_shift($options);
+ if (!empty($options)) {
+ $temp['max'] = array_shift($options);
+ }
+
+ if (!empty($options)) {
+ $temp['encoding'] = array_shift($options);
+ }
+
+ $options = $temp;
+ }
+
+ if (!array_key_exists('min', $options)) {
+ $options['min'] = 0;
+ }
+
+ $this->setMin($options['min']);
+ if (array_key_exists('max', $options)) {
+ $this->setMax($options['max']);
+ }
+
+ if (array_key_exists('encoding', $options)) {
+ $this->setEncoding($options['encoding']);
+ }
}
/**
@@ -113,7 +137,7 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract
/**
* @see Zend_Validate_Exception
*/
- require_once 'Zend/Validate/Exception.php';
+ // 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");
}
@@ -146,7 +170,7 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract
/**
* @see Zend_Validate_Exception
*/
- require_once 'Zend/Validate/Exception.php';
+ // 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 {
@@ -178,7 +202,7 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract
$orig = iconv_get_encoding('internal_encoding');
$result = iconv_set_encoding('internal_encoding', $encoding);
if (!$result) {
- require_once 'Zend/Validate/Exception.php';
+ // require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Given encoding not supported on this OS!');
}
diff --git a/libs/Zend/Version.php b/libs/Zend/Version.php
index ded3d4cdd1..392ae3c7df 100644
--- a/libs/Zend/Version.php
+++ b/libs/Zend/Version.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Version
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Version.php 18706 2009-10-26 13:15:20Z matthew $
+ * @version $Id: Version.php 22304 2010-05-26 14:25:33Z matthew $
*/
/**
@@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_Version
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
final class Zend_Version
@@ -32,7 +32,7 @@ final class Zend_Version
/**
* Zend Framework version identification - see compareVersion()
*/
- const VERSION = '1.9.5';
+ const VERSION = '1.10.5';
/**
* Compare the specified Zend Framework version string $version
diff --git a/libs/javascript/json2.js b/libs/javascript/json2.js
index d7c3fb5d13..273eca0fc2 100644
--- a/libs/javascript/json2.js
+++ b/libs/javascript/json2.js
@@ -1,29 +1 @@
-// see http://www.json.org/js.html
-if(!this.JSON){JSON={};}
-(function(){function f(n){return n<10?'0'+n:n;}
-if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+
-f(this.getUTCMonth()+1)+'-'+
-f(this.getUTCDate())+'T'+
-f(this.getUTCHours())+':'+
-f(this.getUTCMinutes())+':'+
-f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
-var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
-function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
-if(typeof rep==='function'){value=rep.call(holder,key,value);}
-switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
-gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
-v=partial.length===0?'[]':gap?'[\n'+gap+
-partial.join(',\n'+gap)+'\n'+
-mind+']':'['+partial.join(',')+']';gap=mind;return v;}
-if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
-v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
-mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
-if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
-rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
-return str('',{'':value});};}
-if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
-return reviver.call(holder,key,value);}
-cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
-('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
-if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
-throw new SyntaxError('JSON.parse');};}}()); \ No newline at end of file
+if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}()); \ No newline at end of file
diff --git a/libs/jquery/fdd2div-modified.js b/libs/jquery/fdd2div-modified.js
index a1e4629a0e..2f04934b00 100644
--- a/libs/jquery/fdd2div-modified.js
+++ b/libs/jquery/fdd2div-modified.js
@@ -95,7 +95,11 @@
$('body').append("<div style=\"position:absolute\">"+newForm+"</div>");
child_options+="<li><a href='"+FormAction+"' onclick=\"document.form"+unique_id+"_"+n+".submit();return false;\">"+i.firstChild.nodeValue+"</a></li>\n";
} else {
- child_options+="<li><a href='"+FormAction+SelectName+"="+OptionValue+"'>"+i.firstChild.nodeValue+"</a></li>\n";
+ if($(i).attr('href')) {
+ child_options+="<li><b><a target='_blank' href='"+$(i).attr('href')+"'>"+i.firstChild.nodeValue+"</a></b></li>\n";
+ } else {
+ child_options+="<li><a href='"+FormAction+SelectName+"="+OptionValue+"'>"+i.firstChild.nodeValue+"</a></li>\n";
+ }
}
}
});
diff --git a/libs/jquery/jquery-calendar.css b/libs/jquery/jquery-calendar.css
deleted file mode 100644
index fc40fd1d3e..0000000000
--- a/libs/jquery/jquery-calendar.css
+++ /dev/null
@@ -1,190 +0,0 @@
-/* Main Style Sheet for jQuery Calendar */
-#calendar_div,.calendar_inline {
- font-size: 14px;
- padding: 0;
- margin: 0;
-}
-
-#calendar_div {
- display: none;
- border: 1px solid #777;
- z-index: 10; /*must have*/
-}
-
-#calendar_div,.calendar_control,.calendar_links,.calendar_header,.calendar
- {
- width: 185px;
-}
-
-.calendar_inline {
- float: left;
- display: block;
- border: 0;
-}
-
-.calendar_dialog {
- padding: 5px !important;
- border: 4px ridge #ddd !important;
-}
-
-button.calendar_trigger {
- width: 25px;
-}
-
-img.calendar_trigger {
- margin: 2px;
- vertical-align: middle;
-}
-
-.calendar_prompt {
- float: left;
- width: 181px;
- padding: 2px;
- background: #ddd;
- color: #000;
-}
-
-* html .calendar_prompt {
- width: 185px;
-}
-
-.calendar_control,.calendar_links,.calendar_header,.calendar {
- clear: both;
- float: left;
- color: #fff;
-}
-
-.calendar_control {
- background: #400;
-}
-
-.calendar_links {
- background: #000;
-}
-
-.calendar_control,.calendar_links {
- font-weight: bold;
- font-size: 80%;
- letter-spacing: 1px;
-}
-
-.calendar_links label { /* disabled links */
- padding: 2px 5px;
- color: #888;
-}
-
-.calendar_clear,.calendar_prev {
- float: left;
-}
-
-.calendar_current {
- float: left;
- width: 35%;
- text-align: center;
-}
-
-.calendar_close,.calendar_next {
- float: right;
-}
-
-.calendar_header {
- background: #333;
- text-align: center;
- font-weight: bold;
-}
-
-.calendar_header select {
- background: #333;
- color: #fff;
- border: 0px;
- font-weight: bold;
-}
-
-.calendar {
- background: #ccc;
- text-align: center;
- font-size: 100%;
-}
-
-.calendar a {
- display: block;
- width: 100%;
-}
-
-.calendar .calendar_titleRow {
- background: #777;
-}
-
-.calendar .calendar_daysRow {
- background: #eee;
- color: #666;
-}
-
-.calendar .calendar_daysCell {
- color: #000;
- border: 1px solid #ddd;
-}
-
-#calendar .calendar_daysCell a {
- display: block;
-}
-
-.calendar .calendar_weekEndCell {
- background: #ddd;
-}
-
-.calendar .calendar_daysCellOver {
- background: #fff;
- border: 1px solid #777;
-}
-
-.calendar .calendar_unselectable {
- color: #888;
-}
-
-/* ________ CALENDAR LINKS _______
-
-** Reset link properties and then override them with !important */
-#calendar_div a,.calendar_inline a {
- cursor: pointer;
- margin: 0;
- padding: 0;
- background: none;
- color: #000;
-}
-
-.calendar_inline .calendar_links a {
- padding: 0 5px !important;
-}
-
-.calendar_control a,.calendar_links a {
- padding: 2px 5px !important;
- color: #eee !important;
-}
-
-.calendar_titleRow a {
- color: #eee !important;
-}
-
-.calendar_control a:hover {
- background: #fdd !important;
- color: #333 !important;
-}
-
-.calendar_links a:hover,.calendar_titleRow a:hover {
- background: #ddd !important;
- color: #333 !important;
-}
-
-/* ___________ IE6 IFRAME FIX ________ */
-.calendar_cover {
- display: none; /*sorry for IE5*/
- display /**/: block; /*sorry for IE5*/
- position: absolute; /*must have*/
- z-index: -1; /*must have*/
- filter: mask(); /*must have*/
- top: -4px; /*must have*/
- left: -4px; /*must have*/
- width: 193px; /*must have to match width and borders*/
- height: 200px; /*must have to match maximum height*/
-}
diff --git a/libs/jquery/jquery-calendar.js b/libs/jquery/jquery-calendar.js
deleted file mode 100644
index 6b80456d29..0000000000
--- a/libs/jquery/jquery-calendar.js
+++ /dev/null
@@ -1,72 +0,0 @@
-
-function PopUpCal(){this._nextId=0;this._inst=[];this._curInst=null;this._disabledInputs=[];this._popUpShowing=false;this._inDialog=false;this.regional=[];this.regional['']={clearText:'Clear',closeText:'Close',prevText:'&lt;Prev',nextText:'Next&gt;',currentText:'Today',dayNames:['Su','Mo','Tu','We','Th','Fr','Sa'],monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],dateFormat:'DMY/'};this._defaults={autoPopUp:'focus',appendText:'',buttonText:'...',buttonImage:'',buttonImageOnly:false,closeAtTop:true,hideIfNoPrevNext:false,changeMonth:true,changeYear:true,yearRange:'-10:+10',firstDay:0,changeFirstDay:true,showOtherMonths:false,minDate:null,maxDate:null,speed:'medium',customDate:null,fieldSettings:null,onSelect:null};$.extend(this._defaults,this.regional['']);this._calendarDiv=$('<div id="calendar_div"></div>');$(document.body).append(this._calendarDiv);$(document.body).mousedown(this._checkExternalClick);}
-$.extend(PopUpCal.prototype,{_register:function(inst){var id=this._nextId++;this._inst[id]=inst;return id;},_getInst:function(id){return this._inst[id]||id;},setDefaults:function(settings){$.extend(this._defaults,settings||{});},_doKeyDown:function(e){var inst=popUpCal._getInst(this._calId);if(popUpCal._popUpShowing){switch(e.keyCode){case 9:popUpCal.hideCalendar(inst,'');break;case 13:popUpCal._selectDate(inst);break;case 27:popUpCal.hideCalendar(inst,inst._get('speed'));break;case 33:popUpCal._adjustDate(inst,-1,(e.ctrlKey?'Y':'M'));break;case 34:popUpCal._adjustDate(inst,+1,(e.ctrlKey?'Y':'M'));break;case 35:if(e.ctrlKey)popUpCal._clearDate(inst);break;case 36:if(e.ctrlKey)popUpCal._gotoToday(inst);break;case 37:if(e.ctrlKey)popUpCal._adjustDate(inst,-1,'D');break;case 38:if(e.ctrlKey)popUpCal._adjustDate(inst,-7,'D');break;case 39:if(e.ctrlKey)popUpCal._adjustDate(inst,+1,'D');break;case 40:if(e.ctrlKey)popUpCal._adjustDate(inst,+7,'D');break;}}
-else if(e.keyCode==36&&e.ctrlKey){popUpCal.showFor(this);}},_doKeyPress:function(e){var inst=popUpCal._getInst(this._calId);var chr=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return(chr<' '||chr==inst._get('dateFormat').charAt(3)||(chr>='0'&&chr<='9'));},_connectCalendar:function(target,inst){var $input=$(target);var appendText=inst._get('appendText');if(appendText){$input.after('<span class="calendar_append">'+appendText+'</span>');}
-var autoPopUp=inst._get('autoPopUp');if(autoPopUp=='focus'||autoPopUp=='both'){$input.focus(this.showFor);}
-if(autoPopUp=='button'||autoPopUp=='both'){var buttonText=inst._get('buttonText');var buttonImage=inst._get('buttonImage');var buttonImageOnly=inst._get('buttonImageOnly');var trigger=$(buttonImageOnly?'<img class="calendar_trigger" src="'+
-buttonImage+'" alt="'+buttonText+'" title="'+buttonText+'"/>':'<button type="button" class="calendar_trigger">'+(buttonImage!=''?'<img src="'+buttonImage+'" alt="'+buttonText+'" title="'+buttonText+'"/>':buttonText)+'</button>');$input.wrap('<span class="calendar_wrap"></span>').after(trigger);trigger.click(this.showFor);}
-$input.keydown(this._doKeyDown).keypress(this._doKeyPress);$input[0]._calId=inst._id;},_inlineCalendar:function(target,inst,defaultDate){$(target).append(inst._calendarDiv);target._calId=inst._id;var date=defaultDate;inst._selectedDay=date.getDate();inst._selectedMonth=date.getMonth();inst._selectedYear=date.getFullYear();popUpCal._adjustDate(inst);},dialogCalendar:function(dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){inst=this._dialogInst=new PopUpCalInstance({},false);this._dialogInput=$('<input type="text" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$('body').append(this._dialogInput);this._dialogInput[0]._calId=inst._id;}
-$.extend(inst._settings,settings||{});this._dialogInput.val(dateText);if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
-this._pos=pos||[(windowWidth/2)-100,(windowHeight/2)-100];this._dialogInput.css('left',this._pos[0]+'px').css('top',this._pos[1]+'px');inst._settings.onSelect=onSelect;this._inDialog=true;this._calendarDiv.addClass('calendar_dialog');this.showFor(this._dialogInput[0]);if($.blockUI){$.blockUI(this._calendarDiv);}},enableFor:function(inputs){inputs=(inputs.jquery?inputs:$(inputs));inputs.each(function(){this.disabled=false;$('../button.calendar_trigger',this).each(function(){this.disabled=false;});$('../img.calendar_trigger',this).css({opacity:'1.0',cursor:''});var $this=this;popUpCal._disabledInputs=$.map(popUpCal._disabledInputs,function(value){return(value==$this?null:value);});});},disableFor:function(inputs){inputs=(inputs.jquery?inputs:$(inputs));inputs.each(function(){this.disabled=true;$('../button.calendar_trigger',this).each(function(){this.disabled=true;});$('../img.calendar_trigger',this).css({opacity:'0.5',cursor:'default'});var $this=this;popUpCal._disabledInputs=$.map(popUpCal._disabledInputs,function(value){return(value==$this?null:value);});popUpCal._disabledInputs[popUpCal._disabledInputs.length]=this;});},reconfigureFor:function(control,settings){var inst=this._getInst(control._calId);if(inst){$.extend(inst._settings,settings||{});this._updateCalendar(inst);}},setDateFor:function(control,date){var inst=this._getInst(control._calId);if(inst){inst._setDate(date);}},getDateFor:function(control){var inst=this._getInst(control._calId);return(inst?inst._getDate():null);},showFor:function(target){var input=(target.nodeName&&target.nodeName.toLowerCase()=='input'?target:this);if(input.nodeName.toLowerCase()!='input'){input=$('input',input.parentNode)[0];}
-if(popUpCal._lastInput==input){return;}
-for(var i=0;i<popUpCal._disabledInputs.length;i++){if(popUpCal._disabledInputs[i]==input){return;}}
-var inst=popUpCal._getInst(input._calId);popUpCal.hideCalendar(inst,'');popUpCal._lastInput=input;inst._setDateFromField(input);if(popUpCal._inDialog){input.value='';}
-if(!popUpCal._pos){popUpCal._pos=popUpCal._findPos(input);popUpCal._pos[1]+=input.offsetHeight;}
-inst._calendarDiv.css('position',(popUpCal._inDialog&&$.blockUI?'static':'absolute')).css('left',popUpCal._pos[0]+'px').css('top',popUpCal._pos[1]+'px');popUpCal._pos=null;var fieldSettings=inst._get('fieldSettings');$.extend(inst._settings,(fieldSettings?fieldSettings(input):{}));popUpCal._showCalendar(inst);},_showCalendar:function(id){var inst=this._getInst(id);popUpCal._updateCalendar(inst);if(!inst._inline){var speed=inst._get('speed');inst._calendarDiv.show(speed,function(){popUpCal._popUpShowing=true;popUpCal._afterShow(inst);});if(speed==''){popUpCal._popUpShowing=true;popUpCal._afterShow(inst);}
-if(inst._input[0].type!='hidden'){inst._input[0].focus();}
-this._curInst=inst;}},_updateCalendar:function(inst){inst._calendarDiv.empty().append(inst._generateCalendar());if(inst._input&&inst._input!='hidden'){inst._input[0].focus();}},_afterShow:function(inst){if($.browser.msie){$('#calendar_cover').css({width:inst._calendarDiv[0].offsetWidth+4,height:inst._calendarDiv[0].offsetHeight+4});}},hideCalendar:function(id,speed){var inst=this._getInst(id);if(popUpCal._popUpShowing){speed=(speed!=null?speed:inst._get('speed'));inst._calendarDiv.hide(speed,function(){popUpCal._tidyDialog(inst);});if(speed==''){popUpCal._tidyDialog(inst);}
-popUpCal._popUpShowing=false;popUpCal._lastInput=null;inst._settings.prompt=null;if(popUpCal._inDialog){popUpCal._dialogInput.css('position','absolute').css('left','0px').css('top','-100px');if($.blockUI){$.unblockUI();$('body').append(this._calendarDiv);}}
-popUpCal._inDialog=false;}
-popUpCal._curInst=null;},_tidyDialog:function(inst){inst._calendarDiv.removeClass('calendar_dialog');$('.calendar_prompt',inst._calendarDiv).remove();},_checkExternalClick:function(event){if(!popUpCal._curInst){return;}
-var target=$(event.target);if((target.parents("#calendar_div").length==0)&&(target.attr('class')!='calendar_trigger')&&popUpCal._popUpShowing&&!(popUpCal._inDialog&&$.blockUI))
-{popUpCal.hideCalendar(popUpCal._curInst,'');}},_adjustDate:function(id,offset,period){var inst=this._getInst(id);inst._adjustDate(offset,period);this._updateCalendar(inst);},_gotoToday:function(id){var date=new Date();var inst=this._getInst(id);inst._selectedDay=date.getDate();inst._selectedMonth=date.getMonth();inst._selectedYear=date.getFullYear();this._adjustDate(inst);},_selectMonthYear:function(id,select,period){var inst=this._getInst(id);inst._selectingMonthYear=false;inst[period=='M'?'_selectedMonth':'_selectedYear']=select.options[select.selectedIndex].value-0;this._adjustDate(inst);},_clickMonthYear:function(id){var inst=this._getInst(id);if(inst._input&&inst._selectingMonthYear&&!$.browser.msie){inst._input[0].focus();}
-inst._selectingMonthYear=!inst._selectingMonthYear;},_changeFirstDay:function(id,a){var inst=this._getInst(id);var dayNames=inst._get('dayNames');var value=a.firstChild.nodeValue;for(var i=0;i<7;i++){if(dayNames[i]==value){inst._settings.firstDay=i;break;}}
-this._updateCalendar(inst);},_selectDay:function(id,td){var inst=this._getInst(id);inst._selectedDay=$("a",td).html();this._selectDate(id);},_clearDate:function(id){this._selectDate(id,'');},_selectDate:function(id,dateStr){var inst=this._getInst(id);dateStr=(dateStr!=null?dateStr:inst._formatDate());if(inst._input){inst._input.val(dateStr);}
-var onSelect=inst._get('onSelect');if(onSelect){onSelect(dateStr);}
-else{inst._input.trigger('change');}
-if(inst._inline){this._updateCalendar(inst);}
-else{this.hideCalendar(inst,inst._get('speed'));}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),''];},_findPos:function(obj){if(obj.type=='hidden'){obj=obj.nextSibling;}
-var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){var origcurleft=curleft;curleft+=obj.offsetLeft;if(curleft<0){curleft=origcurleft;}
-curtop+=obj.offsetTop;}}
-return[curleft,curtop];}});function PopUpCalInstance(settings,inline,defaultDate){this._id=popUpCal._register(this);this._selectedDay=0;this._selectedMonth=0;this._selectedYear=0;this._input=null;this._inline=inline;this._calendarDiv=(!inline?popUpCal._calendarDiv:$('<div id="calendar_div_'+this._id+'" class="calendar_inline"></div>'));if(inline){var date=defaultDate;this._currentDate=defaultDate;this._currentDay=date.getDate();this._currentMonth=date.getMonth();this._currentYear=date.getFullYear();}
-this._settings=$.extend({},settings||{});}
-$.extend(PopUpCalInstance.prototype,{_get:function(name){return(this._settings[name]!=null?this._settings[name]:popUpCal._defaults[name]);},_setDateFromField:function(input){this._input=$(input);var dateFormat=this._get('dateFormat');var currentDate=this._input.val().split(dateFormat.charAt(3));if(currentDate.length==3){this._currentDay=parseInt(currentDate[dateFormat.indexOf('D')],10);this._currentMonth=parseInt(currentDate[dateFormat.indexOf('M')],10)-1;this._currentYear=parseInt(currentDate[dateFormat.indexOf('Y')],10);}
-else{var date=new Date();this._currentDay=date.getDate();this._currentMonth=date.getMonth();this._currentYear=date.getFullYear();}
-this._selectedDay=this._currentDay;this._selectedMonth=this._currentMonth;this._selectedYear=this._currentYear;this._adjustDate();},_setDate:function(date){this._selectedDay=this._currentDay=date.getDate();this._selectedMonth=this._currentMonth=date.getMonth();this._selectedYear=this._currentYear=date.getFullYear();this._adjustDate();},_getDate:function(){return new Date(this._currentYear,this._currentMonth,this._currentDay);},_generateCalendar:function(){var today=this._currentDate;today=new Date(today.getFullYear(),today.getMonth(),today.getDate());var controls='<div class="calendar_control">'+'<a class="calendar_clear" onclick="popUpCal._clearDate('+this._id+');">'+
-this._get('clearText')+'</a>'+'<a class="calendar_close" onclick="popUpCal.hideCalendar('+this._id+');">'+
-this._get('closeText')+'</a></div>';var prompt=this._get('prompt');var closeAtTop=this._get('closeAtTop');var hideIfNoPrevNext=this._get('hideIfNoPrevNext');var html=(prompt?'<div class="calendar_prompt">'+prompt+'</div>':'')+
-(closeAtTop&&!this._inline?controls:'')+'<div class="calendar_links">'+
-(this._canAdjustMonth(-1)?'<a class="calendar_prev" '+'onclick="popUpCal._adjustDate('+this._id+', -1, \'M\');">'+this._get('prevText')+'</a>':(hideIfNoPrevNext?'':'<label class="calendar_prev">'+this._get('prevText')+'</label>'))+
-(this._isInRange(today)?'<a class="calendar_current" '+'onclick="popUpCal._gotoToday('+this._id+');">'+this._get('currentText')+'</a>':'')+
-(this._canAdjustMonth(+1)?'<a class="calendar_next" '+'onclick="popUpCal._adjustDate('+this._id+', +1, \'M\');">'+this._get('nextText')+'</a>':(hideIfNoPrevNext?'':'<label class="calendar_next">'+this._get('nextText')+'</label>'))+'</div><div class="calendar_header">';var minDate=this._get('minDate');var maxDate=this._get('maxDate');var monthNames=this._get('monthNames');if(!this._get('changeMonth')){html+=monthNames[this._selectedMonth]+'&nbsp;';}
-else{var inMinYear=(minDate&&minDate.getFullYear()==this._selectedYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==this._selectedYear);html+='<select class="calendar_newMonth" '+'onchange="popUpCal._selectMonthYear('+this._id+', this, \'M\');" '+'onclick="popUpCal._clickMonthYear('+this._id+');">';for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){html+='<option value="'+month+'"'+
-(month==this._selectedMonth?' selected="selected"':'')+'>'+monthNames[month]+'</option>';}}
-html+='</select>';}
-if(!this._get('changeYear')){html+=this._selectedYear;}
-else{var years=this._get('yearRange').split(':');var year=0;var endYear=0;if(years.length!=2){year=this._selectedYear-10;endYear=this._selectedYear+10;}
-else if(years[0].charAt(0)=='+'||years[0].charAt(0)=='-'){year=this._selectedYear+parseInt(years[0],10);endYear=this._selectedYear+parseInt(years[1],10);}
-else{year=parseInt(years[0],10);endYear=parseInt(years[1],10);}
-year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="calendar_newYear" onchange="popUpCal._selectMonthYear('+
-this._id+', this, \'Y\');" '+'onclick="popUpCal._clickMonthYear('+
-this._id+');">';for(;year<=endYear;year++){html+='<option value="'+year+'"'+
-(year==this._selectedYear?' selected="selected"':'')+'>'+year+'</option>';}
-html+='</select>';}
-html+='</div><table class="calendar" cellpadding="0" cellspacing="0"><thead>'+'<tr class="calendar_titleRow">';var firstDay=this._get('firstDay');var changeFirstDay=this._get('changeFirstDay');var dayNames=this._get('dayNames');for(var dow=0;dow<7;dow++){html+='<td>'+(!changeFirstDay?'':'<a onclick="popUpCal._changeFirstDay('+
-this._id+', this);">')+dayNames[(dow+firstDay)%7]+
-(changeFirstDay?'</a>':'')+'</td>';}
-html+='</tr></thead><tbody>';var daysInMonth=this._getDaysInMonth(this._selectedYear,this._selectedMonth);this._selectedDay=Math.min(this._selectedDay,daysInMonth);var leadDays=(this._getFirstDayOfMonth(this._selectedYear,this._selectedMonth)-firstDay+7)%7;var currentDate=new Date(this._currentYear,this._currentMonth,this._currentDay);var selectedDate=new Date(this._selectedYear,this._selectedMonth,this._selectedDay);var printDate=new Date(this._selectedYear,this._selectedMonth,1-leadDays);var numRows=Math.ceil((leadDays+daysInMonth)/7);var customDate=this._get('customDate');var showOtherMonths=this._get('showOtherMonths');for(var row=0;row<numRows;row++){html+='<tr class="calendar_daysRow">';for(var dow=0;dow<7;dow++){var customSettings=(customDate?customDate(printDate):[true,'']);var otherMonth=(printDate.getMonth()!=this._selectedMonth);var unselectable=otherMonth||!customSettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);html+='<td class="calendar_daysCell'+
-((dow+firstDay+6)%7>=5?' calendar_weekEndCell':'')+
-(otherMonth?' calendar_otherMonth':'')+
-(unselectable?' calendar_unselectable':'')+
-(!otherMonth||showOtherMonths?' '+customSettings[1]:'')+
-(printDate.getTime()==currentDate.getTime()?' calendar_currentDay':(printDate.getTime()==today.getTime()?' calendar_today':''))+'"'+
-(unselectable?'':' onmouseover="$(this).addClass(\'calendar_daysCellOver\');"'+' onmouseout="$(this).removeClass(\'calendar_daysCellOver\');"'+' onclick="popUpCal._selectDay('+this._id+', this);"')+'>'+
-(otherMonth?(showOtherMonths?printDate.getDate():'&nbsp;'):(unselectable?printDate.getDate():'<a>'+printDate.getDate()+'</a>'))+'</td>';printDate.setDate(printDate.getDate()+1);}
-html+='</tr>';}
-html+='</tbody></table>'+(!closeAtTop&&!this._inline?controls:'')+'<div style="clear: both;"></div>'+(!$.browser.msie?'':'<!--[if lte IE 6.5]><iframe src="javascript:false;" class="calendar_cover"></iframe><![endif]-->');return html;},_adjustDate:function(offset,period){var date=new Date(this._selectedYear+(period=='Y'?offset:0),this._selectedMonth+(period=='M'?offset:0),this._selectedDay+(period=='D'?offset:0));var minDate=this._get('minDate');var maxDate=this._get('maxDate');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);this._selectedDay=date.getDate();this._selectedMonth=date.getMonth();this._selectedYear=date.getFullYear();},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(offset){var date=new Date(this._selectedYear,this._selectedMonth+offset,1);if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));}
-return this._isInRange(date);},_isInRange:function(date){var minDate=this._get('minDate');var maxDate=this._get('maxDate');return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate));},_formatDate:function(){var day=this._currentDay=this._selectedDay;var month=this._currentMonth=this._selectedMonth;var year=this._currentYear=this._selectedYear;month++;var dateFormat=this._get('dateFormat');var dateString='';for(var i=0;i<3;i++){dateString+=dateFormat.charAt(3)+
-(dateFormat.charAt(i)=='D'?(day<10?'0':'')+day:(dateFormat.charAt(i)=='M'?(month<10?'0':'')+month:(dateFormat.charAt(i)=='Y'?year:'?')));}
-return dateString.substring(dateFormat.charAt(3)?1:0);}});$.fn.calendar=function(settings,defaultDate){return this.each(function(){var inlineSettings=null;for(attrName in popUpCal._defaults){var attrValue=this.getAttribute('cal:'+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}
-catch(err){inlineSettings[attrName]=attrValue;}}}
-var nodeName=this.nodeName.toLowerCase();if(nodeName=='input'){var instSettings=(inlineSettings?$.extend($.extend({},settings||{}),inlineSettings||{}):settings);var inst=(inst&&!inlineSettings?inst:new PopUpCalInstance(instSettings,false,defaultDate));popUpCal._connectCalendar(this,inst);}
-else if(nodeName=='div'||nodeName=='span'){var instSettings=$.extend($.extend({},settings||{}),inlineSettings||{});var inst=new PopUpCalInstance(instSettings,true,defaultDate);popUpCal._inlineCalendar(this,inst,defaultDate);}});};$(document).ready(function(){popUpCal=new PopUpCal();});
diff --git a/libs/jquery/jquery-ui.js b/libs/jquery/jquery-ui.js
index 013c0364a9..4b7a52cddb 100644
--- a/libs/jquery/jquery-ui.js
+++ b/libs/jquery/jquery-ui.js
@@ -1,10 +1,393 @@
-/*
- * jQuery UI 1.7.2
+/*!
+ * jQuery UI 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
-jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));a.extend(a.ui.draggable,{version:"1.7.2",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;d.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);(function(a){a.widget("ui.droppable",{_init:function(){var c=this.options,b=c.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};a.ui.ddmanager.droppables[this.options.scope]=a.ui.ddmanager.droppables[this.options.scope]||[];a.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"))},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++){if(b[c]==this){b.splice(c,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(b,c){if(b=="accept"){this.options.accept=c&&a.isFunction(c)?c:function(e){return e.is(c)}}else{a.widget.prototype._setData.apply(this,arguments)}},_activate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}(b&&this._trigger("activate",c,this.ui(b)))},_deactivate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}(b&&this._trigger("deactivate",c,this.ui(b)))},_over:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",c,this.ui(b))}},_out:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",c,this.ui(b))}},_drop:function(c,d){var b=d||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false}var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var f=a.data(this,"droppable");if(f.options.greedy&&a.ui.intersect(b,a.extend(f,{offset:f.element.offset()}),f.options.tolerance)){e=true;return false}});if(e){return false}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",c,this.ui(b));return this.element}return false},ui:function(b){return{draggable:(b.currentItem||b.element),helper:b.helper,position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs}}});a.extend(a.ui.droppable,{version:"1.7.2",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});a.ui.intersect=function(q,j,o){if(!j.offset){return false}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);break;case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);break;case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);return f;break;case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d<b.length;d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue}for(var c=0;c<h.length;c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;continue droppablesLoop}}b[d].visible=b[d].element.css("display")!="none";if(!b[d].visible){continue}b[d].offset=b[d].element.offset();b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};if(f=="mousedown"){b[d]._activate.call(b[d],g)}}},drop:function(b,c){var d=false;a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)){d=this._drop.call(this,c)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(b.currentItem||b.element))){this.isout=1;this.isover=0;this._deactivate.call(this,c)}});return d},drag:function(b,c){if(b.options.refreshPositions){a.ui.ddmanager.prepareOffsets(b,c)}a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var e=a.ui.intersect(b,this,this.options.tolerance);var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);if(!g){return}var f;if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");if(d.length){f=a.data(d[0],"droppable");f.greedyChild=(g=="isover"?1:0)}}if(f&&g=="isover"){f.isover=0;f.isout=1;f._out.call(f,c)}this[g]=1;this[g=="isout"?"isover":"isout"]=0;this[g=="isover"?"_over":"_out"].call(this,c);if(f&&g=="isout"){f.isout=0;f.isover=1;f._over.call(f,c)}})}}})(jQuery);(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,u){var s=(q[u]||0)+(j[u]||0);if(s&&s>=0){o[u]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var e=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a(c.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");e.startselected=true;if(!d.metaKey){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;b._trigger("unselecting",d,{unselecting:e.element})}});a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");e.unselecting=false;e.selecting=true;e.selected=true;b._trigger("selecting",d,{selecting:e.element});return false}})},_mouseDrag:function(i){var c=this;this.dragged=true;if(this.options.disabled){return}var e=this.options;var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;if(d>b){var f=b;b=d;d=f}if(h>g){var f=g;g=h;h=f}this.helper.css({left:d,top:h,width:b-d,height:g-h});this.selectees.each(function(){var j=a.data(this,"selectable-item");if(!j||j.element==c.element[0]){return}var k=false;if(e.tolerance=="touch"){k=(!(j.left>b||j.right<d||j.top>g||j.bottom<h))}else{if(e.tolerance=="fit"){k=(j.left>d&&j.right<b&&j.top>h&&j.bottom<g)}}if(k){if(j.selected){j.$element.removeClass("ui-selected");j.selected=false}if(j.unselecting){j.$element.removeClass("ui-unselecting");j.unselecting=false}if(!j.selecting){j.$element.addClass("ui-selecting");j.selecting=true;c._trigger("selecting",i,{selecting:j.element})}}else{if(j.selecting){if(i.metaKey&&j.startselected){j.$element.removeClass("ui-selecting");j.selecting=false;j.$element.addClass("ui-selected");j.selected=true}else{j.$element.removeClass("ui-selecting");j.selecting=false;if(j.startselected){j.$element.addClass("ui-unselecting");j.unselecting=true}c._trigger("unselecting",i,{unselecting:j.element})}}if(j.selected){if(!i.metaKey&&!j.startselected){j.$element.removeClass("ui-selected");j.selected=false;j.$element.addClass("ui-unselecting");j.unselecting=true;c._trigger("unselecting",i,{unselecting:j.element})}}}});return false},_mouseStop:function(d){var b=this;this.dragged=false;var c=this.options;a(".ui-unselecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-unselecting");e.unselecting=false;e.startselected=false;b._trigger("unselected",d,{unselected:e.element})});a(".ui-selecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-selecting").addClass("ui-selected");e.selecting=false;e.selected=true;e.startselected=true;b._trigger("selected",d,{selected:e.element})});this._trigger("stop",d);this.helper.remove();return false}}));a.extend(a.ui.selectable,{version:"1.7.2",defaults:{appendTo:"body",autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:"*",tolerance:"touch"}})})(jQuery);(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],b=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(c){var b=c||this;return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}}}));a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.2",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.data("ec.storage."+h[f],g[0].style[h[f]])}}},restore:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.css(h[f],g.data("ec.storage."+h[f]))}}},setMode:function(f,g){if(g=="toggle"){g=f.is(":hidden")?"show":"hide"}return g},getBaseline:function(g,h){var i,f;switch(g[0]){case"top":i=0;break;case"middle":i=0.5;break;case"bottom":i=1;break;default:i=g[0]/h.height}switch(g[1]){case"left":f=0;break;case"center":f=0.5;break;case"right":f=1;break;default:f=g[1]/h.width}return{x:f,y:i}},createWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent()}var g={width:f.outerWidth(true),height:f.outerHeight(true),"float":f.css("float")};f.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(d.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return -(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f},easeOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return h*Math.pow(2,-10*i)*Math.sin((i*l-j)*(2*Math.PI)/k)+m+f},easeInOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l/2)==2){return f+m}if(!k){k=l*(0.3*1.5)}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}if(i<1){return -0.5*(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f}return h*Math.pow(2,-10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k)*0.5+m+f},easeInBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*(h/=j)*h*((i+1)*h-i)+f},easeOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*((h=h/j-1)*h*((i+1)*h+i)+1)+f},easeInOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}if((h/=j/2)<1){return k/2*(h*h*(((i*=(1.525))+1)*h-i))+f}return k/2*((h-=2)*h*(((i*=(1.525))+1)*h+i)+2)+f},easeInBounce:function(g,h,f,j,i){return j-d.easing.easeOutBounce(g,i-h,0,j,i)+f},easeOutBounce:function(g,h,f,j,i){if((h/=i)<(1/2.75)){return j*(7.5625*h*h)+f}else{if(h<(2/2.75)){return j*(7.5625*(h-=(1.5/2.75))*h+0.75)+f}else{if(h<(2.5/2.75)){return j*(7.5625*(h-=(2.25/2.75))*h+0.9375)+f}else{return j*(7.5625*(h-=(2.625/2.75))*h+0.984375)+f}}}},easeInOutBounce:function(g,h,f,j,i){if(h<i/2){return d.easing.easeInBounce(g,h*2,0,j,i)*0.5+f}return d.easing.easeOutBounce(g,h*2-i,0,j,i)*0.5+j*0.5+f}})})(jQuery);(function(a){a.effects.blind=function(b){return this.queue(function(){var d=a(this),c=["position","top","left"];var h=a.effects.setMode(d,b.options.mode||"hide");var g=b.options.direction||"vertical";a.effects.save(d,c);d.show();var j=a.effects.createWrapper(d).css({overflow:"hidden"});var e=(g=="vertical")?"height":"width";var i=(g=="vertical")?j.height():j.width();if(h=="show"){j.css(e,0)}var f={};f[e]=h=="show"?i:0;j.animate(f,b.duration,b.options.easing,function(){if(h=="hide"){d.hide()}a.effects.restore(d,c);a.effects.removeWrapper(d);if(b.callback){b.callback.apply(d[0],arguments)}d.dequeue()})})}})(jQuery);(function(a){a.effects.bounce=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];var k=a.effects.setMode(e,b.options.mode||"effect");var n=b.options.direction||"up";var c=b.options.distance||20;var d=b.options.times||5;var g=b.duration||250;if(/show|hide/.test(k)){l.push("opacity")}a.effects.save(e,l);e.show();a.effects.createWrapper(e);var f=(n=="up"||n=="down")?"top":"left";var p=(n=="up"||n=="left")?"pos":"neg";var c=b.options.distance||(f=="top"?e.outerHeight({margin:true})/3:e.outerWidth({margin:true})/3);if(k=="show"){e.css("opacity",0).css(f,p=="pos"?-c:c)}if(k=="hide"){c=c/(d*2)}if(k!="hide"){d--}if(k=="show"){var h={opacity:1};h[f]=(p=="pos"?"+=":"-=")+c;e.animate(h,g/2,b.options.easing);c=c/2;d--}for(var j=0;j<d;j++){var o={},m={};o[f]=(p=="pos"?"-=":"+=")+c;m[f]=(p=="pos"?"+=":"-=")+c;e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing);c=(k=="hide")?c*2:c/2}if(k=="hide"){var h={opacity:0};h[f]=(p=="pos"?"-=":"+=")+c;e.animate(h,g/2,b.options.easing,function(){e.hide();a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}})}else{var o={},m={};o[f]=(p=="pos"?"-=":"+=")+c;m[f]=(p=="pos"?"+=":"-=")+c;e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing,function(){a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}})}e.queue("fx",function(){e.dequeue()});e.dequeue()})}})(jQuery);(function(a){a.effects.clip=function(b){return this.queue(function(){var f=a(this),j=["position","top","left","height","width"];var i=a.effects.setMode(f,b.options.mode||"hide");var k=b.options.direction||"vertical";a.effects.save(f,j);f.show();var c=a.effects.createWrapper(f).css({overflow:"hidden"});var e=f[0].tagName=="IMG"?c:f;var g={size:(k=="vertical")?"height":"width",position:(k=="vertical")?"top":"left"};var d=(k=="vertical")?e.height():e.width();if(i=="show"){e.css(g.size,0);e.css(g.position,d/2)}var h={};h[g.size]=i=="show"?d:0;h[g.position]=i=="show"?0:d/2;e.animate(h,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){f.hide()}a.effects.restore(f,j);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(f[0],arguments)}f.dequeue()}})})}})(jQuery);(function(a){a.effects.drop=function(b){return this.queue(function(){var e=a(this),d=["position","top","left","opacity"];var i=a.effects.setMode(e,b.options.mode||"hide");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e);var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true})/2:e.outerWidth({margin:true})/2);if(i=="show"){e.css("opacity",0).css(f,c=="pos"?-j:j)}var g={opacity:i=="show"?1:0};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);(function(a){a.effects.explode=function(b){return this.queue(function(){var k=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;var e=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?(a(this).is(":visible")?"hide":"show"):b.options.mode;var h=a(this).show().css("visibility","hidden");var l=h.offset();l.top-=parseInt(h.css("marginTop"),10)||0;l.left-=parseInt(h.css("marginLeft"),10)||0;var g=h.outerWidth(true);var c=h.outerHeight(true);for(var f=0;f<k;f++){for(var d=0;d<e;d++){h.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-d*(g/e),top:-f*(c/k)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/e,height:c/k,left:l.left+d*(g/e)+(b.options.mode=="show"?(d-Math.floor(e/2))*(g/e):0),top:l.top+f*(c/k)+(b.options.mode=="show"?(f-Math.floor(k/2))*(c/k):0),opacity:b.options.mode=="show"?0:1}).animate({left:l.left+d*(g/e)+(b.options.mode=="show"?0:(d-Math.floor(e/2))*(g/e)),top:l.top+f*(c/k)+(b.options.mode=="show"?0:(f-Math.floor(k/2))*(c/k)),opacity:b.options.mode=="show"?1:0},b.duration||500)}}setTimeout(function(){b.options.mode=="show"?h.css({visibility:"visible"}):h.css({visibility:"visible"}).hide();if(b.callback){b.callback.apply(h[0])}h.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);(function(a){a.effects.fold=function(b){return this.queue(function(){var e=a(this),k=["position","top","left"];var h=a.effects.setMode(e,b.options.mode||"hide");var o=b.options.size||15;var n=!(!b.options.horizFirst);var g=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(e,k);e.show();var d=a.effects.createWrapper(e).css({overflow:"hidden"});var i=((h=="show")!=n);var f=i?["width","height"]:["height","width"];var c=i?[d.width(),d.height()]:[d.height(),d.width()];var j=/([0-9]+)%/.exec(o);if(j){o=parseInt(j[1],10)/100*c[h=="hide"?0:1]}if(h=="show"){d.css(n?{height:0,width:o}:{height:o,width:0})}var m={},l={};m[f[0]]=h=="show"?c[0]:o;l[f[1]]=h=="show"?c[1]:0;d.animate(m,g,b.options.easing).animate(l,g,b.options.easing,function(){if(h=="hide"){e.hide()}a.effects.restore(e,k);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(e[0],arguments)}e.dequeue()})})}})(jQuery);(function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];var h=a.effects.setMode(e,b.options.mode||"show");var c=b.options.color||"#ffff99";var g=e.css("backgroundColor");a.effects.save(e,d);e.show();e.css({backgroundImage:"none",backgroundColor:c});var f={backgroundColor:g};if(h=="hide"){f.opacity=0}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()}a.effects.restore(e,d);if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);(function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);var g=a.effects.setMode(d,b.options.mode||"show");var f=b.options.times||5;var e=b.duration?b.duration/2:a.fx.speeds._default/2;if(g=="hide"){f--}if(d.is(":hidden")){d.css("opacity",0);d.show();d.animate({opacity:1},e,b.options.easing);f=f-2}for(var c=0;c<f;c++){d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing)}if(g=="hide"){d.animate({opacity:0},e,b.options.easing,function(){d.hide();if(b.callback){b.callback.apply(this,arguments)}})}else{d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing,function(){if(b.callback){b.callback.apply(this,arguments)}})}d.queue("fx",function(){d.dequeue()});d.dequeue()})}})(jQuery);(function(a){a.effects.puff=function(b){return this.queue(function(){var f=a(this);var c=a.extend(true,{},b.options);var h=a.effects.setMode(f,b.options.mode||"hide");var g=parseInt(b.options.percent,10)||150;c.fade=true;var e={height:f.height(),width:f.width()};var d=g/100;f.from=(h=="hide")?e:{height:e.height*d,width:e.width*d};c.from=f.from;c.percent=(h=="hide")?g:100;c.mode=h;f.effect("scale",c,b.duration,b.callback);f.dequeue()})};a.effects.scale=function(b){return this.queue(function(){var g=a(this);var d=a.extend(true,{},b.options);var j=a.effects.setMode(g,b.options.mode||"effect");var h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:(j=="hide"?0:100));var i=b.options.direction||"both";var c=b.options.origin;if(j!="effect"){d.origin=c||["middle","center"];d.restore=true}var f={height:g.height(),width:g.width()};g.from=b.options.from||(j=="show"?{height:0,width:0}:f);var e={y:i!="horizontal"?(h/100):1,x:i!="vertical"?(h/100):1};g.to={height:f.height*e.y,width:f.width*e.x};if(b.options.fade){if(j=="show"){g.from.opacity=0;g.to.opacity=1}if(j=="hide"){g.from.opacity=1;g.to.opacity=0}}d.from=g.from;d.to=g.to;d.mode=j;g.effect("size",d,b.duration,b.callback);g.dequeue()})};a.effects.size=function(b){return this.queue(function(){var c=a(this),n=["position","top","left","width","height","overflow","opacity"];var m=["position","top","left","overflow","opacity"];var j=["width","height","overflow"];var p=["fontSize"];var k=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var f=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var g=a.effects.setMode(c,b.options.mode||"effect");var i=b.options.restore||false;var e=b.options.scale||"both";var o=b.options.origin;var d={height:c.height(),width:c.width()};c.from=b.options.from||d;c.to=b.options.to||d;if(o){var h=a.effects.getBaseline(o,d);c.from.top=(d.height-c.from.height)*h.y;c.from.left=(d.width-c.from.width)*h.x;c.to.top=(d.height-c.to.height)*h.y;c.to.left=(d.width-c.to.width)*h.x}var l={from:{y:c.from.height/d.height,x:c.from.width/d.width},to:{y:c.to.height/d.height,x:c.to.width/d.width}};if(e=="box"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(k);c.from=a.effects.setTransition(c,k,l.from.y,c.from);c.to=a.effects.setTransition(c,k,l.to.y,c.to)}if(l.from.x!=l.to.x){n=n.concat(f);c.from=a.effects.setTransition(c,f,l.from.x,c.from);c.to=a.effects.setTransition(c,f,l.to.x,c.to)}}if(e=="content"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(p);c.from=a.effects.setTransition(c,p,l.from.y,c.from);c.to=a.effects.setTransition(c,p,l.to.y,c.to)}}a.effects.save(c,i?n:m);c.show();a.effects.createWrapper(c);c.css("overflow","hidden").css(c.from);if(e=="content"||e=="both"){k=k.concat(["marginTop","marginBottom"]).concat(p);f=f.concat(["marginLeft","marginRight"]);j=n.concat(k).concat(f);c.find("*[width]").each(function(){child=a(this);if(i){a.effects.save(child,j)}var q={height:child.height(),width:child.width()};child.from={height:q.height*l.from.y,width:q.width*l.from.x};child.to={height:q.height*l.to.y,width:q.width*l.to.x};if(l.from.y!=l.to.y){child.from=a.effects.setTransition(child,k,l.from.y,child.from);child.to=a.effects.setTransition(child,k,l.to.y,child.to)}if(l.from.x!=l.to.x){child.from=a.effects.setTransition(child,f,l.from.x,child.from);child.to=a.effects.setTransition(child,f,l.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){if(i){a.effects.restore(child,j)}})})}c.animate(c.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(g=="hide"){c.hide()}a.effects.restore(c,i?n:m);a.effects.removeWrapper(c);if(b.callback){b.callback.apply(this,arguments)}c.dequeue()}})})}})(jQuery);(function(a){a.effects.shake=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];var k=a.effects.setMode(e,b.options.mode||"effect");var n=b.options.direction||"left";var c=b.options.distance||20;var d=b.options.times||3;var g=b.duration||b.options.duration||140;a.effects.save(e,l);e.show();a.effects.createWrapper(e);var f=(n=="up"||n=="down")?"top":"left";var p=(n=="up"||n=="left")?"pos":"neg";var h={},o={},m={};h[f]=(p=="pos"?"-=":"+=")+c;o[f]=(p=="pos"?"+=":"-=")+c*2;m[f]=(p=="pos"?"-=":"+=")+c*2;e.animate(h,g,b.options.easing);for(var j=1;j<d;j++){e.animate(o,g,b.options.easing).animate(m,g,b.options.easing)}e.animate(o,g,b.options.easing).animate(h,g/2,b.options.easing,function(){a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}});e.queue("fx",function(){e.dequeue()});e.dequeue()})}})(jQuery);(function(a){a.effects.slide=function(b){return this.queue(function(){var e=a(this),d=["position","top","left"];var i=a.effects.setMode(e,b.options.mode||"show");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e).css({overflow:"hidden"});var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true}):e.outerWidth({margin:true}));if(i=="show"){e.css(f,c=="pos"?-j:j)}var g={};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);(function(a){a.effects.transfer=function(b){return this.queue(function(){var f=a(this),h=a(b.options.to),e=h.offset(),g={top:e.top,left:e.left,height:h.innerHeight(),width:h.innerWidth()},d=f.offset(),c=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("<span/>").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);(function($){$.extend($.ui,{datepicker:{version:"1.7.2"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},$.datepicker._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker(null)}var date=this._getDateDatepicker(target);extendRemove(inst.settings,settings);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);date=defaultDate}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+="first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+="last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+="middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?"&#xa0;":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.2";window.DP_jQuery=$})(jQuery);(function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||"&nbsp;",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("<div/>")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("<span/>").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(f){var d=this;if(false===d._trigger("beforeclose",f)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",f)}):d.uiDialog.hide()&&d._trigger("close",f));c.ui.dialog.overlay.resize();d._isOpen=false;if(d.options.modal){var e=0;c(".ui-dialog").each(function(){if(this!=d.uiDialog[0]){e=Math.max(e,c(this).css("z-index"))}});c.ui.dialog.maxZ=e}},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||"&nbsp;");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.2",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){if(c.ui.dialog.overlay.instances.length){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})}},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove();var e=0;c.each(this.instances,function(){e=Math.max(e,this.css("z-index"))});this.maxZ=e},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e<d){return c(window).height()+"px"}else{return e+"px"}}else{return c(document).height()+"px"}},width:function(){if(c.browser.msie&&c.browser.version<7){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var e=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(d<e){return c(window).width()+"px"}else{return d+"px"}}else{return c(document).width()+"px"}},resize:function(){var d=c([]);c.each(c.ui.dialog.overlay.instances,function(){d=d.add(this)});d.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);(function(a){a.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=a('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();a.widget.prototype.destroy.apply(this,arguments)},value:function(b){if(b===undefined){return this._value()}this._setData("value",b);return this},_setData:function(b,c){switch(b){case"value":this.options.value=c;this._refreshValue();this._trigger("change",null,{});break}a.widget.prototype._setData.apply(this,arguments)},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_valueMin:function(){var b=0;return b},_valueMax:function(){var b=100;return b},_refreshValue:function(){var b=this.value();this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(b+"%");this.element.attr("aria-valuenow",b)}});a.extend(a.ui.progressbar,{version:"1.7.2",defaults:{value:0}})})(jQuery);(function(a){a.widget("ui.slider",a.extend({},a.ui.mouse,{_init:function(){var b=this,c=this.options;this._keySliding=false;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");this.range=a([]);if(c.range){if(c.range===true){this.range=a("<div></div>");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("<div></div>")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length<c.values.length){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){if(!c.disabled){a(this).addClass("ui-state-hover")}},function(){a(this).removeClass("ui-state-hover")}).focus(function(){if(!c.disabled){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}else{a(this).blur()}}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(i){var f=true;var e=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i,e)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(e)}else{g=d=b.value()}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return}d=g+h;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return}d=g-h;break}b._slide(i,e,d);return f}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(e,d);b._change(e,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var e=this.options;if(e.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var h={x:d.pageX,y:d.pageY};var j=this._normValueFromMouse(h);var c=this._valueMax()-this._valueMin()+1,f;var k=this,i;this.handles.each(function(l){var m=Math.abs(j-k.values(l));if(c>m){c=m;f=a(this);i=l}});if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])}this._start(d,i);k._handleIndex=i;f.addClass("ui-state-active").focus();var g=f.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};j=this._normValueFromMouse(h);this._slide(d,i,j);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,h;if("horizontal"==this.orientation){c=this.elementSize.width;h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var f=(h/c);if(f>1){f=1}if(f<0){f=0}if("vertical"==this.orientation){f=1-f}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;if(b>(this.options.step/2)){g+=this.options.step}return parseFloat(g.toFixed(5))},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("start",d,b)},_slide:function(f,e,d){var g=this.handles[e];if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);if((this.options.values.length==2&&this.options.range===true)&&((e==0&&d>b)||(e==1&&d<b))){d=b}if(d!=this.values(e)){var c=this.values();c[e]=d;var h=this._trigger("slide",f,{handle:this.handles[e],value:d,values:c});var b=this.values(e?0:1);if(h!==false){this.values(e,d,(f.type=="mousedown"&&this.options.animate),true)}}}else{if(d!=this.value()){var h=this._trigger("slide",f,{handle:this.handles[e],value:d});if(h!==false){this._setData("value",d,(f.type=="mousedown"&&this.options.animate))}}}},_stop:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("stop",d,b)},_change:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("change",d,b)},value:function(b){if(arguments.length){this._setData("value",b);this._change(null,0)}return this._value()},values:function(b,e,c,d){if(arguments.length>1){this.options.values[b]=e;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"disabled":if(d){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled")}else{this.handles.removeAttr("disabled")}case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(c<this._valueMin()){c=this._valueMin()}if(c>this._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(c){var f=this.options.range,d=this.options,l=this;if(this.options.values&&this.options.values.length){var i,h;this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;var m={};m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[c?"animate":"css"](m,d.animate);if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=o})}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;var b={};b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7.2",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b}),function(g,f){return g>=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.2",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i<b.anchors.length?i:0)},d);if(h){h.stopPropagation()}});var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)}}:function(h){t=g.selected;c()});if(d){this.element.bind("tabsshow",c);this.anchors.bind(g.event+".tabs",e);c()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",c);this.anchors.unbind(g.event+".tabs",e);delete this._rotate;delete this._unrotate}}})})(jQuery);
+(function(c){c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.2",plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==
+"hidden")return false;b=b&&b=="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,f,g){return c.ui.isOverAxis(a,d,f)&&c.ui.isOverAxis(b,e,g)},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,
+NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect",
+"none")},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",
+1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==undefined)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b=="absolute"||b=="relative"||b=="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");return(/input|select|textarea|button|object/.test(b)?
+!a.disabled:"a"==b||"area"==b?a.href||!isNaN(d):!isNaN(d))&&!c(a)["area"==b?"parents":"closest"](":hidden").length},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}})}})(jQuery);
+(function(b){var j=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add(this).each(function(){b(this).triggerHandler("remove")});return j.call(b(this),a,c)})};b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend({},c.options);b[e][a].prototype=
+b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.substring(0,1)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==undefined){h=i;return false}}):this.each(function(){var g=
+b.data(this,a);if(g){d&&g.option(d);g._init()}else b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){this.element=b(c).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();
+this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===undefined)return this.options[a];d={};d[a]=c}b.each(d,function(f,
+h){e._setOption(f,h)});return e},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=
+b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
+(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(a._preventClickEvent){a._preventClickEvent=false;b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&
+this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();
+return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);c.browser.safari||a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&
+this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=a.target==this._mouseDownEvent.target;this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-
+a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
+(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
+"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
+this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-
+this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();
+d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||
+this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if(!this.element[0]||!this.element[0].parentNode)return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,
+b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==
+a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||
+0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
+this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-
+(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment==
+"parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&
+a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),
+10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
+this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():
+f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+
+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+
+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-
+this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=
+this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.2"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");
+if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;
+c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=
+1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;
+this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=
+this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=
+d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;
+if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!=
+"HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-
+b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-
+c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,
+width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&
+o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t=
+p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&&
+(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),
+10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
+(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);
+a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&
+this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);
+this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g=
+d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",
+a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.2"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height;
+switch(c){case "fit":return i<e&&g<k&&j<f&&h<l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=i&&
+e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!=
+"none";if(c[f].visible){c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight};e=="mousedown"&&c[f]._activate.call(c[f],b)}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||
+a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e=
+d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})}}})(jQuery);
+(function(d){d.widget("ui.resizable",d.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");d.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
+_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&d.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(d('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),
+top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=
+this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!d(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",
+nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var e=0;e<c.length;e++){var g=d.trim(c[e]),f=d('<div class="ui-resizable-handle '+("ui-resizable-"+g)+'"></div>');/sw|se|ne|nw/.test(g)&&f.css({zIndex:++a.zIndex});"se"==g&&f.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[g]=".ui-resizable-"+g;this.element.append(f)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
+String)this.handles[i]=d(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=d(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}d(this.handles[i])}};this._renderAxis(this.element);this._handles=d(".ui-resizable-handle",this.element).disableSelection();
+this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();d(this.element).addClass("ui-resizable-autohide").hover(function(){d(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){d(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){d(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};
+if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(d(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),
+e=this.element;this.resizing=true;this.documentScroll={top:d(document).scrollTop(),left:d(document).scrollLeft()};if(e.is(".ui-draggable")||/absolute/.test(e.css("position")))e.css({position:"absolute",top:c.top,left:c.left});d.browser.opera&&/relative/.test(e.css("position"))&&e.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var g=m(this.helper.css("top"));if(a.containment){c+=d(a.containment).scrollLeft()||0;g+=d(a.containment).scrollTop()||0}this.offset=
+this.helper.offset();this.position={left:c,top:g};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:c,top:g};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:
+this.originalSize.width/this.originalSize.height||1;a=d(".ui-resizable-"+this.axis).css("cursor");d("body").css("cursor",a=="auto"?this.axis+"-resize":a);e.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,e=this._change[this.axis];if(!e)return false;c=e.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",
+b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var e=this._proportionallyResizeElements,g=e.length&&/textarea/i.test(e[0].nodeName);e=g&&d.ui.hasScroll(e[0],"left")?0:c.sizeDiff.height;
+g={width:c.size.width-(g?0:c.sizeDiff.width),height:c.size.height-e};e=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var f=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(d.extend(g,{top:f,left:e}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}d("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",
+b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(k(b.left))this.position.left=b.left;if(k(b.top))this.position.top=b.top;if(k(b.height))this.size.height=b.height;if(k(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,e=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(e=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(e=="nw"){b.top=
+a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,e=k(b.width)&&a.maxWidth&&a.maxWidth<b.width,g=k(b.height)&&a.maxHeight&&a.maxHeight<b.height,f=k(b.width)&&a.minWidth&&a.minWidth>b.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(f)b.width=a.minWidth;if(h)b.height=a.minHeight;if(e)b.width=a.maxWidth;if(g)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,
+l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(f&&l)b.left=i-a.minWidth;if(e&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(g&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var e=[c.css("borderTopWidth"),
+c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],g=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=d.map(e,function(f,h){f=parseInt(f,10)||0;h=parseInt(g[h],10)||0;return f+h})}d.browser.msie&&(d(b).is(":hidden")||d(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=
+this.element.offset();if(this._helper){this.helper=this.helper||d('<div style="overflow:hidden;"></div>');var a=d.browser.msie&&d.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+
+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return d.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return d.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return d.extend(this._change.n.apply(this,
+arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return d.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){d.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});d.extend(d.ui.resizable,
+{version:"1.8.2"});d.ui.plugin.add("resizable","alsoResize",{start:function(){var b=d(this).data("resizable").options,a=function(c){d(c).each(function(){d(this).data("resizable-alsoresize",{width:parseInt(d(this).width(),10),height:parseInt(d(this).height(),10),left:parseInt(d(this).css("left"),10),top:parseInt(d(this).css("top"),10)})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else d.each(b.alsoResize,function(c){a(c)});
+else a(b.alsoResize)},resize:function(){var b=d(this).data("resizable"),a=b.options,c=b.originalSize,e=b.originalPosition,g={height:b.size.height-c.height||0,width:b.size.width-c.width||0,top:b.position.top-e.top||0,left:b.position.left-e.left||0},f=function(h,i){d(h).each(function(){var j=d(this),l=d(this).data("resizable-alsoresize"),p={};d.each((i&&i.length?i:["width","height","top","left"])||["width","height","top","left"],function(n,o){if((n=(l[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(/relative/.test(j.css("position"))&&
+d.browser.opera){b._revertToRelativePosition=true;j.css({position:"absolute",top:"auto",left:"auto"})}j.css(p)})};typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?d.each(a.alsoResize,function(h,i){f(h,i)}):f(a.alsoResize)},stop:function(){var b=d(this).data("resizable");if(b._revertToRelativePosition&&d.browser.opera){b._revertToRelativePosition=false;el.css({position:"relative"})}d(this).removeData("resizable-alsoresize-start")}});d.ui.plugin.add("resizable","animate",{stop:function(b){var a=
+d(this).data("resizable"),c=a.options,e=a._proportionallyResizeElements,g=e.length&&/textarea/i.test(e[0].nodeName),f=g&&d.ui.hasScroll(e[0],"left")?0:a.sizeDiff.height;g={width:a.size.width-(g?0:a.sizeDiff.width),height:a.size.height-f};f=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(d.extend(g,h&&f?{top:h,left:f}:{}),{duration:c.animateDuration,easing:c.animateEasing,
+step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};e&&e.length&&d(e[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});d.ui.plugin.add("resizable","containment",{start:function(){var b=d(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof d?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=
+d(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:d(document),left:0,top:0,width:d(document).width(),height:d(document).height()||document.body.parentNode.scrollHeight}}else{var e=d(a),g=[];d(["Top","Right","Left","Bottom"]).each(function(i,j){g[i]=m(e.css("padding"+j))});b.containerOffset=e.offset();b.containerPosition=e.position();b.containerSize={height:e.innerHeight()-g[3],width:e.innerWidth()-g[1]};c=b.containerOffset;
+var f=b.containerSize.height,h=b.containerSize.width;h=d.ui.hasScroll(a,"left")?a.scrollWidth:h;f=d.ui.hasScroll(a)?a.scrollHeight:f;b.parentData={element:a,left:c.left,top:c.top,width:h,height:f}}}},resize:function(b){var a=d(this).data("resizable"),c=a.options,e=a.containerOffset,g=a.position;b=a._aspectRatio||b.shiftKey;var f={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))f=e;if(g.left<(a._helper?e.left:0)){a.size.width+=a._helper?a.position.left-e.left:
+a.position.left-f.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?e.left:0}if(g.top<(a._helper?e.top:0)){a.size.height+=a._helper?a.position.top-e.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?e.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-f.left:a.offset.left-f.left)+a.sizeDiff.width);e=Math.abs((a._helper?a.offset.top-f.top:a.offset.top-
+e.top)+a.sizeDiff.height);g=a.containerElement.get(0)==a.element.parent().get(0);f=/relative|absolute/.test(a.containerElement.css("position"));if(g&&f)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(e+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-e;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=d(this).data("resizable"),a=b.options,c=b.containerOffset,e=b.containerPosition,
+g=b.containerElement,f=d(b.helper),h=f.offset(),i=f.outerWidth()-b.sizeDiff.width;f=f.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(g.css("position"))&&d(this).css({left:h.left-e.left-c.left,width:i,height:f});b._helper&&!a.animate&&/static/.test(g.css("position"))&&d(this).css({left:h.left-e.left-c.left,width:i,height:f})}});d.ui.plugin.add("resizable","ghost",{start:function(){var b=d(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,
+display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=d(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=d(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});d.ui.plugin.add("resizable","grid",{resize:function(){var b=
+d(this).data("resizable"),a=b.options,c=b.size,e=b.originalSize,g=b.originalPosition,f=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-e.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-e.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(f)){b.size.width=e.width+h;b.size.height=e.height+a}else if(/^(ne)$/.test(f)){b.size.width=e.width+h;b.size.height=e.height+a;b.position.top=g.top-a}else{if(/^(sw)$/.test(f)){b.size.width=e.width+h;b.size.height=
+e.height+a}else{b.size.width=e.width+h;b.size.height=e.height+a;b.position.top=g.top-a}b.position.left=g.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery);
+(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),
+selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX,
+c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");
+b.unselecting=true;f._trigger("unselecting",c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=
+this;this.dragged=true;if(!this.options.disabled){var d=this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(d.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected");
+a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting");a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",c,{selecting:a.element})}}else{if(a.selecting)if(c.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting=
+true}f._trigger("unselecting",c,{unselecting:a.element})}if(a.selected)if(!c.metaKey&&!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",c,{unselecting:a.element})}}}});return false}},_mouseStop:function(c){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-unselecting");d.unselecting=false;d.startselected=
+false;f._trigger("unselected",c,{unselected:d.element})});e(".ui-selecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected");d.selecting=false;d.selected=true;d.startselected=true;f._trigger("selected",c,{selected:d.element})});this._trigger("stop",c);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.2"})})(jQuery);
+(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable");
+this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,
+arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=
+c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,
+{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();
+if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",
+a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");
+if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+
+this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+
+b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+
+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(b=this.items.length-1;b>=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,
+c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==
+document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp();this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",
+null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):
+d(this.domPosition.parent).prepend(this.currentItem);return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});return c.join("&")},toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},
+_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+j<k&&b+l>g&&b+l<h;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?j:g<b+this.helperProportions.width/
+2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<k},_intersectsWithPointer:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width);b=b&&a;a=this._getDragVerticalDirection();var c=this._getDragHorizontalDirection();if(!b)return false;return this.floating?c&&c=="right"||a=="down"?2:1:a&&(a=="down"?2:1)},_intersectsWithSides:function(a){var b=
+d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width);var c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?e=="right"&&a||e=="left"&&!a:c&&(c=="down"&&b||c=="up"&&!b)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=
+this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?
+h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),
+b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var b=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),this]],e=this._connectWith();if(e)for(var f=e.length-1;f>=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?
+i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h<g;h++){i=d(e[h]);i.data("sortable-item",a);b.push({item:i,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(a){if(this.offsetParent&&this.helper)this.offset.parent=this._getParentOffset();for(var b=this.items.length-1;b>=0;b--){var c=this.items[b],e=this.options.toleranceElement?d(this.options.toleranceElement,
+c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=
+this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-
+parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],
+this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=
+1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-f)<b){b=Math.abs(h-f);e=this.items[g]}}if(e||this.options.dropOnEmpty){this.currentContainer=this.containers[c];e?this._rearrange(a,e,null,true):this._rearrange(a,null,this.containers[c].element,true);this._trigger("change",a,this._uiHash());this.containers[c]._trigger("change",
+a,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}}},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a,this.currentItem])):b.helper=="clone"?this.currentItem.clone():this.currentItem;a.parents("body").length||d(b.appendTo!="parent"?b.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);if(a[0]==
+this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(a[0].style.width==""||b.forceHelperSize)a.width(this.currentItem.width());if(a[0].style.height==""||b.forceHelperSize)a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||
+0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
+this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-
+(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;
+if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var b=
+d(a.containment)[0];a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-
+this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);return{top:b.top+
+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
+this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var f=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])f=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;
+if(a.pageX-this.offset.click.left>this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;f=this.originalPageX+Math.round((f-
+this.originalPageX)/b.grid[0])*b.grid[0];f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-b.grid[0]:f+b.grid[0]:f}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+
+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())}},_rearrange:function(a,b,c,e){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==f.counter&&f.refreshPositions(!e)},0)},_clear:function(a,b){this.reverting=false;var c=[];!this._noFinalSort&&
+this.currentItem[0].parentNode&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if(this._storedCSS[e]=="auto"||this._storedCSS[e]=="static")this._storedCSS[e]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!b&&c.push(function(f){this._trigger("receive",f,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||
+this.domPosition.parent!=this.currentItem.parent()[0])&&!b)c.push(function(f){this._trigger("update",f,this._uiHash())});if(!d.ui.contains(this.element[0],this.currentItem[0])){b||c.push(function(f){this._trigger("remove",f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",
+g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",
+this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b||this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=
+0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position,originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});d.extend(d.ui.sortable,{version:"1.8.2"})})(jQuery);
+jQuery.effects||function(f){function k(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
+16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return l.transparent;return l[f.trim(c).toLowerCase()]}function q(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return k(b)}function m(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
+a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function n(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in r||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function s(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function j(c,a,b,d){if(typeof c=="object"){d=
+a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(f.isFunction(b)){d=b;b=null}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:f.fx.speeds[b]||f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=q(b.elem,a);b.end=k(b.end);b.colorInit=
+true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var l={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,
+183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,
+165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},o=["add","remove","toggle"],r={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,d){if(f.isFunction(b)){d=b;b=null}return this.each(function(){var e=f(this),g=e.attr("style")||" ",h=n(m.call(this)),p,t=e.attr("className");f.each(o,function(u,
+i){c[i]&&e[i+"Class"](c[i])});p=n(m.call(this));e.attr("className",t);e.animate(s(h,p),a,b,function(){f.each(o,function(u,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?
+f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===undefined?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.2",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==
+null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();
+var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});
+c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=j.apply(this,arguments);a={options:a[1],duration:a[2],callback:a[3]};var b=f.effects[c];return b&&!f.fx.off?b.call(this,a):this},_show:f.fn.show,show:function(c){if(!c||
+typeof c=="number"||f.fx.speeds[c])return this._show.apply(this,arguments);else{var a=j.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(!c||typeof c=="number"||f.fx.speeds[c])return this._hide.apply(this,arguments);else{var a=j.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(!c||typeof c=="number"||f.fx.speeds[c]||typeof c=="boolean"||f.isFunction(c))return this.__toggle.apply(this,
+arguments);else{var a=j.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,
+a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+
+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,
+10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*
+a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,
+a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==undefined)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==undefined)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,
+a,b,d,e,g){if(g==undefined)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,
+d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
+(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","left"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,g);b.effects.removeWrapper(a);
+c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
+(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","left"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
+3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
+b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);
+(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","left","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,c/2)}var h={};h[g.size]=
+f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
+(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","left","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e=="show"?1:
+0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
+0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
+e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
+(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
+(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","left"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],10)/100*
+f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
+(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
+this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
+a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
+(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
+b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
+1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","left","width","height","overflow","opacity"],g=["position","top","left","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=c.effects.setMode(a,
+b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};if(m=="box"||m=="both"){if(d.from.y!=
+d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);a.css("overflow","hidden").css(a.from);
+if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);child.to=c.effects.setTransition(child,
+f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,n?e:g);c.effects.removeWrapper(a);b.callback&&
+b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","left"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=(h=="pos"?"-=":"+=")+
+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
+(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","left"],e=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(e=="show")a.css(f,b=="pos"?-g:g);var i={};i[f]=(e=="show"?b=="pos"?
+"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
+b.dequeue()})})}})(jQuery);
+(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},_create:function(){var a=this.options,b=this;this.running=0;this.element.addClass("ui-accordion ui-widget ui-helper-reset");
+this.element.children("li").addClass("ui-accordion-li-fix");this.headers=this.element.find(a.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){c(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
+if(a.navigation){var d=this.element.find("a").filter(a.navigationFilter);if(d.length){var f=d.closest(".ui-accordion-header");this.active=f.length?f:d.closest(".ui-accordion-content").prev()}}this.active=this._findActive(this.active||a.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");this._createIcons();this.resize();this.element.attr("role","tablist");this.headers.attr("role",
+"tab").bind("keydown",function(g){return b._keydown(g)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();this.active.length?this.active.attr("aria-expanded","true").attr("tabIndex","0"):this.headers.eq(0).attr("tabIndex","0");c.browser.safari||this.headers.find("a").attr("tabIndex","-1");a.event&&this.headers.bind(a.event+".accordion",function(g){b._clickHandler.call(b,g,this);g.preventDefault()})},_createIcons:function(){var a=
+this.options;if(a.icons){c("<span/>").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");
+this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex");this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(a.autoHeight||a.fillHeight)b.css("height",
+"");return this},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();b&&this._createIcons()}},_keydown:function(a){var b=c.ui.keyCode;if(!(this.options.disabled||a.altKey||a.ctrlKey)){var d=this.headers.length,f=this.headers.index(a.target),g=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:g=this.headers[(f+1)%d];break;case b.LEFT:case b.UP:g=this.headers[(f-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},
+a.target);a.preventDefault()}if(g){c(a.target).attr("tabIndex","-1");c(g).attr("tabIndex","0");g.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,
+b-c(this).innerHeight()+c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a=="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=
+this.options;if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]==this.active[0];d.active=d.collapsible&&b?false:c(".ui-accordion-header",this.element).index(a);if(!(this.running||!d.collapsible&&b)){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);
+a.next().addClass("ui-accordion-content-active")}e=a.next();f=this.active.next();g={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):e,oldContent:f};d=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(e,f,g,b,d)}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
+this.active.next().addClass("ui-accordion-content-active");var f=this.active.next(),g={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:f},e=this.active=c([]);this._toggle(e,f,g)}},_toggle:function(a,b,d,f,g){var e=this.options,k=this;this.toShow=a;this.toHide=b;this.data=d;var i=function(){if(k)return k._completed.apply(k,arguments)};this._trigger("changestart",null,this.data);this.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&f?{toShow:c([]),
+toHide:b,complete:i,down:g,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:i,down:g,autoHeight:e.autoHeight||e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;f=c.ui.accordion.animations;var h=e.duration,j=e.animated;if(j&&!f[j]&&!c.easing[j])j="slide";f[j]||(f[j]=function(l){this.slide(l,{easing:j,
+duration:h||700})});f[j](d)}else{if(e.collapsible&&f)a.toggle();else{b.hide();a.show()}i(true)}b.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();a.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(a){var b=this.options;this.running=a?0:--this.running;if(!this.running){b.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,
+{version:"1.8.2",animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),f=0,g={},e={},k;b=a.toShow;k=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(i,h){e[h]="hide";i=(""+c.css(a.toShow[0],
+h)).match(/^([\d+-.]+)(.*)$/);g[h]={value:i[1],unit:i[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(e,{step:function(i,h){if(h.prop=="height")f=h.end-h.start===0?0:(h.now-h.start)/(h.end-h.start);a.toShow[0].style[h.prop]=f*g[h.prop].value+g[h.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css("width",k);a.toShow.css({overflow:d});a.complete()}})}else a.toHide.animate({height:"hide"},
+a);else a.toShow.animate({height:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
+(function(e){e.widget("ui.autocomplete",{options:{minLength:1,delay:300},_create:function(){var a=this,c=this.element[0].ownerDocument;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(d){var b=e.ui.keyCode;switch(d.keyCode){case b.PAGE_UP:a._move("previousPage",d);break;case b.PAGE_DOWN:a._move("nextPage",d);break;case b.UP:a._move("previous",d);d.preventDefault();
+break;case b.DOWN:a._move("next",d);d.preventDefault();break;case b.ENTER:case b.NUMPAD_ENTER:a.menu.active&&d.preventDefault();case b.TAB:if(!a.menu.active)return;a.menu.select(d);break;case b.ESCAPE:a.element.val(a.term);a.close(d);break;case b.LEFT:case b.RIGHT:case b.SHIFT:case b.CONTROL:case b.ALT:case b.COMMAND:case b.COMMAND_RIGHT:case b.INSERT:case b.CAPS_LOCK:case b.END:case b.HOME:break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){a.search(null,d)},a.options.delay);
+break}}).bind("focus.autocomplete",function(){a.selectedItem=null;a.previous=a.element.val()}).bind("blur.autocomplete",function(d){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(d);a._change(d)},150)});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=e("<ul></ul>").addClass("ui-autocomplete").appendTo("body",c).mousedown(function(){setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(d,b){b=b.item.data("item.autocomplete");
+false!==a._trigger("focus",null,{item:b})&&/^key/.test(d.originalEvent.type)&&a.element.val(b.value)},selected:function(d,b){b=b.item.data("item.autocomplete");false!==a._trigger("select",d,{item:b})&&a.element.val(b.value);a.close(d);d=a.previous;if(a.element[0]!==c.activeElement){a.element.focus();a.previous=d}a.selectedItem=b},blur:function(){a.menu.element.is(":visible")&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");e.fn.bgiframe&&this.menu.element.bgiframe()},
+destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();e.Widget.prototype.destroy.call(this)},_setOption:function(a){e.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource()},_initSource:function(){var a,c;if(e.isArray(this.options.source)){a=this.options.source;this.source=function(d,b){b(e.ui.autocomplete.filter(a,d.term))}}else if(typeof this.options.source===
+"string"){c=this.options.source;this.source=function(d,b){e.getJSON(c,d,b)}}else this.source=this.options.source},search:function(a,c){a=a!=null?a:this.element.val();if(a.length<this.options.minLength)return this.close(c);clearTimeout(this.closing);if(this._trigger("search")!==false)return this._search(a)},_search:function(a){this.term=this.element.addClass("ui-autocomplete-loading").val();this.source({term:a},this.response)},_response:function(a){if(a.length){a=this._normalize(a);this._suggest(a);
+this._trigger("open")}else this.close();this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this._trigger("close",a);this.menu.element.hide();this.menu.deactivate()}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return e.map(a,function(c){if(typeof c==="string")return{label:c,value:c};return e.extend({label:c.label||
+c.value,value:c.value||c.label},c)})},_suggest:function(a){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1),d;this._renderMenu(c,a);this.menu.deactivate();this.menu.refresh();this.menu.element.show().position({my:"left top",at:"left bottom",of:this.element,collision:"none"});a=c.width("").width();d=this.element.width();c.width(Math.max(a,d))},_renderMenu:function(a,c){var d=this;e.each(c,function(b,f){d._renderItem(a,f)})},_renderItem:function(a,c){return e("<li></li>").data("item.autocomplete",
+c).append("<a>"+c.label+"</a>").appendTo(a)},_move:function(a,c){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](c);else this.search(null,c)},widget:function(){return this.menu.element}});e.extend(e.ui.autocomplete,{escapeRegex:function(a){return a.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")},filter:function(a,c){var d=new RegExp(e.ui.autocomplete.escapeRegex(c),
+"i");return e.grep(a,function(b){return d.test(b.label||b.value||b)})}})})(jQuery);
+(function(e){e.widget("ui.menu",{_create:function(){var a=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(e(c.target).closest(".ui-menu-item a").length){c.preventDefault();a.select(c)}});this.refresh()},refresh:function(){var a=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
+-1).mouseenter(function(c){a.activate(c,e(this).parent())}).mouseleave(function(){a.deactivate()})},activate:function(a,c){this.deactivate();if(this.hasScroll()){var d=c.offset().top-this.element.offset().top,b=this.element.attr("scrollTop"),f=this.element.height();if(d<0)this.element.attr("scrollTop",b+d);else d>f&&this.element.attr("scrollTop",b+d-f+c.height())}this.active=c.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",a,{item:c})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");
+this._trigger("blur");this.active=null}},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prev().length},last:function(){return this.active&&!this.active.next().length},move:function(a,c,d){if(this.active){a=this.active[a+"All"](".ui-menu-item").eq(0);a.length?this.activate(d,a):this.activate(d,this.element.children(c))}else this.activate(d,this.element.children(c))},nextPage:function(a){if(this.hasScroll())if(!this.active||
+this.last())this.activate(a,this.element.children(":first"));else{var c=this.active.offset().top,d=this.element.height(),b=this.element.children("li").filter(function(){var f=e(this).offset().top-c-d+e(this).height();return f<10&&f>-10});b.length||(b=this.element.children(":last"));this.activate(a,b)}else this.activate(a,this.element.children(!this.active||this.last()?":first":":last"))},previousPage:function(a){if(this.hasScroll())if(!this.active||this.first())this.activate(a,this.element.children(":last"));
+else{var c=this.active.offset().top,d=this.element.height();result=this.element.children("li").filter(function(){var b=e(this).offset().top-c+d-e(this).height();return b<10&&b>-10});result.length||(result=this.element.children(":first"));this.activate(a,result)}else this.activate(a,this.element.children(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})})(jQuery);
+(function(a){var g,i=function(b){a(":ui-button",b.target.form).each(function(){var c=a(this).data("button");setTimeout(function(){c.refresh()},1)})},h=function(b){var c=b.name,d=b.form,e=a([]);if(c)e=d?a(d).find("[name='"+c+"']"):a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form});return e};a.widget("ui.button",{options:{text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",i);this._determineButtonType();
+this.hasTitle=!!this.buttonElement.attr("title");var b=this,c=this.options,d=this.type==="checkbox"||this.type==="radio",e="ui-state-hover"+(!d?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){a(this).addClass("ui-state-hover");this===g&&a(this).addClass("ui-state-active")}}).bind("mouseleave.button",
+function(){c.disabled||a(this).removeClass(e)}).bind("focus.button",function(){a(this).addClass("ui-state-focus")}).bind("blur.button",function(){a(this).removeClass("ui-state-focus")});d&&this.element.bind("change.button",function(){b.refresh()});if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled)return false;a(this).toggleClass("ui-state-active");b.buttonElement.attr("aria-pressed",b.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",
+function(){if(c.disabled)return false;a(this).addClass("ui-state-active");b.buttonElement.attr("aria-pressed",true);var f=b.element[0];h(f).not(f).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed",false)});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;a(this).addClass("ui-state-active");g=this;a(document).one("mouseup",function(){g=null})}).bind("mouseup.button",function(){if(c.disabled)return false;a(this).removeClass("ui-state-active")}).bind("keydown.button",
+function(f){if(c.disabled)return false;if(f.keyCode==a.ui.keyCode.SPACE||f.keyCode==a.ui.keyCode.ENTER)a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(f){f.keyCode===a.ui.keyCode.SPACE&&a(this).click()})}this._setOption("disabled",c.disabled)},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?
+"input":"button";if(this.type==="checkbox"||this.type==="radio"){this.buttonElement=this.element.parents().last().find("[for="+this.element.attr("id")+"]");this.element.addClass("ui-helper-hidden-accessible");var b=this.element.is(":checked");b&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",b)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());
+this.hasTitle||this.buttonElement.removeAttr("title");a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled")c?this.element.attr("disabled",true):this.element.removeAttr("disabled");this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b);if(this.type==="radio")h(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed",
+true):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed",false)});else if(this.type==="checkbox")this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed",true):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed",false)},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only"),
+c=a("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary;if(d.primary||d.secondary){b.addClass("ui-button-text-icon"+(e?"s":""));d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>");d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>");if(!this.options.text){b.addClass(e?"ui-button-icons-only":"ui-button-icon-only").removeClass("ui-button-text-icons ui-button-text-icon");
+this.hasTitle||b.attr("title",c)}}else b.addClass("ui-button-text-only")}}});a.widget("ui.buttonset",{_create:function(){this.element.addClass("ui-buttonset");this._init()},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){this.buttons=this.element.find(":button, :submit, :reset, :checkbox, :radio, a, :data(button)").filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()},
+destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");a.Widget.prototype.destroy.call(this)}})})(jQuery);
+(function(d){function J(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
+"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
+"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
+minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}function E(a,b){d.extend(a,
+b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.2"}});var y=(new Date).getTime();d.extend(J.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){E(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=
+f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}},
+_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&
+b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==
+""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,
+c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),
+true);this._updateDatepicker(b);this._updateAlternate(b)}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}E(a.settings,e||{});b=b&&b.constructor==
+Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);
+d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},
+_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=
+d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;
+for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&
+this._hideDatepicker();var h=this._getDateDatepicker(a,true);E(e.settings,f);this._attachments(d(a),e);this._autoSize(e);this._setDateDatepicker(a,h);this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&
+!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass,b.dpDiv).add(d("td."+d.datepicker._currentClass,b.dpDiv));c[0]?d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();
+return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||
+a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,
+a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));
+var c=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||
+a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");E(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);
+d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&
+d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=d.datepicker._getBorders(b.dpDiv);b.dpDiv.find("iframe.ui-datepicker-cover").css({left:-i[0],top:-i[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,
+h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a)).find("iframe.ui-datepicker-cover").css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");
+this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");
+this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);var e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");
+a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input.focus()},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),
+k=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>k&&k>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1);)a=a[b?"previousSibling":"nextSibling"];
+a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():
+"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&
+!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;
+b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){a=this._getInst(d(a)[0]);
+a.input&&a._selectingMonthYear&&!d.browser.msie&&a.input.focus();a._selectingMonthYear=!a._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,
+"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||
+this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;
+for(var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff,f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,k=c=-1,l=-1,u=-1,j=false,o=function(p){(p=z+1<a.length&&a.charAt(z+1)==p)&&z++;return p},m=function(p){o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"?4:p=="o"?3:2)+"}");p=b.substring(s).match(p);if(!p)throw"Missing number at position "+
+s;s+=p[0].length;return parseInt(p[0],10)},n=function(p,w,G){p=o(p)?G:w;for(w=0;w<p.length;w++)if(b.substr(s,p[w].length)==p[w]){s+=p[w].length;return w+1}throw"Unknown name at position "+s;},r=function(){if(b.charAt(s)!=a.charAt(z))throw"Unexpected literal at position "+s;s++},s=0,z=0;z<a.length;z++)if(j)if(a.charAt(z)=="'"&&!o("'"))j=false;else r();else switch(a.charAt(z)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":k=m("m");break;case "M":k=n("M",i,g);break;
+case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "'":if(o("'"))r();else j=true;break;default:r()}if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){k=1;l=u;do{e=this._getDaysInMonth(c,k-1);if(l<=e)break;k++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,
+k-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=k||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?
+c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=j+1<a.length&&a.charAt(j+1)==o)&&j++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},k=function(o,m,n,r){return i(o)?r[m]:n[m]},l="",u=false;if(b)for(var j=0;j<a.length;j++)if(u)if(a.charAt(j)=="'"&&!i("'"))u=false;else l+=a.charAt(j);else switch(a.charAt(j)){case "d":l+=g("d",b.getDate(),2);break;
+case "D":l+=k("D",b.getDay(),e,f);break;case "o":l+=g("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=k("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(j)}return l},_possibleChars:function(a){for(var b="",c=false,
+e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),
+e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},
+_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,k=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,j=u.exec(h);j;){switch(j[2]||"d"){case "d":case "D":g+=parseInt(j[1],10);break;case "w":case "W":g+=parseInt(j[1],
+10)*7;break;case "m":case "M":l+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break;case "y":case "Y":k+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break}j=u.exec(h)}return new Date(k,l,g)};if(b=(b=b==null?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):b)&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;
+a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||
+a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),k=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?
+new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),j=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=j&&n<j?j:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-k,1)),this._getFormatConfig(a));
+n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', -"+k+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,
+g+k,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', +"+k+", 'M');\" title=\""+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>";k=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&
+a.currentDay?u:b;k=!h?k:this.formatDate(k,r,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+y+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,r)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
+y+".datepicker._gotoToday('#"+a.id+"');\">"+k+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;k=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),w=this._get(a,"showOtherMonths"),G=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var K=this._getDefaultDate(a),H="",C=0;C<i[0];C++){for(var L=
+"",D=0;D<i[1];D++){var M=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",x="";if(l){x+='<div class="ui-datepicker-group';if(i[1]>1)switch(D){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&C==0?c?
+f:n:"")+(/all|right/.test(t)&&C==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,j,o,C>0||D>0,z,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var A=k?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var q=(t+h)%7;A+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+r[q]+'">'+s[q]+"</span></th>"}x+=A+"</tr></thead><tbody>";A=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,
+A);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;A=l?6:Math.ceil((t+A)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var N=0;N<A;N++){x+="<tr>";var O=!k?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(q)+"</td>";for(t=0;t<7;t++){var F=p?p.apply(a.input?a.input[0]:null,[q]):[true,""],B=q.getMonth()!=g,I=B&&!G||!F[0]||j&&q<j||o&&q>o;O+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(B?" ui-datepicker-other-month":"")+(q.getTime()==M.getTime()&&g==a.selectedMonth&&
+a._keyEvent||K.getTime()==q.getTime()&&K.getTime()==M.getTime()?" "+this._dayOverClass:"")+(I?" "+this._unselectableClass+" ui-state-disabled":"")+(B&&!w?"":" "+F[1]+(q.getTime()==u.getTime()?" "+this._currentClass:"")+(q.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!B||w)&&F[2]?' title="'+F[2]+'"':"")+(I?"":' onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a.id+"',"+q.getMonth()+","+q.getFullYear()+', this);return false;"')+">"+(B&&!w?"&#xa0;":I?'<span class="ui-state-default">'+q.getDate()+
+"</span>":'<a class="ui-state-default'+(q.getTime()==b.getTime()?" ui-state-highlight":"")+(q.getTime()==u.getTime()?" ui-state-active":"")+(B?" ui-priority-secondary":"")+'" href="#">'+q.getDate()+"</a>")+"</td>";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+=O+"</tr>"}g++;if(g>11){g=0;m++}x+="</tbody></table>"+(l?"</div>"+(i[0]>0&&D==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");L+=x}H+=L}H+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':
+"");a._keyEvent=false;return H},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var k=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),j='<div class="ui-datepicker-title">',o="";if(h||!k)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+
+a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(j+=o+(h||!(k&&l)?"&#xa0;":""));if(h||!l)j+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,
+i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(j+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)j+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";j+="</select>"}j+=this._get(a,"yearSuffix");if(u)j+=(h||!(k&&l)?"&#xa0;":"")+o;j+="</div>";return j},_adjustInstDate:function(a,b,c){var e=
+a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,
+"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);
+c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,
+"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=
+function(a){if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));
+return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new J;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.2";window["DP_jQuery_"+y]=d})(jQuery);
+(function(c){c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");var a=this,b=a.options,d=b.title||a.originalTitle||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),
+h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",
+e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
+a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==
+b.uiDialog[0])d=Math.max(d,c(this).css("z-index"))});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=1;d.uiDialog.css("z-index",
+c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;d.next().length&&d.appendTo("body");a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===
+f[0]&&e.shiftKey){g.focus(1);return false}}});c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();a._trigger("open");a._isOpen=true;return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,function(){return!(d=true)});if(d){c.each(a,
+function(g,f){g=c('<button type="button"></button>').text(g).click(function(){f.apply(b.element[0],arguments)}).appendTo(e);c.fn.button&&g.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");
+b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,originalSize:f.originalSize,position:f.position,size:f.size}}a=a===undefined?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");
+a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",
+f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0];a=a||c.ui.dialog.prototype.options.position;if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(e,g){if(+b[e]===b[e]){d[e]=b[e];b[e]=
+g}})}else if(typeof a==="object"){if("left"in a){b[0]="left";d[0]=a.left}else if("right"in a){b[0]="right";d[0]=-a.right}if("top"in a){b[1]="top";d[1]=a.top}else if("bottom"in a){b[1]="bottom";d[1]=-a.bottom}}(a=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position({my:b.join(" "),at:b.join(" "),offset:d.join(" "),of:window,collision:"fit",using:function(e){var g=c(this).css(e).offset().top;g<0&&c(this).css("top",e.top-g)}});a||this.uiDialog.hide()},_setOption:function(a,
+b){var d=this,e=d.uiDialog,g=e.is(":data(resizable)"),f=false;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):e.removeClass("ui-dialog-disabled");break;case "draggable":b?d._makeDraggable():e.draggable("destroy");break;
+case "height":f=true;break;case "maxHeight":g&&e.resizable("option","maxHeight",b);f=true;break;case "maxWidth":g&&e.resizable("option","maxWidth",b);f=true;break;case "minHeight":g&&e.resizable("option","minHeight",b);f=true;break;case "minWidth":g&&e.resizable("option","minWidth",b);f=true;break;case "position":d._position(b);break;case "resizable":g&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",
+d.uiDialogTitlebar).html(""+(b||"&#160;"));break;case "width":f=true;break}c.Widget.prototype._setOption.apply(d,arguments);f&&d._size()},_size:function(){var a=this.options,b;this.element.css({width:"auto",minHeight:0,height:0});b=this.uiDialog.css({height:"auto",width:a.width}).height();this.element.css(a.height==="auto"?{minHeight:Math.max(a.minHeight-b,0),height:"auto"}:{minHeight:0,height:Math.max(a.height-b,0)}).show();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",
+this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.2",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&
+c(document).bind(c.ui.dialog.overlay.events,function(d){return c(d.target).zIndex()>=c.ui.dialog.overlay.maxZ})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&
+b.bgiframe();this.instances.push(b);return b},destroy:function(a){this.oldInstances.push(this.instances.splice(c.inArray(a,this.instances),1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var b=0;c.each(this.instances,function(){b=Math.max(b,this.css("z-index"))});this.maxZ=b},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,
+document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,
+height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
+(function(c){c.ui=c.ui||{};var m=/left|center|right/,n=/top|center|bottom/,p=c.fn.position,q=c.fn.offset;c.fn.position=function(a){if(!a||!a.of)return p.apply(this,arguments);a=c.extend({},a);var b=c(a.of),d=(a.collision||"flip").split(" "),e=a.offset?a.offset.split(" "):[0,0],g,h,i;if(a.of.nodeType===9){g=b.width();h=b.height();i={top:0,left:0}}else if(a.of.scrollTo&&a.of.document){g=b.width();h=b.height();i={top:b.scrollTop(),left:b.scrollLeft()}}else if(a.of.preventDefault){a.at="left top";g=h=
+0;i={top:a.of.pageY,left:a.of.pageX}}else{g=b.outerWidth();h=b.outerHeight();i=b.offset()}c.each(["my","at"],function(){var f=(a[this]||"").split(" ");if(f.length===1)f=m.test(f[0])?f.concat(["center"]):n.test(f[0])?["center"].concat(f):["center","center"];f[0]=m.test(f[0])?f[0]:"center";f[1]=n.test(f[1])?f[1]:"center";a[this]=f});if(d.length===1)d[1]=d[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(a.at[0]==="right")i.left+=g;else if(a.at[0]==="center")i.left+=
+g/2;if(a.at[1]==="bottom")i.top+=h;else if(a.at[1]==="center")i.top+=h/2;i.left+=e[0];i.top+=e[1];return this.each(function(){var f=c(this),k=f.outerWidth(),l=f.outerHeight(),j=c.extend({},i);if(a.my[0]==="right")j.left-=k;else if(a.my[0]==="center")j.left-=k/2;if(a.my[1]==="bottom")j.top-=l;else if(a.my[1]==="center")j.top-=l/2;j.left=parseInt(j.left);j.top=parseInt(j.top);c.each(["left","top"],function(o,r){c.ui.position[d[o]]&&c.ui.position[d[o]][r](j,{targetWidth:g,targetHeight:h,elemWidth:k,
+elemHeight:l,offset:e,my:a.my,at:a.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(j,{using:a.using}))})};c.ui.position={fit:{left:function(a,b){var d=c(window);b=a.left+b.elemWidth-d.width()-d.scrollLeft();a.left=b>0?a.left-b:Math.max(0,a.left)},top:function(a,b){var d=c(window);b=a.top+b.elemHeight-d.height()-d.scrollTop();a.top=b>0?a.top-b:Math.max(0,a.top)}},flip:{left:function(a,b){if(b.at[0]!=="center"){var d=c(window);d=a.left+b.elemWidth-d.width()-d.scrollLeft();var e=b.my[0]==="left"?
+-b.elemWidth:b.my[0]==="right"?b.elemWidth:0,g=-2*b.offset[0];a.left+=a.left<0?e+b.targetWidth+g:d>0?e-b.targetWidth+g:0}},top:function(a,b){if(b.at[1]!=="center"){var d=c(window);d=a.top+b.elemHeight-d.height()-d.scrollTop();var e=b.my[1]==="top"?-b.elemHeight:b.my[1]==="bottom"?b.elemHeight:0,g=b.at[1]==="top"?b.targetHeight:-b.targetHeight,h=-2*b.offset[1];a.top+=a.top<0?e+b.targetHeight+h:d>0?e+g+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(a,b){if(/static/.test(c.curCSS(a,"position")))a.style.position=
+"relative";var d=c(a),e=d.offset(),g=parseInt(c.curCSS(a,"top",true),10)||0,h=parseInt(c.curCSS(a,"left",true),10)||0;e={top:b.top-e.top+g,left:b.left-e.left+h};"using"in b?b.using.call(a,e):d.css(e)};c.fn.offset=function(a){var b=this[0];if(!b||!b.ownerDocument)return null;if(a)return this.each(function(){c.offset.setOffset(this,a)});return q.call(this)}}})(jQuery);
+(function(b){b.widget("ui.progressbar",{options:{value:0},_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
+this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===undefined)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){switch(a){case "value":this.options.value=c;this._refreshValue();this._trigger("change");break}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;if(a<this._valueMin())a=this._valueMin();if(a>this._valueMax())a=this._valueMax();return a},
+_valueMin:function(){return 0},_valueMax:function(){return 100},_refreshValue:function(){var a=this.value();this.valueDiv[a===this._valueMax()?"addClass":"removeClass"]("ui-corner-right").width(a+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.2"})})(jQuery);
+(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options;this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");b.disabled&&this.element.addClass("ui-slider-disabled ui-disabled");
+this.range=d([]);if(b.range){if(b.range===true){this.range=d("<div></div>");if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}else this.range=d("<div></div>");this.range.appendTo(this.element).addClass("ui-slider-range");if(b.range==="min"||b.range==="max")this.range.addClass("ui-slider-range-"+b.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");
+if(b.values&&b.values.length)for(;d(".ui-slider-handle",this.element).length<b.values.length;)d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();
+else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),g,h,i;if(!a.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e=
+false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");g=a._start(c,f);if(g===false)return}break}i=a.options.step;g=a.options.values&&a.options.values.length?(h=a.values(f)):(h=a.value());switch(c.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(g+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(g-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(g===
+a._valueMax())return;h=a._trimAlignValue(g+i);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(g===a._valueMin())return;h=a._trimAlignValue(g-i);break}a._slide(c,f,h);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(c,e);a._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
+this._mouseDestroy();return this},_mouseCapture:function(a){var b=this.options,c,e,f,g,h,i;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c={x:a.pageX,y:a.pageY};e=this._normValueFromMouse(c);f=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(j){var k=Math.abs(e-h.values(j));if(f>k){f=k;g=d(this);i=j}});if(b.range===true&&this.values(1)===b.min){i+=1;g=d(this.handles[i])}if(this._start(a,
+i)===false)return false;this._mouseSliding=true;h._handleIndex=i;g.addClass("ui-state-active").focus();b=g.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-g.width()/2,top:a.pageY-b.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)};e=this._normValueFromMouse(c);this._slide(a,i,e);return this._animateOff=true},_mouseStart:function(){return true},
+_mouseDrag:function(a){var b=this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;
+if(this.orientation==="horizontal"){b=this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=
+this.values(b);c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var e;if(this.options.values&&this.options.values.length){e=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>e||b===1&&c<e))c=e;if(c!==this.values(b)){e=this.values();e[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],
+value:c});a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
+this._trimAlignValue(a);this._refreshValue();this._change(null,0)}return this._value()},values:function(a,b){var c,e,f;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f<c.length;f+=1){c[f]=this._trimAlignValue(e[f]);this._change(null,f)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):this.value();
+else return this._values()},_setOption:function(a,b){var c,e=0;if(d.isArray(this.options.values))e=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled")}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
+this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<e;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
+return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<this._valueMin())return this._valueMin();if(a>this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=a%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
+this.options.range,b=this.options,c=this,e=!this._animateOff?b.animate:false,f,g={},h,i,j,k;if(this.options.values&&this.options.values.length)this.handles.each(function(l){f=(c.values(l)-c._valueMin())/(c._valueMax()-c._valueMin())*100;g[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](g,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(l===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},b.animate);if(l===1)c.range[e?"animate":"css"]({width:f-
+h+"%"},{queue:false,duration:b.animate})}else{if(l===0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},b.animate);if(l===1)c.range[e?"animate":"css"]({height:f-h+"%"},{queue:false,duration:b.animate})}h=f});else{i=this.value();j=this._valueMin();k=this._valueMax();f=k!==j?(i-j)/(k-j)*100:0;g[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](g,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},
+b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[e?"animate":"css"]({width:100-f+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.2"})})(jQuery);
+(function(d){function s(){return++u}function v(){return++w}var u=0,w=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'},_create:function(){this._tabify(true)},_setOption:function(c,e){if(c=="selected")this.options.collapsible&&
+e==this.options.selected||this.select(e);else{this.options[c]=e;this._tabify()}},_tabId:function(c){return c.title&&c.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+s()},_sanitizeSelector:function(c){return c.replace(/:/g,"\\:")},_cookie:function(){var c=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+v());return d.cookie.apply(null,[c].concat(d.makeArray(arguments)))},_ui:function(c,e){return{tab:c,panel:e,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var c=
+d(this);c.html(c.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function e(g,f){g.css({display:""});!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}this.list=this.element.find("ol,ul").eq(0);this.lis=d("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);var a=this,b=this.options,h=/^#.+/;this.anchors.each(function(g,f){var j=d(f).attr("href"),l=j.split("#")[0],p;if(l&&(l===location.toString().split("#")[0]||
+(p=d("base")[0])&&l===p.href)){j=f.hash;f.href=j}if(h.test(j))a.panels=a.panels.add(a._sanitizeSelector(j));else if(j!="#"){d.data(f,"href.tabs",j);d.data(f,"load.tabs",j.replace(/#.*$/,""));j=a._tabId(f);f.href="#"+j;f=d("#"+j);if(!f.length){f=d(b.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else b.disabled.push(g)});if(c){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
+this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(b.selected===undefined){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){b.selected=g;return false}});if(typeof b.selected!="number"&&b.cookie)b.selected=parseInt(a._cookie(),10);if(typeof b.selected!="number"&&this.lis.filter(".ui-tabs-selected").length)b.selected=
+this.lis.index(this.lis.filter(".ui-tabs-selected"));b.selected=b.selected||(this.lis.length?0:-1)}else if(b.selected===null)b.selected=-1;b.selected=b.selected>=0&&this.anchors[b.selected]||b.selected<0?b.selected:0;b.disabled=d.unique(b.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(b.selected,b.disabled)!=-1&&b.disabled.splice(d.inArray(b.selected,b.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
+if(b.selected>=0&&this.anchors.length){this.panels.eq(b.selected).removeClass("ui-tabs-hide");this.lis.eq(b.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[b.selected],a.panels[b.selected]))});this.load(b.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else b.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));this.element[b.collapsible?"addClass":
+"removeClass"]("ui-tabs-collapsible");b.cookie&&this._cookie(b.selected,b.cookie);c=0;for(var i;i=this.lis[c];c++)d(i)[d.inArray(c,b.disabled)!=-1&&!d(i).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");b.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(b.event!="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+g)};this.lis.bind("mouseover.tabs",
+function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(b.fx)if(d.isArray(b.fx)){m=b.fx[0];o=b.fx[1]}else m=o=b.fx;var q=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",function(){e(f,o);a._trigger("show",
+null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},r=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};this.anchors.bind(b.event+".tabs",
+function(){var g=this,f=d(this).closest("li"),j=a.panels.filter(":not(.ui-tabs-hide)"),l=d(a._sanitizeSelector(this.hash));if(f.hasClass("ui-tabs-selected")&&!b.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}b.selected=a.anchors.index(this);a.abort();if(b.collapsible)if(f.hasClass("ui-tabs-selected")){b.selected=-1;b.cookie&&a._cookie(b.selected,b.cookie);a.element.queue("tabs",function(){r(g,
+j)}).dequeue("tabs");this.blur();return false}else if(!j.length){b.cookie&&a._cookie(b.selected,b.cookie);a.element.queue("tabs",function(){q(g,l)});a.load(a.anchors.index(this));this.blur();return false}b.cookie&&a._cookie(b.selected,b.cookie);if(l.length){j.length&&a.element.queue("tabs",function(){r(g,j)});a.element.queue("tabs",function(){q(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",
+function(){return false})},destroy:function(){var c=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(b,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,
+"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});c.cookie&&this._cookie(null,c.cookie);return this},add:function(c,e,a){if(a===undefined)a=this.anchors.length;var b=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,e));c=!c.indexOf("#")?c.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",
+true);var i=d("#"+c);i.length||(i=d(h.panelTemplate).attr("id",c).data("destroy.tabs",true));i.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);i.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);i.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");i.removeClass("ui-tabs-hide");
+this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(c){var e=this.options,a=this.lis.eq(c).remove(),b=this.panels.eq(c).remove();if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(c+(c+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=c}),function(h){return h>=c?--h:h});this._tabify();this._trigger("remove",
+null,this._ui(a.find("a")[0],b[0]));return this},enable:function(c){var e=this.options;if(d.inArray(c,e.disabled)!=-1){this.lis.eq(c).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=c});this._trigger("enable",null,this._ui(this.anchors[c],this.panels[c]));return this}},disable:function(c){var e=this.options;if(c!=e.selected){this.lis.eq(c).addClass("ui-state-disabled");e.disabled.push(c);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}return this},
+select:function(c){if(typeof c=="string")c=this.anchors.index(this.anchors.filter("[href$="+c+"]"));else if(c===null)c=-1;if(c==-1&&this.options.collapsible)c=this.options.selected;this.anchors.eq(c).trigger(this.options.event+".tabs");return this},load:function(c){var e=this,a=this.options,b=this.anchors.eq(c)[0],h=d.data(b,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(b,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(c).addClass("ui-state-processing");
+if(a.spinner){var i=d("span",b);i.data("label.tabs",i.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){d(e._sanitizeSelector(b.hash)).html(k);e._cleanup();a.cache&&d.data(b,"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[c],e.panels[c]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[c],e.panels[c]));try{a.ajaxOptions.error(k,n,c,b)}catch(m){}}}));e.element.dequeue("tabs");return this}},
+abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(c,e){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.2"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(c,e){var a=this,b=this.options,h=a._rotate||(a._rotate=
+function(i){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=b.selected;a.select(++k<a.anchors.length?k:0)},c);i&&i.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(i){i.clientX&&a.rotate(null)}:function(){t=b.selected;h()});if(c){this.element.bind("tabsshow",h);this.anchors.bind(b.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(b.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
diff --git a/libs/jquery/jquery.bgiframe.js b/libs/jquery/jquery.bgiframe.js
new file mode 100644
index 0000000000..ef8679d906
--- /dev/null
+++ b/libs/jquery/jquery.bgiframe.js
@@ -0,0 +1,10 @@
+/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * $LastChangedDate: 2007-07-21 18:45:56 -0500 (Sat, 21 Jul 2007) $
+ * $Rev: 2447 $
+ *
+ * Version 2.1.1
+ */
+(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery); \ No newline at end of file
diff --git a/libs/jquery/jquery.blockUI.js b/libs/jquery/jquery.blockUI.js
index 35925db955..e5a30ccd2a 100644
--- a/libs/jquery/jquery.blockUI.js
+++ b/libs/jquery/jquery.blockUI.js
@@ -1 +1,14 @@
-(function(f){if(/1\.(0|1|2)\.(0|1|2)/.test(f.fn.jquery)||/^1.1/.test(f.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later! You are using v"+f.fn.jquery);return}f.blockUI=function(m){c(window,m)};f.unblockUI=function(m){g(window,m)};f.growlUI=function(p,n,o){var m=f('<div class="growlUI"></div>');if(p){m.append("<h1>"+p+"</h1>")}if(n){m.append("<h2>"+n+"</h2>")}if(o==undefined){o=3000}f.blockUI({message:m,fadeIn:700,fadeOut:1000,centerY:false,timeout:o,showOverlay:false,css:f.blockUI.defaults.growlCSS})};f.fn.block=function(m){return this.each(function(){if(f.css(this,"position")=="static"){this.style.position="relative"}if(f.browser.msie){this.style.zoom=1}c(this,m)})};f.fn.unblock=function(m){return this.each(function(){g(this,m)})};f.blockUI.version=2.14;f.blockUI.defaults={message:"<h1>Please wait...</h1>",css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},overlayCSS:{backgroundColor:"#000",opacity:"0.6"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:"0.6",cursor:null,color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px"},baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onUnblock:null,quirksmodeOffsetHack:4};var d=f.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);var b=null;var e=[];function c(o,m){var y=(o==window);var p=m&&m.message!==undefined?m.message:undefined;m=f.extend({},f.blockUI.defaults,m||{});m.overlayCSS=f.extend({},f.blockUI.defaults.overlayCSS,m.overlayCSS||{});var x=f.extend({},f.blockUI.defaults.css,m.css||{});p=p===undefined?m.message:p;if(y&&b){g(window,{fadeOut:0})}if(p&&typeof p!="string"&&(p.parentNode||p.jquery)){var r=p.jquery?p[0]:p;var w={};f(o).data("blockUI.history",w);w.el=r;w.parent=r.parentNode;w.display=r.style.display;w.position=r.style.position;if(w.parent){w.parent.removeChild(r)}}var A=m.baseZ;var v=(f.browser.msie)?f('<iframe class="blockUI" style="z-index:'+A+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false;"></iframe>'):f('<div class="blockUI" style="display:none"></div>');var u=f('<div class="blockUI blockOverlay" style="z-index:'+A+++';display:none;cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var q=y?f('<div class="blockUI blockMsg blockPage" style="z-index:'+A+';display:none;position:fixed"></div>'):f('<div class="blockUI blockMsg blockElement" style="z-index:'+A+';display:none;position:absolute"></div>');if(p){q.css(x)}if(!m.applyPlatformOpacityRules||!(f.browser.mozilla&&/Linux/.test(navigator.platform))){u.css(m.overlayCSS)}u.css("position",y?"fixed":"absolute");if(f.browser.msie){v.css("opacity","0.0")}f([v[0],u[0],q[0]]).appendTo(y?"body":o);var C=f.browser.msie&&(!f.boxModel||f("object,embed",y?null:o).length>0);if(d||C){if(y&&m.allowBodyStretch&&f.boxModel){f("html,body").css("height","100%")}if((d||!f.boxModel)&&!y){var D=j(o,"borderTopWidth"),s=j(o,"borderLeftWidth");var B=D?"(0 - "+D+")":0;var n=s?"(0 - "+s+")":0}f.each([v,u,q],function(t,G){var z=G[0].style;z.position="absolute";if(t<2){y?z.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+m.quirksmodeOffsetHack+') + "px"'):z.setExpression("height",'this.parentNode.offsetHeight + "px"');y?z.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):z.setExpression("width",'this.parentNode.offsetWidth + "px"');if(n){z.setExpression("left",n)}if(B){z.setExpression("top",B)}}else{if(m.centerY){if(y){z.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}z.marginTop=0}else{if(!m.centerY&&y){var E=(m.css&&m.css.top)?parseInt(m.css.top):0;var F="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+E+') + "px"';z.setExpression("top",F)}}}})}q.append(p);if(p&&(p.jquery||p.nodeType)){f(p).show()}if(m.fadeIn){if(f.browser.msie&&m.showOverlay){v.fadeIn(m.fadeIn)}if(m.showOverlay){u.fadeIn(m.fadeIn)}q.fadeIn(m.fadeIn)}else{if(f.browser.msie&&m.showOverlay){v.show()}if(m.showOverlay){u.show()}q.show()}i(1,o,m);if(y){b=q[0];e=f(":input:enabled:visible",b);if(m.focusInput){setTimeout(l,20)}}else{a(q[0],m.centerX,m.centerY)}if(m.timeout){setTimeout(function(){y?f.unblockUI(m):f(o).unblock(m)},m.timeout)}}function g(o,p){var n=o==window;var q=f(o).data("blockUI.history");p=f.extend({},f.blockUI.defaults,p||{});i(0,o,p);var m=n?f("body").children().filter(".blockUI"):f(".blockUI",o);if(n){b=e=null}if(p.fadeOut){m.fadeOut(p.fadeOut);setTimeout(function(){h(m,q,p,o)},p.fadeOut)}else{h(m,q,p,o)}}function h(m,p,o,n){m.each(function(q,r){if(this.parentNode){this.parentNode.removeChild(this)}});if(p&&p.el){p.el.style.display=p.display;p.el.style.position=p.position;if(p.parent){p.parent.appendChild(p.el)}f(p.el).removeData("blockUI.history")}if(typeof o.onUnblock=="function"){o.onUnblock(n,o)}}function i(m,q,r){var p=q==window,o=f(q);if(!m&&(p&&!b||!p&&!o.data("blockUI.isBlocked"))){return}if(!p){o.data("blockUI.isBlocked",m)}if(m&&!r.showOverlay){return}var n="mousedown mouseup keydown keypress";m?f(document).bind(n,r,k):f(document).unbind(n,k)}function k(p){if(p.keyCode&&p.keyCode==9){if(b&&p.data.constrainTabKey){var o=e;var n=!p.shiftKey&&p.target==o[o.length-1];var m=p.shiftKey&&p.target==o[0];if(n||m){setTimeout(function(){l(m)},10);return false}}}if(f(p.target).parents("div.blockMsg").length>0){return true}return f(p.target).parents().children().filter("div.blockUI").length==0}function l(m){if(!e){return}var n=e[m===true?e.length-1:0];if(n){n.focus()}}function a(r,m,v){var u=r.parentNode,q=r.style;var n=((u.offsetWidth-r.offsetWidth)/2)-j(u,"borderLeftWidth");var o=((u.offsetHeight-r.offsetHeight)/2)-j(u,"borderTopWidth");if(m){q.left=n>0?(n+"px"):"0"}if(v){q.top=o>0?(o+"px"):"0"}}function j(m,n){return parseInt(f.css(m,n))||0}})(jQuery); \ No newline at end of file
+/*
+ * jQuery blockUI plugin
+ * Version 2.31 (06-JAN-2010)
+ * @requires jQuery v1.2.3 or later
+ *
+ * Examples at: http://malsup.com/jquery/block/
+ * Copyright (c) 2007-2008 M. Alsup
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
+ */
+(function(i){if(/1\.(0|1|2)\.(0|1|2)/.test(i.fn.jquery)||/^1.1/.test(i.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later! You are using v"+i.fn.jquery);return}i.fn._fadeIn=i.fn.fadeIn;var c=function(){};var j=document.documentMode||0;var e=i.browser.msie&&((i.browser.version<8&&!j)||j<8);var f=i.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!j;i.blockUI=function(p){d(window,p)};i.unblockUI=function(p){h(window,p)};i.growlUI=function(t,r,s,p){var q=i('<div class="growlUI"></div>');if(t){q.append("<h1>"+t+"</h1>")}if(r){q.append("<h2>"+r+"</h2>")}if(s==undefined){s=3000}i.blockUI({message:q,fadeIn:700,fadeOut:1000,centerY:false,timeout:s,showOverlay:false,onUnblock:p,css:i.blockUI.defaults.growlCSS})};i.fn.block=function(p){return this.unblock({fadeOut:0}).each(function(){if(i.css(this,"position")=="static"){this.style.position="relative"}if(i.browser.msie){this.style.zoom=1}d(this,p)})};i.fn.unblock=function(p){return this.each(function(){h(this,p)})};i.blockUI.version=2.31;i.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:true,theme:false,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:0.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:0.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,bindEvents:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4};var b=null;var g=[];function d(r,F){var A=(r==window);var w=F&&F.message!==undefined?F.message:undefined;F=i.extend({},i.blockUI.defaults,F||{});F.overlayCSS=i.extend({},i.blockUI.defaults.overlayCSS,F.overlayCSS||{});var C=i.extend({},i.blockUI.defaults.css,F.css||{});var N=i.extend({},i.blockUI.defaults.themedCSS,F.themedCSS||{});w=w===undefined?F.message:w;if(A&&b){h(window,{fadeOut:0})}if(w&&typeof w!="string"&&(w.parentNode||w.jquery)){var I=w.jquery?w[0]:w;var P={};i(r).data("blockUI.history",P);P.el=I;P.parent=I.parentNode;P.display=I.style.display;P.position=I.style.position;if(P.parent){P.parent.removeChild(I)}}var B=F.baseZ;var M=(i.browser.msie||F.forceIframe)?i('<iframe class="blockUI" style="z-index:'+(B++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+F.iframeSrc+'"></iframe>'):i('<div class="blockUI" style="display:none"></div>');var L=i('<div class="blockUI blockOverlay" style="z-index:'+(B++)+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var K;if(F.theme&&A){var G='<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+B+';display:none;position:fixed"><div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(F.title||"&nbsp;")+'</div><div class="ui-widget-content ui-dialog-content"></div></div>';K=i(G)}else{K=A?i('<div class="blockUI blockMsg blockPage" style="z-index:'+B+';display:none;position:fixed"></div>'):i('<div class="blockUI blockMsg blockElement" style="z-index:'+B+';display:none;position:absolute"></div>')}if(w){if(F.theme){K.css(N);K.addClass("ui-widget-content")}else{K.css(C)}}if(!F.applyPlatformOpacityRules||!(i.browser.mozilla&&/Linux/.test(navigator.platform))){L.css(F.overlayCSS)}L.css("position",A?"fixed":"absolute");if(i.browser.msie||F.forceIframe){M.css("opacity",0)}var y=[M,L,K],O=A?i("body"):i(r);i.each(y,function(){this.appendTo(O)});if(F.theme&&F.draggable&&i.fn.draggable){K.draggable({handle:".ui-dialog-titlebar",cancel:"li"})}var v=e&&(!i.boxModel||i("object,embed",A?null:r).length>0);if(f||v){if(A&&F.allowBodyStretch&&i.boxModel){i("html,body").css("height","100%")}if((f||!i.boxModel)&&!A){var E=m(r,"borderTopWidth"),J=m(r,"borderLeftWidth");var x=E?"(0 - "+E+")":0;var D=J?"(0 - "+J+")":0}i.each([M,L,K],function(t,S){var z=S[0].style;z.position="absolute";if(t<2){A?z.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+F.quirksmodeOffsetHack+') + "px"'):z.setExpression("height",'this.parentNode.offsetHeight + "px"');A?z.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):z.setExpression("width",'this.parentNode.offsetWidth + "px"');if(D){z.setExpression("left",D)}if(x){z.setExpression("top",x)}}else{if(F.centerY){if(A){z.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}z.marginTop=0}else{if(!F.centerY&&A){var Q=(F.css&&F.css.top)?parseInt(F.css.top):0;var R="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+Q+') + "px"';z.setExpression("top",R)}}}})}if(w){if(F.theme){K.find(".ui-widget-content").append(w)}else{K.append(w)}if(w.jquery||w.nodeType){i(w).show()}}if((i.browser.msie||F.forceIframe)&&F.showOverlay){M.show()}if(F.fadeIn){var H=F.onBlock?F.onBlock:c;var q=(F.showOverlay&&!w)?H:c;var p=w?H:c;if(F.showOverlay){L._fadeIn(F.fadeIn,q)}if(w){K._fadeIn(F.fadeIn,p)}}else{if(F.showOverlay){L.show()}if(w){K.show()}if(F.onBlock){F.onBlock()}}l(1,r,F);if(A){b=K[0];g=i(":input:enabled:visible",b);if(F.focusInput){setTimeout(o,20)}}else{a(K[0],F.centerX,F.centerY)}if(F.timeout){var u=setTimeout(function(){A?i.unblockUI(F):i(r).unblock(F)},F.timeout);i(r).data("blockUI.timeout",u)}}function h(s,t){var r=(s==window);var q=i(s);var u=q.data("blockUI.history");var v=q.data("blockUI.timeout");if(v){clearTimeout(v);q.removeData("blockUI.timeout")}t=i.extend({},i.blockUI.defaults,t||{});l(0,s,t);var p;if(r){p=i("body").children().filter(".blockUI").add("body > .blockUI")}else{p=i(".blockUI",s)}if(r){b=g=null}if(t.fadeOut){p.fadeOut(t.fadeOut);setTimeout(function(){k(p,u,t,s)},t.fadeOut)}else{k(p,u,t,s)}}function k(p,s,r,q){p.each(function(t,u){if(this.parentNode){this.parentNode.removeChild(this)}});if(s&&s.el){s.el.style.display=s.display;s.el.style.position=s.position;if(s.parent){s.parent.appendChild(s.el)}i(q).removeData("blockUI.history")}if(typeof r.onUnblock=="function"){r.onUnblock(q,r)}}function l(p,t,u){var s=t==window,r=i(t);if(!p&&(s&&!b||!s&&!r.data("blockUI.isBlocked"))){return}if(!s){r.data("blockUI.isBlocked",p)}if(!u.bindEvents||(p&&!u.showOverlay)){return}var q="mousedown mouseup keydown keypress";p?i(document).bind(q,u,n):i(document).unbind(q,n)}function n(s){if(s.keyCode&&s.keyCode==9){if(b&&s.data.constrainTabKey){var r=g;var q=!s.shiftKey&&s.target==r[r.length-1];var p=s.shiftKey&&s.target==r[0];if(q||p){setTimeout(function(){o(p)},10);return false}}}if(i(s.target).parents("div.blockMsg").length>0){return true}return i(s.target).parents().children().filter("div.blockUI").length==0}function o(p){if(!g){return}var q=g[p===true?g.length-1:0];if(q){q.focus()}}function a(w,q,A){var z=w.parentNode,v=w.style;var r=((z.offsetWidth-w.offsetWidth)/2)-m(z,"borderLeftWidth");var u=((z.offsetHeight-w.offsetHeight)/2)-m(z,"borderTopWidth");if(q){v.left=r>0?(r+"px"):"0"}if(A){v.top=u>0?(u+"px"):"0"}}function m(q,r){return parseInt(i.css(q,r))||0}})(jQuery); \ No newline at end of file
diff --git a/libs/jquery/jquery.js b/libs/jquery/jquery.js
index b1ae21d8b2..7c24308023 100644
--- a/libs/jquery/jquery.js
+++ b/libs/jquery/jquery.js
@@ -1,19 +1,154 @@
-/*
- * jQuery JavaScript Library v1.3.2
+/*!
+ * jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
- * Copyright (c) 2009 John Resig
- * Dual licensed under the MIT and GPL licenses.
- * http://docs.jquery.com/License
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
*
- * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
- * Revision: 6246
- */
-(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
-/*
- * Sizzle CSS Selector Engine - v0.9.3
- * Copyright 2009, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Sat Feb 13 22:33:48 2010 -0500
*/
-(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file
+(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
+e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
+j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
+"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
+true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
+Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
+(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
+a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
+"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
+function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
+c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
+L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
+"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
+d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
+a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
+!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
+true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
+parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
+false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
+s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
+applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
+else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
+a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
+w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
+cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
+i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
+" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
+this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
+e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
+c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
+a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
+function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
+k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
+C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
+null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
+e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
+f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
+if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
+d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
+"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
+a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
+isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
+{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
+if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
+e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
+"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
+d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
+!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
+toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
+u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
+function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
+if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
+t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
+g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
+for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
+1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
+relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
+l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
+h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
+CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
+g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
+text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
+setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
+h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
+m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
+"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
+h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
+!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
+h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
+q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
+if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
+(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
+function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
+gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
+c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
+{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
+"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
+d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
+a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
+1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
+a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
+c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
+wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
+prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
+this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
+return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
+""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
+this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
+u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
+1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
+return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
+""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
+c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
+c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
+function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
+Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
+"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
+a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
+a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
+"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
+serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
+function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
+global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
+e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
+"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
+false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
+false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
+c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
+d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
+g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
+1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
+"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
+if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
+this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
+"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
+animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
+j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
+this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
+"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
+c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
+this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
+this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
+e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
+c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
+function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
+this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
+k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
+f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
+a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
+c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
+d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
+f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
+"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
+e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
diff --git a/libs/jquery/jquery.scrollTo-min.js b/libs/jquery/jquery.scrollTo-min.js
deleted file mode 100644
index eacfe567c3..0000000000
--- a/libs/jquery/jquery.scrollTo-min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * jQuery.ScrollTo - Easy element scrolling using jQuery.
- * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
- * Dual licensed under MIT and GPL.
- * Date: 9/11/2008
- * @author Ariel Flesler
- * @version 1.4
- *
- * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
- */
-;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery); \ No newline at end of file
diff --git a/libs/jquery/macFFBgHack.png b/libs/jquery/macFFBgHack.png
deleted file mode 100644
index c6473b324e..0000000000
--- a/libs/jquery/macFFBgHack.png
+++ /dev/null
Binary files differ
diff --git a/libs/jquery/original lib/jquery-calendar.js b/libs/jquery/original lib/jquery-calendar.js
deleted file mode 100644
index e7100e2d93..0000000000
--- a/libs/jquery/original lib/jquery-calendar.js
+++ /dev/null
@@ -1,814 +0,0 @@
-/* jQuery Calendar v2.7
- Written by Marc Grabanski (m@marcgrabanski.com) and enhanced by Keith Wood (kbwood@iprimus.com.au).
-
- Copyright (c) 2007 Marc Grabanski (http://marcgrabanski.com/code/jquery-calendar)
- Dual licensed under the GPL (http://www.gnu.org/licenses/gpl-3.0.txt) and
- CC (http://creativecommons.org/licenses/by/3.0/) licenses. "Share or Remix it but please Attribute the authors."
- Date: 09-03-2007 */
-
-/* PopUp Calendar manager.
- Use the singleton instance of this class, popUpCal, to interact with the calendar.
- Settings for (groups of) calendars are maintained in an instance object
- (PopUpCalInstance), allowing multiple different settings on the same page. */
-function PopUpCal() {
- this._nextId = 0; // Next ID for a calendar instance
- this._inst = []; // List of instances indexed by ID
- this._curInst = null; // The current instance in use
- this._disabledInputs = []; // List of calendar inputs that have been disabled
- this._popUpShowing = false; // True if the popup calendar is showing , false if not
- this._inDialog = false; // True if showing within a "dialog", false if not
- this.regional = []; // Available regional settings, indexed by language code
- this.regional[''] = { // Default regional settings
- clearText: 'Clear', // Display text for clear link
- closeText: 'Close', // Display text for close link
- prevText: '&lt;Prev', // Display text for previous month link
- nextText: 'Next&gt;', // Display text for next month link
- currentText: 'Today', // Display text for current month link
- dayNames: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Names of days starting at Sunday
- monthNames: ['January','February','March','April','May','June',
- 'July','August','September','October','November','December'], // Names of months
- dateFormat: 'DMY/' // First three are day, month, year in the required order,
- // fourth (optional) is the separator, e.g. US would be 'MDY/', ISO would be 'YMD-'
- };
- this._defaults = { // Global defaults for all the calendar instances
- autoPopUp: 'focus', // 'focus' for popup on focus,
- // 'button' for trigger button, or 'both' for either
- appendText: '', // Display text following the input box, e.g. showing the format
- buttonText: '...', // Text for trigger button
- buttonImage: '', // URL for trigger button image
- buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
- closeAtTop: true, // True to have the clear/close at the top,
- // false to have them at the bottom
- hideIfNoPrevNext: false, // True to hide next/previous month links
- // if not applicable, false to just disable them
- changeMonth: true, // True if month can be selected directly, false if only prev/next
- changeYear: true, // True if year can be selected directly, false if only prev/next
- yearRange: '-10:+10', // Range of years to display in drop-down,
- // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
- firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
- changeFirstDay: true, // True to click on day name to change, false to remain as set
- showOtherMonths: false, // True to show dates in other months, false to leave blank
- minDate: null, // The earliest selectable date, or null for no limit
- maxDate: null, // The latest selectable date, or null for no limit
- speed: 'medium', // Speed of display/closure
- customDate: null, // Function that takes a date and returns an array with
- // [0] = true if selectable, false if not,
- // [1] = custom CSS class name(s) or '', e.g. popUpCal.noWeekends
- fieldSettings: null, // Function that takes an input field and
- // returns a set of custom settings for the calendar
- onSelect: null // Define a callback function when a date is selected
- };
- $.extend(this._defaults, this.regional['']);
- this._calendarDiv = $('<div id="calendar_div"></div>');
- $(document.body).append(this._calendarDiv);
- $(document.body).mousedown(this._checkExternalClick);
-}
-
-$.extend(PopUpCal.prototype, {
- /* Register a new calendar instance - with custom settings. */
- _register: function(inst) {
- var id = this._nextId++;
- this._inst[id] = inst;
- return id;
- },
-
- /* Retrieve a particular calendar instance based on its ID. */
- _getInst: function(id) {
- return this._inst[id] || id;
- },
-
- /* Override the default settings for all instances of the calendar.
- @param settings object - the new settings to use as defaults (anonymous object)
- @return void */
- setDefaults: function(settings) {
- $.extend(this._defaults, settings || {});
- },
-
- /* Handle keystrokes. */
- _doKeyDown: function(e) {
- var inst = popUpCal._getInst(this._calId);
- if (popUpCal._popUpShowing) {
- switch (e.keyCode) {
- case 9: popUpCal.hideCalendar(inst, '');
- break; // hide on tab out
- case 13: popUpCal._selectDate(inst);
- break; // select the value on enter
- case 27: popUpCal.hideCalendar(inst, inst._get('speed'));
- break; // hide on escape
- case 33: popUpCal._adjustDate(inst, -1, (e.ctrlKey ? 'Y' : 'M'));
- break; // previous month/year on page up/+ ctrl
- case 34: popUpCal._adjustDate(inst, +1, (e.ctrlKey ? 'Y' : 'M'));
- break; // next month/year on page down/+ ctrl
- case 35: if (e.ctrlKey) popUpCal._clearDate(inst);
- break; // clear on ctrl+end
- case 36: if (e.ctrlKey) popUpCal._gotoToday(inst);
- break; // current on ctrl+home
- case 37: if (e.ctrlKey) popUpCal._adjustDate(inst, -1, 'D');
- break; // -1 day on ctrl+left
- case 38: if (e.ctrlKey) popUpCal._adjustDate(inst, -7, 'D');
- break; // -1 week on ctrl+up
- case 39: if (e.ctrlKey) popUpCal._adjustDate(inst, +1, 'D');
- break; // +1 day on ctrl+right
- case 40: if (e.ctrlKey) popUpCal._adjustDate(inst, +7, 'D');
- break; // +1 week on ctrl+down
- }
- }
- else if (e.keyCode == 36 && e.ctrlKey) { // display the calendar on ctrl+home
- popUpCal.showFor(this);
- }
- },
-
- /* Filter entered characters. */
- _doKeyPress: function(e) {
- var inst = popUpCal._getInst(this._calId);
- var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
- return (chr < ' ' || chr == inst._get('dateFormat').charAt(3) ||
- (chr >= '0' && chr <= '9')); // only allow numbers and separator
- },
-
- /* Attach the calendar to an input field. */
- _connectCalendar: function(target, inst) {
- var $input = $(target);
- var appendText = inst._get('appendText');
- if (appendText) {
- $input.after('<span class="calendar_append">' + appendText + '</span>');
- }
- var autoPopUp = inst._get('autoPopUp');
- if (autoPopUp == 'focus' || autoPopUp == 'both') { // pop-up calendar when in the marked field
- $input.focus(this.showFor);
- }
- if (autoPopUp == 'button' || autoPopUp == 'both') { // pop-up calendar when button clicked
- var buttonText = inst._get('buttonText');
- var buttonImage = inst._get('buttonImage');
- var buttonImageOnly = inst._get('buttonImageOnly');
- var trigger = $(buttonImageOnly ? '<img class="calendar_trigger" src="' +
- buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
- '<button type="button" class="calendar_trigger">' + (buttonImage != '' ?
- '<img src="' + buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
- buttonText) + '</button>');
- $input.wrap('<span class="calendar_wrap"></span>').after(trigger);
- trigger.click(this.showFor);
- }
- $input.keydown(this._doKeyDown).keypress(this._doKeyPress);
- $input[0]._calId = inst._id;
- },
-
- /* Attach an inline calendar to a div. */
- _inlineCalendar: function(target, inst, defaultDate) {
- $(target).append(inst._calendarDiv);
- target._calId = inst._id;
- var date = defaultDate;
- inst._selectedDay = date.getDate();
- inst._selectedMonth = date.getMonth();
- inst._selectedYear = date.getFullYear();
- popUpCal._adjustDate(inst);
- },
-
- /* Pop-up the calendar in a "dialog" box.
- @param dateText string - the initial date to display (in the current format)
- @param onSelect function - the function(dateText) to call when a date is selected
- @param settings object - update the dialog calendar instance's settings (anonymous object)
- @param pos int[2] - coordinates for the dialog's position within the screen
- leave empty for default (screen centre)
- @return void */
- dialogCalendar: function(dateText, onSelect, settings, pos) {
- var inst = this._dialogInst; // internal instance
- if (!inst) {
- inst = this._dialogInst = new PopUpCalInstance({}, false);
- this._dialogInput = $('<input type="text" size="1" style="position: absolute; top: -100px;"/>');
- this._dialogInput.keydown(this._doKeyDown);
- $('body').append(this._dialogInput);
- this._dialogInput[0]._calId = inst._id;
- }
- $.extend(inst._settings, settings || {});
- this._dialogInput.val(dateText);
-
- /* Cross Browser Positioning */
- if (self.innerHeight) { // all except Explorer
- windowWidth = self.innerWidth;
- windowHeight = self.innerHeight;
- } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
- windowWidth = document.documentElement.clientWidth;
- windowHeight = document.documentElement.clientHeight;
- } else if (document.body) { // other Explorers
- windowWidth = document.body.clientWidth;
- windowHeight = document.body.clientHeight;
- }
- this._pos = pos || // should use actual width/height below
- [(windowWidth / 2) - 100, (windowHeight / 2) - 100];
-
- // move input on screen for focus, but hidden behind dialog
- this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
- inst._settings.onSelect = onSelect;
- this._inDialog = true;
- this._calendarDiv.addClass('calendar_dialog');
- this.showFor(this._dialogInput[0]);
- if ($.blockUI) {
- $.blockUI(this._calendarDiv);
- }
- },
-
- /* Enable the input field(s) for entry.
- @param inputs element/object - single input field or jQuery collection of input fields
- @return void */
- enableFor: function(inputs) {
- inputs = (inputs.jquery ? inputs : $(inputs));
- inputs.each(function() {
- this.disabled = false;
- $('../button.calendar_trigger', this).each(function() { this.disabled = false; });
- $('../img.calendar_trigger',
-this).css({opacity:'1.0',cursor:''});
- var $this = this;
- popUpCal._disabledInputs = $.map(popUpCal._disabledInputs,
- function(value) { return (value == $this ? null : value); }); // delete entry
- });
- },
-
- /* Disable the input field(s) from entry.
- @param inputs element/object - single input field or jQuery collection of input fields
- @return void */
- disableFor: function(inputs) {
- inputs = (inputs.jquery ? inputs : $(inputs));
- inputs.each(function() {
- this.disabled = true;
- $('../button.calendar_trigger', this).each(function() { this.disabled = true; });
- $('../img.calendar_trigger', this).css({opacity:'0.5',cursor:'default'});
- var $this = this;
- popUpCal._disabledInputs = $.map(popUpCal._disabledInputs,
- function(value) { return (value == $this ? null : value); }); // delete entry
- popUpCal._disabledInputs[popUpCal._disabledInputs.length] = this;
- });
- },
-
- /* Update the settings for a calendar attached to an input field or division.
- @param control element - the input field or div/span attached to the calendar
- @param settings object - the new settings to update
- @return void */
- reconfigureFor: function(control, settings) {
- var inst = this._getInst(control._calId);
- if (inst) {
- $.extend(inst._settings, settings || {});
- this._updateCalendar(inst);
- }
- },
-
- /* Set the date for a calendar attached to an input field or division.
- @param control element - the input field or div/span attached to the calendar
- @param date Date - the new date
- @return void */
- setDateFor: function(control, date) {
- var inst = this._getInst(control._calId);
- if (inst) {
- inst._setDate(date);
- }
- },
-
- /* Retrieve the date for a calendar attached to an input field or division.
- @param control element - the input field or div/span attached to the calendar
- @return Date - the current date */
- getDateFor: function(control) {
- var inst = this._getInst(control._calId);
- return (inst ? inst._getDate() : null);
- },
-
- /* Pop-up the calendar for a given input field.
- @param target element - the input field attached to the calendar
- @return void */
- showFor: function(target) {
- var input = (target.nodeName && target.nodeName.toLowerCase() == 'input' ? target : this);
- if (input.nodeName.toLowerCase() != 'input') { // find from button/image trigger
- input = $('input', input.parentNode)[0];
- }
- if (popUpCal._lastInput == input) { // already here
- return;
- }
- for (var i = 0; i < popUpCal._disabledInputs.length; i++) { // check not disabled
- if (popUpCal._disabledInputs[i] == input) {
- return;
- }
- }
- var inst = popUpCal._getInst(input._calId);
- popUpCal.hideCalendar(inst, '');
- popUpCal._lastInput = input;
- inst._setDateFromField(input);
- if (popUpCal._inDialog) { // hide cursor
- input.value = '';
- }
- if (!popUpCal._pos) { // position below input
- popUpCal._pos = popUpCal._findPos(input);
- popUpCal._pos[1] += input.offsetHeight;
- }
- inst._calendarDiv.css('position', (popUpCal._inDialog && $.blockUI ? 'static' : 'absolute')).
- css('left', popUpCal._pos[0] + 'px').css('top', popUpCal._pos[1] + 'px');
- popUpCal._pos = null;
- var fieldSettings = inst._get('fieldSettings');
- $.extend(inst._settings, (fieldSettings ? fieldSettings(input) : {}));
- popUpCal._showCalendar(inst);
- },
-
- /* Construct and display the calendar. */
- _showCalendar: function(id) {
- var inst = this._getInst(id);
- popUpCal._updateCalendar(inst);
- if (!inst._inline) {
- var speed = inst._get('speed');
- inst._calendarDiv.show(speed, function() {
- popUpCal._popUpShowing = true;
- popUpCal._afterShow(inst);
- });
- if (speed == '') {
- popUpCal._popUpShowing = true;
- popUpCal._afterShow(inst);
- }
- if (inst._input[0].type != 'hidden') {
- inst._input[0].focus();
- }
- this._curInst = inst;
- }
- },
-
- /* Generate the calendar content. */
- _updateCalendar: function(inst) {
- inst._calendarDiv.empty().append(inst._generateCalendar());
- if (inst._input && inst._input != 'hidden') {
- inst._input[0].focus();
- }
- },
-
- /* Tidy up after displaying the calendar. */
- _afterShow: function(inst) {
- if ($.browser.msie) { // fix IE < 7 select problems
- $('#calendar_cover').css({width: inst._calendarDiv[0].offsetWidth + 4,
- height: inst._calendarDiv[0].offsetHeight + 4});
- }
- /*// re-position on screen if necessary
- var calDiv = inst._calendarDiv[0];
- var pos = popUpCal._findPos(inst._input[0]);
- if ((calDiv.offsetLeft + calDiv.offsetWidth) >
- (document.body.clientWidth + document.body.scrollLeft)) {
- inst._calendarDiv.css('left', (pos[0] + inst._input[0].offsetWidth - calDiv.offsetWidth) + 'px');
- }
- if ((calDiv.offsetTop + calDiv.offsetHeight) >
- (document.body.clientHeight + document.body.scrollTop)) {
- inst._calendarDiv.css('top', (pos[1] - calDiv.offsetHeight) + 'px');
- }*/
- },
-
- /* Hide the calendar from view.
- @param id string/object - the ID of the current calendar instance,
- or the instance itself
- @param speed string - the speed at which to close the calendar
- @return void */
- hideCalendar: function(id, speed) {
- var inst = this._getInst(id);
- if (popUpCal._popUpShowing) {
- speed = (speed != null ? speed : inst._get('speed'));
- inst._calendarDiv.hide(speed, function() {
- popUpCal._tidyDialog(inst);
- });
- if (speed == '') {
- popUpCal._tidyDialog(inst);
- }
- popUpCal._popUpShowing = false;
- popUpCal._lastInput = null;
- inst._settings.prompt = null;
- if (popUpCal._inDialog) {
- popUpCal._dialogInput.css('position', 'absolute').
- css('left', '0px').css('top', '-100px');
- if ($.blockUI) {
- $.unblockUI();
- $('body').append(this._calendarDiv);
- }
- }
- popUpCal._inDialog = false;
- }
- popUpCal._curInst = null;
- },
-
- /* Tidy up after a dialog display. */
- _tidyDialog: function(inst) {
- inst._calendarDiv.removeClass('calendar_dialog');
- $('.calendar_prompt', inst._calendarDiv).remove();
- },
-
- /* Close calendar if clicked elsewhere. */
- _checkExternalClick: function(event) {
- if (!popUpCal._curInst) {
- return;
- }
- var target = $(event.target);
- if( (target.parents("#calendar_div").length == 0)
- && (target.attr('class') != 'calendar_trigger')
- && popUpCal._popUpShowing
- && !(popUpCal._inDialog && $.blockUI) )
- {
- popUpCal.hideCalendar(popUpCal._curInst, '');
- }
- },
-
- /* Adjust one of the date sub-fields. */
- _adjustDate: function(id, offset, period) {
- var inst = this._getInst(id);
- inst._adjustDate(offset, period);
- this._updateCalendar(inst);
- },
-
- /* Action for current link. */
- _gotoToday: function(id) {
- var date = new Date();
- var inst = this._getInst(id);
- inst._selectedDay = date.getDate();
- inst._selectedMonth = date.getMonth();
- inst._selectedYear = date.getFullYear();
- this._adjustDate(inst);
- },
-
- /* Action for selecting a new month/year. */
- _selectMonthYear: function(id, select, period) {
- var inst = this._getInst(id);
- inst._selectingMonthYear = false;
- inst[period == 'M' ? '_selectedMonth' : '_selectedYear'] =
- select.options[select.selectedIndex].value - 0;
- this._adjustDate(inst);
- },
-
- /* Restore input focus after not changing month/year. */
- _clickMonthYear: function(id) {
- var inst = this._getInst(id);
- if (inst._input && inst._selectingMonthYear && !$.browser.msie) {
- inst._input[0].focus();
- }
- inst._selectingMonthYear = !inst._selectingMonthYear;
- },
-
- /* Action for changing the first week day. */
- _changeFirstDay: function(id, a) {
- var inst = this._getInst(id);
- var dayNames = inst._get('dayNames');
- var value = a.firstChild.nodeValue;
- for (var i = 0; i < 7; i++) {
- if (dayNames[i] == value) {
- inst._settings.firstDay = i;
- break;
- }
- }
- this._updateCalendar(inst);
- },
-
- /* Action for selecting a day. */
- _selectDay: function(id, td) {
- var inst = this._getInst(id);
- inst._selectedDay = $("a", td).html();
- this._selectDate(id);
- },
-
- /* Erase the input field and hide the calendar. */
- _clearDate: function(id) {
- this._selectDate(id, '');
- },
-
- /* Update the input field with the selected date. */
- _selectDate: function(id, dateStr) {
- var inst = this._getInst(id);
- dateStr = (dateStr != null ? dateStr : inst._formatDate());
- if (inst._input) {
- inst._input.val(dateStr);
- }
- var onSelect = inst._get('onSelect');
- if (onSelect) {
- onSelect(dateStr); // trigger custom callback
- }
- else {
- inst._input.trigger('change'); // fire the change event
- }
- if (inst._inline) {
- this._updateCalendar(inst);
- }
- else {
- this.hideCalendar(inst, inst._get('speed'));
- }
- },
-
- /* Set as customDate function to prevent selection of weekends.
- @param date Date - the date to customise
- @return [boolean, string] - is this date selectable?, what is its CSS class? */
- noWeekends: function(date) {
- var day = date.getDay();
- return [(day > 0 && day < 6), ''];
- },
-
- /* Find an object's position on the screen. */
- _findPos: function(obj) {
- if (obj.type == 'hidden') {
- obj = obj.nextSibling;
- }
- var curleft = curtop = 0;
- if (obj.offsetParent) {
- curleft = obj.offsetLeft;
- curtop = obj.offsetTop;
- while (obj = obj.offsetParent) {
- var origcurleft = curleft;
- curleft += obj.offsetLeft;
- if (curleft < 0) {
- curleft = origcurleft;
- }
- curtop += obj.offsetTop;
- }
- }
- return [curleft,curtop];
- }
-});
-
-/* Individualised settings for calendars applied to one or more related inputs.
- Instances are managed and manipulated through the PopUpCal manager. */
-function PopUpCalInstance(settings, inline, defaultDate) {
- this._id = popUpCal._register(this);
- this._selectedDay = 0;
- this._selectedMonth = 0; // 0-11
- this._selectedYear = 0; // 4-digit year
- this._input = null; // The attached input field
- this._inline = inline; // True if showing inline, false if used in a popup
- this._calendarDiv = (!inline ? popUpCal._calendarDiv :
- $('<div id="calendar_div_' + this._id + '" class="calendar_inline"></div>'));
- if (inline) {
- var date = defaultDate;
- this._currentDate = defaultDate;
- this._currentDay = date.getDate();
- this._currentMonth = date.getMonth();
- this._currentYear = date.getFullYear();
- }
- // customise the calendar object - uses manager defaults if not overridden
- this._settings = $.extend({}, settings || {}); // clone
-}
-
-$.extend(PopUpCalInstance.prototype, {
- /* Get a setting value, defaulting if necessary. */
- _get: function(name) {
- return (this._settings[name] != null ? this._settings[name] : popUpCal._defaults[name]);
- },
-
- /* Parse existing date and initialise calendar. */
- _setDateFromField: function(input) {
- this._input = $(input);
- var dateFormat = this._get('dateFormat');
- var currentDate = this._input.val().split(dateFormat.charAt(3));
- if (currentDate.length == 3) {
- this._currentDay = parseInt(currentDate[dateFormat.indexOf('D')], 10);
- this._currentMonth = parseInt(currentDate[dateFormat.indexOf('M')], 10) - 1;
- this._currentYear = parseInt(currentDate[dateFormat.indexOf('Y')], 10);
- }
- else {
- var date = new Date();
- this._currentDay = date.getDate();
- this._currentMonth = date.getMonth();
- this._currentYear = date.getFullYear();
- }
- this._selectedDay = this._currentDay;
- this._selectedMonth = this._currentMonth;
- this._selectedYear = this._currentYear;
- this._adjustDate();
- },
-
- /* Set the date directly. */
- _setDate: function(date) {
- this._selectedDay = this._currentDay = date.getDate();
- this._selectedMonth = this._currentMonth = date.getMonth();
- this._selectedYear = this._currentYear = date.getFullYear();
- this._adjustDate();
- },
-
- /* Retrieve the date directly. */
- _getDate: function() {
- return new Date(this._currentYear, this._currentMonth, this._currentDay);
- },
-
- /* Generate the HTML for the current state of the calendar. */
- _generateCalendar: function() {
- var today = this._currentDate;
- today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time
- // build the calendar HTML
- var controls = '<div class="calendar_control">' +
- '<a class="calendar_clear" onclick="popUpCal._clearDate(' + this._id + ');">' +
- this._get('clearText') + '</a>' +
- '<a class="calendar_close" onclick="popUpCal.hideCalendar(' + this._id + ');">' +
- this._get('closeText') + '</a></div>';
- var prompt = this._get('prompt');
- var closeAtTop = this._get('closeAtTop');
- var hideIfNoPrevNext = this._get('hideIfNoPrevNext');
- // controls and links
- var html = (prompt ? '<div class="calendar_prompt">' + prompt + '</div>' : '') +
- (closeAtTop && !this._inline ? controls : '') + '<div class="calendar_links">' +
- (this._canAdjustMonth(-1) ? '<a class="calendar_prev" ' +
- 'onclick="popUpCal._adjustDate(' + this._id + ', -1, \'M\');">' + this._get('prevText') + '</a>' :
- (hideIfNoPrevNext ? '' : '<label class="calendar_prev">' + this._get('prevText') + '</label>')) +
- (this._isInRange(today) ? '<a class="calendar_current" ' +
- 'onclick="popUpCal._gotoToday(' + this._id + ');">' + this._get('currentText') + '</a>' : '') +
- (this._canAdjustMonth(+1) ? '<a class="calendar_next" ' +
- 'onclick="popUpCal._adjustDate(' + this._id + ', +1, \'M\');">' + this._get('nextText') + '</a>' :
- (hideIfNoPrevNext ? '' : '<label class="calendar_next">' + this._get('nextText') + '</label>')) +
- '</div><div class="calendar_header">';
- var minDate = this._get('minDate');
- var maxDate = this._get('maxDate');
- // month selection
- var monthNames = this._get('monthNames');
- if (!this._get('changeMonth')) {
- html += monthNames[this._selectedMonth] + '&nbsp;';
- }
- else {
- var inMinYear = (minDate && minDate.getFullYear() == this._selectedYear);
- var inMaxYear = (maxDate && maxDate.getFullYear() == this._selectedYear);
- html += '<select class="calendar_newMonth" ' +
- 'onchange="popUpCal._selectMonthYear(' + this._id + ', this, \'M\');" ' +
- 'onclick="popUpCal._clickMonthYear(' + this._id + ');">';
- for (var month = 0; month < 12; month++) {
- if ((!inMinYear || month >= minDate.getMonth()) &&
- (!inMaxYear || month <= maxDate.getMonth())) {
- html += '<option value="' + month + '"' +
- (month == this._selectedMonth ? ' selected="selected"' : '') +
- '>' + monthNames[month] + '</option>';
- }
- }
- html += '</select>';
- }
- // year selection
- if (!this._get('changeYear')) {
- html += this._selectedYear;
- }
- else {
- // determine range of years to display
- var years = this._get('yearRange').split(':');
- var year = 0;
- var endYear = 0;
- if (years.length != 2) {
- year = this._selectedYear - 10;
- endYear = this._selectedYear + 10;
- }
- else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
- year = this._selectedYear + parseInt(years[0], 10);
- endYear = this._selectedYear + parseInt(years[1], 10);
- }
- else {
- year = parseInt(years[0], 10);
- endYear = parseInt(years[1], 10);
- }
- year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
- endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
- html += '<select class="calendar_newYear" onchange="popUpCal._selectMonthYear(' +
- this._id + ', this, \'Y\');" ' + 'onclick="popUpCal._clickMonthYear(' +
- this._id + ');">';
- for (; year <= endYear; year++) {
- html += '<option value="' + year + '"' +
- (year == this._selectedYear ? ' selected="selected"' : '') +
- '>' + year + '</option>';
- }
- html += '</select>';
- }
- html += '</div><table class="calendar" cellpadding="0" cellspacing="0"><thead>' +
- '<tr class="calendar_titleRow">';
- var firstDay = this._get('firstDay');
- var changeFirstDay = this._get('changeFirstDay');
- var dayNames = this._get('dayNames');
- for (var dow = 0; dow < 7; dow++) { // days of the week
- html += '<td>' + (!changeFirstDay ? '' : '<a onclick="popUpCal._changeFirstDay(' +
- this._id + ', this);">') + dayNames[(dow + firstDay) % 7] +
- (changeFirstDay ? '</a>' : '') + '</td>';
- }
- html += '</tr></thead><tbody>';
- var daysInMonth = this._getDaysInMonth(this._selectedYear, this._selectedMonth);
- this._selectedDay = Math.min(this._selectedDay, daysInMonth);
- var leadDays = (this._getFirstDayOfMonth(this._selectedYear, this._selectedMonth) - firstDay + 7) % 7;
- var currentDate = new Date(this._currentYear, this._currentMonth, this._currentDay);
- var selectedDate = new Date(this._selectedYear, this._selectedMonth, this._selectedDay);
- var printDate = new Date(this._selectedYear, this._selectedMonth, 1 - leadDays);
- var numRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
- var customDate = this._get('customDate');
- var showOtherMonths = this._get('showOtherMonths');
- for (var row = 0; row < numRows; row++) { // create calendar rows
- html += '<tr class="calendar_daysRow">';
- for (var dow = 0; dow < 7; dow++) { // create calendar days
- var customSettings = (customDate ? customDate(printDate) : [true, '']);
- var otherMonth = (printDate.getMonth() != this._selectedMonth);
- var unselectable = otherMonth || !customSettings[0] ||
- (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
- html += '<td class="calendar_daysCell' +
- ((dow + firstDay + 6) % 7 >= 5 ? ' calendar_weekEndCell' : '') + // highlight weekends
- (otherMonth ? ' calendar_otherMonth' : '') + // highlight days from other months
- //(printDate.getTime() == selectedDate.getTime() ? ' calendar_daysCellOver' : '') + // highlight selected day
- (unselectable ? ' calendar_unselectable' : '') + // highlight unselectable days
- (!otherMonth || showOtherMonths ? ' ' + customSettings[1] : '') + // highlight custom dates
- (printDate.getTime() == currentDate.getTime() ? ' calendar_currentDay' : // highlight current day
- (printDate.getTime() == today.getTime() ? ' calendar_today' : '')) + '"' + // highlight today (if different)
- (unselectable ? '' : ' onmouseover="$(this).addClass(\'calendar_daysCellOver\');"' +
- ' onmouseout="$(this).removeClass(\'calendar_daysCellOver\');"' +
- ' onclick="popUpCal._selectDay(' + this._id + ', this);"') + '>' + // actions
- (otherMonth ? (showOtherMonths ? printDate.getDate() : '&nbsp;') : // display for other months
- (unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
- printDate.setDate(printDate.getDate() + 1);
- }
- html += '</tr>';
- }
- html += '</tbody></table>' + (!closeAtTop && !this._inline ? controls : '') +
- '<div style="clear: both;"></div>' + (!$.browser.msie ? '' :
- '<!--[if lte IE 6.5]><iframe src="javascript:false;" class="calendar_cover"></iframe><![endif]-->');
- return html;
- },
-
- /* Adjust one of the date sub-fields. */
- _adjustDate: function(offset, period) {
- var date = new Date(this._selectedYear + (period == 'Y' ? offset : 0),
- this._selectedMonth + (period == 'M' ? offset : 0),
- this._selectedDay + (period == 'D' ? offset : 0));
- // ensure it is within the bounds set
- var minDate = this._get('minDate');
- var maxDate = this._get('maxDate');
- date = (minDate && date < minDate ? minDate : date);
- date = (maxDate && date > maxDate ? maxDate : date);
- this._selectedDay = date.getDate();
- this._selectedMonth = date.getMonth();
- this._selectedYear = date.getFullYear();
- },
-
- /* Find the number of days in a given month. */
- _getDaysInMonth: function(year, month) {
- return 32 - new Date(year, month, 32).getDate();
- },
-
- /* Find the day of the week of the first of a month. */
- _getFirstDayOfMonth: function(year, month) {
- return new Date(year, month, 1).getDay();
- },
-
- /* Determines if we should allow a "next/prev" month display change. */
- _canAdjustMonth: function(offset) {
- var date = new Date(this._selectedYear, this._selectedMonth + offset, 1);
- if (offset < 0) {
- date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
- }
- return this._isInRange(date);
- },
-
- /* Is the given date in the accepted range? */
- _isInRange: function(date) {
- var minDate = this._get('minDate');
- var maxDate = this._get('maxDate');
- return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
- },
-
- /* Format the given date for display. */
- _formatDate: function() {
- var day = this._currentDay = this._selectedDay;
- var month = this._currentMonth = this._selectedMonth;
- var year = this._currentYear = this._selectedYear;
- month++; // adjust javascript month
- var dateFormat = this._get('dateFormat');
- var dateString = '';
- for (var i = 0; i < 3; i++) {
- dateString += dateFormat.charAt(3) +
- (dateFormat.charAt(i) == 'D' ? (day < 10 ? '0' : '') + day :
- (dateFormat.charAt(i) == 'M' ? (month < 10 ? '0' : '') + month :
- (dateFormat.charAt(i) == 'Y' ? year : '?')));
- }
- return dateString.substring(dateFormat.charAt(3) ? 1 : 0);
- }
-});
-
-/* Attach the calendar to a jQuery selection.
- @param settings object - the new settings to use for this calendar instance (anonymous)
- @return jQuery object - for chaining further calls */
-$.fn.calendar = function(settings, defaultDate) {
- return this.each(function() {
- // check for settings on the control itself - in namespace 'cal:'
- var inlineSettings = null;
- for (attrName in popUpCal._defaults) {
- var attrValue = this.getAttribute('cal:' + attrName);
- if (attrValue) {
- inlineSettings = inlineSettings || {};
- try {
- inlineSettings[attrName] = eval(attrValue);
- }
- catch (err) {
- inlineSettings[attrName] = attrValue;
- }
- }
- }
- var nodeName = this.nodeName.toLowerCase();
- if (nodeName == 'input') {
- var instSettings = (inlineSettings ? $.extend($.extend({}, settings || {}),
- inlineSettings || {}) : settings); // clone and customise
- var inst = (inst && !inlineSettings ? inst :
- new PopUpCalInstance(instSettings, false, defaultDate));
- popUpCal._connectCalendar(this, inst);
- }
- else if (nodeName == 'div' || nodeName == 'span') {
- var instSettings = $.extend($.extend({}, settings || {}),
- inlineSettings || {}); // clone and customise
- var inst = new PopUpCalInstance(instSettings, true, defaultDate);
- popUpCal._inlineCalendar(this, inst, defaultDate);
- }
- });
-};
-
-/* Initialise the calendar. */
-$(document).ready(function() {
- popUpCal = new PopUpCal(); // singleton instance
-});
diff --git a/libs/jquery/original lib/jquery-ui.js b/libs/jquery/original lib/jquery-ui.js
index fc3a87fabe..5b1595b3f2 100644
--- a/libs/jquery/original lib/jquery-ui.js
+++ b/libs/jquery/original lib/jquery-ui.js
@@ -1,20 +1,26 @@
-/*
- * jQuery UI 1.7.2
+/*!
+ * jQuery UI 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
-;jQuery.ui || (function($) {
-var _remove = $.fn.remove,
- isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
+(function($) {
+
+// prevent duplicate loading
+// this is only a problem because we proxy existing functions
+// and we don't want to double proxy them
+$.ui = $.ui || {};
+if ($.ui.version) {
+ return;
+}
//Helper functions and ui object
-$.ui = {
- version: "1.7.2",
+$.extend($.ui, {
+ version: "1.8.2",
// $.ui.plugin is deprecated. Use the proxy pattern instead.
plugin: {
@@ -73,9 +79,13 @@ $.ui = {
},
keyCode: {
+ ALT: 18,
BACKSPACE: 8,
CAPS_LOCK: 20,
COMMA: 188,
+ COMMAND: 91,
+ COMMAND_LEFT: 91, // COMMAND
+ COMMAND_RIGHT: 93,
CONTROL: 17,
DELETE: 46,
DOWN: 40,
@@ -85,6 +95,7 @@ $.ui = {
HOME: 36,
INSERT: 45,
LEFT: 37,
+ MENU: 93, // COMMAND_RIGHT
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
@@ -98,64 +109,36 @@ $.ui = {
SHIFT: 16,
SPACE: 32,
TAB: 9,
- UP: 38
+ UP: 38,
+ WINDOWS: 91 // COMMAND
}
-};
-
-// WAI-ARIA normalization
-if (isFF2) {
- var attr = $.attr,
- removeAttr = $.fn.removeAttr,
- ariaNS = "http://www.w3.org/2005/07/aaa",
- ariaState = /^aria-/,
- ariaRole = /^wairole:/;
-
- $.attr = function(elem, name, value) {
- var set = value !== undefined;
-
- return (name == 'role'
- ? (set
- ? attr.call(this, elem, name, "wairole:" + value)
- : (attr.apply(this, arguments) || "").replace(ariaRole, ""))
- : (ariaState.test(name)
- ? (set
- ? elem.setAttributeNS(ariaNS,
- name.replace(ariaState, "aaa:"), value)
- : attr.call(this, elem, name.replace(ariaState, "aaa:")))
- : attr.apply(this, arguments)));
- };
-
- $.fn.removeAttr = function(name) {
- return (ariaState.test(name)
- ? this.each(function() {
- this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
- }) : removeAttr.call(this, name));
- };
-}
+});
//jQuery plugins
$.fn.extend({
- remove: function() {
- // Safari has a native remove event which actually removes DOM elements,
- // so we have to use triggerHandler instead of trigger (#3037).
- $("*", this).add(this).each(function() {
- $(this).triggerHandler("remove");
- });
- return _remove.apply(this, arguments );
+ _focus: $.fn.focus,
+ focus: function(delay, fn) {
+ return typeof delay === 'number'
+ ? this.each(function() {
+ var elem = this;
+ setTimeout(function() {
+ $(elem).focus();
+ (fn && fn.call(elem));
+ }, delay);
+ })
+ : this._focus.apply(this, arguments);
},
-
+
enableSelection: function() {
return this
.attr('unselectable', 'off')
- .css('MozUserSelect', '')
- .unbind('selectstart.ui');
+ .css('MozUserSelect', '');
},
disableSelection: function() {
return this
.attr('unselectable', 'on')
- .css('MozUserSelect', 'none')
- .bind('selectstart.ui', function() { return false; });
+ .css('MozUserSelect', 'none');
},
scrollParent: function() {
@@ -171,6 +154,36 @@ $.fn.extend({
}
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
+ },
+
+ zIndex: function(zIndex) {
+ if (zIndex !== undefined) {
+ return this.css('zIndex', zIndex);
+ }
+
+ if (this.length) {
+ var elem = $(this[0]), position, value;
+ while (elem.length && elem[0] !== document) {
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
+ // This makes behavior of this function consistent across browsers
+ // WebKit always returns auto if the element is positioned
+ position = elem.css('position');
+ if (position == 'absolute' || position == 'relative' || position == 'fixed')
+ {
+ // IE returns 0 when zIndex is not specified
+ // other browsers return a string
+ // we ignore the case of nested elements with an explicit value of 0
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+ value = parseInt(elem.css('zIndex'));
+ if (!isNaN(value) && value != 0) {
+ return value;
+ }
+ }
+ elem = elem.parent();
+ }
+ }
+
+ return 0;
}
});
@@ -200,176 +213,263 @@ $.extend($.expr[':'], {
}
});
+})(jQuery);
+/*!
+ * jQuery UI Widget 1.8.2
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Widget
+ */
+(function( $ ) {
-// $.widget is a factory to create jQuery plugins
-// taking some boilerplate code out of the plugin code
-function getter(namespace, plugin, method, args) {
- function getMethods(type) {
- var methods = $[namespace][plugin][type] || [];
- return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
- }
+var _remove = $.fn.remove;
- var methods = getMethods('getter');
- if (args.length == 1 && typeof args[0] == 'string') {
- methods = methods.concat(getMethods('getterSetter'));
- }
- return ($.inArray(method, methods) != -1);
-}
+$.fn.remove = function( selector, keepData ) {
+ return this.each(function() {
+ if ( !keepData ) {
+ if ( !selector || $.filter( selector, [ this ] ).length ) {
+ $( "*", this ).add( this ).each(function() {
+ $( this ).triggerHandler( "remove" );
+ });
+ }
+ }
+ return _remove.call( $(this), selector, keepData );
+ });
+};
-$.widget = function(name, prototype) {
- var namespace = name.split(".")[0];
- name = name.split(".")[1];
+$.widget = function( name, base, prototype ) {
+ var namespace = name.split( "." )[ 0 ],
+ fullName;
+ name = name.split( "." )[ 1 ];
+ fullName = namespace + "-" + name;
- // create plugin method
- $.fn[name] = function(options) {
- var isMethodCall = (typeof options == 'string'),
- args = Array.prototype.slice.call(arguments, 1);
+ if ( !prototype ) {
+ prototype = base;
+ base = $.Widget;
+ }
- // prevent calls to internal methods
- if (isMethodCall && options.substring(0, 1) == '_') {
- return this;
- }
+ // create selector for plugin
+ $.expr[ ":" ][ fullName ] = function( elem ) {
+ return !!$.data( elem, name );
+ };
- // handle getter methods
- if (isMethodCall && getter(namespace, name, options, args)) {
- var instance = $.data(this[0], name);
- return (instance ? instance[options].apply(instance, args)
- : undefined);
+ $[ namespace ] = $[ namespace ] || {};
+ $[ namespace ][ name ] = function( options, element ) {
+ // allow instantiation without initializing for simple inheritance
+ if ( arguments.length ) {
+ this._createWidget( options, element );
}
+ };
- // handle initialization and non-getter methods
- return this.each(function() {
- var instance = $.data(this, name);
+ var basePrototype = new base();
+ // we need to make the options hash a property directly on the new instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+// $.each( basePrototype, function( key, val ) {
+// if ( $.isPlainObject(val) ) {
+// basePrototype[ key ] = $.extend( {}, val );
+// }
+// });
+ basePrototype.options = $.extend( {}, basePrototype.options );
+ $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
+ namespace: namespace,
+ widgetName: name,
+ widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
+ widgetBaseClass: fullName
+ }, prototype );
+
+ $.widget.bridge( name, $[ namespace ][ name ] );
+};
- // constructor
- (!instance && !isMethodCall &&
- $.data(this, name, new $[namespace][name](this, options))._init());
+$.widget.bridge = function( name, object ) {
+ $.fn[ name ] = function( options ) {
+ var isMethodCall = typeof options === "string",
+ args = Array.prototype.slice.call( arguments, 1 ),
+ returnValue = this;
- // method call
- (instance && isMethodCall && $.isFunction(instance[options]) &&
- instance[options].apply(instance, args));
- });
- };
-
- // create widget constructor
- $[namespace] = $[namespace] || {};
- $[namespace][name] = function(element, options) {
- var self = this;
+ // allow multiple hashes to be passed on init
+ options = !isMethodCall && args.length ?
+ $.extend.apply( null, [ true, options ].concat(args) ) :
+ options;
- this.namespace = namespace;
- this.widgetName = name;
- this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
- this.widgetBaseClass = namespace + '-' + name;
-
- this.options = $.extend({},
- $.widget.defaults,
- $[namespace][name].defaults,
- $.metadata && $.metadata.get(element)[name],
- options);
-
- this.element = $(element)
- .bind('setData.' + name, function(event, key, value) {
- if (event.target == element) {
- return self._setData(key, value);
+ // prevent calls to internal methods
+ if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
+ return returnValue;
+ }
+
+ if ( isMethodCall ) {
+ this.each(function() {
+ var instance = $.data( this, name ),
+ methodValue = instance && $.isFunction( instance[options] ) ?
+ instance[ options ].apply( instance, args ) :
+ instance;
+ if ( methodValue !== instance && methodValue !== undefined ) {
+ returnValue = methodValue;
+ return false;
}
- })
- .bind('getData.' + name, function(event, key) {
- if (event.target == element) {
- return self._getData(key);
+ });
+ } else {
+ this.each(function() {
+ var instance = $.data( this, name );
+ if ( instance ) {
+ if ( options ) {
+ instance.option( options );
+ }
+ instance._init();
+ } else {
+ $.data( this, name, new object( options, this ) );
}
- })
- .bind('remove', function() {
- return self.destroy();
});
- };
+ }
- // add widget prototype
- $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
+ return returnValue;
+ };
+};
- // TODO: merge getter and getterSetter properties from widget prototype
- // and plugin prototype
- $[namespace][name].getterSetter = 'option';
+$.Widget = function( options, element ) {
+ // allow instantiation without initializing for simple inheritance
+ if ( arguments.length ) {
+ this._createWidget( options, element );
+ }
};
-$.widget.prototype = {
+$.Widget.prototype = {
+ widgetName: "widget",
+ widgetEventPrefix: "",
+ options: {
+ disabled: false
+ },
+ _createWidget: function( options, element ) {
+ // $.widget.bridge stores the plugin instance, but we do it anyway
+ // so that it's stored even before the _create function runs
+ this.element = $( element ).data( this.widgetName, this );
+ this.options = $.extend( true, {},
+ this.options,
+ $.metadata && $.metadata.get( element )[ this.widgetName ],
+ options );
+
+ var self = this;
+ this.element.bind( "remove." + this.widgetName, function() {
+ self.destroy();
+ });
+
+ this._create();
+ this._init();
+ },
+ _create: function() {},
_init: function() {},
+
destroy: function() {
- this.element.removeData(this.widgetName)
- .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
- .removeAttr('aria-disabled');
+ this.element
+ .unbind( "." + this.widgetName )
+ .removeData( this.widgetName );
+ this.widget()
+ .unbind( "." + this.widgetName )
+ .removeAttr( "aria-disabled" )
+ .removeClass(
+ this.widgetBaseClass + "-disabled " +
+ "ui-state-disabled" );
+ },
+
+ widget: function() {
+ return this.element;
},
- option: function(key, value) {
+ option: function( key, value ) {
var options = key,
self = this;
- if (typeof key == "string") {
- if (value === undefined) {
- return this._getData(key);
+ if ( arguments.length === 0 ) {
+ // don't return a reference to the internal hash
+ return $.extend( {}, self.options );
+ }
+
+ if (typeof key === "string" ) {
+ if ( value === undefined ) {
+ return this.options[ key ];
}
options = {};
- options[key] = value;
+ options[ key ] = value;
}
- $.each(options, function(key, value) {
- self._setData(key, value);
+ $.each( options, function( key, value ) {
+ self._setOption( key, value );
});
+
+ return self;
},
- _getData: function(key) {
- return this.options[key];
- },
- _setData: function(key, value) {
- this.options[key] = value;
+ _setOption: function( key, value ) {
+ this.options[ key ] = value;
- if (key == 'disabled') {
- this.element
- [value ? 'addClass' : 'removeClass'](
- this.widgetBaseClass + '-disabled' + ' ' +
- this.namespace + '-state-disabled')
- .attr("aria-disabled", value);
+ if ( key === "disabled" ) {
+ this.widget()
+ [ value ? "addClass" : "removeClass"](
+ this.widgetBaseClass + "-disabled" + " " +
+ "ui-state-disabled" )
+ .attr( "aria-disabled", value );
}
+
+ return this;
},
enable: function() {
- this._setData('disabled', false);
+ return this._setOption( "disabled", false );
},
disable: function() {
- this._setData('disabled', true);
+ return this._setOption( "disabled", true );
},
- _trigger: function(type, event, data) {
- var callback = this.options[type],
- eventName = (type == this.widgetEventPrefix
- ? type : this.widgetEventPrefix + type);
+ _trigger: function( type, event, data ) {
+ var callback = this.options[ type ];
- event = $.Event(event);
- event.type = eventName;
+ event = $.Event( event );
+ event.type = ( type === this.widgetEventPrefix ?
+ type :
+ this.widgetEventPrefix + type ).toLowerCase();
+ data = data || {};
// copy original event properties over to the new event
// this would happen if we could call $.event.fix instead of $.Event
// but we don't have a way to force an event to be fixed multiple times
- if (event.originalEvent) {
- for (var i = $.event.props.length, prop; i;) {
- prop = $.event.props[--i];
- event[prop] = event.originalEvent[prop];
+ if ( event.originalEvent ) {
+ for ( var i = $.event.props.length, prop; i; ) {
+ prop = $.event.props[ --i ];
+ event[ prop ] = event.originalEvent[ prop ];
}
}
- this.element.trigger(event, data);
+ this.element.trigger( event, data );
- return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
- || event.isDefaultPrevented());
+ return !( $.isFunction(callback) &&
+ callback.call( this.element[0], event, data ) === false ||
+ event.isDefaultPrevented() );
}
};
-$.widget.defaults = {
- disabled: false
-};
-
-
-/** Mouse Interaction Plugin **/
+})( jQuery );
+/*!
+ * jQuery UI Mouse 1.8.2
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Mouse
+ *
+ * Depends:
+ * jquery.ui.widget.js
+ */
+(function($) {
-$.ui.mouse = {
+$.widget("ui.mouse", {
+ options: {
+ cancel: ':input,option',
+ distance: 1,
+ delay: 0
+ },
_mouseInit: function() {
var self = this;
@@ -385,12 +485,6 @@ $.ui.mouse = {
}
});
- // Prevent text selection in IE
- if ($.browser.msie) {
- this._mouseUnselectable = this.element.attr('unselectable');
- this.element.attr('unselectable', 'on');
- }
-
this.started = false;
},
@@ -398,10 +492,6 @@ $.ui.mouse = {
// other instances of mouse
_mouseDestroy: function() {
this.element.unbind('.'+this.widgetName);
-
- // Restore text selection in IE
- ($.browser.msie
- && this.element.attr('unselectable', this._mouseUnselectable));
},
_mouseDown: function(event) {
@@ -508,32 +598,54 @@ $.ui.mouse = {
_mouseDrag: function(event) {},
_mouseStop: function(event) {},
_mouseCapture: function(event) { return true; }
-};
-
-$.ui.mouse.defaults = {
- cancel: null,
- distance: 1,
- delay: 0
-};
+});
})(jQuery);
/*
- * jQuery UI Draggable 1.7.2
+ * jQuery UI Draggable 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Draggables
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
*/
(function($) {
-$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
-
- _init: function() {
+$.widget("ui.draggable", $.ui.mouse, {
+ widgetEventPrefix: "drag",
+ options: {
+ addClasses: true,
+ appendTo: "parent",
+ axis: false,
+ connectToSortable: false,
+ containment: false,
+ cursor: "auto",
+ cursorAt: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ iframeFix: false,
+ opacity: false,
+ refreshPositions: false,
+ revert: false,
+ revertDuration: 500,
+ scope: "default",
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ snap: false,
+ snapMode: "both",
+ snapTolerance: 20,
+ stack: false,
+ zIndex: false
+ },
+ _create: function() {
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
this.element[0].style.position = 'relative';
@@ -554,12 +666,15 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
+ " ui-draggable-dragging"
+ " ui-draggable-disabled");
this._mouseDestroy();
+
+ return this;
},
_mouseCapture: function(event) {
var o = this.options;
+ // among others, prevent a drag on a resizable-handle
if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
return false;
@@ -599,7 +714,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
this.scrollParent = this.helper.scrollParent();
//The element's absolute position on the page minus margins
- this.offset = this.element.offset();
+ this.offset = this.positionAbs = this.element.offset();
this.offset = {
top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left
@@ -615,20 +730,22 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
});
//Generate the original position
- this.originalPosition = this._generatePosition(event);
+ this.originalPosition = this.position = this._generatePosition(event);
this.originalPageX = event.pageX;
this.originalPageY = event.pageY;
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
- if(o.cursorAt)
- this._adjustOffsetFromHelper(o.cursorAt);
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
//Set a containment if given in the options
if(o.containment)
this._setContainment();
- //Call plugins and callbacks
- this._trigger("start", event);
+ //Trigger event + callbacks
+ if(this._trigger("start", event) === false) {
+ this._clear();
+ return false;
+ }
//Recache the helper size
this._cacheHelperProportions();
@@ -651,7 +768,10 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
//Call plugins and callbacks and use the resulting position if something is returned
if (!noPropagation) {
var ui = this._uiHash();
- this._trigger('drag', event, ui);
+ if(this._trigger('drag', event, ui) === false) {
+ this._mouseUp({});
+ return false;
+ }
this.position = ui.position;
}
@@ -674,20 +794,38 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
dropped = this.dropped;
this.dropped = false;
}
+
+ //if the original element is removed, don't bother to continue
+ if(!this.element[0] || !this.element[0].parentNode)
+ return false;
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
var self = this;
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
- self._trigger("stop", event);
- self._clear();
+ if(self._trigger("stop", event) !== false) {
+ self._clear();
+ }
});
} else {
- this._trigger("stop", event);
- this._clear();
+ if(this._trigger("stop", event) !== false) {
+ this._clear();
+ }
}
return false;
},
+
+ cancel: function() {
+
+ if(this.helper.is(".ui-draggable-dragging")) {
+ this._mouseUp({});
+ } else {
+ this._clear();
+ }
+
+ return this;
+
+ },
_getHandle: function(event) {
@@ -719,10 +857,24 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
},
_adjustOffsetFromHelper: function(obj) {
- if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
- if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
- if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
- if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ if (typeof obj == 'string') {
+ obj = obj.split(' ');
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ('left' in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ('right' in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ('top' in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ('bottom' in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
},
_getParentOffset: function() {
@@ -818,13 +970,13 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
pos.top // The absolute mouse position
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
- - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
),
left: (
pos.left // The absolute mouse position
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
- - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
)
};
@@ -833,15 +985,6 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
_generatePosition: function(event) {
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
-
- // This is another very weird special case that only happens for relative elements:
- // 1. If the css position is relative
- // 2. and the scroll parent is the document or similar to the offset parent
- // we have to refresh the relative offset during the scroll so there are no jumps
- if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
- this.offset.relative = this._getRelativeOffset();
- }
-
var pageX = event.pageX;
var pageY = event.pageY;
@@ -875,14 +1018,14 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
- this.offset.click.top // Click offset (relative to the element)
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
- + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
),
left: (
pageX // The absolute mouse position
- this.offset.click.left // Click offset (relative to the element)
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
- + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
)
};
@@ -902,7 +1045,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
ui = ui || this._uiHash();
$.ui.plugin.call(this, type, [event, ui]);
if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
- return $.widget.prototype._trigger.call(this, type, event, ui);
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
},
plugins: {},
@@ -911,45 +1054,15 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
return {
helper: this.helper,
position: this.position,
- absolutePosition: this.positionAbs, //deprecated
+ originalPosition: this.originalPosition,
offset: this.positionAbs
};
}
-}));
+});
$.extend($.ui.draggable, {
- version: "1.7.2",
- eventPrefix: "drag",
- defaults: {
- addClasses: true,
- appendTo: "parent",
- axis: false,
- cancel: ":input,option",
- connectToSortable: false,
- containment: false,
- cursor: "auto",
- cursorAt: false,
- delay: 0,
- distance: 1,
- grid: false,
- handle: false,
- helper: "original",
- iframeFix: false,
- opacity: false,
- refreshPositions: false,
- revert: false,
- revertDuration: 500,
- scope: "default",
- scroll: true,
- scrollSensitivity: 20,
- scrollSpeed: 20,
- snap: false,
- snapMode: "both",
- snapTolerance: 20,
- stack: false,
- zIndex: false
- }
+ version: "1.8.2"
});
$.ui.plugin.add("draggable", "connectToSortable", {
@@ -1019,12 +1132,12 @@ $.ui.plugin.add("draggable", "connectToSortable", {
};
$.each(inst.sortables, function(i) {
-
+
//Copy over some variables to allow calling the sortable's native _intersectsWith
this.instance.positionAbs = inst.positionAbs;
this.instance.helperProportions = inst.helperProportions;
this.instance.offset.click = inst.offset.click;
-
+
if(this.instance._intersectsWith(this.instance.containerCache)) {
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
@@ -1067,13 +1180,13 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.isOver = 0;
this.instance.cancelHelperRemoval = true;
-
+
//Prevent reverting on this forced stop
this.instance.options.revert = false;
-
+
// The out event needs to be triggered independently
this.instance._trigger('out', event, this.instance._uiHash(this.instance));
-
+
this.instance._mouseStop(event, true);
this.instance.options.helper = this.instance.options._helper;
@@ -1257,15 +1370,17 @@ $.ui.plugin.add("draggable", "stack", {
var o = $(this).data("draggable").options;
- var group = $.makeArray($(o.stack.group)).sort(function(a,b) {
- return (parseInt($(a).css("zIndex"),10) || o.stack.min) - (parseInt($(b).css("zIndex"),10) || o.stack.min);
+ var group = $.makeArray($(o.stack)).sort(function(a,b) {
+ return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
});
-
+ if (!group.length) { return; }
+
+ var min = parseInt(group[0].style.zIndex) || 0;
$(group).each(function(i) {
- this.style.zIndex = o.stack.min + i;
+ this.style.zIndex = min + i;
});
- this[0].style.zIndex = o.stack.min + group.length;
+ this[0].style.zIndex = min + group.length;
}
});
@@ -1284,28 +1399,39 @@ $.ui.plugin.add("draggable", "zIndex", {
})(jQuery);
/*
- * jQuery UI Droppable 1.7.2
+ * jQuery UI Droppable 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Droppables
*
* Depends:
- * ui.core.js
- * ui.draggable.js
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.mouse.js
+ * jquery.ui.draggable.js
*/
(function($) {
$.widget("ui.droppable", {
-
- _init: function() {
+ widgetEventPrefix: "drop",
+ options: {
+ accept: '*',
+ activeClass: false,
+ addClasses: true,
+ greedy: false,
+ hoverClass: false,
+ scope: 'default',
+ tolerance: 'intersect'
+ },
+ _create: function() {
var o = this.options, accept = o.accept;
this.isover = 0; this.isout = 1;
- this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) {
+ this.accept = $.isFunction(accept) ? accept : function(d) {
return d.is(accept);
};
@@ -1313,10 +1439,10 @@ $.widget("ui.droppable", {
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
// Add the reference and positions to the manager
- $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
- $.ui.ddmanager.droppables[this.options.scope].push(this);
+ $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
+ $.ui.ddmanager.droppables[o.scope].push(this);
- (this.options.addClasses && this.element.addClass("ui-droppable"));
+ (o.addClasses && this.element.addClass("ui-droppable"));
},
@@ -1330,18 +1456,18 @@ $.widget("ui.droppable", {
.removeClass("ui-droppable ui-droppable-disabled")
.removeData("droppable")
.unbind(".droppable");
+
+ return this;
},
- _setData: function(key, value) {
+ _setOption: function(key, value) {
if(key == 'accept') {
- this.options.accept = value && $.isFunction(value) ? value : function(d) {
+ this.accept = $.isFunction(value) ? value : function(d) {
return d.is(value);
};
- } else {
- $.widget.prototype._setData.apply(this, arguments);
}
-
+ $.Widget.prototype._setOption.apply(this, arguments);
},
_activate: function(event) {
@@ -1361,7 +1487,7 @@ $.widget("ui.droppable", {
var draggable = $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
- if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
this._trigger('over', event, this.ui(draggable));
}
@@ -1373,7 +1499,7 @@ $.widget("ui.droppable", {
var draggable = $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
- if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
this._trigger('out', event, this.ui(draggable));
}
@@ -1388,13 +1514,17 @@ $.widget("ui.droppable", {
var childrenIntersection = false;
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
var inst = $.data(this, 'droppable');
- if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
- childrenIntersection = true; return false;
- }
+ if(
+ inst.options.greedy
+ && !inst.options.disabled
+ && inst.options.scope == draggable.options.scope
+ && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
+ && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
+ ) { childrenIntersection = true; return false; }
});
if(childrenIntersection) return false;
- if(this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
this._trigger('drop', event, this.ui(draggable));
@@ -1410,7 +1540,6 @@ $.widget("ui.droppable", {
draggable: (c.currentItem || c.element),
helper: c.helper,
position: c.position,
- absolutePosition: c.positionAbs, //deprecated
offset: c.positionAbs
};
}
@@ -1418,17 +1547,7 @@ $.widget("ui.droppable", {
});
$.extend($.ui.droppable, {
- version: "1.7.2",
- eventPrefix: 'drop',
- defaults: {
- accept: '*',
- activeClass: false,
- addClasses: true,
- greedy: false,
- hoverClass: false,
- scope: 'default',
- tolerance: 'intersect'
- }
+ version: "1.8.2"
});
$.ui.intersect = function(draggable, droppable, toleranceMode) {
@@ -1483,13 +1602,13 @@ $.ui.ddmanager = {
droppables: { 'default': [] },
prepareOffsets: function(t, event) {
- var m = $.ui.ddmanager.droppables[t.options.scope];
+ var m = $.ui.ddmanager.droppables[t.options.scope] || [];
var type = event ? event.type : null; // workaround for #2317
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
droppablesLoop: for (var i = 0; i < m.length; i++) {
- if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
+ if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
@@ -1504,13 +1623,13 @@ $.ui.ddmanager = {
drop: function(draggable, event) {
var dropped = false;
- $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
if(!this.options) return;
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
- dropped = this._drop.call(this, event);
+ dropped = dropped || this._drop.call(this, event);
- if (!this.options.disabled && this.visible && this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
this.isout = 1; this.isover = 0;
this._deactivate.call(this, event);
}
@@ -1525,8 +1644,7 @@ $.ui.ddmanager = {
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
//Run through all droppables and check their positions based on specific tolerance options
-
- $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
if(this.options.disabled || this.greedyChild || !this.visible) return;
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
@@ -1566,22 +1684,42 @@ $.ui.ddmanager = {
})(jQuery);
/*
- * jQuery UI Resizable 1.7.2
+ * jQuery UI Resizable 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Resizables
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
*/
(function($) {
-$.widget("ui.resizable", $.extend({}, $.ui.mouse, {
-
- _init: function() {
+$.widget("ui.resizable", $.ui.mouse, {
+ widgetEventPrefix: "resize",
+ options: {
+ alsoResize: false,
+ animate: false,
+ animateDuration: "slow",
+ animateEasing: "swing",
+ aspectRatio: false,
+ autoHide: false,
+ containment: false,
+ ghost: false,
+ grid: false,
+ handles: "e,s,se",
+ helper: false,
+ maxHeight: null,
+ maxWidth: null,
+ minHeight: 10,
+ minWidth: 10,
+ zIndex: 1000
+ },
+ _create: function() {
var self = this, o = this.options;
this.element.addClass("ui-resizable");
@@ -1752,7 +1890,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
if (this.elementIsWrapper) {
_destroy(this.element);
var wrapper = this.element;
- wrapper.parent().append(
+ wrapper.after(
this.originalElement.css({
position: wrapper.css('position'),
width: wrapper.outerWidth(),
@@ -1760,23 +1898,24 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
top: wrapper.css('top'),
left: wrapper.css('left')
})
- ).end().remove();
+ ).remove();
}
this.originalElement.css('resize', this.originalResizeStyle);
_destroy(this.originalElement);
+ return this;
},
_mouseCapture: function(event) {
-
var handle = false;
- for(var i in this.handles) {
- if($(this.handles[i])[0] == event.target) handle = true;
+ for (var i in this.handles) {
+ if ($(this.handles[i])[0] == event.target) {
+ handle = true;
+ }
}
- return this.options.disabled || !!handle;
-
+ return !this.options.disabled && handle;
},
_mouseStart: function(event) {
@@ -2062,32 +2201,10 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
};
}
-}));
+});
$.extend($.ui.resizable, {
- version: "1.7.2",
- eventPrefix: "resize",
- defaults: {
- alsoResize: false,
- animate: false,
- animateDuration: "slow",
- animateEasing: "swing",
- aspectRatio: false,
- autoHide: false,
- cancel: ":input,option",
- containment: false,
- delay: 0,
- distance: 1,
- ghost: false,
- grid: false,
- handles: "e,s,se",
- helper: false,
- maxHeight: null,
- maxWidth: null,
- minHeight: 10,
- minWidth: 10,
- zIndex: 1000
- }
+ version: "1.8.2"
});
/*
@@ -2100,7 +2217,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
var self = $(this).data("resizable"), o = self.options;
- _store = function(exp) {
+ var _store = function(exp) {
$(exp).each(function() {
$(this).data("resizable-alsoresize", {
width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
@@ -2365,23 +2482,32 @@ var isNumber = function(value) {
};
})(jQuery);
+
/*
- * jQuery UI Selectable 1.7.2
+ * jQuery UI Selectable 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Selectables
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
*/
(function($) {
-$.widget("ui.selectable", $.extend({}, $.ui.mouse, {
-
- _init: function() {
+$.widget("ui.selectable", $.ui.mouse, {
+ options: {
+ appendTo: 'body',
+ autoRefresh: true,
+ distance: 0,
+ filter: '*',
+ tolerance: 'touch'
+ },
+ _create: function() {
var self = this;
this.element.addClass("ui-selectable");
@@ -2415,17 +2541,20 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
this._mouseInit();
- this.helper = $(document.createElement('div'))
- .css({border:'1px dotted black'})
- .addClass("ui-selectable-helper");
+ this.helper = $("<div class='ui-selectable-helper'></div>");
},
destroy: function() {
+ this.selectees
+ .removeClass("ui-selectee")
+ .removeData("selectable-item");
this.element
.removeClass("ui-selectable ui-selectable-disabled")
.removeData("selectable")
.unbind(".selectable");
this._mouseDestroy();
+
+ return this;
},
_mouseStart: function(event) {
@@ -2475,14 +2604,23 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
$(event.target).parents().andSelf().each(function() {
var selectee = $.data(this, "selectable-item");
if (selectee) {
- selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');
- selectee.unselecting = false;
- selectee.selecting = true;
- selectee.selected = true;
- // selectable SELECTING callback
- self._trigger("selecting", event, {
- selecting: selectee.element
- });
+ var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
+ selectee.$element
+ .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
+ .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
+ selectee.unselecting = !doSelect;
+ selectee.selecting = doSelect;
+ selectee.selected = doSelect;
+ // selectable (UN)SELECTING callback
+ if (doSelect) {
+ self._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ } else {
+ self._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
return false;
}
});
@@ -2606,38 +2744,56 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
return false;
}
-}));
+});
$.extend($.ui.selectable, {
- version: "1.7.2",
- defaults: {
- appendTo: 'body',
- autoRefresh: true,
- cancel: ":input,option",
- delay: 0,
- distance: 0,
- filter: '*',
- tolerance: 'touch'
- }
+ version: "1.8.2"
});
})(jQuery);
/*
- * jQuery UI Sortable 1.7.2
+ * jQuery UI Sortable 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Sortables
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
*/
(function($) {
-$.widget("ui.sortable", $.extend({}, $.ui.mouse, {
- _init: function() {
+$.widget("ui.sortable", $.ui.mouse, {
+ widgetEventPrefix: "sort",
+ options: {
+ appendTo: "parent",
+ axis: false,
+ connectWith: false,
+ containment: false,
+ cursor: 'auto',
+ cursorAt: false,
+ dropOnEmpty: true,
+ forcePlaceholderSize: false,
+ forceHelperSize: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ items: '> *',
+ opacity: false,
+ placeholder: false,
+ revert: false,
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ scope: "default",
+ tolerance: "intersect",
+ zIndex: 1000
+ },
+ _create: function() {
var o = this.options;
this.containerCache = {};
@@ -2666,6 +2822,20 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
for ( var i = this.items.length - 1; i >= 0; i-- )
this.items[i].item.removeData("sortable-item");
+
+ return this;
+ },
+
+ _setOption: function(key, value){
+ if ( key === "disabled" ) {
+ this.options[ key ] = value;
+
+ this.widget()
+ [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
+ } else {
+ // Don't call widget base _setOption for disable as it adds ui-state-disabled class
+ $.Widget.prototype._setOption.apply(this, arguments);
+ }
},
_mouseCapture: function(event, overrideHandle) {
@@ -2754,8 +2924,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this.originalPageY = event.pageY;
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
- if(o.cursorAt)
- this._adjustOffsetFromHelper(o.cursorAt);
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
//Cache the former DOM position
this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
@@ -2880,6 +3049,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
&& !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
&& (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
+ //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
) {
this.direction = intersection == 1 ? "down" : "up";
@@ -2978,7 +3148,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
$(this.domPosition.parent).prepend(this.currentItem);
}
- return true;
+ return this;
},
@@ -3084,6 +3254,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
refresh: function(event) {
this._refreshItems(event);
this.refreshPositions();
+ return this;
},
_connectWith: function() {
@@ -3092,7 +3263,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
? [options.connectWith]
: options.connectWith;
},
-
+
_getItemsAsjQuery: function(connected) {
var self = this;
@@ -3106,13 +3277,13 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
for (var j = cur.length - 1; j >= 0; j--){
var inst = $.data(cur[j], 'sortable');
if(inst && inst != this && !inst.options.disabled) {
- queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]);
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
}
};
};
}
- queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]);
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
for (var i = queries.length - 1; i >= 0; i--){
queries[i][0].each(function() {
@@ -3191,10 +3362,6 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
for (var i = this.items.length - 1; i >= 0; i--){
var item = this.items[i];
- //We ignore calculating positions of all connected containers when we're not over them
- if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
- continue;
-
var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
if (!fast) {
@@ -3219,6 +3386,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
};
}
+ return this;
},
_createPlaceholder: function(that) {
@@ -3264,47 +3432,71 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
},
_contactContainers: function(event) {
+
+ // get innermost container that intersects with item
+ var innermostContainer = null, innermostIndex = null;
+
+
for (var i = this.containers.length - 1; i >= 0; i--){
- if(this._intersectsWith(this.containers[i].containerCache)) {
- if(!this.containers[i].containerCache.over) {
-
- if(this.currentContainer != this.containers[i]) {
-
- //When entering a new container, we will find the item with the least distance and append our item near it
- var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top'];
- for (var j = this.items.length - 1; j >= 0; j--) {
- if(!$.ui.contains(this.containers[i].element[0], this.items[j].item[0])) continue;
- var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];
- if(Math.abs(cur - base) < dist) {
- dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
- }
- }
-
- if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
- continue;
-
- this.currentContainer = this.containers[i];
- itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[i].element, true);
- this._trigger("change", event, this._uiHash());
- this.containers[i]._trigger("change", event, this._uiHash(this));
+ // never consider a container that's located within the item itself
+ if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
+ continue;
- //Update the placeholder
- this.options.placeholder.update(this.currentContainer, this.placeholder);
+ if(this._intersectsWith(this.containers[i].containerCache)) {
- }
+ // if we've already found a container and it's more "inner" than this, then continue
+ if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
+ continue;
- this.containers[i]._trigger("over", event, this._uiHash(this));
- this.containers[i].containerCache.over = 1;
- }
+ innermostContainer = this.containers[i];
+ innermostIndex = i;
+
} else {
+ // container doesn't intersect. trigger "out" event if necessary
if(this.containers[i].containerCache.over) {
this.containers[i]._trigger("out", event, this._uiHash(this));
this.containers[i].containerCache.over = 0;
}
}
- };
+ }
+
+ // if no intersecting containers found, return
+ if(!innermostContainer) return;
+
+ // move the item into the container if it's not there already
+ if(this.containers.length === 1) {
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ } else if(this.currentContainer != this.containers[innermostIndex]) {
+
+ //When entering a new container, we will find the item with the least distance and append our item near it
+ var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
+ for (var j = this.items.length - 1; j >= 0; j--) {
+ if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
+ var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top'];
+ if(Math.abs(cur - base) < dist) {
+ dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+ }
+ }
+
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+ return;
+
+ this.currentContainer = this.containers[innermostIndex];
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+ this._trigger("change", event, this._uiHash());
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+
+ //Update the placeholder
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
+
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ }
+
+
},
_createHelper: function(event) {
@@ -3326,10 +3518,24 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
},
_adjustOffsetFromHelper: function(obj) {
- if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
- if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
- if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
- if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ if (typeof obj == 'string') {
+ obj = obj.split(' ');
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ('left' in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ('right' in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ('top' in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ('bottom' in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
},
_getParentOffset: function() {
@@ -3556,7 +3762,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
//Do what was originally in plugins
if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
- if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset cursor
+ if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
this.dragging = false;
@@ -3587,7 +3793,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
},
_trigger: function() {
- if ($.widget.prototype._trigger.apply(this, arguments) === false) {
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
this.cancel();
}
},
@@ -3598,53 +3804,24 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
helper: self.helper,
placeholder: self.placeholder || $([]),
position: self.position,
- absolutePosition: self.positionAbs, //deprecated
+ originalPosition: self.originalPosition,
offset: self.positionAbs,
item: self.currentItem,
sender: inst ? inst.element : null
};
}
-}));
+});
$.extend($.ui.sortable, {
- getter: "serialize toArray",
- version: "1.7.2",
- eventPrefix: "sort",
- defaults: {
- appendTo: "parent",
- axis: false,
- cancel: ":input,option",
- connectWith: false,
- containment: false,
- cursor: 'auto',
- cursorAt: false,
- delay: 0,
- distance: 1,
- dropOnEmpty: true,
- forcePlaceholderSize: false,
- forceHelperSize: false,
- grid: false,
- handle: false,
- helper: "original",
- items: '> *',
- opacity: false,
- placeholder: false,
- revert: false,
- scroll: true,
- scrollSensitivity: 20,
- scrollSpeed: 20,
- scope: "default",
- tolerance: "intersect",
- zIndex: 1000
- }
+ version: "1.8.2"
});
})(jQuery);
/*
- * jQuery UI Effects 1.7.2
+ * jQuery UI Effects 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
@@ -3652,228 +3829,30 @@ $.extend($.ui.sortable, {
*/
;jQuery.effects || (function($) {
-$.effects = {
- version: "1.7.2",
+$.effects = {};
- // Saves a set of properties in a data storage
- save: function(element, set) {
- for(var i=0; i < set.length; i++) {
- if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
- }
- },
- // Restores a set of previously saved properties from a data storage
- restore: function(element, set) {
- for(var i=0; i < set.length; i++) {
- if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
- }
- },
- setMode: function(el, mode) {
- if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
- return mode;
- },
+/******************************************************************************/
+/****************************** COLOR ANIMATIONS ******************************/
+/******************************************************************************/
- getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
- // this should be a little more flexible in the future to handle a string & hash
- var y, x;
- switch (origin[0]) {
- case 'top': y = 0; break;
- case 'middle': y = 0.5; break;
- case 'bottom': y = 1; break;
- default: y = origin[0] / original.height;
- };
- switch (origin[1]) {
- case 'left': x = 0; break;
- case 'center': x = 0.5; break;
- case 'right': x = 1; break;
- default: x = origin[1] / original.width;
- };
- return {x: x, y: y};
- },
-
- // Wraps the element around a wrapper that copies position properties
- createWrapper: function(element) {
-
- //if the element is already wrapped, return it
- if (element.parent().is('.ui-effects-wrapper'))
- return element.parent();
-
- //Cache width,height and float properties of the element, and create a wrapper around it
- var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') };
- element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
- var wrapper = element.parent();
-
- //Transfer the positioning of the element to the wrapper
- if (element.css('position') == 'static') {
- wrapper.css({ position: 'relative' });
- element.css({ position: 'relative'} );
- } else {
- var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto';
- var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto';
- wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show();
- element.css({position: 'relative', top: 0, left: 0 });
+// override the animation for color styles
+$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
+ 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'],
+function(i, attr) {
+ $.fx.step[attr] = function(fx) {
+ if (!fx.colorInit) {
+ fx.start = getColor(fx.elem, attr);
+ fx.end = getRGB(fx.end);
+ fx.colorInit = true;
}
- wrapper.css(props);
- return wrapper;
- },
-
- removeWrapper: function(element) {
- if (element.parent().is('.ui-effects-wrapper'))
- return element.parent().replaceWith(element);
- return element;
- },
-
- setTransition: function(element, list, factor, value) {
- value = value || {};
- $.each(list, function(i, x){
- unit = element.cssUnit(x);
- if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
- });
- return value;
- },
-
- //Base function to animate from one class to another in a seamless transition
- animateClass: function(value, duration, easing, callback) {
-
- var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
- var ea = (typeof easing == "string" ? easing : null);
-
- return this.each(function() {
-
- var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
- if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
- if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
-
- //Let's get a style offset
- var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
- if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
- var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
- if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
-
- // The main function to form the object for animation
- for(var n in newStyle) {
- if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
- && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
- && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
- && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
- && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
- ) offset[n] = newStyle[n];
- }
-
- that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
- // Change style attribute back to original. For stupid IE, we need to clear the damn object.
- if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
- if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
- if(cb) cb.apply(this, arguments);
- });
-
- });
- }
-};
-
-
-function _normalizeArguments(a, m) {
-
- var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m;
- var speed = a[1] && a[1].constructor != Object ? a[1] : (o.duration ? o.duration : a[2]); //either comes from options.duration or the secon/third argument
- speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
- var callback = o.callback || ( $.isFunction(a[1]) && a[1] ) || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] );
-
- return [a[0], o, speed, callback];
-
-}
-
-//Extend the methods of jQuery
-$.fn.extend({
-
- //Save old methods
- _show: $.fn.show,
- _hide: $.fn.hide,
- __toggle: $.fn.toggle,
- _addClass: $.fn.addClass,
- _removeClass: $.fn.removeClass,
- _toggleClass: $.fn.toggleClass,
-
- // New effect methods
- effect: function(fx, options, speed, callback) {
- return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null;
- },
-
- show: function() {
- if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
- return this._show.apply(this, arguments);
- else {
- return this.effect.apply(this, _normalizeArguments(arguments, 'show'));
- }
- },
-
- hide: function() {
- if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
- return this._hide.apply(this, arguments);
- else {
- return this.effect.apply(this, _normalizeArguments(arguments, 'hide'));
- }
- },
-
- toggle: function(){
- if(!arguments[0] ||
- (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) ||
- ($.isFunction(arguments[0]) || typeof arguments[0] == 'boolean')) {
- return this.__toggle.apply(this, arguments);
- } else {
- return this.effect.apply(this, _normalizeArguments(arguments, 'toggle'));
- }
- },
-
- addClass: function(classNames, speed, easing, callback) {
- return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
- },
- removeClass: function(classNames,speed,easing,callback) {
- return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
- },
- toggleClass: function(classNames,speed,easing,callback) {
- return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed);
- },
- morph: function(remove,add,speed,easing,callback) {
- return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
- },
- switchClass: function() {
- return this.morph.apply(this, arguments);
- },
-
- // helper functions
- cssUnit: function(key) {
- var style = this.css(key), val = [];
- $.each( ['em','px','%','pt'], function(i, unit){
- if(style.indexOf(unit) > 0)
- val = [parseFloat(style), unit];
- });
- return val;
- }
-});
-
-/*
- * jQuery Color Animations
- * Copyright 2007 John Resig
- * Released under the MIT and GPL licenses.
- */
-
-// We override the animation for all of these color styles
-$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
- $.fx.step[attr] = function(fx) {
- if ( fx.state == 0 ) {
- fx.start = getColor( fx.elem, attr );
- fx.end = getRGB( fx.end );
- }
-
- fx.elem.style[attr] = "rgb(" + [
- Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0),
- Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0),
- Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0)
- ].join(",") + ")";
- };
+ fx.elem.style[attr] = 'rgb(' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
+ };
});
// Color Conversion functions from highlightFade
@@ -3979,6 +3958,373 @@ var colors = {
transparent: [255,255,255]
};
+
+
+/******************************************************************************/
+/****************************** CLASS ANIMATIONS ******************************/
+/******************************************************************************/
+
+var classAnimationActions = ['add', 'remove', 'toggle'],
+ shorthandStyles = {
+ border: 1,
+ borderBottom: 1,
+ borderColor: 1,
+ borderLeft: 1,
+ borderRight: 1,
+ borderTop: 1,
+ borderWidth: 1,
+ margin: 1,
+ padding: 1
+ };
+
+function getElementStyles() {
+ var style = document.defaultView
+ ? document.defaultView.getComputedStyle(this, null)
+ : this.currentStyle,
+ newStyle = {},
+ key,
+ camelCase;
+
+ // webkit enumerates style porperties
+ if (style && style.length && style[0] && style[style[0]]) {
+ var len = style.length;
+ while (len--) {
+ key = style[len];
+ if (typeof style[key] == 'string') {
+ camelCase = key.replace(/\-(\w)/g, function(all, letter){
+ return letter.toUpperCase();
+ });
+ newStyle[camelCase] = style[key];
+ }
+ }
+ } else {
+ for (key in style) {
+ if (typeof style[key] === 'string') {
+ newStyle[key] = style[key];
+ }
+ }
+ }
+
+ return newStyle;
+}
+
+function filterStyles(styles) {
+ var name, value;
+ for (name in styles) {
+ value = styles[name];
+ if (
+ // ignore null and undefined values
+ value == null ||
+ // ignore functions (when does this occur?)
+ $.isFunction(value) ||
+ // shorthand styles that need to be expanded
+ name in shorthandStyles ||
+ // ignore scrollbars (break in IE)
+ (/scrollbar/).test(name) ||
+
+ // only colors or values that can be converted to numbers
+ (!(/color/i).test(name) && isNaN(parseFloat(value)))
+ ) {
+ delete styles[name];
+ }
+ }
+
+ return styles;
+}
+
+function styleDifference(oldStyle, newStyle) {
+ var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
+ name;
+
+ for (name in newStyle) {
+ if (oldStyle[name] != newStyle[name]) {
+ diff[name] = newStyle[name];
+ }
+ }
+
+ return diff;
+}
+
+$.effects.animateClass = function(value, duration, easing, callback) {
+ if ($.isFunction(easing)) {
+ callback = easing;
+ easing = null;
+ }
+
+ return this.each(function() {
+
+ var that = $(this),
+ originalStyleAttr = that.attr('style') || ' ',
+ originalStyle = filterStyles(getElementStyles.call(this)),
+ newStyle,
+ className = that.attr('className');
+
+ $.each(classAnimationActions, function(i, action) {
+ if (value[action]) {
+ that[action + 'Class'](value[action]);
+ }
+ });
+ newStyle = filterStyles(getElementStyles.call(this));
+ that.attr('className', className);
+
+ that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
+ $.each(classAnimationActions, function(i, action) {
+ if (value[action]) { that[action + 'Class'](value[action]); }
+ });
+ // work around bug in IE by clearing the cssText before setting it
+ if (typeof that.attr('style') == 'object') {
+ that.attr('style').cssText = '';
+ that.attr('style').cssText = originalStyleAttr;
+ } else {
+ that.attr('style', originalStyleAttr);
+ }
+ if (callback) { callback.apply(this, arguments); }
+ });
+ });
+};
+
+$.fn.extend({
+ _addClass: $.fn.addClass,
+ addClass: function(classNames, speed, easing, callback) {
+ return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
+ },
+
+ _removeClass: $.fn.removeClass,
+ removeClass: function(classNames,speed,easing,callback) {
+ return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
+ },
+
+ _toggleClass: $.fn.toggleClass,
+ toggleClass: function(classNames, force, speed, easing, callback) {
+ if ( typeof force == "boolean" || force === undefined ) {
+ if ( !speed ) {
+ // without speed parameter;
+ return this._toggleClass(classNames, force);
+ } else {
+ return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
+ }
+ } else {
+ // without switch parameter;
+ return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
+ }
+ },
+
+ switchClass: function(remove,add,speed,easing,callback) {
+ return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
+ }
+});
+
+
+
+/******************************************************************************/
+/*********************************** EFFECTS **********************************/
+/******************************************************************************/
+
+$.extend($.effects, {
+ version: "1.8.2",
+
+ // Saves a set of properties in a data storage
+ save: function(element, set) {
+ for(var i=0; i < set.length; i++) {
+ if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
+ }
+ },
+
+ // Restores a set of previously saved properties from a data storage
+ restore: function(element, set) {
+ for(var i=0; i < set.length; i++) {
+ if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
+ }
+ },
+
+ setMode: function(el, mode) {
+ if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
+ return mode;
+ },
+
+ getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
+ // this should be a little more flexible in the future to handle a string & hash
+ var y, x;
+ switch (origin[0]) {
+ case 'top': y = 0; break;
+ case 'middle': y = 0.5; break;
+ case 'bottom': y = 1; break;
+ default: y = origin[0] / original.height;
+ };
+ switch (origin[1]) {
+ case 'left': x = 0; break;
+ case 'center': x = 0.5; break;
+ case 'right': x = 1; break;
+ default: x = origin[1] / original.width;
+ };
+ return {x: x, y: y};
+ },
+
+ // Wraps the element around a wrapper that copies position properties
+ createWrapper: function(element) {
+
+ // if the element is already wrapped, return it
+ if (element.parent().is('.ui-effects-wrapper')) {
+ return element.parent();
+ }
+
+ // wrap the element
+ var props = {
+ width: element.outerWidth(true),
+ height: element.outerHeight(true),
+ 'float': element.css('float')
+ },
+ wrapper = $('<div></div>')
+ .addClass('ui-effects-wrapper')
+ .css({
+ fontSize: '100%',
+ background: 'transparent',
+ border: 'none',
+ margin: 0,
+ padding: 0
+ });
+
+ element.wrap(wrapper);
+ wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
+
+ // transfer positioning properties to the wrapper
+ if (element.css('position') == 'static') {
+ wrapper.css({ position: 'relative' });
+ element.css({ position: 'relative' });
+ } else {
+ $.extend(props, {
+ position: element.css('position'),
+ zIndex: element.css('z-index')
+ });
+ $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
+ props[pos] = element.css(pos);
+ if (isNaN(parseInt(props[pos], 10))) {
+ props[pos] = 'auto';
+ }
+ });
+ element.css({position: 'relative', top: 0, left: 0 });
+ }
+
+ return wrapper.css(props).show();
+ },
+
+ removeWrapper: function(element) {
+ if (element.parent().is('.ui-effects-wrapper'))
+ return element.parent().replaceWith(element);
+ return element;
+ },
+
+ setTransition: function(element, list, factor, value) {
+ value = value || {};
+ $.each(list, function(i, x){
+ unit = element.cssUnit(x);
+ if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
+ });
+ return value;
+ }
+});
+
+
+function _normalizeArguments(effect, options, speed, callback) {
+ // shift params for method overloading
+ if (typeof effect == 'object') {
+ callback = options;
+ speed = null;
+ options = effect;
+ effect = options.effect;
+ }
+ if ($.isFunction(options)) {
+ callback = options;
+ speed = null;
+ options = {};
+ }
+ if ($.isFunction(speed)) {
+ callback = speed;
+ speed = null;
+ }
+ if (typeof options == 'number' || $.fx.speeds[options]) {
+ callback = speed;
+ speed = options;
+ options = {};
+ }
+
+ options = options || {};
+
+ speed = speed || options.duration;
+ speed = $.fx.off ? 0 : typeof speed == 'number'
+ ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
+
+ callback = callback || options.complete;
+
+ return [effect, options, speed, callback];
+}
+
+$.fn.extend({
+ effect: function(effect, options, speed, callback) {
+ var args = _normalizeArguments.apply(this, arguments),
+ // TODO: make effects takes actual parameters instead of a hash
+ args2 = {
+ options: args[1],
+ duration: args[2],
+ callback: args[3]
+ },
+ effectMethod = $.effects[effect];
+
+ return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
+ },
+
+ _show: $.fn.show,
+ show: function(speed) {
+ if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {
+ return this._show.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'show';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ _hide: $.fn.hide,
+ hide: function(speed) {
+ if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {
+ return this._hide.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'hide';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ // jQuery core overloads toggle and create _toggle
+ __toggle: $.fn.toggle,
+ toggle: function(speed) {
+ if (!speed || typeof speed == 'number' || $.fx.speeds[speed] ||
+ typeof speed == 'boolean' || $.isFunction(speed)) {
+ return this.__toggle.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'toggle';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ // helper functions
+ cssUnit: function(key) {
+ var style = this.css(key), val = [];
+ $.each( ['em','px','%','pt'], function(i, unit){
+ if(style.indexOf(unit) > 0)
+ val = [parseFloat(style), unit];
+ });
+ return val;
+ }
+});
+
+
+
+/******************************************************************************/
+/*********************************** EASING ***********************************/
+/******************************************************************************/
+
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
@@ -4187,16 +4533,16 @@ $.extend($.easing,
})(jQuery);
/*
- * jQuery UI Effects Blind 1.7.2
+ * jQuery UI Effects Blind 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Blind
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4236,16 +4582,16 @@ $.effects.blind = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Bounce 1.7.2
+ * jQuery UI Effects Bounce 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Bounce
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4314,16 +4660,16 @@ $.effects.bounce = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Clip 1.7.2
+ * jQuery UI Effects Clip 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Clip
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4368,16 +4714,16 @@ $.effects.clip = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Drop 1.7.2
+ * jQuery UI Effects Drop 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Drop
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4418,16 +4764,16 @@ $.effects.drop = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Explode 1.7.2
+ * jQuery UI Effects Explode 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Explode
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4497,16 +4843,48 @@ $.effects.explode = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Fold 1.7.2
+ * jQuery UI Effects Fade 1.8.2
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Effects/Fade
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function($) {
+
+$.effects.fade = function(o) {
+ return this.queue(function() {
+ var elem = $(this),
+ mode = $.effects.setMode(elem, o.options.mode || 'hide');
+
+ elem.animate({ opacity: mode }, {
+ queue: false,
+ duration: o.duration,
+ easing: o.options.easing,
+ complete: function() {
+ (o.callback && o.callback.apply(this, arguments));
+ elem.dequeue();
+ }
+ });
+ });
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Fold 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Fold
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4553,151 +4931,143 @@ $.effects.fold = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Highlight 1.7.2
+ * jQuery UI Effects Highlight 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Highlight
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
$.effects.highlight = function(o) {
-
return this.queue(function() {
+ var elem = $(this),
+ props = ['backgroundImage', 'backgroundColor', 'opacity'],
+ mode = $.effects.setMode(elem, o.options.mode || 'show'),
+ animation = {
+ backgroundColor: elem.css('backgroundColor')
+ };
- // Create element
- var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
-
- // Set options
- var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
- var color = o.options.color || "#ffff99"; // Default highlight color
- var oldColor = el.css("backgroundColor");
-
- // Adjust
- $.effects.save(el, props); el.show(); // Save & Show
- el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
-
- // Animation
- var animation = {backgroundColor: oldColor };
- if (mode == "hide") animation['opacity'] = 0;
-
- // Animate
- el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
- if(mode == "hide") el.hide();
- $.effects.restore(el, props);
- if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter');
- if(o.callback) o.callback.apply(this, arguments);
- el.dequeue();
- }});
+ if (mode == 'hide') {
+ animation.opacity = 0;
+ }
+ $.effects.save(elem, props);
+ elem
+ .show()
+ .css({
+ backgroundImage: 'none',
+ backgroundColor: o.options.color || '#ffff99'
+ })
+ .animate(animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.options.easing,
+ complete: function() {
+ (mode == 'hide' && elem.hide());
+ $.effects.restore(elem, props);
+ (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
+ (o.callback && o.callback.apply(this, arguments));
+ elem.dequeue();
+ }
+ });
});
-
};
})(jQuery);
/*
- * jQuery UI Effects Pulsate 1.7.2
+ * jQuery UI Effects Pulsate 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Pulsate
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
$.effects.pulsate = function(o) {
-
return this.queue(function() {
+ var elem = $(this),
+ mode = $.effects.setMode(elem, o.options.mode || 'show');
+ times = ((o.options.times || 5) * 2) - 1;
+ duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
+ isVisible = elem.is(':visible'),
+ animateTo = 0;
- // Create element
- var el = $(this);
+ if (!isVisible) {
+ elem.css('opacity', 0).show();
+ animateTo = 1;
+ }
- // Set options
- var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
- var times = o.options.times || 5; // Default # of times
- var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
+ if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
+ times--;
+ }
- // Adjust
- if (mode == 'hide') times--;
- if (el.is(':hidden')) { // Show fadeIn
- el.css('opacity', 0);
- el.show(); // Show
- el.animate({opacity: 1}, duration, o.options.easing);
- times = times-2;
+ for (var i = 0; i < times; i++) {
+ elem.animate({ opacity: animateTo }, duration, o.options.easing);
+ animateTo = (animateTo + 1) % 2;
}
- // Animate
- for (var i = 0; i < times; i++) { // Pulsate
- el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing);
- };
- if (mode == 'hide') { // Last Pulse
- el.animate({opacity: 0}, duration, o.options.easing, function(){
- el.hide(); // Hide
- if(o.callback) o.callback.apply(this, arguments); // Callback
- });
- } else {
- el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing, function(){
- if(o.callback) o.callback.apply(this, arguments); // Callback
- });
- };
- el.queue('fx', function() { el.dequeue(); });
- el.dequeue();
- });
+ elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
+ if (animateTo == 0) {
+ elem.hide();
+ }
+ (o.callback && o.callback.apply(this, arguments));
+ });
+ elem
+ .queue('fx', function() { elem.dequeue(); })
+ .dequeue();
+ });
};
})(jQuery);
/*
- * jQuery UI Effects Scale 1.7.2
+ * jQuery UI Effects Scale 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Scale
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
$.effects.puff = function(o) {
-
return this.queue(function() {
+ var elem = $(this),
+ mode = $.effects.setMode(elem, o.options.mode || 'hide'),
+ percent = parseInt(o.options.percent, 10) || 150,
+ factor = percent / 100,
+ original = { height: elem.height(), width: elem.width() };
+
+ $.extend(o.options, {
+ fade: true,
+ mode: mode,
+ percent: mode == 'hide' ? percent : 100,
+ from: mode == 'hide'
+ ? original
+ : {
+ height: original.height * factor,
+ width: original.width * factor
+ }
+ });
- // Create element
- var el = $(this);
-
- // Set options
- var options = $.extend(true, {}, o.options);
- var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
- var percent = parseInt(o.options.percent,10) || 150; // Set default puff percent
- options.fade = true; // It's not a puff if it doesn't fade! :)
- var original = {height: el.height(), width: el.width()}; // Save original
-
- // Adjust
- var factor = percent / 100;
- el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
-
- // Animation
- options.from = el.from;
- options.percent = (mode == 'hide') ? percent : 100;
- options.mode = mode;
-
- // Animate
- el.effect('scale', options, o.duration, o.callback);
- el.dequeue();
+ elem.effect('scale', o.options, o.duration, o.callback);
+ elem.dequeue();
});
-
};
$.effects.scale = function(o) {
@@ -4825,6 +5195,9 @@ $.effects.size = function(o) {
// Animate
el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+ if (el.to.opacity === 0) {
+ el.css('opacity', el.from.opacity);
+ }
if(mode == 'hide') el.hide(); // Hide
$.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
if(o.callback) o.callback.apply(this, arguments); // Callback
@@ -4837,16 +5210,16 @@ $.effects.size = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Shake 1.7.2
+ * jQuery UI Effects Shake 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Shake
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4894,16 +5267,16 @@ $.effects.shake = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Slide 1.7.2
+ * jQuery UI Effects Slide 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Slide
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4944,16 +5317,16 @@ $.effects.slide = function(o) {
})(jQuery);
/*
- * jQuery UI Effects Transfer 1.7.2
+ * jQuery UI Effects Transfer 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Transfer
*
* Depends:
- * effects.core.js
+ * jquery.effects.core.js
*/
(function($) {
@@ -4989,52 +5362,48 @@ $.effects.transfer = function(o) {
})(jQuery);
/*
- * jQuery UI Accordion 1.7.2
+ * jQuery UI Accordion 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Accordion
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
*/
(function($) {
$.widget("ui.accordion", {
-
- _init: function() {
+ options: {
+ active: 0,
+ animated: 'slide',
+ autoHeight: true,
+ clearStyle: false,
+ collapsible: false,
+ event: "click",
+ fillSpace: false,
+ header: "> li > :first-child,> :not(li):even",
+ icons: {
+ header: "ui-icon-triangle-1-e",
+ headerSelected: "ui-icon-triangle-1-s"
+ },
+ navigation: false,
+ navigationFilter: function() {
+ return this.href.toLowerCase() == location.href.toLowerCase();
+ }
+ },
+ _create: function() {
var o = this.options, self = this;
this.running = 0;
- // if the user set the alwaysOpen option on init
- // then we need to set the collapsible option
- // if they set both on init, collapsible will take priority
- if (o.collapsible == $.ui.accordion.defaults.collapsible &&
- o.alwaysOpen != $.ui.accordion.defaults.alwaysOpen) {
- o.collapsible = !o.alwaysOpen;
- }
-
- if ( o.navigation ) {
- var current = this.element.find("a").filter(o.navigationFilter);
- if ( current.length ) {
- if ( current.filter(o.header).length ) {
- this.active = current;
- } else {
- this.active = current.parent().parent().prev();
- current.addClass("ui-accordion-content-active");
- }
- }
- }
-
this.element.addClass("ui-accordion ui-widget ui-helper-reset");
-
+
// in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
- if (this.element[0].nodeName == "UL") {
- this.element.children("li").addClass("ui-accordion-li-fix");
- }
+ this.element.children("li").addClass("ui-accordion-li-fix");
this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
.bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); })
@@ -5046,17 +5415,25 @@ $.widget("ui.accordion", {
.next()
.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
+ if ( o.navigation ) {
+ var current = this.element.find("a").filter(o.navigationFilter);
+ if ( current.length ) {
+ var header = current.closest(".ui-accordion-header");
+ if ( header.length ) {
+ // anchor within header
+ this.active = header;
+ } else {
+ // anchor within content
+ this.active = current.closest(".ui-accordion-content").prev();
+ }
+ }
+ }
+
this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
this.active.next().addClass('ui-accordion-content-active');
//Append icon elements
- $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
- this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
-
- // IE7-/Win - Extra vertical space in lists fixed
- if ($.browser.msie) {
- this.element.find('a').css('zoom', '1');
- }
+ this._createIcons();
this.resize();
@@ -5090,10 +5467,27 @@ $.widget("ui.accordion", {
this.headers.find('a').attr('tabIndex','-1');
if (o.event) {
- this.headers.bind((o.event) + ".accordion", function(event) { return self._clickHandler.call(self, event, this); });
+ this.headers.bind((o.event) + ".accordion", function(event) {
+ self._clickHandler.call(self, event, this);
+ event.preventDefault();
+ });
}
},
+
+ _createIcons: function() {
+ var o = this.options;
+ if (o.icons) {
+ $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
+ this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
+ this.element.addClass("ui-accordion-icons");
+ }
+ },
+
+ _destroyIcons: function() {
+ this.headers.children(".ui-icon").remove();
+ this.element.removeClass("ui-accordion-icons");
+ },
destroy: function() {
var o = this.options;
@@ -5107,19 +5501,31 @@ $.widget("ui.accordion", {
this.headers
.unbind(".accordion")
.removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
- .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
+ .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex");
- this.headers.find("a").removeAttr("tabindex");
- this.headers.children(".ui-icon").remove();
+ this.headers.find("a").removeAttr("tabIndex");
+ this._destroyIcons();
var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
if (o.autoHeight || o.fillHeight) {
contents.css("height", "");
}
- },
- _setData: function(key, value) {
- if(key == 'alwaysOpen') { key = 'collapsible'; value = !value; }
- $.widget.prototype._setData.apply(this, arguments);
+ return this;
+ },
+
+ _setOption: function(key, value) {
+ $.Widget.prototype._setOption.apply(this, arguments);
+
+ if (key == "active") {
+ this.activate(value);
+ }
+ if (key == "icons") {
+ this._destroyIcons();
+ if (value) {
+ this._createIcons();
+ }
+ }
+
},
_keydown: function(event) {
@@ -5144,7 +5550,8 @@ $.widget("ui.accordion", {
break;
case keyCode.SPACE:
case keyCode.ENTER:
- return this._clickHandler({ target: event.target }, event.target);
+ this._clickHandler({ target: event.target }, event.target);
+ event.preventDefault();
}
if (toFocus) {
@@ -5163,34 +5570,37 @@ $.widget("ui.accordion", {
var o = this.options, maxHeight;
if (o.fillSpace) {
-
+
if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); }
maxHeight = this.element.parent().height();
if($.browser.msie) { this.element.parent().css('overflow', defOverflow); }
-
+
this.headers.each(function() {
- maxHeight -= $(this).outerHeight();
+ maxHeight -= $(this).outerHeight(true);
});
- var maxPadding = 0;
this.headers.next().each(function() {
- maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
- }).height(Math.max(0, maxHeight - maxPadding))
- .css('overflow', 'auto');
+ $(this).height(Math.max(0, maxHeight - $(this).innerHeight() + $(this).height()));
+ }).css('overflow', 'auto');
} else if ( o.autoHeight ) {
maxHeight = 0;
this.headers.next().each(function() {
- maxHeight = Math.max(maxHeight, $(this).outerHeight());
+ maxHeight = Math.max(maxHeight, $(this).height());
}).height(maxHeight);
}
+ return this;
},
activate: function(index) {
+ // TODO this gets called on init, changing the option without an explicit call for that
+ this.options.active = index;
// call clickHandler with custom event
var active = this._findActive(index)[0];
this._clickHandler({ target: active }, active);
+
+ return this;
},
_findActive: function(selector) {
@@ -5203,13 +5613,17 @@ $.widget("ui.accordion", {
: this.headers.filter(":eq(0)");
},
+ // TODO isn't event.target enough? why the seperate target argument?
_clickHandler: function(event, target) {
var o = this.options;
- if (o.disabled) return false;
+ if (o.disabled)
+ return;
// called only when using activate(false) to close all parts programmatically
- if (!event.target && o.collapsible) {
+ if (!event.target) {
+ if (!o.collapsible)
+ return;
this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
.find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
this.active.next().addClass('ui-accordion-content-active');
@@ -5223,22 +5637,25 @@ $.widget("ui.accordion", {
},
toShow = (this.active = $([]));
this._toggle(toShow, toHide, data);
- return false;
+ return;
}
// get the click target
var clicked = $(event.currentTarget || target);
var clickedIsActive = clicked[0] == this.active[0];
+
+ // TODO the option is changed, is that correct?
+ // TODO if it is correct, shouldn't that happen after determining that the click is valid?
+ o.active = o.collapsible && clickedIsActive ? false : $('.ui-accordion-header', this.element).index(clicked);
// if animations are still active, or the active header is the target, ignore click
if (this.running || (!o.collapsible && clickedIsActive)) {
- return false;
+ return;
}
// switch classes
this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
.find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
- this.active.next().addClass('ui-accordion-content-active');
if (!clickedIsActive) {
clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
.find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
@@ -5252,15 +5669,15 @@ $.widget("ui.accordion", {
options: o,
newHeader: clickedIsActive && o.collapsible ? $([]) : clicked,
oldHeader: this.active,
- newContent: clickedIsActive && o.collapsible ? $([]) : toShow.find('> *'),
- oldContent: toHide.find('> *')
+ newContent: clickedIsActive && o.collapsible ? $([]) : toShow,
+ oldContent: toHide
},
down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
this.active = clickedIsActive ? $([]) : clicked;
this._toggle(toShow, toHide, data, clickedIsActive, down);
- return false;
+ return;
},
@@ -5320,6 +5737,9 @@ $.widget("ui.accordion", {
duration = o.duration,
easing = o.animated;
+ if (easing && !animations[easing] && !$.easing[easing]) {
+ easing = 'slide';
+ }
if (!animations[easing]) {
animations[easing] = function(options) {
this.slide(options, {
@@ -5344,6 +5764,7 @@ $.widget("ui.accordion", {
}
+ // TODO assert that the blur and focus triggers are really necessary, remove otherwise
toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur();
toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus();
@@ -5362,6 +5783,9 @@ $.widget("ui.accordion", {
overflow: ""
});
}
+
+ // other classes are removed before the animation; this one needs to stay until completed
+ this.toHide.removeClass("ui-accordion-content-active");
this._trigger('change', null, this.data);
}
@@ -5370,26 +5794,7 @@ $.widget("ui.accordion", {
$.extend($.ui.accordion, {
- version: "1.7.2",
- defaults: {
- active: null,
- alwaysOpen: true, //deprecated, use collapsible
- animated: 'slide',
- autoHeight: true,
- clearStyle: false,
- collapsible: false,
- event: "click",
- fillSpace: false,
- header: "> li > :first-child,> :not(li):even",
- icons: {
- header: "ui-icon-triangle-1-e",
- headerSelected: "ui-icon-triangle-1-s"
- },
- navigation: false,
- navigationFilter: function() {
- return this.href.toLowerCase() == location.href.toLowerCase();
- }
- },
+ version: "1.8.2",
animations: {
slide: function(options, additions) {
options = $.extend({
@@ -5405,7 +5810,7 @@ $.extend($.ui.accordion, {
return;
}
var overflow = options.toShow.css('overflow'),
- percentDone,
+ percentDone = 0,
showProps = {},
hideProps = {},
fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
@@ -5414,10 +5819,10 @@ $.extend($.ui.accordion, {
var s = options.toShow;
originalWidth = s[0].style.width;
s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) );
-
+
$.each(fxAttrs, function(i, prop) {
hideProps[prop] = 'hide';
-
+
var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/);
showProps[prop] = {
value: parts[1],
@@ -5431,9 +5836,10 @@ $.extend($.ui.accordion, {
// IE gets very inconsistent results when animating elements
// with small values, which is common for padding
if (settings.prop == 'height') {
- percentDone = (settings.now - settings.start) / (settings.end - settings.start);
+ percentDone = ( settings.end - settings.start === 0 ) ? 0 :
+ (settings.now - settings.start) / (settings.end - settings.start);
}
-
+
options.toShow[0].style[settings.prop] =
(percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit;
},
@@ -5454,35 +5860,906 @@ $.extend($.ui.accordion, {
easing: options.down ? "easeOutBounce" : "swing",
duration: options.down ? 1000 : 200
});
- },
- easeslide: function(options) {
- this.slide(options, {
- easing: "easeinout",
- duration: 700
- });
}
}
});
})(jQuery);
/*
- * jQuery UI Datepicker 1.7.2
+ * jQuery UI Autocomplete 1.8.2
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Autocomplete
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.position.js
+ */
+(function( $ ) {
+
+$.widget( "ui.autocomplete", {
+ options: {
+ minLength: 1,
+ delay: 300
+ },
+ _create: function() {
+ var self = this,
+ doc = this.element[ 0 ].ownerDocument;
+ this.element
+ .addClass( "ui-autocomplete-input" )
+ .attr( "autocomplete", "off" )
+ // TODO verify these actually work as intended
+ .attr({
+ role: "textbox",
+ "aria-autocomplete": "list",
+ "aria-haspopup": "true"
+ })
+ .bind( "keydown.autocomplete", function( event ) {
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ self._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ self._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ self._move( "previous", event );
+ // prevent moving cursor to beginning of text field in some browsers
+ event.preventDefault();
+ break;
+ case keyCode.DOWN:
+ self._move( "next", event );
+ // prevent moving cursor to end of text field in some browsers
+ event.preventDefault();
+ break;
+ case keyCode.ENTER:
+ case keyCode.NUMPAD_ENTER:
+ // when menu is open or has focus
+ if ( self.menu.active ) {
+ event.preventDefault();
+ }
+ //passthrough - ENTER and TAB both select the current element
+ case keyCode.TAB:
+ if ( !self.menu.active ) {
+ return;
+ }
+ self.menu.select( event );
+ break;
+ case keyCode.ESCAPE:
+ self.element.val( self.term );
+ self.close( event );
+ break;
+ case keyCode.LEFT:
+ case keyCode.RIGHT:
+ case keyCode.SHIFT:
+ case keyCode.CONTROL:
+ case keyCode.ALT:
+ case keyCode.COMMAND:
+ case keyCode.COMMAND_RIGHT:
+ case keyCode.INSERT:
+ case keyCode.CAPS_LOCK:
+ case keyCode.END:
+ case keyCode.HOME:
+ // ignore metakeys (shift, ctrl, alt)
+ break;
+ default:
+ // keypress is triggered before the input value is changed
+ clearTimeout( self.searching );
+ self.searching = setTimeout(function() {
+ self.search( null, event );
+ }, self.options.delay );
+ break;
+ }
+ })
+ .bind( "focus.autocomplete", function() {
+ self.selectedItem = null;
+ self.previous = self.element.val();
+ })
+ .bind( "blur.autocomplete", function( event ) {
+ clearTimeout( self.searching );
+ // clicks on the menu (or a button to trigger a search) will cause a blur event
+ self.closing = setTimeout(function() {
+ self.close( event );
+ self._change( event );
+ }, 150 );
+ });
+ this._initSource();
+ this.response = function() {
+ return self._response.apply( self, arguments );
+ };
+ this.menu = $( "<ul></ul>" )
+ .addClass( "ui-autocomplete" )
+ .appendTo( "body", doc )
+ // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
+ .mousedown(function() {
+ // use another timeout to make sure the blur-event-handler on the input was already triggered
+ setTimeout(function() {
+ clearTimeout( self.closing );
+ }, 13);
+ })
+ .menu({
+ focus: function( event, ui ) {
+ var item = ui.item.data( "item.autocomplete" );
+ if ( false !== self._trigger( "focus", null, { item: item } ) ) {
+ // use value to match what will end up in the input, if it was a key event
+ if ( /^key/.test(event.originalEvent.type) ) {
+ self.element.val( item.value );
+ }
+ }
+ },
+ selected: function( event, ui ) {
+ var item = ui.item.data( "item.autocomplete" );
+ if ( false !== self._trigger( "select", event, { item: item } ) ) {
+ self.element.val( item.value );
+ }
+ self.close( event );
+ // only trigger when focus was lost (click on menu)
+ var previous = self.previous;
+ if ( self.element[0] !== doc.activeElement ) {
+ self.element.focus();
+ self.previous = previous;
+ }
+ self.selectedItem = item;
+ },
+ blur: function( event, ui ) {
+ if ( self.menu.element.is(":visible") ) {
+ self.element.val( self.term );
+ }
+ }
+ })
+ .zIndex( this.element.zIndex() + 1 )
+ // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
+ .css({ top: 0, left: 0 })
+ .hide()
+ .data( "menu" );
+ if ( $.fn.bgiframe ) {
+ this.menu.element.bgiframe();
+ }
+ },
+
+ destroy: function() {
+ this.element
+ .removeClass( "ui-autocomplete-input" )
+ .removeAttr( "autocomplete" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-autocomplete" )
+ .removeAttr( "aria-haspopup" );
+ this.menu.element.remove();
+ $.Widget.prototype.destroy.call( this );
+ },
+
+ _setOption: function( key ) {
+ $.Widget.prototype._setOption.apply( this, arguments );
+ if ( key === "source" ) {
+ this._initSource();
+ }
+ },
+
+ _initSource: function() {
+ var array,
+ url;
+ if ( $.isArray(this.options.source) ) {
+ array = this.options.source;
+ this.source = function( request, response ) {
+ response( $.ui.autocomplete.filter(array, request.term) );
+ };
+ } else if ( typeof this.options.source === "string" ) {
+ url = this.options.source;
+ this.source = function( request, response ) {
+ $.getJSON( url, request, response );
+ };
+ } else {
+ this.source = this.options.source;
+ }
+ },
+
+ search: function( value, event ) {
+ value = value != null ? value : this.element.val();
+ if ( value.length < this.options.minLength ) {
+ return this.close( event );
+ }
+
+ clearTimeout( this.closing );
+ if ( this._trigger("search") === false ) {
+ return;
+ }
+
+ return this._search( value );
+ },
+
+ _search: function( value ) {
+ this.term = this.element
+ .addClass( "ui-autocomplete-loading" )
+ // always save the actual value, not the one passed as an argument
+ .val();
+
+ this.source( { term: value }, this.response );
+ },
+
+ _response: function( content ) {
+ if ( content.length ) {
+ content = this._normalize( content );
+ this._suggest( content );
+ this._trigger( "open" );
+ } else {
+ this.close();
+ }
+ this.element.removeClass( "ui-autocomplete-loading" );
+ },
+
+ close: function( event ) {
+ clearTimeout( this.closing );
+ if ( this.menu.element.is(":visible") ) {
+ this._trigger( "close", event );
+ this.menu.element.hide();
+ this.menu.deactivate();
+ }
+ },
+
+ _change: function( event ) {
+ if ( this.previous !== this.element.val() ) {
+ this._trigger( "change", event, { item: this.selectedItem } );
+ }
+ },
+
+ _normalize: function( items ) {
+ // assume all items have the right format when the first item is complete
+ if ( items.length && items[0].label && items[0].value ) {
+ return items;
+ }
+ return $.map( items, function(item) {
+ if ( typeof item === "string" ) {
+ return {
+ label: item,
+ value: item
+ };
+ }
+ return $.extend({
+ label: item.label || item.value,
+ value: item.value || item.label
+ }, item );
+ });
+ },
+
+ _suggest: function( items ) {
+ var ul = this.menu.element
+ .empty()
+ .zIndex( this.element.zIndex() + 1 ),
+ menuWidth,
+ textWidth;
+ this._renderMenu( ul, items );
+ // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
+ this.menu.deactivate();
+ this.menu.refresh();
+ this.menu.element.show().position({
+ my: "left top",
+ at: "left bottom",
+ of: this.element,
+ collision: "none"
+ });
+
+ menuWidth = ul.width( "" ).width();
+ textWidth = this.element.width();
+ ul.width( Math.max( menuWidth, textWidth ) );
+ },
+
+ _renderMenu: function( ul, items ) {
+ var self = this;
+ $.each( items, function( index, item ) {
+ self._renderItem( ul, item );
+ });
+ },
+
+ _renderItem: function( ul, item) {
+ return $( "<li></li>" )
+ .data( "item.autocomplete", item )
+ .append( "<a>" + item.label + "</a>" )
+ .appendTo( ul );
+ },
+
+ _move: function( direction, event ) {
+ if ( !this.menu.element.is(":visible") ) {
+ this.search( null, event );
+ return;
+ }
+ if ( this.menu.first() && /^previous/.test(direction) ||
+ this.menu.last() && /^next/.test(direction) ) {
+ this.element.val( this.term );
+ this.menu.deactivate();
+ return;
+ }
+ this.menu[ direction ]( event );
+ },
+
+ widget: function() {
+ return this.menu.element;
+ }
+});
+
+$.extend( $.ui.autocomplete, {
+ escapeRegex: function( value ) {
+ return value.replace( /([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1" );
+ },
+ filter: function(array, term) {
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
+ return $.grep( array, function(value) {
+ return matcher.test( value.label || value.value || value );
+ });
+ }
+});
+
+}( jQuery ));
+
+/*
+ * jQuery UI Menu (not officially released)
+ *
+ * This widget isn't yet finished and the API is subject to change. We plan to finish
+ * it for the next release. You're welcome to give it a try anyway and give us feedback,
+ * as long as you're okay with migrating your code later on. We can help with that, too.
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Menu
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function($) {
+
+$.widget("ui.menu", {
+ _create: function() {
+ var self = this;
+ this.element
+ .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
+ .attr({
+ role: "listbox",
+ "aria-activedescendant": "ui-active-menuitem"
+ })
+ .click(function( event ) {
+ if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
+ return;
+ }
+ // temporary
+ event.preventDefault();
+ self.select( event );
+ });
+ this.refresh();
+ },
+
+ refresh: function() {
+ var self = this;
+
+ // don't refresh list items that are already adapted
+ var items = this.element.children("li:not(.ui-menu-item):has(a)")
+ .addClass("ui-menu-item")
+ .attr("role", "menuitem");
+
+ items.children("a")
+ .addClass("ui-corner-all")
+ .attr("tabindex", -1)
+ // mouseenter doesn't work with event delegation
+ .mouseenter(function( event ) {
+ self.activate( event, $(this).parent() );
+ })
+ .mouseleave(function() {
+ self.deactivate();
+ });
+ },
+
+ activate: function( event, item ) {
+ this.deactivate();
+ if (this.hasScroll()) {
+ var offset = item.offset().top - this.element.offset().top,
+ scroll = this.element.attr("scrollTop"),
+ elementHeight = this.element.height();
+ if (offset < 0) {
+ this.element.attr("scrollTop", scroll + offset);
+ } else if (offset > elementHeight) {
+ this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
+ }
+ }
+ this.active = item.eq(0)
+ .children("a")
+ .addClass("ui-state-hover")
+ .attr("id", "ui-active-menuitem")
+ .end();
+ this._trigger("focus", event, { item: item });
+ },
+
+ deactivate: function() {
+ if (!this.active) { return; }
+
+ this.active.children("a")
+ .removeClass("ui-state-hover")
+ .removeAttr("id");
+ this._trigger("blur");
+ this.active = null;
+ },
+
+ next: function(event) {
+ this.move("next", ".ui-menu-item:first", event);
+ },
+
+ previous: function(event) {
+ this.move("prev", ".ui-menu-item:last", event);
+ },
+
+ first: function() {
+ return this.active && !this.active.prev().length;
+ },
+
+ last: function() {
+ return this.active && !this.active.next().length;
+ },
+
+ move: function(direction, edge, event) {
+ if (!this.active) {
+ this.activate(event, this.element.children(edge));
+ return;
+ }
+ var next = this.active[direction + "All"](".ui-menu-item").eq(0);
+ if (next.length) {
+ this.activate(event, next);
+ } else {
+ this.activate(event, this.element.children(edge));
+ }
+ },
+
+ // TODO merge with previousPage
+ nextPage: function(event) {
+ if (this.hasScroll()) {
+ // TODO merge with no-scroll-else
+ if (!this.active || this.last()) {
+ this.activate(event, this.element.children(":first"));
+ return;
+ }
+ var base = this.active.offset().top,
+ height = this.element.height(),
+ result = this.element.children("li").filter(function() {
+ var close = $(this).offset().top - base - height + $(this).height();
+ // TODO improve approximation
+ return close < 10 && close > -10;
+ });
+
+ // TODO try to catch this earlier when scrollTop indicates the last page anyway
+ if (!result.length) {
+ result = this.element.children(":last");
+ }
+ this.activate(event, result);
+ } else {
+ this.activate(event, this.element.children(!this.active || this.last() ? ":first" : ":last"));
+ }
+ },
+
+ // TODO merge with nextPage
+ previousPage: function(event) {
+ if (this.hasScroll()) {
+ // TODO merge with no-scroll-else
+ if (!this.active || this.first()) {
+ this.activate(event, this.element.children(":last"));
+ return;
+ }
+
+ var base = this.active.offset().top,
+ height = this.element.height();
+ result = this.element.children("li").filter(function() {
+ var close = $(this).offset().top - base + height - $(this).height();
+ // TODO improve approximation
+ return close < 10 && close > -10;
+ });
+
+ // TODO try to catch this earlier when scrollTop indicates the last page anyway
+ if (!result.length) {
+ result = this.element.children(":first");
+ }
+ this.activate(event, result);
+ } else {
+ this.activate(event, this.element.children(!this.active || this.first() ? ":last" : ":first"));
+ }
+ },
+
+ hasScroll: function() {
+ return this.element.height() < this.element.attr("scrollHeight");
+ },
+
+ select: function( event ) {
+ this._trigger("selected", event, { item: this.active });
+ }
+});
+
+}(jQuery));
+/*
+ * jQuery UI Button 1.8.2
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Button
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function( $ ) {
+
+var lastActive,
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+ stateClasses = "ui-state-hover ui-state-active ",
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only",
+ formResetHandler = function( event ) {
+ $( ":ui-button", event.target.form ).each(function() {
+ var inst = $( this ).data( "button" );
+ setTimeout(function() {
+ inst.refresh();
+ }, 1 );
+ });
+ },
+ radioGroup = function( radio ) {
+ var name = radio.name,
+ form = radio.form,
+ radios = $( [] );
+ if ( name ) {
+ if ( form ) {
+ radios = $( form ).find( "[name='" + name + "']" );
+ } else {
+ radios = $( "[name='" + name + "']", radio.ownerDocument )
+ .filter(function() {
+ return !this.form;
+ });
+ }
+ }
+ return radios;
+ };
+
+$.widget( "ui.button", {
+ options: {
+ text: true,
+ label: null,
+ icons: {
+ primary: null,
+ secondary: null
+ }
+ },
+ _create: function() {
+ this.element.closest( "form" )
+ .unbind( "reset.button" )
+ .bind( "reset.button", formResetHandler );
+
+ this._determineButtonType();
+ this.hasTitle = !!this.buttonElement.attr( "title" );
+
+ var self = this,
+ options = this.options,
+ toggleButton = this.type === "checkbox" || this.type === "radio",
+ hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
+ focusClass = "ui-state-focus";
+
+ if ( options.label === null ) {
+ options.label = this.buttonElement.html();
+ }
+
+ if ( this.element.is( ":disabled" ) ) {
+ options.disabled = true;
+ }
+
+ this.buttonElement
+ .addClass( baseClasses )
+ .attr( "role", "button" )
+ .bind( "mouseenter.button", function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).addClass( "ui-state-hover" );
+ if ( this === lastActive ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "mouseleave.button", function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).removeClass( hoverClass );
+ })
+ .bind( "focus.button", function() {
+ // no need to check disabled, focus won't be triggered anyway
+ $( this ).addClass( focusClass );
+ })
+ .bind( "blur.button", function() {
+ $( this ).removeClass( focusClass );
+ });
+
+ if ( toggleButton ) {
+ this.element.bind( "change.button", function() {
+ self.refresh();
+ });
+ }
+
+ if ( this.type === "checkbox" ) {
+ this.buttonElement.bind( "click.button", function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).toggleClass( "ui-state-active" );
+ self.buttonElement.attr( "aria-pressed", self.element[0].checked );
+ });
+ } else if ( this.type === "radio" ) {
+ this.buttonElement.bind( "click.button", function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ self.buttonElement.attr( "aria-pressed", true );
+
+ var radio = self.element[ 0 ];
+ radioGroup( radio )
+ .not( radio )
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", false );
+ });
+ } else {
+ this.buttonElement
+ .bind( "mousedown.button", function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ lastActive = this;
+ $( document ).one( "mouseup", function() {
+ lastActive = null;
+ });
+ })
+ .bind( "mouseup.button", function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).removeClass( "ui-state-active" );
+ })
+ .bind( "keydown.button", function(event) {
+ if ( options.disabled ) {
+ return false;
+ }
+ if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "keyup.button", function() {
+ $( this ).removeClass( "ui-state-active" );
+ });
+
+ if ( this.buttonElement.is("a") ) {
+ this.buttonElement.keyup(function(event) {
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
+ $( this ).click();
+ }
+ });
+ }
+ }
+
+ // TODO: pull out $.Widget's handling for the disabled option into
+ // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
+ // be overridden by individual plugins
+ this._setOption( "disabled", options.disabled );
+ },
+
+ _determineButtonType: function() {
+
+ if ( this.element.is(":checkbox") ) {
+ this.type = "checkbox";
+ } else {
+ if ( this.element.is(":radio") ) {
+ this.type = "radio";
+ } else {
+ if ( this.element.is("input") ) {
+ this.type = "input";
+ } else {
+ this.type = "button";
+ }
+ }
+ }
+
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ // we don't search against the document in case the element
+ // is disconnected from the DOM
+ this.buttonElement = this.element.parents().last()
+ .find( "[for=" + this.element.attr("id") + "]" );
+ this.element.addClass( "ui-helper-hidden-accessible" );
+
+ var checked = this.element.is( ":checked" );
+ if ( checked ) {
+ this.buttonElement.addClass( "ui-state-active" );
+ }
+ this.buttonElement.attr( "aria-pressed", checked );
+ } else {
+ this.buttonElement = this.element;
+ }
+ },
+
+ widget: function() {
+ return this.buttonElement;
+ },
+
+ destroy: function() {
+ this.element
+ .removeClass( "ui-helper-hidden-accessible" );
+ this.buttonElement
+ .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
+ .removeAttr( "role" )
+ .removeAttr( "aria-pressed" )
+ .html( this.buttonElement.find(".ui-button-text").html() );
+
+ if ( !this.hasTitle ) {
+ this.buttonElement.removeAttr( "title" );
+ }
+
+ $.Widget.prototype.destroy.call( this );
+ },
+
+ _setOption: function( key, value ) {
+ $.Widget.prototype._setOption.apply( this, arguments );
+ if ( key === "disabled" ) {
+ if ( value ) {
+ this.element.attr( "disabled", true );
+ } else {
+ this.element.removeAttr( "disabled" );
+ }
+ }
+ this._resetButton();
+ },
+
+ refresh: function() {
+ var isDisabled = this.element.is( ":disabled" );
+ if ( isDisabled !== this.options.disabled ) {
+ this._setOption( "disabled", isDisabled );
+ }
+ if ( this.type === "radio" ) {
+ radioGroup( this.element[0] ).each(function() {
+ if ( $( this ).is( ":checked" ) ) {
+ $( this ).button( "widget" )
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", true );
+ } else {
+ $( this ).button( "widget" )
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", false );
+ }
+ });
+ } else if ( this.type === "checkbox" ) {
+ if ( this.element.is( ":checked" ) ) {
+ this.buttonElement
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", true );
+ } else {
+ this.buttonElement
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", false );
+ }
+ }
+ },
+
+ _resetButton: function() {
+ if ( this.type === "input" ) {
+ if ( this.options.label ) {
+ this.element.val( this.options.label );
+ }
+ return;
+ }
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
+ buttonText = $( "<span></span>" )
+ .addClass( "ui-button-text" )
+ .html( this.options.label )
+ .appendTo( buttonElement.empty() )
+ .text(),
+ icons = this.options.icons,
+ multipleIcons = icons.primary && icons.secondary;
+ if ( icons.primary || icons.secondary ) {
+ buttonElement.addClass( "ui-button-text-icon" +
+ ( multipleIcons ? "s" : "" ) );
+ if ( icons.primary ) {
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
+ }
+ if ( icons.secondary ) {
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
+ }
+ if ( !this.options.text ) {
+ buttonElement
+ .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
+ .removeClass( "ui-button-text-icons ui-button-text-icon" );
+ if ( !this.hasTitle ) {
+ buttonElement.attr( "title", buttonText );
+ }
+ }
+ } else {
+ buttonElement.addClass( "ui-button-text-only" );
+ }
+ }
+});
+
+$.widget( "ui.buttonset", {
+ _create: function() {
+ this.element.addClass( "ui-buttonset" );
+ this._init();
+ },
+
+ _init: function() {
+ this.refresh();
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "disabled" ) {
+ this.buttons.button( "option", key, value );
+ }
+
+ $.Widget.prototype._setOption.apply( this, arguments );
+ },
+
+ refresh: function() {
+ this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
+ .filter( ":ui-button" )
+ .button( "refresh" )
+ .end()
+ .not( ":ui-button" )
+ .button()
+ .end()
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
+ .filter( ":first" )
+ .addClass( "ui-corner-left" )
+ .end()
+ .filter( ":last" )
+ .addClass( "ui-corner-right" )
+ .end()
+ .end();
+ },
+
+ destroy: function() {
+ this.element.removeClass( "ui-buttonset" );
+ this.buttons
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-left ui-corner-right" )
+ .end()
+ .button( "destroy" );
+
+ $.Widget.prototype.destroy.call( this );
+ }
+});
+
+}( jQuery ) );
+/*
+ * jQuery UI Datepicker 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Datepicker
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
*/
(function($) { // hide the namespace
-$.extend($.ui, { datepicker: { version: "1.7.2" } });
+$.extend($.ui, { datepicker: { version: "1.8.2" } });
var PROP_NAME = 'datepicker';
+var dpuuid = new Date().getTime();
/* Date picker manager.
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
@@ -5517,14 +6794,17 @@ function Datepicker() {
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
+ weekHeader: 'Wk', // Column header for week of the year
dateFormat: 'mm/dd/yy', // See format options on parseDate
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
- isRTL: false // True if right-to-left language, false if left-to-right
+ isRTL: false, // True if right-to-left language, false if left-to-right
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
+ yearSuffix: '' // Additional text to append to the year in the month headers
};
this._defaults = { // Global defaults for all the date picker instances
showOn: 'focus', // 'focus' for popup on focus,
// 'button' for trigger button, or 'both' for either
- showAnim: 'show', // Name of jQuery animation for popup
+ showAnim: 'fadeIn', // Name of jQuery animation for popup
showOptions: {}, // Options for enhanced animations
defaultDate: null, // Used when field is blank: actual date,
// +/-number for offset from today, null for today
@@ -5538,10 +6818,12 @@ function Datepicker() {
gotoCurrent: false, // True if today link goes back to current selection instead
changeMonth: false, // True if month can be selected directly, false if only prev/next
changeYear: false, // True if year can be selected directly, false if only prev/next
- showMonthAfterYear: false, // True if the year select precedes month, false for month then year
- yearRange: '-10:+10', // Range of years to display in drop-down,
- // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
+ yearRange: 'c-10:c+10', // Range of years to display in drop-down,
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
showOtherMonths: false, // True to show dates in other months, false to leave blank
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
+ showWeek: false, // True to show week of the year, false to not show it
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
// takes a Date and returns the number of the week for it
shortYearCutoff: '+10', // Short year values < this are in the current century,
@@ -5549,7 +6831,7 @@ function Datepicker() {
// string value starting with '+' for current year + value
minDate: null, // The earliest selectable date, or null for no limit
maxDate: null, // The latest selectable date, or null for no limit
- duration: 'normal', // Duration of display/closure
+ duration: 'fast', // Duration of display/closure
beforeShowDay: null, // Function that takes a date and returns an array with
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
@@ -5565,7 +6847,8 @@ function Datepicker() {
altField: '', // Selector for an alternate field to store selected dates into
altFormat: '', // The date format to use for the alternate field
constrainInput: true, // The input is constrained by the current date format
- showButtonPanel: false // True to show button panel, false to not show it
+ showButtonPanel: false, // True to show button panel, false to not show it
+ autoSize: false // True to size the input for the date format, false to leave as is
};
$.extend(this._defaults, this.regional['']);
this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
@@ -5580,6 +6863,11 @@ $.extend(Datepicker.prototype, {
if (this.debug)
console.log.apply('', arguments);
},
+
+ // TODO rename to "widget" when switching to widget factory
+ _widgetDatepicker: function() {
+ return this.dpDiv;
+ },
/* Override the default settings for all instances of the date picker.
@param settings object - the new settings to use as defaults (anonymous object)
@@ -5608,8 +6896,10 @@ $.extend(Datepicker.prototype, {
}
var nodeName = target.nodeName.toLowerCase();
var inline = (nodeName == 'div' || nodeName == 'span');
- if (!target.id)
- target.id = 'dp' + (++this.uuid);
+ if (!target.id) {
+ this.uuid += 1;
+ target.id = 'dp' + this.uuid;
+ }
var inst = this._newInst($(target), inline);
inst.settings = $.extend({}, settings || {}, inlineSettings || {});
if (nodeName == 'input') {
@@ -5621,7 +6911,7 @@ $.extend(Datepicker.prototype, {
/* Create a new instance object. */
_newInst: function(target, inline) {
- var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars
+ var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars
return {id: id, input: target, // associated target
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
drawMonth: 0, drawYear: 0, // month being drawn
@@ -5637,12 +6927,31 @@ $.extend(Datepicker.prototype, {
inst.trigger = $([]);
if (input.hasClass(this.markerClassName))
return;
+ this._attachments(input, inst);
+ input.addClass(this.markerClassName).keydown(this._doKeyDown).
+ keypress(this._doKeyPress).keyup(this._doKeyUp).
+ bind("setData.datepicker", function(event, key, value) {
+ inst.settings[key] = value;
+ }).bind("getData.datepicker", function(event, key) {
+ return this._get(inst, key);
+ });
+ this._autoSize(inst);
+ $.data(target, PROP_NAME, inst);
+ },
+
+ /* Make attachments based on settings. */
+ _attachments: function(input, inst) {
var appendText = this._get(inst, 'appendText');
var isRTL = this._get(inst, 'isRTL');
+ if (inst.append)
+ inst.append.remove();
if (appendText) {
inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
input[isRTL ? 'before' : 'after'](inst.append);
}
+ input.unbind('focus', this._showDatepicker);
+ if (inst.trigger)
+ inst.trigger.remove();
var showOn = this._get(inst, 'showOn');
if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
input.focus(this._showDatepicker);
@@ -5657,20 +6966,39 @@ $.extend(Datepicker.prototype, {
{ src:buttonImage, alt:buttonText, title:buttonText })));
input[isRTL ? 'before' : 'after'](inst.trigger);
inst.trigger.click(function() {
- if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
+ if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
$.datepicker._hideDatepicker();
else
- $.datepicker._showDatepicker(target);
+ $.datepicker._showDatepicker(input[0]);
return false;
});
}
- input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).
- bind("setData.datepicker", function(event, key, value) {
- inst.settings[key] = value;
- }).bind("getData.datepicker", function(event, key) {
- return this._get(inst, key);
- });
- $.data(target, PROP_NAME, inst);
+ },
+
+ /* Apply the maximum length for the date format. */
+ _autoSize: function(inst) {
+ if (this._get(inst, 'autoSize') && !inst.inline) {
+ var date = new Date(2009, 12 - 1, 20); // Ensure double digits
+ var dateFormat = this._get(inst, 'dateFormat');
+ if (dateFormat.match(/[DM]/)) {
+ var findMax = function(names) {
+ var max = 0;
+ var maxI = 0;
+ for (var i = 0; i < names.length; i++) {
+ if (names[i].length > max) {
+ max = names[i].length;
+ maxI = i;
+ }
+ }
+ return maxI;
+ };
+ date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
+ 'monthNames' : 'monthNamesShort'))));
+ date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
+ 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
+ }
+ inst.input.attr('size', this._formatDate(inst, date).length);
+ }
},
/* Attach an inline date picker to a div. */
@@ -5685,26 +7013,27 @@ $.extend(Datepicker.prototype, {
return this._get(inst, key);
});
$.data(target, PROP_NAME, inst);
- this._setDate(inst, this._getDefaultDate(inst));
+ this._setDate(inst, this._getDefaultDate(inst), true);
this._updateDatepicker(inst);
this._updateAlternate(inst);
},
/* Pop-up the date picker in a "dialog" box.
@param input element - ignored
- @param dateText string - the initial date to display (in the current format)
- @param onSelect function - the function(dateText) to call when a date is selected
+ @param date string or Date - the initial date to display
+ @param onSelect function - the function to call when a date is selected
@param settings object - update the dialog date picker instance's settings (anonymous object)
@param pos int[2] - coordinates for the dialog's position within the screen or
event - with x/y coordinates or
leave empty for default (screen centre)
@return the manager object */
- _dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
+ _dialogDatepicker: function(input, date, onSelect, settings, pos) {
var inst = this._dialogInst; // internal instance
if (!inst) {
- var id = 'dp' + (++this.uuid);
+ this.uuid += 1;
+ var id = 'dp' + this.uuid;
this._dialogInput = $('<input type="text" id="' + id +
- '" size="1" style="position: absolute; top: -100px;"/>');
+ '" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
this._dialogInput.keydown(this._doKeyDown);
$('body').append(this._dialogInput);
inst = this._dialogInst = this._newInst(this._dialogInput, false);
@@ -5712,12 +7041,13 @@ $.extend(Datepicker.prototype, {
$.data(this._dialogInput[0], PROP_NAME, inst);
}
extendRemove(inst.settings, settings || {});
- this._dialogInput.val(dateText);
+ date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
+ this._dialogInput.val(date);
this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
if (!this._pos) {
- var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
- var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+ var browserWidth = document.documentElement.clientWidth;
+ var browserHeight = document.documentElement.clientHeight;
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
this._pos = // should use actual width/height below
@@ -5725,7 +7055,7 @@ $.extend(Datepicker.prototype, {
}
// move input on screen for focus, but hidden behind dialog
- this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
+ this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
inst.settings.onSelect = onSelect;
this._inDialog = true;
this.dpDiv.addClass(this._dialogClass);
@@ -5752,7 +7082,8 @@ $.extend(Datepicker.prototype, {
$target.removeClass(this.markerClassName).
unbind('focus', this._showDatepicker).
unbind('keydown', this._doKeyDown).
- unbind('keypress', this._doKeyPress);
+ unbind('keypress', this._doKeyPress).
+ unbind('keyup', this._doKeyUp);
} else if (nodeName == 'div' || nodeName == 'span')
$target.removeClass(this.markerClassName).empty();
},
@@ -5853,10 +7184,12 @@ $.extend(Datepicker.prototype, {
}
if (inst) {
if (this._curInst == inst) {
- this._hideDatepicker(null);
+ this._hideDatepicker();
}
- var date = this._getDateDatepicker(target);
+ var date = this._getDateDatepicker(target, true);
extendRemove(inst.settings, settings);
+ this._attachments($(target), inst);
+ this._autoSize(inst);
this._setDateDatepicker(target, date);
this._updateDatepicker(inst);
}
@@ -5878,25 +7211,24 @@ $.extend(Datepicker.prototype, {
/* Set the dates for a jQuery selection.
@param target element - the target input field or division or span
- @param date Date - the new date
- @param endDate Date - the new end date for a range (optional) */
- _setDateDatepicker: function(target, date, endDate) {
+ @param date Date - the new date */
+ _setDateDatepicker: function(target, date) {
var inst = this._getInst(target);
if (inst) {
- this._setDate(inst, date, endDate);
+ this._setDate(inst, date);
this._updateDatepicker(inst);
this._updateAlternate(inst);
}
},
/* Get the date(s) for the first entry in a jQuery selection.
- @param target element - the target input field or division or span
- @return Date - the current date or
- Date[2] - the current dates for a range */
- _getDateDatepicker: function(target) {
+ @param target element - the target input field or division or span
+ @param noDefault boolean - true if no default date is to be used
+ @return Date - the current date */
+ _getDateDatepicker: function(target, noDefault) {
var inst = this._getInst(target);
if (inst && !inst.inline)
- this._setDateFromField(inst);
+ this._setDateFromField(inst, noDefault);
return (inst ? this._getDate(inst) : null);
},
@@ -5908,17 +7240,18 @@ $.extend(Datepicker.prototype, {
inst._keyEvent = true;
if ($.datepicker._datepickerShowing)
switch (event.keyCode) {
- case 9: $.datepicker._hideDatepicker(null, '');
+ case 9: $.datepicker._hideDatepicker();
+ handled = false;
break; // hide on tab out
- case 13: var sel = $('td.' + $.datepicker._dayOverClass +
- ', td.' + $.datepicker._currentClass, inst.dpDiv);
+ case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).
+ add($('td.' + $.datepicker._currentClass, inst.dpDiv));
if (sel[0])
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
else
- $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
+ $.datepicker._hideDatepicker();
return false; // don't submit the form
break; // select the value on enter
- case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
+ case 27: $.datepicker._hideDatepicker();
break; // hide on escape
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
-$.datepicker._get(inst, 'stepBigMonths') :
@@ -5979,6 +7312,27 @@ $.extend(Datepicker.prototype, {
}
},
+ /* Synchronise manual entry and field/alternate field. */
+ _doKeyUp: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ if (inst.input.val() != inst.lastVal) {
+ try {
+ var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ (inst.input ? inst.input.val() : null),
+ $.datepicker._getFormatConfig(inst));
+ if (date) { // only if valid
+ $.datepicker._setDateFromField(inst);
+ $.datepicker._updateAlternate(inst);
+ $.datepicker._updateDatepicker(inst);
+ }
+ }
+ catch (event) {
+ $.datepicker.log(event);
+ }
+ }
+ return true;
+ },
+
/* Pop-up the date picker for a given input field.
@param input element - the input field attached to the date picker or
event - if triggered by focus */
@@ -5989,9 +7343,12 @@ $.extend(Datepicker.prototype, {
if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
return;
var inst = $.datepicker._getInst(input);
+ if ($.datepicker._curInst && $.datepicker._curInst != inst) {
+ $.datepicker._curInst.dpDiv.stop(true, true);
+ }
var beforeShow = $.datepicker._get(inst, 'beforeShow');
extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
- $.datepicker._hideDatepicker(null, '');
+ inst.lastVal = null;
$.datepicker._lastInput = input;
$.datepicker._setDateFromField(inst);
if ($.datepicker._inDialog) // hide cursor
@@ -6011,7 +7368,6 @@ $.extend(Datepicker.prototype, {
}
var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
$.datepicker._pos = null;
- inst.rangeStart = null;
// determine sizing offscreen
inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
$.datepicker._updateDatepicker(inst);
@@ -6022,34 +7378,36 @@ $.extend(Datepicker.prototype, {
'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
left: offset.left + 'px', top: offset.top + 'px'});
if (!inst.inline) {
- var showAnim = $.datepicker._get(inst, 'showAnim') || 'show';
+ var showAnim = $.datepicker._get(inst, 'showAnim');
var duration = $.datepicker._get(inst, 'duration');
var postProcess = function() {
$.datepicker._datepickerShowing = true;
- if ($.browser.msie && parseInt($.browser.version,10) < 7) // fix IE < 7 select problems
- $('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4,
- height: inst.dpDiv.height() + 4});
+ var borders = $.datepicker._getBorders(inst.dpDiv);
+ inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only
+ css({left: -borders[0], top: -borders[1],
+ width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
};
+ inst.dpDiv.zIndex($(input).zIndex()+1);
if ($.effects && $.effects[showAnim])
inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
else
- inst.dpDiv[showAnim](duration, postProcess);
- if (duration == '')
+ inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
+ if (!showAnim || !duration)
postProcess();
- if (inst.input[0].type != 'hidden')
- inst.input[0].focus();
+ if (inst.input.is(':visible') && !inst.input.is(':disabled'))
+ inst.input.focus();
$.datepicker._curInst = inst;
}
},
/* Generate the date picker content. */
_updateDatepicker: function(inst) {
- var dims = {width: inst.dpDiv.width() + 4,
- height: inst.dpDiv.height() + 4};
var self = this;
+ var borders = $.datepicker._getBorders(inst.dpDiv);
inst.dpDiv.empty().append(this._generateHTML(inst))
- .find('iframe.ui-datepicker-cover').
- css({width: dims.width, height: dims.height})
+ .find('iframe.ui-datepicker-cover') // IE6- only
+ .css({left: -borders[0], top: -borders[1],
+ width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
.end()
.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
.bind('mouseout', function(){
@@ -6072,17 +7430,28 @@ $.extend(Datepicker.prototype, {
var numMonths = this._getNumberOfMonths(inst);
var cols = numMonths[1];
var width = 17;
- if (cols > 1) {
+ if (cols > 1)
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
- } else {
+ else
inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
- }
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
'Class']('ui-datepicker-multi');
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
'Class']('ui-datepicker-rtl');
- if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
- $(inst.input[0]).focus();
+ if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
+ inst.input.is(':visible') && !inst.input.is(':disabled'))
+ inst.input.focus();
+ },
+
+ /* Retrieve the size of left and top borders for an element.
+ @param elem (jQuery object) the element of interest
+ @return (number[2]) the left and top borders */
+ _getBorders: function(elem) {
+ var convert = function(value) {
+ return {thin: 1, medium: 2, thick: 3}[value] || value;
+ };
+ return [parseFloat(convert(elem.css('border-left-width'))),
+ parseFloat(convert(elem.css('border-top-width')))];
},
/* Check positioning to remain on screen. */
@@ -6091,54 +7460,53 @@ $.extend(Datepicker.prototype, {
var dpHeight = inst.dpDiv.outerHeight();
var inputWidth = inst.input ? inst.input.outerWidth() : 0;
var inputHeight = inst.input ? inst.input.outerHeight() : 0;
- var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
- var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop();
+ var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
+ var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
// now check if datepicker is showing outside window viewport - move to a better place if so.
- offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0;
- offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0;
+ offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
+ offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
+ Math.abs(dpHeight + inputHeight) : 0);
return offset;
},
/* Find an object's position on the screen. */
_findPos: function(obj) {
+ var inst = this._getInst(obj);
+ var isRTL = this._get(inst, 'isRTL');
while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
- obj = obj.nextSibling;
+ obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
}
var position = $(obj).offset();
return [position.left, position.top];
},
/* Hide the date picker from view.
- @param input element - the input field attached to the date picker
- @param duration string - the duration over which to close the date picker */
- _hideDatepicker: function(input, duration) {
+ @param input element - the input field attached to the date picker */
+ _hideDatepicker: function(input) {
var inst = this._curInst;
if (!inst || (input && inst != $.data(input, PROP_NAME)))
return;
- if (inst.stayOpen)
- this._selectDate('#' + inst.id, this._formatDate(inst,
- inst.currentDay, inst.currentMonth, inst.currentYear));
- inst.stayOpen = false;
if (this._datepickerShowing) {
- duration = (duration != null ? duration : this._get(inst, 'duration'));
var showAnim = this._get(inst, 'showAnim');
+ var duration = this._get(inst, 'duration');
var postProcess = function() {
$.datepicker._tidyDialog(inst);
+ this._curInst = null;
};
- if (duration != '' && $.effects && $.effects[showAnim])
- inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'),
- duration, postProcess);
+ if ($.effects && $.effects[showAnim])
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
else
- inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' :
- (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
- if (duration == '')
- this._tidyDialog(inst);
+ inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
+ (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
+ if (!showAnim)
+ postProcess();
var onClose = this._get(inst, 'onClose');
if (onClose)
onClose.apply((inst.input ? inst.input[0] : null),
@@ -6154,7 +7522,6 @@ $.extend(Datepicker.prototype, {
}
this._inDialog = false;
}
- this._curInst = null;
},
/* Tidy up after a dialog display. */
@@ -6167,11 +7534,12 @@ $.extend(Datepicker.prototype, {
if (!$.datepicker._curInst)
return;
var $target = $(event.target);
- if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
+ if ($target[0].id != $.datepicker._mainDivId &&
+ $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.hasClass($.datepicker._triggerClass) &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
- $.datepicker._hideDatepicker(null, '');
+ $.datepicker._hideDatepicker();
},
/* Adjust one of the date sub-fields. */
@@ -6197,10 +7565,10 @@ $.extend(Datepicker.prototype, {
inst.drawYear = inst.selectedYear = inst.currentYear;
}
else {
- var date = new Date();
- inst.selectedDay = date.getDate();
- inst.drawMonth = inst.selectedMonth = date.getMonth();
- inst.drawYear = inst.selectedYear = date.getFullYear();
+ var date = new Date();
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
}
this._notifyChange(inst);
this._adjustDate(target);
@@ -6223,7 +7591,7 @@ $.extend(Datepicker.prototype, {
var target = $(id);
var inst = this._getInst(target[0]);
if (inst.input && inst._selectingMonthYear && !$.browser.msie)
- inst.input[0].focus();
+ inst.input.focus();
inst._selectingMonthYear = !inst._selectingMonthYear;
},
@@ -6237,24 +7605,14 @@ $.extend(Datepicker.prototype, {
inst.selectedDay = inst.currentDay = $('a', td).html();
inst.selectedMonth = inst.currentMonth = month;
inst.selectedYear = inst.currentYear = year;
- if (inst.stayOpen) {
- inst.endDay = inst.endMonth = inst.endYear = null;
- }
this._selectDate(id, this._formatDate(inst,
inst.currentDay, inst.currentMonth, inst.currentYear));
- if (inst.stayOpen) {
- inst.rangeStart = this._daylightSavingAdjust(
- new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
- this._updateDatepicker(inst);
- }
},
/* Erase the input field and hide the date picker. */
_clearDate: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
- inst.stayOpen = false;
- inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
this._selectDate(target, '');
},
@@ -6273,11 +7631,11 @@ $.extend(Datepicker.prototype, {
inst.input.trigger('change'); // fire the change event
if (inst.inline)
this._updateDatepicker(inst);
- else if (!inst.stayOpen) {
- this._hideDatepicker(null, this._get(inst, 'duration'));
+ else {
+ this._hideDatepicker();
this._lastInput = inst.input[0];
if (typeof(inst.input[0]) != 'object')
- inst.input[0].focus(); // restore focus
+ inst.input.focus(); // restore focus
this._lastInput = null;
}
},
@@ -6288,7 +7646,7 @@ $.extend(Datepicker.prototype, {
if (altField) { // update alternate field too
var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
var date = this._getDate(inst);
- dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
+ var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
$(altField).each(function() { $(this).val(dateStr); });
}
},
@@ -6305,20 +7663,13 @@ $.extend(Datepicker.prototype, {
@param date Date - the date to get the week for
@return number - the number of the week within the year that contains this date */
iso8601Week: function(date) {
- var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
- var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
- var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7
- firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday
- if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary
- checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year
- return $.datepicker.iso8601Week(checkDate);
- } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
- firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
- if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary
- return 1;
- }
- }
- return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
+ var checkDate = new Date(date.getTime());
+ // Find Thursday of this week starting on Monday
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+ var time = checkDate.getTime();
+ checkDate.setMonth(0); // Compare with Jan 1
+ checkDate.setDate(1);
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
},
/* Parse a string value into a date object.
@@ -6359,34 +7710,25 @@ $.extend(Datepicker.prototype, {
// Extract a number from the string value
var getNumber = function(match) {
lookAhead(match);
- var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)));
- var size = origSize;
- var num = 0;
- while (size > 0 && iValue < value.length &&
- value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {
- num = num * 10 + parseInt(value.charAt(iValue++),10);
- size--;
- }
- if (size == origSize)
+ var size = (match == '@' ? 14 : (match == '!' ? 20 :
+ (match == 'y' ? 4 : (match == 'o' ? 3 : 2))));
+ var digits = new RegExp('^\\d{1,' + size + '}');
+ var num = value.substring(iValue).match(digits);
+ if (!num)
throw 'Missing number at position ' + iValue;
- return num;
+ iValue += num[0].length;
+ return parseInt(num[0], 10);
};
// Extract a name from the string value and convert to an index
var getName = function(match, shortNames, longNames) {
var names = (lookAhead(match) ? longNames : shortNames);
- var size = 0;
- for (var j = 0; j < names.length; j++)
- size = Math.max(size, names[j].length);
- var name = '';
- var iInit = iValue;
- while (size > 0 && iValue < value.length) {
- name += value.charAt(iValue++);
- for (var i = 0; i < names.length; i++)
- if (name == names[i])
- return i + 1;
- size--;
- }
- throw 'Unknown name at position ' + iInit;
+ for (var i = 0; i < names.length; i++) {
+ if (value.substr(iValue, names[i].length) == names[i]) {
+ iValue += names[i].length;
+ return i + 1;
+ }
+ }
+ throw 'Unknown name at position ' + iValue;
};
// Confirm that a literal character matches the string value
var checkLiteral = function() {
@@ -6427,6 +7769,12 @@ $.extend(Datepicker.prototype, {
month = date.getMonth() + 1;
day = date.getDate();
break;
+ case '!':
+ var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
case "'":
if (lookAhead("'"))
checkLiteral();
@@ -6469,9 +7817,13 @@ $.extend(Datepicker.prototype, {
RFC_1123: 'D, d M yy',
RFC_2822: 'D, d M yy',
RSS: 'D, d M y', // RFC 822
+ TICKS: '!',
TIMESTAMP: '@',
W3C: 'yy-mm-dd', // ISO 8601
+ _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
+ Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
+
/* Format a date object into a string value.
The format can be combinations of the following:
d - day of month (no leading zero)
@@ -6487,6 +7839,7 @@ $.extend(Datepicker.prototype, {
y - year (two digit)
yy - year (four digit)
@ - Unix timestamp (ms since 01/01/1970)
+ ! - Windows ticks (100ns since 01/01/0001)
'...' - literal text
'' - single quote
@@ -6542,10 +7895,8 @@ $.extend(Datepicker.prototype, {
output += formatName('D', date.getDay(), dayNamesShort, dayNames);
break;
case 'o':
- var doy = date.getDate();
- for (var m = date.getMonth() - 1; m >= 0; m--)
- doy += this._getDaysInMonth(date.getFullYear(), m);
- output += formatNumber('o', doy, 3);
+ output += formatNumber('o',
+ (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
break;
case 'm':
output += formatNumber('m', date.getMonth() + 1, 2);
@@ -6560,6 +7911,9 @@ $.extend(Datepicker.prototype, {
case '@':
output += date.getTime();
break;
+ case '!':
+ output += date.getTime() * 10000 + this._ticksTo1970;
+ break;
case "'":
if (lookAhead("'"))
output += "'";
@@ -6577,6 +7931,13 @@ $.extend(Datepicker.prototype, {
_possibleChars: function (format) {
var chars = '';
var literal = false;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
for (var iFormat = 0; iFormat < format.length; iFormat++)
if (literal)
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
@@ -6609,17 +7970,20 @@ $.extend(Datepicker.prototype, {
},
/* Parse existing date and initialise date picker. */
- _setDateFromField: function(inst) {
+ _setDateFromField: function(inst, noDefault) {
+ if (inst.input.val() == inst.lastVal) {
+ return;
+ }
var dateFormat = this._get(inst, 'dateFormat');
- var dates = inst.input ? inst.input.val() : null;
- inst.endDay = inst.endMonth = inst.endYear = null;
- var date = defaultDate = this._getDefaultDate(inst);
+ var dates = inst.lastVal = inst.input ? inst.input.val() : null;
+ var date, defaultDate;
+ date = defaultDate = this._getDefaultDate(inst);
var settings = this._getFormatConfig(inst);
try {
date = this.parseDate(dateFormat, dates, settings) || defaultDate;
} catch (event) {
this.log(event);
- date = defaultDate;
+ dates = (noDefault ? '' : dates);
}
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
@@ -6632,23 +7996,27 @@ $.extend(Datepicker.prototype, {
/* Retrieve the default date shown on opening. */
_getDefaultDate: function(inst) {
- var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
- var minDate = this._getMinMaxDate(inst, 'min', true);
- var maxDate = this._getMinMaxDate(inst, 'max');
- date = (minDate && date < minDate ? minDate : date);
- date = (maxDate && date > maxDate ? maxDate : date);
- return date;
+ return this._restrictMinMax(inst,
+ this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
},
/* A date may be specified as an exact value or a relative one. */
- _determineDate: function(date, defaultDate) {
+ _determineDate: function(inst, date, defaultDate) {
var offsetNumeric = function(offset) {
var date = new Date();
date.setDate(date.getDate() + offset);
return date;
};
- var offsetString = function(offset, getDaysInMonth) {
- var date = new Date();
+ var offsetString = function(offset) {
+ try {
+ return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ offset, $.datepicker._getFormatConfig(inst));
+ }
+ catch (e) {
+ // Ignore
+ }
+ var date = (offset.toLowerCase().match(/^c/) ?
+ $.datepicker._getDate(inst) : null) || new Date();
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
@@ -6662,19 +8030,18 @@ $.extend(Datepicker.prototype, {
day += parseInt(matches[1],10) * 7; break;
case 'm' : case 'M' :
month += parseInt(matches[1],10);
- day = Math.min(day, getDaysInMonth(year, month));
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
break;
case 'y': case 'Y' :
year += parseInt(matches[1],10);
- day = Math.min(day, getDaysInMonth(year, month));
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
break;
}
matches = pattern.exec(offset);
}
return new Date(year, month, day);
};
- date = (date == null ? defaultDate :
- (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :
+ date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) :
(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
if (date) {
@@ -6699,15 +8066,15 @@ $.extend(Datepicker.prototype, {
},
/* Set the date(s) directly. */
- _setDate: function(inst, date, endDate) {
+ _setDate: function(inst, date, noChange) {
var clear = !(date);
var origMonth = inst.selectedMonth;
var origYear = inst.selectedYear;
- date = this._determineDate(date, new Date());
+ date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
inst.selectedDay = inst.currentDay = date.getDate();
inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
- if (origMonth != inst.selectedMonth || origYear != inst.selectedYear)
+ if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
this._notifyChange(inst);
this._adjustInstDate(inst);
if (inst.input) {
@@ -6735,11 +8102,10 @@ $.extend(Datepicker.prototype, {
var numMonths = this._getNumberOfMonths(inst);
var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
var stepMonths = this._get(inst, 'stepMonths');
- var stepBigMonths = this._get(inst, 'stepBigMonths');
var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
- var minDate = this._getMinMaxDate(inst, 'min', true);
+ var minDate = this._getMinMaxDate(inst, 'min');
var maxDate = this._getMinMaxDate(inst, 'max');
var drawMonth = inst.drawMonth - showCurrentAtPos;
var drawYear = inst.drawYear;
@@ -6749,7 +8115,7 @@ $.extend(Datepicker.prototype, {
}
if (maxDate) {
var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
- maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()));
+ maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
drawMonth--;
@@ -6766,7 +8132,8 @@ $.extend(Datepicker.prototype, {
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
this._getFormatConfig(inst)));
var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
- '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
+ '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
+ '.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
var nextText = this._get(inst, 'nextText');
@@ -6774,19 +8141,23 @@ $.extend(Datepicker.prototype, {
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
this._getFormatConfig(inst)));
var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
- '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
+ '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
+ '.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
var currentText = this._get(inst, 'currentText');
var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
currentText = (!navigationAsDateFormat ? currentText :
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
- var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
+ var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
+ '.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
- (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
+ (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
+ '.datepicker._gotoToday(\'#' + inst.id + '\');"' +
'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
var firstDay = parseInt(this._get(inst, 'firstDay'),10);
firstDay = (isNaN(firstDay) ? 0 : firstDay);
+ var showWeek = this._get(inst, 'showWeek');
var dayNames = this._get(inst, 'dayNames');
var dayNamesShort = this._get(inst, 'dayNamesShort');
var dayNamesMin = this._get(inst, 'dayNamesMin');
@@ -6794,9 +8165,8 @@ $.extend(Datepicker.prototype, {
var monthNamesShort = this._get(inst, 'monthNamesShort');
var beforeShowDay = this._get(inst, 'beforeShowDay');
var showOtherMonths = this._get(inst, 'showOtherMonths');
+ var selectOtherMonths = this._get(inst, 'selectOtherMonths');
var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
- var endDate = inst.endDay ? this._daylightSavingAdjust(
- new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate;
var defaultDate = this._getDefaultDate(inst);
var html = '';
for (var row = 0; row < numMonths[0]; row++) {
@@ -6806,22 +8176,25 @@ $.extend(Datepicker.prototype, {
var cornerClass = ' ui-corner-all';
var calender = '';
if (isMultiMonth) {
- calender += '<div class="ui-datepicker-group ui-datepicker-group-';
- switch (col) {
- case 0: calender += 'first'; cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
- case numMonths[1]-1: calender += 'last'; cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
- default: calender += 'middle'; cornerClass = ''; break;
- }
+ calender += '<div class="ui-datepicker-group';
+ if (numMonths[1] > 1)
+ switch (col) {
+ case 0: calender += ' ui-datepicker-group-first';
+ cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
+ case numMonths[1]-1: calender += ' ui-datepicker-group-last';
+ cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
+ default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
+ }
calender += '">';
}
calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
- selectedDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
+ row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
'</div><table class="ui-datepicker-calendar"><thead>' +
'<tr>';
- var thead = '';
+ var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
for (var dow = 0; dow < 7; dow++) { // days of the week
var day = (dow + firstDay) % 7;
thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
@@ -6836,12 +8209,13 @@ $.extend(Datepicker.prototype, {
var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
calender += '<tr>';
- var tbody = '';
+ var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
+ this._get(inst, 'calculateWeek')(printDate) + '</td>');
for (var dow = 0; dow < 7; dow++) { // create date picker days
var daySettings = (beforeShowDay ?
beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
var otherMonth = (printDate.getMonth() != drawMonth);
- var unselectable = otherMonth || !daySettings[0] ||
+ var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
tbody += '<td class="' +
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
@@ -6852,18 +8226,17 @@ $.extend(Datepicker.prototype, {
' ' + this._dayOverClass : '') + // highlight selected day
(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
- (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
- ' ' + this._currentClass : '') + // highlight selected day
+ (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
- (unselectable ? '' : ' onclick="DP_jQuery.datepicker._selectDay(\'#' +
- inst.id + '\',' + drawMonth + ',' + drawYear + ', this);return false;"') + '>' + // actions
- (otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
+ (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
+ inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
+ (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
- (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
- ' ui-state-active' : '') + // highlight selected day
- '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
+ (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
+ (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
+ '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
printDate.setDate(printDate.getDate() + 1);
printDate = this._daylightSavingAdjust(printDate);
}
@@ -6874,7 +8247,7 @@ $.extend(Datepicker.prototype, {
drawMonth = 0;
drawYear++;
}
- calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
+ calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
group += calender;
}
@@ -6888,8 +8261,7 @@ $.extend(Datepicker.prototype, {
/* Generate the month and year header. */
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
- selectedDate, secondary, monthNames, monthNamesShort) {
- minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
+ secondary, monthNames, monthNamesShort) {
var changeMonth = this._get(inst, 'changeMonth');
var changeYear = this._get(inst, 'changeYear');
var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
@@ -6897,13 +8269,13 @@ $.extend(Datepicker.prototype, {
var monthHtml = '';
// month selection
if (secondary || !changeMonth)
- monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span> ';
+ monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
else {
var inMinYear = (minDate && minDate.getFullYear() == drawYear);
var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
monthHtml += '<select class="ui-datepicker-month" ' +
- 'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
- 'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
+ 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
+ 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
'>';
for (var month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) &&
@@ -6915,30 +8287,27 @@ $.extend(Datepicker.prototype, {
monthHtml += '</select>';
}
if (!showMonthAfterYear)
- html += monthHtml + ((secondary || changeMonth || changeYear) && (!(changeMonth && changeYear)) ? '&#xa0;' : '');
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
// year selection
if (secondary || !changeYear)
html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
else {
// determine range of years to display
var years = this._get(inst, 'yearRange').split(':');
- var year = 0;
- var endYear = 0;
- if (years.length != 2) {
- year = drawYear - 10;
- endYear = drawYear + 10;
- } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
- year = drawYear + parseInt(years[0], 10);
- endYear = drawYear + parseInt(years[1], 10);
- } else {
- year = parseInt(years[0], 10);
- endYear = parseInt(years[1], 10);
- }
+ var thisYear = new Date().getFullYear();
+ var determineYear = function(value) {
+ var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
+ (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
+ parseInt(value, 10)));
+ return (isNaN(year) ? thisYear : year);
+ };
+ var year = determineYear(years[0]);
+ var endYear = Math.max(year, determineYear(years[1] || ''));
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
html += '<select class="ui-datepicker-year" ' +
- 'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
- 'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
+ 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
+ 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
'>';
for (; year <= endYear; year++) {
html += '<option value="' + year + '"' +
@@ -6947,8 +8316,9 @@ $.extend(Datepicker.prototype, {
}
html += '</select>';
}
+ html += this._get(inst, 'yearSuffix');
if (showMonthAfterYear)
- html += (secondary || changeMonth || changeYear ? '&#xa0;' : '') + monthHtml;
+ html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
html += '</div>'; // Close datepicker_header
return html;
},
@@ -6959,12 +8329,8 @@ $.extend(Datepicker.prototype, {
var month = inst.drawMonth + (period == 'M' ? offset : 0);
var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
(period == 'D' ? offset : 0);
- var date = this._daylightSavingAdjust(new Date(year, month, day));
- // ensure it is within the bounds set
- var minDate = this._getMinMaxDate(inst, 'min', true);
- var maxDate = this._getMinMaxDate(inst, 'max');
- date = (minDate && date < minDate ? minDate : date);
- date = (maxDate && date > maxDate ? maxDate : date);
+ var date = this._restrictMinMax(inst,
+ this._daylightSavingAdjust(new Date(year, month, day)));
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
@@ -6972,6 +8338,15 @@ $.extend(Datepicker.prototype, {
this._notifyChange(inst);
},
+ /* Ensure a date is within any min/max bounds. */
+ _restrictMinMax: function(inst, date) {
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ date = (minDate && date < minDate ? minDate : date);
+ date = (maxDate && date > maxDate ? maxDate : date);
+ return date;
+ },
+
/* Notify change of month/year. */
_notifyChange: function(inst) {
var onChange = this._get(inst, 'onChangeMonthYear');
@@ -6986,11 +8361,9 @@ $.extend(Datepicker.prototype, {
return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
},
- /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */
- _getMinMaxDate: function(inst, minMax, checkRange) {
- var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
- return (!checkRange || !inst.rangeStart ? date :
- (!date || inst.rangeStart > date ? inst.rangeStart : date));
+ /* Determine the current maximum date - ensure no time components are set. */
+ _getMinMaxDate: function(inst, minMax) {
+ return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
},
/* Find the number of days in a given month. */
@@ -7006,8 +8379,8 @@ $.extend(Datepicker.prototype, {
/* Determines if we should allow a "next/prev" month display change. */
_canAdjustMonth: function(inst, offset, curYear, curMonth) {
var numMonths = this._getNumberOfMonths(inst);
- var date = this._daylightSavingAdjust(new Date(
- curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1));
+ var date = this._daylightSavingAdjust(new Date(curYear,
+ curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
if (offset < 0)
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
return this._isInRange(inst, date);
@@ -7015,13 +8388,10 @@ $.extend(Datepicker.prototype, {
/* Is the given date in the accepted range? */
_isInRange: function(inst, date) {
- // during range selection, use minimum of selected date and range start
- var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust(
- new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)));
- newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
- var minDate = newMinDate || this._getMinMaxDate(inst, 'min');
+ var minDate = this._getMinMaxDate(inst, 'min');
var maxDate = this._getMinMaxDate(inst, 'max');
- return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
+ return ((!minDate || date.getTime() >= minDate.getTime()) &&
+ (!maxDate || date.getTime() <= maxDate.getTime()));
},
/* Provide the configuration settings for formatting/parsing. */
@@ -7077,7 +8447,7 @@ $.fn.datepicker = function(options){
}
var otherArgs = Array.prototype.slice.call(arguments, 1);
- if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
+ if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
return $.datepicker['_' + options + 'Datepicker'].
apply($.datepicker, [this[0]].concat(otherArgs));
if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
@@ -7094,73 +8464,87 @@ $.fn.datepicker = function(options){
$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
-$.datepicker.version = "1.7.2";
+$.datepicker.version = "1.8.2";
// Workaround for #4055
// Add another global to avoid noConflict issues with inline event handlers
-window.DP_jQuery = $;
+window['DP_jQuery_' + dpuuid] = $;
})(jQuery);
/*
- * jQuery UI Dialog 1.7.2
+ * jQuery UI Dialog 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Dialog
*
* Depends:
- * ui.core.js
- * ui.draggable.js
- * ui.resizable.js
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.button.js
+ * jquery.ui.draggable.js
+ * jquery.ui.mouse.js
+ * jquery.ui.position.js
+ * jquery.ui.resizable.js
*/
(function($) {
-var setDataSwitch = {
- dragStart: "start.draggable",
- drag: "drag.draggable",
- dragStop: "stop.draggable",
- maxHeight: "maxHeight.resizable",
- minHeight: "minHeight.resizable",
- maxWidth: "maxWidth.resizable",
- minWidth: "minWidth.resizable",
- resizeStart: "start.resizable",
- resize: "drag.resizable",
- resizeStop: "stop.resizable"
- },
-
- uiDialogClasses =
- 'ui-dialog ' +
- 'ui-widget ' +
- 'ui-widget-content ' +
- 'ui-corner-all ';
+var uiDialogClasses =
+ 'ui-dialog ' +
+ 'ui-widget ' +
+ 'ui-widget-content ' +
+ 'ui-corner-all ';
$.widget("ui.dialog", {
-
- _init: function() {
+ options: {
+ autoOpen: true,
+ buttons: {},
+ closeOnEscape: true,
+ closeText: 'close',
+ dialogClass: '',
+ draggable: true,
+ hide: null,
+ height: 'auto',
+ maxHeight: false,
+ maxWidth: false,
+ minHeight: 150,
+ minWidth: 150,
+ modal: false,
+ position: 'center',
+ resizable: true,
+ show: null,
+ stack: true,
+ title: '',
+ width: 300,
+ zIndex: 1000
+ },
+ _create: function() {
this.originalTitle = this.element.attr('title');
var self = this,
- options = this.options,
+ options = self.options,
- title = options.title || this.originalTitle || '&nbsp;',
- titleId = $.ui.dialog.getTitleId(this.element),
+ title = options.title || self.originalTitle || '&#160;',
+ titleId = $.ui.dialog.getTitleId(self.element),
- uiDialog = (this.uiDialog = $('<div/>'))
+ uiDialog = (self.uiDialog = $('<div></div>'))
.appendTo(document.body)
.hide()
.addClass(uiDialogClasses + options.dialogClass)
.css({
- position: 'absolute',
- overflow: 'hidden',
zIndex: options.zIndex
})
// setting tabIndex makes the div focusable
// setting outline to 0 prevents a border on focus in Mozilla
.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
- (options.closeOnEscape && event.keyCode
- && event.keyCode == $.ui.keyCode.ESCAPE && self.close(event));
+ if (options.closeOnEscape && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE) {
+
+ self.close(event);
+ event.preventDefault();
+ }
})
.attr({
role: 'dialog',
@@ -7170,7 +8554,7 @@ $.widget("ui.dialog", {
self.moveToTop(false, event);
}),
- uiDialogContent = this.element
+ uiDialogContent = self.element
.show()
.removeAttr('title')
.addClass(
@@ -7178,7 +8562,7 @@ $.widget("ui.dialog", {
'ui-widget-content')
.appendTo(uiDialog),
- uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>'))
+ uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
.addClass(
'ui-dialog-titlebar ' +
'ui-widget-header ' +
@@ -7187,7 +8571,7 @@ $.widget("ui.dialog", {
)
.prependTo(uiDialog),
- uiDialogTitlebarClose = $('<a href="#"/>')
+ uiDialogTitlebarClose = $('<a href="#"></a>')
.addClass(
'ui-dialog-titlebar-close ' +
'ui-corner-all'
@@ -7207,16 +8591,13 @@ $.widget("ui.dialog", {
.blur(function() {
uiDialogTitlebarClose.removeClass('ui-state-focus');
})
- .mousedown(function(ev) {
- ev.stopPropagation();
- })
.click(function(event) {
self.close(event);
return false;
})
.appendTo(uiDialogTitlebar),
- uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>'))
+ uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
.addClass(
'ui-icon ' +
'ui-icon-closethick'
@@ -7224,68 +8605,104 @@ $.widget("ui.dialog", {
.text(options.closeText)
.appendTo(uiDialogTitlebarClose),
- uiDialogTitle = $('<span/>')
+ uiDialogTitle = $('<span></span>')
.addClass('ui-dialog-title')
.attr('id', titleId)
.html(title)
.prependTo(uiDialogTitlebar);
- uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
+ //handling of deprecated beforeclose (vs beforeClose) option
+ //Ticket #4669 http://dev.jqueryui.com/ticket/4669
+ //TODO: remove in 1.9pre
+ if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
+ options.beforeClose = options.beforeclose;
+ }
- (options.draggable && $.fn.draggable && this._makeDraggable());
- (options.resizable && $.fn.resizable && this._makeResizable());
+ uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
- this._createButtons(options.buttons);
- this._isOpen = false;
+ if (options.draggable && $.fn.draggable) {
+ self._makeDraggable();
+ }
+ if (options.resizable && $.fn.resizable) {
+ self._makeResizable();
+ }
- (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
- (options.autoOpen && this.open());
+ self._createButtons(options.buttons);
+ self._isOpen = false;
+ if ($.fn.bgiframe) {
+ uiDialog.bgiframe();
+ }
+ },
+ _init: function() {
+ if ( this.options.autoOpen ) {
+ this.open();
+ }
},
destroy: function() {
- (this.overlay && this.overlay.destroy());
- this.uiDialog.hide();
- this.element
+ var self = this;
+
+ if (self.overlay) {
+ self.overlay.destroy();
+ }
+ self.uiDialog.hide();
+ self.element
.unbind('.dialog')
.removeData('dialog')
.removeClass('ui-dialog-content ui-widget-content')
.hide().appendTo('body');
- this.uiDialog.remove();
+ self.uiDialog.remove();
+
+ if (self.originalTitle) {
+ self.element.attr('title', self.originalTitle);
+ }
- (this.originalTitle && this.element.attr('title', this.originalTitle));
+ return self;
+ },
+
+ widget: function() {
+ return this.uiDialog;
},
close: function(event) {
- var self = this;
-
- if (false === self._trigger('beforeclose', event)) {
+ var self = this,
+ maxZ;
+
+ if (false === self._trigger('beforeClose', event)) {
return;
}
- (self.overlay && self.overlay.destroy());
+ if (self.overlay) {
+ self.overlay.destroy();
+ }
self.uiDialog.unbind('keypress.ui-dialog');
- (self.options.hide
- ? self.uiDialog.hide(self.options.hide, function() {
+ self._isOpen = false;
+
+ if (self.options.hide) {
+ self.uiDialog.hide(self.options.hide, function() {
self._trigger('close', event);
- })
- : self.uiDialog.hide() && self._trigger('close', event));
+ });
+ } else {
+ self.uiDialog.hide();
+ self._trigger('close', event);
+ }
$.ui.dialog.overlay.resize();
- self._isOpen = false;
-
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
if (self.options.modal) {
- var maxZ = 0;
+ maxZ = 0;
$('.ui-dialog').each(function() {
- if (this != self.uiDialog[0]) {
+ if (this !== self.uiDialog[0]) {
maxZ = Math.max(maxZ, $(this).css('z-index'));
}
});
$.ui.dialog.maxZ = maxZ;
}
+
+ return self;
},
isOpen: function() {
@@ -7295,58 +8712,70 @@ $.widget("ui.dialog", {
// the force parameter allows us to move modal dialogs to their correct
// position on open
moveToTop: function(force, event) {
-
- if ((this.options.modal && !force)
- || (!this.options.stack && !this.options.modal)) {
- return this._trigger('focus', event);
+ var self = this,
+ options = self.options,
+ saveScroll;
+
+ if ((options.modal && !force) ||
+ (!options.stack && !options.modal)) {
+ return self._trigger('focus', event);
}
-
- if (this.options.zIndex > $.ui.dialog.maxZ) {
- $.ui.dialog.maxZ = this.options.zIndex;
+
+ if (options.zIndex > $.ui.dialog.maxZ) {
+ $.ui.dialog.maxZ = options.zIndex;
+ }
+ if (self.overlay) {
+ $.ui.dialog.maxZ += 1;
+ self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
}
- (this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ));
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
// http://ui.jquery.com/bugs/ticket/3193
- var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') };
- this.uiDialog.css('z-index', ++$.ui.dialog.maxZ);
- this.element.attr(saveScroll);
- this._trigger('focus', event);
+ saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') };
+ $.ui.dialog.maxZ += 1;
+ self.uiDialog.css('z-index', $.ui.dialog.maxZ);
+ self.element.attr(saveScroll);
+ self._trigger('focus', event);
+
+ return self;
},
open: function() {
if (this._isOpen) { return; }
- var options = this.options,
- uiDialog = this.uiDialog;
+ var self = this,
+ options = self.options,
+ uiDialog = self.uiDialog;
- this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null;
- (uiDialog.next().length && uiDialog.appendTo('body'));
- this._size();
- this._position(options.position);
+ self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
+ if (uiDialog.next().length) {
+ uiDialog.appendTo('body');
+ }
+ self._size();
+ self._position(options.position);
uiDialog.show(options.show);
- this.moveToTop(true);
+ self.moveToTop(true);
// prevent tabbing out of modal dialogs
- (options.modal && uiDialog.bind('keypress.ui-dialog', function(event) {
- if (event.keyCode != $.ui.keyCode.TAB) {
- return;
- }
-
- var tabbables = $(':tabbable', this),
- first = tabbables.filter(':first')[0],
- last = tabbables.filter(':last')[0];
-
- if (event.target == last && !event.shiftKey) {
- setTimeout(function() {
- first.focus();
- }, 1);
- } else if (event.target == first && event.shiftKey) {
- setTimeout(function() {
- last.focus();
- }, 1);
- }
- }));
+ if (options.modal) {
+ uiDialog.bind('keypress.ui-dialog', function(event) {
+ if (event.keyCode !== $.ui.keyCode.TAB) {
+ return;
+ }
+
+ var tabbables = $(':tabbable', this),
+ first = tabbables.filter(':first'),
+ last = tabbables.filter(':last');
+
+ if (event.target === last[0] && !event.shiftKey) {
+ first.focus(1);
+ return false;
+ } else if (event.target === first[0] && event.shiftKey) {
+ last.focus(1);
+ return false;
+ }
+ });
+ }
// set focus to the first tabbable element in the content area or the first button
// if there are no tabbable elements, set focus on the dialog itself
@@ -7357,8 +8786,10 @@ $.widget("ui.dialog", {
.filter(':first')
.focus();
- this._trigger('open');
- this._isOpen = true;
+ self._trigger('open');
+ self._isOpen = true;
+
+ return self;
},
_createButtons: function(buttons) {
@@ -7372,59 +8803,57 @@ $.widget("ui.dialog", {
);
// if we already have a button pane, remove it
- this.uiDialog.find('.ui-dialog-buttonpane').remove();
+ self.uiDialog.find('.ui-dialog-buttonpane').remove();
- (typeof buttons == 'object' && buttons !== null &&
- $.each(buttons, function() { return !(hasButtons = true); }));
+ if (typeof buttons === 'object' && buttons !== null) {
+ $.each(buttons, function() {
+ return !(hasButtons = true);
+ });
+ }
if (hasButtons) {
$.each(buttons, function(name, fn) {
- $('<button type="button"></button>')
- .addClass(
- 'ui-state-default ' +
- 'ui-corner-all'
- )
+ var button = $('<button type="button"></button>')
.text(name)
.click(function() { fn.apply(self.element[0], arguments); })
- .hover(
- function() {
- $(this).addClass('ui-state-hover');
- },
- function() {
- $(this).removeClass('ui-state-hover');
- }
- )
- .focus(function() {
- $(this).addClass('ui-state-focus');
- })
- .blur(function() {
- $(this).removeClass('ui-state-focus');
- })
.appendTo(uiDialogButtonPane);
+ if ($.fn.button) {
+ button.button();
+ }
});
- uiDialogButtonPane.appendTo(this.uiDialog);
+ uiDialogButtonPane.appendTo(self.uiDialog);
}
},
_makeDraggable: function() {
var self = this,
- options = this.options,
+ options = self.options,
+ doc = $(document),
heightBeforeDrag;
- this.uiDialog.draggable({
- cancel: '.ui-dialog-content',
+ function filteredUi(ui) {
+ return {
+ position: ui.position,
+ offset: ui.offset
+ };
+ }
+
+ self.uiDialog.draggable({
+ cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
handle: '.ui-dialog-titlebar',
containment: 'document',
- start: function() {
- heightBeforeDrag = options.height;
+ start: function(event, ui) {
+ heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
$(this).height($(this).height()).addClass("ui-dialog-dragging");
- (options.dragStart && options.dragStart.apply(self.element[0], arguments));
+ self._trigger('dragStart', event, filteredUi(ui));
},
- drag: function() {
- (options.drag && options.drag.apply(self.element[0], arguments));
+ drag: function(event, ui) {
+ self._trigger('drag', event, filteredUi(ui));
},
- stop: function() {
+ stop: function(event, ui) {
+ options.position = [ui.position.left - doc.scrollLeft(),
+ ui.position.top - doc.scrollTop()];
$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
- (options.dragStop && options.dragStop.apply(self.element[0], arguments));
+ self._trigger('dragStop', event, filteredUi(ui));
$.ui.dialog.overlay.resize();
}
});
@@ -7433,202 +8862,282 @@ $.widget("ui.dialog", {
_makeResizable: function(handles) {
handles = (handles === undefined ? this.options.resizable : handles);
var self = this,
- options = this.options,
- resizeHandles = typeof handles == 'string'
- ? handles
- : 'n,e,s,w,se,sw,ne,nw';
+ options = self.options,
+ // .ui-resizable has position: relative defined in the stylesheet
+ // but dialogs have to use absolute or fixed positioning
+ position = self.uiDialog.css('position'),
+ resizeHandles = (typeof handles === 'string' ?
+ handles :
+ 'n,e,s,w,se,sw,ne,nw'
+ );
+
+ function filteredUi(ui) {
+ return {
+ originalPosition: ui.originalPosition,
+ originalSize: ui.originalSize,
+ position: ui.position,
+ size: ui.size
+ };
+ }
- this.uiDialog.resizable({
+ self.uiDialog.resizable({
cancel: '.ui-dialog-content',
- alsoResize: this.element,
+ containment: 'document',
+ alsoResize: self.element,
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
minWidth: options.minWidth,
- minHeight: options.minHeight,
- start: function() {
+ minHeight: self._minHeight(),
+ handles: resizeHandles,
+ start: function(event, ui) {
$(this).addClass("ui-dialog-resizing");
- (options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
+ self._trigger('resizeStart', event, filteredUi(ui));
},
- resize: function() {
- (options.resize && options.resize.apply(self.element[0], arguments));
+ resize: function(event, ui) {
+ self._trigger('resize', event, filteredUi(ui));
},
- handles: resizeHandles,
- stop: function() {
+ stop: function(event, ui) {
$(this).removeClass("ui-dialog-resizing");
options.height = $(this).height();
options.width = $(this).width();
- (options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
+ self._trigger('resizeStop', event, filteredUi(ui));
$.ui.dialog.overlay.resize();
}
})
+ .css('position', position)
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
},
- _position: function(pos) {
- var wnd = $(window), doc = $(document),
- pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
- minTop = pTop;
+ _minHeight: function() {
+ var options = this.options;
- if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
- pos = [
- pos == 'right' || pos == 'left' ? pos : 'center',
- pos == 'top' || pos == 'bottom' ? pos : 'middle'
- ];
- }
- if (pos.constructor != Array) {
- pos = ['center', 'middle'];
- }
- if (pos[0].constructor == Number) {
- pLeft += pos[0];
+ if (options.height === 'auto') {
+ return options.minHeight;
} else {
- switch (pos[0]) {
- case 'left':
- pLeft += 0;
- break;
- case 'right':
- pLeft += wnd.width() - this.uiDialog.outerWidth();
- break;
- default:
- case 'center':
- pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2;
- }
+ return Math.min(options.minHeight, options.height);
}
- if (pos[1].constructor == Number) {
- pTop += pos[1];
- } else {
- switch (pos[1]) {
- case 'top':
- pTop += 0;
- break;
- case 'bottom':
- pTop += wnd.height() - this.uiDialog.outerHeight();
- break;
- default:
- case 'middle':
- pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2;
+ },
+
+ _position: function(position) {
+ var myAt = [],
+ offset = [0, 0],
+ isVisible;
+
+ position = position || $.ui.dialog.prototype.options.position;
+
+ // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
+// if (typeof position == 'string' || $.isArray(position)) {
+// myAt = $.isArray(position) ? position : position.split(' ');
+
+ if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
+ myAt = position.split ? position.split(' ') : [position[0], position[1]];
+ if (myAt.length === 1) {
+ myAt[1] = myAt[0];
+ }
+
+ $.each(['left', 'top'], function(i, offsetPosition) {
+ if (+myAt[i] === myAt[i]) {
+ offset[i] = myAt[i];
+ myAt[i] = offsetPosition;
+ }
+ });
+ } else if (typeof position === 'object') {
+ if ('left' in position) {
+ myAt[0] = 'left';
+ offset[0] = position.left;
+ } else if ('right' in position) {
+ myAt[0] = 'right';
+ offset[0] = -position.right;
+ }
+
+ if ('top' in position) {
+ myAt[1] = 'top';
+ offset[1] = position.top;
+ } else if ('bottom' in position) {
+ myAt[1] = 'bottom';
+ offset[1] = -position.bottom;
}
}
- // prevent the dialog from being too high (make sure the titlebar
- // is accessible)
- pTop = Math.max(pTop, minTop);
- this.uiDialog.css({top: pTop, left: pLeft});
+ // need to show the dialog to get the actual offset in the position plugin
+ isVisible = this.uiDialog.is(':visible');
+ if (!isVisible) {
+ this.uiDialog.show();
+ }
+ this.uiDialog
+ // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
+ .css({ top: 0, left: 0 })
+ .position({
+ my: myAt.join(' '),
+ at: myAt.join(' '),
+ offset: offset.join(' '),
+ of: window,
+ collision: 'fit',
+ // ensure that the titlebar is never outside the document
+ using: function(pos) {
+ var topOffset = $(this).css(pos).offset().top;
+ if (topOffset < 0) {
+ $(this).css('top', pos.top - topOffset);
+ }
+ }
+ });
+ if (!isVisible) {
+ this.uiDialog.hide();
+ }
},
- _setData: function(key, value){
- (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
+ _setOption: function(key, value){
+ var self = this,
+ uiDialog = self.uiDialog,
+ isResizable = uiDialog.is(':data(resizable)'),
+ resize = false;
+
switch (key) {
+ //handling of deprecated beforeclose (vs beforeClose) option
+ //Ticket #4669 http://dev.jqueryui.com/ticket/4669
+ //TODO: remove in 1.9pre
+ case "beforeclose":
+ key = "beforeClose";
+ break;
case "buttons":
- this._createButtons(value);
+ self._createButtons(value);
break;
case "closeText":
- this.uiDialogTitlebarCloseText.text(value);
+ // convert whatever was passed in to a string, for text() to not throw up
+ self.uiDialogTitlebarCloseText.text("" + value);
break;
case "dialogClass":
- this.uiDialog
- .removeClass(this.options.dialogClass)
+ uiDialog
+ .removeClass(self.options.dialogClass)
.addClass(uiDialogClasses + value);
break;
+ case "disabled":
+ if (value) {
+ uiDialog.addClass('ui-dialog-disabled');
+ } else {
+ uiDialog.removeClass('ui-dialog-disabled');
+ }
+ break;
case "draggable":
- (value
- ? this._makeDraggable()
- : this.uiDialog.draggable('destroy'));
+ if (value) {
+ self._makeDraggable();
+ } else {
+ uiDialog.draggable('destroy');
+ }
break;
case "height":
- this.uiDialog.height(value);
+ resize = true;
+ break;
+ case "maxHeight":
+ if (isResizable) {
+ uiDialog.resizable('option', 'maxHeight', value);
+ }
+ resize = true;
+ break;
+ case "maxWidth":
+ if (isResizable) {
+ uiDialog.resizable('option', 'maxWidth', value);
+ }
+ resize = true;
+ break;
+ case "minHeight":
+ if (isResizable) {
+ uiDialog.resizable('option', 'minHeight', value);
+ }
+ resize = true;
+ break;
+ case "minWidth":
+ if (isResizable) {
+ uiDialog.resizable('option', 'minWidth', value);
+ }
+ resize = true;
break;
case "position":
- this._position(value);
+ self._position(value);
break;
case "resizable":
- var uiDialog = this.uiDialog,
- isResizable = this.uiDialog.is(':data(resizable)');
-
// currently resizable, becoming non-resizable
- (isResizable && !value && uiDialog.resizable('destroy'));
+ if (isResizable && !value) {
+ uiDialog.resizable('destroy');
+ }
// currently resizable, changing handles
- (isResizable && typeof value == 'string' &&
- uiDialog.resizable('option', 'handles', value));
+ if (isResizable && typeof value === 'string') {
+ uiDialog.resizable('option', 'handles', value);
+ }
// currently non-resizable, becoming resizable
- (isResizable || this._makeResizable(value));
+ if (!isResizable && value !== false) {
+ self._makeResizable(value);
+ }
break;
case "title":
- $(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');
+ // convert whatever was passed in o a string, for html() to not throw up
+ $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
break;
case "width":
- this.uiDialog.width(value);
+ resize = true;
break;
}
- $.widget.prototype._setData.apply(this, arguments);
+ $.Widget.prototype._setOption.apply(self, arguments);
+ if (resize) {
+ self._size();
+ }
},
_size: function() {
/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
* divs will both have width and height set, so we need to reset them
*/
- var options = this.options;
+ var options = this.options,
+ nonContentHeight;
// reset content sizing
+ // hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
this.element.css({
- height: 0,
+ width: 'auto',
minHeight: 0,
- width: 'auto'
+ height: 0
});
// reset wrapper sizing
// determine the height of all the non-content elements
- var nonContentHeight = this.uiDialog.css({
+ nonContentHeight = this.uiDialog.css({
height: 'auto',
width: options.width
})
.height();
this.element
- .css({
- minHeight: Math.max(options.minHeight - nonContentHeight, 0),
- height: options.height == 'auto'
- ? 'auto'
- : Math.max(options.height - nonContentHeight, 0)
- });
+ .css(options.height === 'auto' ? {
+ minHeight: Math.max(options.minHeight - nonContentHeight, 0),
+ height: 'auto'
+ } : {
+ minHeight: 0,
+ height: Math.max(options.height - nonContentHeight, 0)
+ })
+ .show();
+
+ if (this.uiDialog.is(':data(resizable)')) {
+ this.uiDialog.resizable('option', 'minHeight', this._minHeight());
+ }
}
});
$.extend($.ui.dialog, {
- version: "1.7.2",
- defaults: {
- autoOpen: true,
- bgiframe: false,
- buttons: {},
- closeOnEscape: true,
- closeText: 'close',
- dialogClass: '',
- draggable: true,
- hide: null,
- height: 'auto',
- maxHeight: false,
- maxWidth: false,
- minHeight: 150,
- minWidth: 150,
- modal: false,
- position: 'center',
- resizable: true,
- show: null,
- stack: true,
- title: '',
- width: 300,
- zIndex: 1000
- },
-
- getter: 'isOpen',
+ version: "1.8.2",
uuid: 0,
maxZ: 0,
getTitleId: function($el) {
- return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
+ var id = $el.attr('id');
+ if (!id) {
+ this.uuid += 1;
+ id = this.uuid;
+ }
+ return 'ui-dialog-title-' + id;
},
overlay: function(dialog) {
@@ -7638,6 +9147,8 @@ $.extend($.ui.dialog, {
$.extend($.ui.dialog.overlay, {
instances: [],
+ // reuse old instances due to IE memory leak with alpha transparency (see #5185)
+ oldInstances: [],
maxZ: 0,
events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
function(event) { return event + '.dialog-overlay'; }).join(' '),
@@ -7650,43 +9161,50 @@ $.extend($.ui.dialog.overlay, {
// handle $(el).dialog().dialog('close') (see #4065)
if ($.ui.dialog.overlay.instances.length) {
$(document).bind($.ui.dialog.overlay.events, function(event) {
- var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0;
- return (dialogZ > $.ui.dialog.overlay.maxZ);
+ // stop events if the z-index of the target is < the z-index of the overlay
+ return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ);
});
}
}, 1);
// allow closing by pressing the escape key
$(document).bind('keydown.dialog-overlay', function(event) {
- (dialog.options.closeOnEscape && event.keyCode
- && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event));
+ if (dialog.options.closeOnEscape && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE) {
+
+ dialog.close(event);
+ event.preventDefault();
+ }
});
// handle window resize
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
}
- var $el = $('<div></div>').appendTo(document.body)
- .addClass('ui-widget-overlay').css({
+ var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
+ .appendTo(document.body)
+ .css({
width: this.width(),
height: this.height()
});
- (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
+ if ($.fn.bgiframe) {
+ $el.bgiframe();
+ }
this.instances.push($el);
return $el;
},
destroy: function($el) {
- this.instances.splice($.inArray(this.instances, $el), 1);
+ this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]);
if (this.instances.length === 0) {
$([document, window]).unbind('.dialog-overlay');
}
$el.remove();
-
+
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
var maxZ = 0;
$.each(this.instances, function() {
@@ -7696,13 +9214,15 @@ $.extend($.ui.dialog.overlay, {
},
height: function() {
+ var scrollHeight,
+ offsetHeight;
// handle IE 6
if ($.browser.msie && $.browser.version < 7) {
- var scrollHeight = Math.max(
+ scrollHeight = Math.max(
document.documentElement.scrollHeight,
document.body.scrollHeight
);
- var offsetHeight = Math.max(
+ offsetHeight = Math.max(
document.documentElement.offsetHeight,
document.body.offsetHeight
);
@@ -7719,13 +9239,15 @@ $.extend($.ui.dialog.overlay, {
},
width: function() {
+ var scrollWidth,
+ offsetWidth;
// handle IE 6
if ($.browser.msie && $.browser.version < 7) {
- var scrollWidth = Math.max(
+ scrollWidth = Math.max(
document.documentElement.scrollWidth,
document.body.scrollWidth
);
- var offsetWidth = Math.max(
+ offsetWidth = Math.max(
document.documentElement.offsetWidth,
document.body.offsetWidth
);
@@ -7771,30 +9293,262 @@ $.extend($.ui.dialog.overlay.prototype, {
}
});
-})(jQuery);
+}(jQuery));
/*
- * jQuery UI Progressbar 1.7.2
+ * jQuery UI Position 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Position
+ */
+(function( $ ) {
+
+$.ui = $.ui || {};
+
+var horizontalPositions = /left|center|right/,
+ horizontalDefault = "center",
+ verticalPositions = /top|center|bottom/,
+ verticalDefault = "center",
+ _position = $.fn.position,
+ _offset = $.fn.offset;
+
+$.fn.position = function( options ) {
+ if ( !options || !options.of ) {
+ return _position.apply( this, arguments );
+ }
+
+ // make a copy, we don't want to modify arguments
+ options = $.extend( {}, options );
+
+ var target = $( options.of ),
+ collision = ( options.collision || "flip" ).split( " " ),
+ offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
+ targetWidth,
+ targetHeight,
+ basePosition;
+
+ if ( options.of.nodeType === 9 ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ basePosition = { top: 0, left: 0 };
+ } else if ( options.of.scrollTo && options.of.document ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
+ } else if ( options.of.preventDefault ) {
+ // force left top to allow flipping
+ options.at = "left top";
+ targetWidth = targetHeight = 0;
+ basePosition = { top: options.of.pageY, left: options.of.pageX };
+ } else {
+ targetWidth = target.outerWidth();
+ targetHeight = target.outerHeight();
+ basePosition = target.offset();
+ }
+
+ // force my and at to have valid horizontal and veritcal positions
+ // if a value is missing or invalid, it will be converted to center
+ $.each( [ "my", "at" ], function() {
+ var pos = ( options[this] || "" ).split( " " );
+ if ( pos.length === 1) {
+ pos = horizontalPositions.test( pos[0] ) ?
+ pos.concat( [verticalDefault] ) :
+ verticalPositions.test( pos[0] ) ?
+ [ horizontalDefault ].concat( pos ) :
+ [ horizontalDefault, verticalDefault ];
+ }
+ pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault;
+ pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault;
+ options[ this ] = pos;
+ });
+
+ // normalize collision option
+ if ( collision.length === 1 ) {
+ collision[ 1 ] = collision[ 0 ];
+ }
+
+ // normalize offset option
+ offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
+ if ( offset.length === 1 ) {
+ offset[ 1 ] = offset[ 0 ];
+ }
+ offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
+
+ if ( options.at[0] === "right" ) {
+ basePosition.left += targetWidth;
+ } else if (options.at[0] === horizontalDefault ) {
+ basePosition.left += targetWidth / 2;
+ }
+
+ if ( options.at[1] === "bottom" ) {
+ basePosition.top += targetHeight;
+ } else if ( options.at[1] === verticalDefault ) {
+ basePosition.top += targetHeight / 2;
+ }
+
+ basePosition.left += offset[ 0 ];
+ basePosition.top += offset[ 1 ];
+
+ return this.each(function() {
+ var elem = $( this ),
+ elemWidth = elem.outerWidth(),
+ elemHeight = elem.outerHeight(),
+ position = $.extend( {}, basePosition );
+
+ if ( options.my[0] === "right" ) {
+ position.left -= elemWidth;
+ } else if ( options.my[0] === horizontalDefault ) {
+ position.left -= elemWidth / 2;
+ }
+
+ if ( options.my[1] === "bottom" ) {
+ position.top -= elemHeight;
+ } else if ( options.my[1] === verticalDefault ) {
+ position.top -= elemHeight / 2;
+ }
+
+ // prevent fractions (see #5280)
+ position.left = parseInt( position.left );
+ position.top = parseInt( position.top );
+
+ $.each( [ "left", "top" ], function( i, dir ) {
+ if ( $.ui.position[ collision[i] ] ) {
+ $.ui.position[ collision[i] ][ dir ]( position, {
+ targetWidth: targetWidth,
+ targetHeight: targetHeight,
+ elemWidth: elemWidth,
+ elemHeight: elemHeight,
+ offset: offset,
+ my: options.my,
+ at: options.at
+ });
+ }
+ });
+
+ if ( $.fn.bgiframe ) {
+ elem.bgiframe();
+ }
+ elem.offset( $.extend( position, { using: options.using } ) );
+ });
+};
+
+$.ui.position = {
+ fit: {
+ left: function( position, data ) {
+ var win = $( window ),
+ over = position.left + data.elemWidth - win.width() - win.scrollLeft();
+ position.left = over > 0 ? position.left - over : Math.max( 0, position.left );
+ },
+ top: function( position, data ) {
+ var win = $( window ),
+ over = position.top + data.elemHeight - win.height() - win.scrollTop();
+ position.top = over > 0 ? position.top - over : Math.max( 0, position.top );
+ }
+ },
+
+ flip: {
+ left: function( position, data ) {
+ if ( data.at[0] === "center" ) {
+ return;
+ }
+ var win = $( window ),
+ over = position.left + data.elemWidth - win.width() - win.scrollLeft(),
+ myOffset = data.my[ 0 ] === "left" ?
+ -data.elemWidth :
+ data.my[ 0 ] === "right" ?
+ data.elemWidth :
+ 0,
+ offset = -2 * data.offset[ 0 ];
+ position.left += position.left < 0 ?
+ myOffset + data.targetWidth + offset :
+ over > 0 ?
+ myOffset - data.targetWidth + offset :
+ 0;
+ },
+ top: function( position, data ) {
+ if ( data.at[1] === "center" ) {
+ return;
+ }
+ var win = $( window ),
+ over = position.top + data.elemHeight - win.height() - win.scrollTop(),
+ myOffset = data.my[ 1 ] === "top" ?
+ -data.elemHeight :
+ data.my[ 1 ] === "bottom" ?
+ data.elemHeight :
+ 0,
+ atOffset = data.at[ 1 ] === "top" ?
+ data.targetHeight :
+ -data.targetHeight,
+ offset = -2 * data.offset[ 1 ];
+ position.top += position.top < 0 ?
+ myOffset + data.targetHeight + offset :
+ over > 0 ?
+ myOffset + atOffset + offset :
+ 0;
+ }
+ }
+};
+
+// offset setter from jQuery 1.4
+if ( !$.offset.setOffset ) {
+ $.offset.setOffset = function( elem, options ) {
+ // set position first, in-case top/left are set even on static elem
+ if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
+ elem.style.position = "relative";
+ }
+ var curElem = $( elem ),
+ curOffset = curElem.offset(),
+ curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
+ curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
+ props = {
+ top: (options.top - curOffset.top) + curTop,
+ left: (options.left - curOffset.left) + curLeft
+ };
+
+ if ( 'using' in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ };
+
+ $.fn.offset = function( options ) {
+ var elem = this[ 0 ];
+ if ( !elem || !elem.ownerDocument ) { return null; }
+ if ( options ) {
+ return this.each(function() {
+ $.offset.setOffset( this, options );
+ });
+ }
+ return _offset.call( this );
+ };
+}
+
+}( jQuery ));
+/*
+ * jQuery UI Progressbar 1.8.2
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Progressbar
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
*/
-(function($) {
-
-$.widget("ui.progressbar", {
-
- _init: function() {
+(function( $ ) {
+$.widget( "ui.progressbar", {
+ options: {
+ value: 0
+ },
+ _create: function() {
this.element
- .addClass("ui-progressbar"
- + " ui-widget"
- + " ui-widget-content"
- + " ui-corner-all")
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
role: "progressbar",
"aria-valuemin": this._valueMin(),
@@ -7802,294 +9556,345 @@ $.widget("ui.progressbar", {
"aria-valuenow": this._value()
});
- this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
+ .appendTo( this.element );
this._refreshValue();
-
},
destroy: function() {
-
this.element
- .removeClass("ui-progressbar"
- + " ui-widget"
- + " ui-widget-content"
- + " ui-corner-all")
- .removeAttr("role")
- .removeAttr("aria-valuemin")
- .removeAttr("aria-valuemax")
- .removeAttr("aria-valuenow")
- .removeData("progressbar")
- .unbind(".progressbar");
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
this.valueDiv.remove();
- $.widget.prototype.destroy.apply(this, arguments);
-
+ $.Widget.prototype.destroy.apply( this, arguments );
},
- value: function(newValue) {
- if (newValue === undefined) {
+ value: function( newValue ) {
+ if ( newValue === undefined ) {
return this._value();
}
- this._setData('value', newValue);
+ this._setOption( "value", newValue );
return this;
},
- _setData: function(key, value) {
-
- switch (key) {
- case 'value':
+ _setOption: function( key, value ) {
+ switch ( key ) {
+ case "value":
this.options.value = value;
this._refreshValue();
- this._trigger('change', null, {});
+ this._trigger( "change" );
break;
}
- $.widget.prototype._setData.apply(this, arguments);
-
+ $.Widget.prototype._setOption.apply( this, arguments );
},
_value: function() {
-
var val = this.options.value;
- if (val < this._valueMin()) val = this._valueMin();
- if (val > this._valueMax()) val = this._valueMax();
+ // normalize invalid value
+ if ( typeof val !== "number" ) {
+ val = 0;
+ }
+ if ( val < this._valueMin() ) {
+ val = this._valueMin();
+ }
+ if ( val > this._valueMax() ) {
+ val = this._valueMax();
+ }
return val;
-
},
_valueMin: function() {
- var valueMin = 0;
- return valueMin;
+ return 0;
},
_valueMax: function() {
- var valueMax = 100;
- return valueMax;
+ return 100;
},
_refreshValue: function() {
var value = this.value();
- this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
- this.valueDiv.width(value + '%');
- this.element.attr("aria-valuenow", value);
+ this.valueDiv
+ [ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
+ .width( value + "%" );
+ this.element.attr( "aria-valuenow", value );
}
-
});
-$.extend($.ui.progressbar, {
- version: "1.7.2",
- defaults: {
- value: 0
- }
+$.extend( $.ui.progressbar, {
+ version: "1.8.2"
});
-})(jQuery);
+})( jQuery );
/*
- * jQuery UI Slider 1.7.2
+ * jQuery UI Slider 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Slider
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
*/
-(function($) {
+(function( $ ) {
-$.widget("ui.slider", $.extend({}, $.ui.mouse, {
+// number of pages in a slider
+// (how many times can you page up/down to go through the whole range)
+var numPages = 5;
- _init: function() {
+$.widget( "ui.slider", $.ui.mouse, {
+
+ widgetEventPrefix: "slide",
+
+ options: {
+ animate: false,
+ distance: 0,
+ max: 100,
+ min: 0,
+ orientation: "horizontal",
+ range: false,
+ step: 1,
+ value: 0,
+ values: null
+ },
+
+ _create: function() {
+ var self = this,
+ o = this.options;
- var self = this, o = this.options;
this._keySliding = false;
+ this._mouseSliding = false;
+ this._animateOff = true;
this._handleIndex = null;
this._detectOrientation();
this._mouseInit();
this.element
- .addClass("ui-slider"
- + " ui-slider-" + this.orientation
- + " ui-widget"
- + " ui-widget-content"
- + " ui-corner-all");
+ .addClass( "ui-slider" +
+ " ui-slider-" + this.orientation +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" );
+
+ if ( o.disabled ) {
+ this.element.addClass( "ui-slider-disabled ui-disabled" );
+ }
this.range = $([]);
- if (o.range) {
-
- if (o.range === true) {
- this.range = $('<div></div>');
- if (!o.values) o.values = [this._valueMin(), this._valueMin()];
- if (o.values.length && o.values.length != 2) {
- o.values = [o.values[0], o.values[0]];
+ if ( o.range ) {
+ if ( o.range === true ) {
+ this.range = $( "<div></div>" );
+ if ( !o.values ) {
+ o.values = [ this._valueMin(), this._valueMin() ];
+ }
+ if ( o.values.length && o.values.length !== 2 ) {
+ o.values = [ o.values[0], o.values[0] ];
}
} else {
- this.range = $('<div></div>');
+ this.range = $( "<div></div>" );
}
this.range
- .appendTo(this.element)
- .addClass("ui-slider-range");
+ .appendTo( this.element )
+ .addClass( "ui-slider-range" );
- if (o.range == "min" || o.range == "max") {
- this.range.addClass("ui-slider-range-" + o.range);
+ if ( o.range === "min" || o.range === "max" ) {
+ this.range.addClass( "ui-slider-range-" + o.range );
}
// note: this isn't the most fittingly semantic framework class for this element,
// but worked best visually with a variety of themes
- this.range.addClass("ui-widget-header");
-
+ this.range.addClass( "ui-widget-header" );
}
- if ($(".ui-slider-handle", this.element).length == 0)
- $('<a href="#"></a>')
- .appendTo(this.element)
- .addClass("ui-slider-handle");
+ if ( $( ".ui-slider-handle", this.element ).length === 0 ) {
+ $( "<a href='#'></a>" )
+ .appendTo( this.element )
+ .addClass( "ui-slider-handle" );
+ }
- if (o.values && o.values.length) {
- while ($(".ui-slider-handle", this.element).length < o.values.length)
- $('<a href="#"></a>')
- .appendTo(this.element)
- .addClass("ui-slider-handle");
+ if ( o.values && o.values.length ) {
+ while ( $(".ui-slider-handle", this.element).length < o.values.length ) {
+ $( "<a href='#'></a>" )
+ .appendTo( this.element )
+ .addClass( "ui-slider-handle" );
+ }
}
- this.handles = $(".ui-slider-handle", this.element)
- .addClass("ui-state-default"
- + " ui-corner-all");
+ this.handles = $( ".ui-slider-handle", this.element )
+ .addClass( "ui-state-default" +
+ " ui-corner-all" );
- this.handle = this.handles.eq(0);
+ this.handle = this.handles.eq( 0 );
- this.handles.add(this.range).filter("a")
- .click(function(event) {
+ this.handles.add( this.range ).filter( "a" )
+ .click(function( event ) {
event.preventDefault();
})
.hover(function() {
- if (!o.disabled) {
- $(this).addClass('ui-state-hover');
+ if ( !o.disabled ) {
+ $( this ).addClass( "ui-state-hover" );
}
}, function() {
- $(this).removeClass('ui-state-hover');
+ $( this ).removeClass( "ui-state-hover" );
})
.focus(function() {
- if (!o.disabled) {
- $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus');
+ if ( !o.disabled ) {
+ $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
+ $( this ).addClass( "ui-state-focus" );
} else {
- $(this).blur();
+ $( this ).blur();
}
})
.blur(function() {
- $(this).removeClass('ui-state-focus');
+ $( this ).removeClass( "ui-state-focus" );
});
- this.handles.each(function(i) {
- $(this).data("index.ui-slider-handle", i);
+ this.handles.each(function( i ) {
+ $( this ).data( "index.ui-slider-handle", i );
});
- this.handles.keydown(function(event) {
-
- var ret = true;
-
- var index = $(this).data("index.ui-slider-handle");
-
- if (self.options.disabled)
- return;
-
- switch (event.keyCode) {
- case $.ui.keyCode.HOME:
- case $.ui.keyCode.END:
- case $.ui.keyCode.UP:
- case $.ui.keyCode.RIGHT:
- case $.ui.keyCode.DOWN:
- case $.ui.keyCode.LEFT:
- ret = false;
- if (!self._keySliding) {
- self._keySliding = true;
- $(this).addClass("ui-state-active");
- self._start(event, index);
- }
- break;
- }
-
- var curVal, newVal, step = self._step();
- if (self.options.values && self.options.values.length) {
- curVal = newVal = self.values(index);
- } else {
- curVal = newVal = self.value();
- }
-
- switch (event.keyCode) {
- case $.ui.keyCode.HOME:
- newVal = self._valueMin();
- break;
- case $.ui.keyCode.END:
- newVal = self._valueMax();
- break;
- case $.ui.keyCode.UP:
- case $.ui.keyCode.RIGHT:
- if(curVal == self._valueMax()) return;
- newVal = curVal + step;
- break;
- case $.ui.keyCode.DOWN:
- case $.ui.keyCode.LEFT:
- if(curVal == self._valueMin()) return;
- newVal = curVal - step;
- break;
- }
-
- self._slide(event, index, newVal);
-
- return ret;
-
- }).keyup(function(event) {
-
- var index = $(this).data("index.ui-slider-handle");
-
- if (self._keySliding) {
- self._stop(event, index);
- self._change(event, index);
- self._keySliding = false;
- $(this).removeClass("ui-state-active");
- }
-
- });
+ this.handles
+ .keydown(function( event ) {
+ var ret = true,
+ index = $( this ).data( "index.ui-slider-handle" ),
+ allowed,
+ curVal,
+ newVal,
+ step;
+
+ if ( self.options.disabled ) {
+ return;
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ case $.ui.keyCode.END:
+ case $.ui.keyCode.PAGE_UP:
+ case $.ui.keyCode.PAGE_DOWN:
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ ret = false;
+ if ( !self._keySliding ) {
+ self._keySliding = true;
+ $( this ).addClass( "ui-state-active" );
+ allowed = self._start( event, index );
+ if ( allowed === false ) {
+ return;
+ }
+ }
+ break;
+ }
+
+ step = self.options.step;
+ if ( self.options.values && self.options.values.length ) {
+ curVal = newVal = self.values( index );
+ } else {
+ curVal = newVal = self.value();
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ newVal = self._valueMin();
+ break;
+ case $.ui.keyCode.END:
+ newVal = self._valueMax();
+ break;
+ case $.ui.keyCode.PAGE_UP:
+ newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
+ break;
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ if ( curVal === self._valueMax() ) {
+ return;
+ }
+ newVal = self._trimAlignValue( curVal + step );
+ break;
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ if ( curVal === self._valueMin() ) {
+ return;
+ }
+ newVal = self._trimAlignValue( curVal - step );
+ break;
+ }
+
+ self._slide( event, index, newVal );
+
+ return ret;
+
+ })
+ .keyup(function( event ) {
+ var index = $( this ).data( "index.ui-slider-handle" );
+
+ if ( self._keySliding ) {
+ self._keySliding = false;
+ self._stop( event, index );
+ self._change( event, index );
+ $( this ).removeClass( "ui-state-active" );
+ }
+
+ });
this._refreshValue();
+ this._animateOff = false;
},
destroy: function() {
-
this.handles.remove();
this.range.remove();
this.element
- .removeClass("ui-slider"
- + " ui-slider-horizontal"
- + " ui-slider-vertical"
- + " ui-slider-disabled"
- + " ui-widget"
- + " ui-widget-content"
- + " ui-corner-all")
- .removeData("slider")
- .unbind(".slider");
+ .removeClass( "ui-slider" +
+ " ui-slider-horizontal" +
+ " ui-slider-vertical" +
+ " ui-slider-disabled" +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" )
+ .removeData( "slider" )
+ .unbind( ".slider" );
this._mouseDestroy();
+ return this;
},
- _mouseCapture: function(event) {
+ _mouseCapture: function( event ) {
+ var o = this.options,
+ position,
+ normValue,
+ distance,
+ closestHandle,
+ self,
+ index,
+ allowed,
+ offset,
+ mouseOverHandle;
- var o = this.options;
-
- if (o.disabled)
+ if ( o.disabled ) {
return false;
+ }
this.elementSize = {
width: this.element.outerWidth(),
@@ -8097,16 +9902,15 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
};
this.elementOffset = this.element.offset();
- var position = { x: event.pageX, y: event.pageY };
- var normValue = this._normValueFromMouse(position);
-
- var distance = this._valueMax() - this._valueMin() + 1, closestHandle;
- var self = this, index;
- this.handles.each(function(i) {
- var thisDistance = Math.abs(normValue - self.values(i));
- if (distance > thisDistance) {
+ position = { x: event.pageX, y: event.pageY };
+ normValue = this._normValueFromMouse( position );
+ distance = this._valueMax() - this._valueMin() + 1;
+ self = this;
+ this.handles.each(function( i ) {
+ var thisDistance = Math.abs( normValue - self.values(i) );
+ if ( distance > thisDistance ) {
distance = thisDistance;
- closestHandle = $(this);
+ closestHandle = $( this );
index = i;
}
});
@@ -8114,362 +9918,456 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
// workaround for bug #3736 (if both handles of a range are at 0,
// the first is always used as the one with least distance,
// and moving it is obviously prevented by preventing negative ranges)
- if(o.range == true && this.values(1) == o.min) {
- closestHandle = $(this.handles[++index]);
+ if( o.range === true && this.values(1) === o.min ) {
+ index += 1;
+ closestHandle = $( this.handles[index] );
}
- this._start(event, index);
+ allowed = this._start( event, index );
+ if ( allowed === false ) {
+ return false;
+ }
+ this._mouseSliding = true;
self._handleIndex = index;
closestHandle
- .addClass("ui-state-active")
+ .addClass( "ui-state-active" )
.focus();
-
- var offset = closestHandle.offset();
- var mouseOverHandle = !$(event.target).parents().andSelf().is('.ui-slider-handle');
+
+ offset = closestHandle.offset();
+ mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
- left: event.pageX - offset.left - (closestHandle.width() / 2),
- top: event.pageY - offset.top
- - (closestHandle.height() / 2)
- - (parseInt(closestHandle.css('borderTopWidth'),10) || 0)
- - (parseInt(closestHandle.css('borderBottomWidth'),10) || 0)
- + (parseInt(closestHandle.css('marginTop'),10) || 0)
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
+ top: event.pageY - offset.top -
+ ( closestHandle.height() / 2 ) -
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
};
- normValue = this._normValueFromMouse(position);
- this._slide(event, index, normValue);
+ normValue = this._normValueFromMouse( position );
+ this._slide( event, index, normValue );
+ this._animateOff = true;
return true;
-
},
- _mouseStart: function(event) {
+ _mouseStart: function( event ) {
return true;
},
- _mouseDrag: function(event) {
-
- var position = { x: event.pageX, y: event.pageY };
- var normValue = this._normValueFromMouse(position);
-
- this._slide(event, this._handleIndex, normValue);
+ _mouseDrag: function( event ) {
+ var position = { x: event.pageX, y: event.pageY },
+ normValue = this._normValueFromMouse( position );
+
+ this._slide( event, this._handleIndex, normValue );
return false;
-
},
- _mouseStop: function(event) {
+ _mouseStop: function( event ) {
+ this.handles.removeClass( "ui-state-active" );
+ this._mouseSliding = false;
+
+ this._stop( event, this._handleIndex );
+ this._change( event, this._handleIndex );
- this.handles.removeClass("ui-state-active");
- this._stop(event, this._handleIndex);
- this._change(event, this._handleIndex);
this._handleIndex = null;
this._clickOffset = null;
+ this._animateOff = false;
return false;
-
},
-
+
_detectOrientation: function() {
- this.orientation = this.options.orientation == 'vertical' ? 'vertical' : 'horizontal';
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
},
- _normValueFromMouse: function(position) {
+ _normValueFromMouse: function( position ) {
+ var pixelTotal,
+ pixelMouse,
+ percentMouse,
+ valueTotal,
+ valueMouse;
- var pixelTotal, pixelMouse;
- if ('horizontal' == this.orientation) {
+ if ( this.orientation === "horizontal" ) {
pixelTotal = this.elementSize.width;
- pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
} else {
pixelTotal = this.elementSize.height;
- pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
}
- var percentMouse = (pixelMouse / pixelTotal);
- if (percentMouse > 1) percentMouse = 1;
- if (percentMouse < 0) percentMouse = 0;
- if ('vertical' == this.orientation)
+ percentMouse = ( pixelMouse / pixelTotal );
+ if ( percentMouse > 1 ) {
+ percentMouse = 1;
+ }
+ if ( percentMouse < 0 ) {
+ percentMouse = 0;
+ }
+ if ( this.orientation === "vertical" ) {
percentMouse = 1 - percentMouse;
+ }
- var valueTotal = this._valueMax() - this._valueMin(),
- valueMouse = percentMouse * valueTotal,
- valueMouseModStep = valueMouse % this.options.step,
- normValue = this._valueMin() + valueMouse - valueMouseModStep;
-
- if (valueMouseModStep > (this.options.step / 2))
- normValue += this.options.step;
-
- // Since JavaScript has problems with large floats, round
- // the final value to 5 digits after the decimal point (see #4124)
- return parseFloat(normValue.toFixed(5));
+ valueTotal = this._valueMax() - this._valueMin();
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
+ return this._trimAlignValue( valueMouse );
},
- _start: function(event, index) {
+ _start: function( event, index ) {
var uiHash = {
- handle: this.handles[index],
+ handle: this.handles[ index ],
value: this.value()
};
- if (this.options.values && this.options.values.length) {
- uiHash.value = this.values(index);
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
uiHash.values = this.values();
}
- this._trigger("start", event, uiHash);
+ return this._trigger( "start", event, uiHash );
},
- _slide: function(event, index, newVal) {
+ _slide: function( event, index, newVal ) {
+ var otherVal,
+ newValues,
+ allowed;
- var handle = this.handles[index];
+ if ( this.options.values && this.options.values.length ) {
+ otherVal = this.values( index ? 0 : 1 );
- if (this.options.values && this.options.values.length) {
-
- var otherVal = this.values(index ? 0 : 1);
-
- if ((this.options.values.length == 2 && this.options.range === true) &&
- ((index == 0 && newVal > otherVal) || (index == 1 && newVal < otherVal))){
- newVal = otherVal;
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
+ ) {
+ newVal = otherVal;
}
- if (newVal != this.values(index)) {
- var newValues = this.values();
- newValues[index] = newVal;
+ if ( newVal !== this.values( index ) ) {
+ newValues = this.values();
+ newValues[ index ] = newVal;
// A slide can be canceled by returning false from the slide callback
- var allowed = this._trigger("slide", event, {
- handle: this.handles[index],
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
value: newVal,
values: newValues
- });
- var otherVal = this.values(index ? 0 : 1);
- if (allowed !== false) {
- this.values(index, newVal, ( event.type == 'mousedown' && this.options.animate ), true);
+ } );
+ otherVal = this.values( index ? 0 : 1 );
+ if ( allowed !== false ) {
+ this.values( index, newVal, true );
}
}
-
} else {
-
- if (newVal != this.value()) {
+ if ( newVal !== this.value() ) {
// A slide can be canceled by returning false from the slide callback
- var allowed = this._trigger("slide", event, {
- handle: this.handles[index],
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
value: newVal
- });
- if (allowed !== false) {
- this._setData('value', newVal, ( event.type == 'mousedown' && this.options.animate ));
+ } );
+ if ( allowed !== false ) {
+ this.value( newVal );
}
-
}
-
}
-
},
- _stop: function(event, index) {
+ _stop: function( event, index ) {
var uiHash = {
- handle: this.handles[index],
+ handle: this.handles[ index ],
value: this.value()
};
- if (this.options.values && this.options.values.length) {
- uiHash.value = this.values(index);
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
uiHash.values = this.values();
}
- this._trigger("stop", event, uiHash);
+
+ this._trigger( "stop", event, uiHash );
},
- _change: function(event, index) {
- var uiHash = {
- handle: this.handles[index],
- value: this.value()
- };
- if (this.options.values && this.options.values.length) {
- uiHash.value = this.values(index);
- uiHash.values = this.values();
+ _change: function( event, index ) {
+ if ( !this._keySliding && !this._mouseSliding ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ this._trigger( "change", event, uiHash );
}
- this._trigger("change", event, uiHash);
},
- value: function(newValue) {
-
- if (arguments.length) {
- this._setData("value", newValue);
- this._change(null, 0);
+ value: function( newValue ) {
+ if ( arguments.length ) {
+ this.options.value = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, 0 );
}
return this._value();
-
},
- values: function(index, newValue, animated, noPropagation) {
+ values: function( index, newValue ) {
+ var vals,
+ newValues,
+ i;
- if (arguments.length > 1) {
- this.options.values[index] = newValue;
- this._refreshValue(animated);
- if(!noPropagation) this._change(null, index);
+ if ( arguments.length > 1 ) {
+ this.options.values[ index ] = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, index );
}
- if (arguments.length) {
- if (this.options.values && this.options.values.length) {
- return this._values(index);
+ if ( arguments.length ) {
+ if ( $.isArray( arguments[ 0 ] ) ) {
+ vals = this.options.values;
+ newValues = arguments[ 0 ];
+ for ( i = 0; i < vals.length; i += 1 ) {
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
+ this._change( null, i );
+ }
+ this._refreshValue();
} else {
- return this.value();
+ if ( this.options.values && this.options.values.length ) {
+ return this._values( index );
+ } else {
+ return this.value();
+ }
}
} else {
return this._values();
}
-
},
- _setData: function(key, value, animated) {
+ _setOption: function( key, value ) {
+ var i,
+ valsLength = 0;
- $.widget.prototype._setData.apply(this, arguments);
+ if ( $.isArray( this.options.values ) ) {
+ valsLength = this.options.values.length;
+ }
- switch (key) {
- case 'disabled':
- if (value) {
- this.handles.filter(".ui-state-focus").blur();
- this.handles.removeClass("ui-state-hover");
- this.handles.attr("disabled", "disabled");
+ $.Widget.prototype._setOption.apply( this, arguments );
+
+ switch ( key ) {
+ case "disabled":
+ if ( value ) {
+ this.handles.filter( ".ui-state-focus" ).blur();
+ this.handles.removeClass( "ui-state-hover" );
+ this.handles.attr( "disabled", "disabled" );
+ this.element.addClass( "ui-disabled" );
} else {
- this.handles.removeAttr("disabled");
+ this.handles.removeAttr( "disabled" );
+ this.element.removeClass( "ui-disabled" );
}
- case 'orientation':
-
+ break;
+ case "orientation":
this._detectOrientation();
-
this.element
- .removeClass("ui-slider-horizontal ui-slider-vertical")
- .addClass("ui-slider-" + this.orientation);
- this._refreshValue(animated);
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
+ .addClass( "ui-slider-" + this.orientation );
+ this._refreshValue();
+ break;
+ case "value":
+ this._animateOff = true;
+ this._refreshValue();
+ this._change( null, 0 );
+ this._animateOff = false;
break;
- case 'value':
- this._refreshValue(animated);
+ case "values":
+ this._animateOff = true;
+ this._refreshValue();
+ for ( i = 0; i < valsLength; i += 1 ) {
+ this._change( null, i );
+ }
+ this._animateOff = false;
break;
}
-
- },
-
- _step: function() {
- var step = this.options.step;
- return step;
},
+ //internal value getter
+ // _value() returns value trimmed by min and max, aligned by step
_value: function() {
-
var val = this.options.value;
- if (val < this._valueMin()) val = this._valueMin();
- if (val > this._valueMax()) val = this._valueMax();
+ val = this._trimAlignValue( val );
return val;
-
},
- _values: function(index) {
+ //internal values getter
+ // _values() returns array of values trimmed by min and max, aligned by step
+ // _values( index ) returns single value trimmed by min and max, aligned by step
+ _values: function( index ) {
+ var val,
+ vals,
+ i;
- if (arguments.length) {
- var val = this.options.values[index];
- if (val < this._valueMin()) val = this._valueMin();
- if (val > this._valueMax()) val = this._valueMax();
+ if ( arguments.length ) {
+ val = this.options.values[ index ];
+ val = this._trimAlignValue( val );
return val;
} else {
- return this.options.values;
+ // .slice() creates a copy of the array
+ // this copy gets trimmed by min and max and then returned
+ vals = this.options.values.slice();
+ for ( i = 0; i < vals.length; i+= 1) {
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
+ }
+
+ return vals;
+ }
+ },
+
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
+ _trimAlignValue: function( val ) {
+ if ( val < this._valueMin() ) {
+ return this._valueMin();
+ }
+ if ( val > this._valueMax() ) {
+ return this._valueMax();
+ }
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
+ valModStep = val % step,
+ alignValue = val - valModStep;
+
+ if ( Math.abs(valModStep) * 2 >= step ) {
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
}
+ // Since JavaScript has problems with large floats, round
+ // the final value to 5 digits after the decimal point (see #4124)
+ return parseFloat( alignValue.toFixed(5) );
},
_valueMin: function() {
- var valueMin = this.options.min;
- return valueMin;
+ return this.options.min;
},
_valueMax: function() {
- var valueMax = this.options.max;
- return valueMax;
+ return this.options.max;
},
-
- _refreshValue: function(animate) {
-
- var oRange = this.options.range, o = this.options, self = this;
-
- if (this.options.values && this.options.values.length) {
- var vp0, vp1;
- this.handles.each(function(i, j) {
- var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100;
- var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
- $(this).stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
- if (self.options.range === true) {
- if (self.orientation == 'horizontal') {
- (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ left: valPercent + '%' }, o.animate);
- (i == 1) && self.range[animate ? 'animate' : 'css']({ width: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
+
+ _refreshValue: function() {
+ var oRange = this.options.range,
+ o = this.options,
+ self = this,
+ animate = ( !this._animateOff ) ? o.animate : false,
+ valPercent,
+ _set = {},
+ lastValPercent,
+ value,
+ valueMin,
+ valueMax;
+
+ if ( this.options.values && this.options.values.length ) {
+ this.handles.each(function( i, j ) {
+ valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
+ _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+ if ( self.options.range === true ) {
+ if ( self.orientation === "horizontal" ) {
+ if ( i === 0 ) {
+ self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
} else {
- (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ bottom: (valPercent) + '%' }, o.animate);
- (i == 1) && self.range[animate ? 'animate' : 'css']({ height: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
+ if ( i === 0 ) {
+ self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
}
}
lastValPercent = valPercent;
});
} else {
- var value = this.value(),
- valueMin = this._valueMin(),
- valueMax = this._valueMax(),
- valPercent = valueMax != valueMin
- ? (value - valueMin) / (valueMax - valueMin) * 100
- : 0;
- var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
- this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
-
- (oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate);
- (oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
- (oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate);
- (oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
+ value = this.value();
+ valueMin = this._valueMin();
+ valueMax = this._valueMax();
+ valPercent = ( valueMax !== valueMin ) ?
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
+ 0;
+ _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ if ( oRange === "min" && this.orientation === "vertical" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "vertical" ) {
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
}
-
}
-}));
+});
-$.extend($.ui.slider, {
- getter: "value values",
- version: "1.7.2",
- eventPrefix: "slide",
- defaults: {
- animate: false,
- delay: 0,
- distance: 0,
- max: 100,
- min: 0,
- orientation: 'horizontal',
- range: false,
- step: 1,
- value: 0,
- values: null
- }
+$.extend( $.ui.slider, {
+ version: "1.8.2"
});
-})(jQuery);
+}(jQuery));
/*
- * jQuery UI Tabs 1.7.2
+ * jQuery UI Tabs 1.8.2
*
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Tabs
*
* Depends:
- * ui.core.js
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
*/
(function($) {
-$.widget("ui.tabs", {
+var tabId = 0,
+ listId = 0;
- _init: function() {
- if (this.options.deselectable !== undefined) {
- this.options.collapsible = this.options.deselectable;
- }
+function getNextTabId() {
+ return ++tabId;
+}
+
+function getNextListId() {
+ return ++listId;
+}
+
+$.widget("ui.tabs", {
+ options: {
+ add: null,
+ ajaxOptions: null,
+ cache: false,
+ cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+ collapsible: false,
+ disable: null,
+ disabled: [],
+ enable: null,
+ event: 'click',
+ fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
+ idPrefix: 'ui-tabs-',
+ load: null,
+ panelTemplate: '<div></div>',
+ remove: null,
+ select: null,
+ show: null,
+ spinner: '<em>Loading&#8230;</em>',
+ tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
+ },
+ _create: function() {
this._tabify(true);
},
- _setData: function(key, value) {
+ _setOption: function(key, value) {
if (key == 'selected') {
if (this.options.collapsible && value == this.options.selected) {
return;
@@ -8478,16 +10376,13 @@ $.widget("ui.tabs", {
}
else {
this.options[key] = value;
- if (key == 'deselectable') {
- this.options.collapsible = value;
- }
this._tabify();
}
},
_tabId: function(a) {
return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') ||
- this.options.idPrefix + $.data(a);
+ this.options.idPrefix + getNextTabId();
},
_sanitizeSelector: function(hash) {
@@ -8495,7 +10390,7 @@ $.widget("ui.tabs", {
},
_cookie: function() {
- var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + $.data(this.list[0]));
+ var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + getNextListId());
return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
},
@@ -8519,7 +10414,7 @@ $.widget("ui.tabs", {
_tabify: function(init) {
- this.list = this.element.children('ul:first');
+ this.list = this.element.find('ol,ul').eq(0);
this.lis = $('li:has(a[href])', this.list);
this.anchors = this.lis.map(function() { return $('a', this)[0]; });
this.panels = $([]);
@@ -8601,7 +10496,7 @@ $.widget("ui.tabs", {
if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) {
o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
}
- o.selected = o.selected || 0;
+ o.selected = o.selected || (this.lis.length ? 0 : -1);
}
else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release
o.selected = -1;
@@ -8633,7 +10528,7 @@ $.widget("ui.tabs", {
self.element.queue("tabs", function() {
self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected]));
});
-
+
this.load(o.selected);
}
@@ -8710,7 +10605,7 @@ $.widget("ui.tabs", {
// and prevent IE's ClearType bug...
function resetStyle($el, fx) {
$el.css({ display: '' });
- if ($.browser.msie && fx.opacity) {
+ if (!$.support.opacity && fx.opacity) {
$el[0].style.removeAttribute('filter');
}
}
@@ -8718,7 +10613,7 @@ $.widget("ui.tabs", {
// Show a tab...
var showTab = showFx ?
function(clicked, $show) {
- $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');
+ $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active');
$show.hide().removeClass('ui-tabs-hide') // avoid flicker that way
.animate(showFx, showFx.duration || 'normal', function() {
resetStyle($show, showFx);
@@ -8726,7 +10621,7 @@ $.widget("ui.tabs", {
});
} :
function(clicked, $show) {
- $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');
+ $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active');
$show.removeClass('ui-tabs-hide');
self._trigger('show', null, self._ui(clicked, $show[0]));
};
@@ -8735,14 +10630,14 @@ $.widget("ui.tabs", {
var hideTab = hideFx ?
function(clicked, $hide) {
$hide.animate(hideFx, hideFx.duration || 'normal', function() {
- self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');
+ self.lis.removeClass('ui-tabs-selected ui-state-active');
$hide.addClass('ui-tabs-hide');
resetStyle($hide, hideFx);
self.element.dequeue("tabs");
});
} :
function(clicked, $hide, $show) {
- self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');
+ self.lis.removeClass('ui-tabs-selected ui-state-active');
$hide.addClass('ui-tabs-hide');
self.element.dequeue("tabs");
};
@@ -8780,7 +10675,7 @@ $.widget("ui.tabs", {
self.element.queue("tabs", function() {
hideTab(el, $hide);
}).dequeue("tabs");
-
+
this.blur();
return false;
}
@@ -8788,13 +10683,13 @@ $.widget("ui.tabs", {
if (o.cookie) {
self._cookie(o.selected, o.cookie);
}
-
+
self.element.queue("tabs", function() {
showTab(el, $show);
});
self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
-
+
this.blur();
return false;
}
@@ -8814,7 +10709,7 @@ $.widget("ui.tabs", {
self.element.queue("tabs", function() {
showTab(el, $show);
});
-
+
self.load(self.anchors.index(this));
}
else {
@@ -8840,7 +10735,7 @@ $.widget("ui.tabs", {
var o = this.options;
this.abort();
-
+
this.element.unbind('.tabs')
.removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible')
.removeData('tabs');
@@ -8882,6 +10777,8 @@ $.widget("ui.tabs", {
if (o.cookie) {
this._cookie(null, o.cookie);
}
+
+ return this;
},
add: function(url, label, index) {
@@ -8917,17 +10814,19 @@ $.widget("ui.tabs", {
this._tabify();
if (this.anchors.length == 1) { // after tabify
+ o.selected = 0;
$li.addClass('ui-tabs-selected ui-state-active');
$panel.removeClass('ui-tabs-hide');
this.element.queue("tabs", function() {
self._trigger('show', null, self._ui(self.anchors[0], self.panels[0]));
});
-
+
this.load(0);
}
// callback
this._trigger('add', null, this._ui(this.anchors[index], this.panels[index]));
+ return this;
},
remove: function(index) {
@@ -8947,6 +10846,7 @@ $.widget("ui.tabs", {
// callback
this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0]));
+ return this;
},
enable: function(index) {
@@ -8960,6 +10860,7 @@ $.widget("ui.tabs", {
// callback
this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index]));
+ return this;
},
disable: function(index) {
@@ -8973,6 +10874,8 @@ $.widget("ui.tabs", {
// callback
this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index]));
}
+
+ return this;
},
select: function(index) {
@@ -8987,6 +10890,7 @@ $.widget("ui.tabs", {
}
this.anchors.eq(index).trigger(this.options.event + '.tabs');
+ return this;
},
load: function(index) {
@@ -9026,11 +10930,28 @@ $.widget("ui.tabs", {
o.ajaxOptions.success(r, s);
}
catch (e) {}
+ },
+ error: function(xhr, s, e) {
+ // take care of tab labels
+ self._cleanup();
- // last, so that load event is fired before show...
- self.element.dequeue("tabs");
+ // callbacks
+ self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
+ try {
+ // Passing index avoid a race condition when this method is
+ // called after the user has selected another tab.
+ // Pass the anchor that initiated this request allows
+ // loadError to manipulate the tab content panel via $(a.hash)
+ o.ajaxOptions.error(xhr, s, index, a);
+ }
+ catch (e) {}
}
}));
+
+ // last, so that load event is fired before show...
+ self.element.dequeue("tabs");
+
+ return this;
},
abort: function() {
@@ -9038,6 +10959,10 @@ $.widget("ui.tabs", {
this.element.queue([]);
this.panels.stop(false, true);
+ // "tabs" queue must not contain more than two elements,
+ // which are the callbacks for the latest clicked tab...
+ this.element.queue("tabs", this.element.queue("tabs").splice(-2, 2));
+
// terminate pending requests from other tabs
if (this.xhr) {
this.xhr.abort();
@@ -9046,11 +10971,12 @@ $.widget("ui.tabs", {
// take care of tab labels
this._cleanup();
-
+ return this;
},
url: function(index, url) {
this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url);
+ return this;
},
length: function() {
@@ -9060,21 +10986,7 @@ $.widget("ui.tabs", {
});
$.extend($.ui.tabs, {
- version: '1.7.2',
- getter: 'length',
- defaults: {
- ajaxOptions: null,
- cache: false,
- cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
- collapsible: false,
- disabled: [],
- event: 'click',
- fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
- idPrefix: 'ui-tabs-',
- panelTemplate: '<div></div>',
- spinner: '<em>Loading&#8230;</em>',
- tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
- }
+ version: '1.8.2'
});
/*
@@ -9089,19 +11001,19 @@ $.extend($.ui.tabs.prototype, {
rotate: function(ms, continuing) {
var self = this, o = this.options;
-
+
var rotate = self._rotate || (self._rotate = function(e) {
clearTimeout(self.rotation);
self.rotation = setTimeout(function() {
var t = o.selected;
self.select( ++t < self.anchors.length ? t : 0 );
}, ms);
-
+
if (e) {
e.stopPropagation();
}
});
-
+
var stop = self._unrotate || (self._unrotate = !continuing ?
function(e) {
if (e.clientX) { // in case of a true click
@@ -9127,6 +11039,8 @@ $.extend($.ui.tabs.prototype, {
delete this._rotate;
delete this._unrotate;
}
+
+ return this;
}
});
diff --git a/libs/jquery/original lib/jquery.blockUI.js b/libs/jquery/original lib/jquery.blockUI.js
index 71fad72d1a..2349452429 100644
--- a/libs/jquery/original lib/jquery.blockUI.js
+++ b/libs/jquery/original lib/jquery.blockUI.js
@@ -1,6 +1,6 @@
-/*
+/*!
* jQuery blockUI plugin
- * Version 2.14 (18-JAN-2009)
+ * Version 2.31 (06-JAN-2010)
* @requires jQuery v1.2.3 or later
*
* Examples at: http://malsup.com/jquery/block/
@@ -8,380 +8,470 @@
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
- *
+ *
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/
;(function($) {
if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
- alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
- return;
+ alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
+ return;
}
+$.fn._fadeIn = $.fn.fadeIn;
+
+var noOp = function() {};
+
+// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
+// retarded userAgent strings on Vista)
+var mode = document.documentMode || 0;
+var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
+var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
+
// global $ methods for blocking/unblocking the entire page
$.blockUI = function(opts) { install(window, opts); };
$.unblockUI = function(opts) { remove(window, opts); };
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
-$.growlUI = function(title, message, timeout) {
+$.growlUI = function(title, message, timeout, onClose) {
var $m = $('<div class="growlUI"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 3000;
- $.blockUI({
+ $.blockUI({
message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
timeout: timeout, showOverlay: false,
+ onUnblock: onClose,
css: $.blockUI.defaults.growlCSS
- });
+ });
};
// plugin method for blocking element content
$.fn.block = function(opts) {
- return this.each(function() {
- if ($.css(this,'position') == 'static')
- this.style.position = 'relative';
- if ($.browser.msie)
- this.style.zoom = 1; // force 'hasLayout'
- install(this, opts);
- });
+ return this.unblock({ fadeOut: 0 }).each(function() {
+ if ($.css(this,'position') == 'static')
+ this.style.position = 'relative';
+ if ($.browser.msie)
+ this.style.zoom = 1; // force 'hasLayout'
+ install(this, opts);
+ });
};
// plugin method for unblocking element content
$.fn.unblock = function(opts) {
- return this.each(function() {
- remove(this, opts);
- });
+ return this.each(function() {
+ remove(this, opts);
+ });
};
-$.blockUI.version = 2.14; // 2nd generation blocking at no extra cost!
+$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost!
// override these in your code to change the default behavior and style
$.blockUI.defaults = {
- // message displayed when blocking (use null for no message)
- message: '<h1>Please wait...</h1>',
-
- // styles for the message when blocking; if you wish to disable
- // these and use an external stylesheet then do this in your code:
- // $.blockUI.defaults.css = {};
- css: {
- padding: 0,
- margin: 0,
- width: '30%',
- top: '40%',
- left: '35%',
- textAlign: 'center',
- color: '#000',
- border: '3px solid #aaa',
- backgroundColor:'#fff',
- cursor: 'wait'
- },
-
- // styles for the overlay
- overlayCSS: {
- backgroundColor: '#000',
- opacity: '0.6'
- },
+ // message displayed when blocking (use null for no message)
+ message: '<h1>Please wait...</h1>',
+
+ title: null, // title string; only used when theme == true
+ draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
+
+ theme: false, // set to true to use with jQuery UI themes
+
+ // styles for the message when blocking; if you wish to disable
+ // these and use an external stylesheet then do this in your code:
+ // $.blockUI.defaults.css = {};
+ css: {
+ padding: 0,
+ margin: 0,
+ width: '30%',
+ top: '40%',
+ left: '35%',
+ textAlign: 'center',
+ color: '#000',
+ border: '3px solid #aaa',
+ backgroundColor:'#fff',
+ cursor: 'wait'
+ },
+
+ // minimal style set used when themes are used
+ themedCSS: {
+ width: '30%',
+ top: '40%',
+ left: '35%'
+ },
+
+ // styles for the overlay
+ overlayCSS: {
+ backgroundColor: '#000',
+ opacity: 0.6,
+ cursor: 'wait'
+ },
// styles applied when using $.growlUI
- growlCSS: {
- width: '350px',
- top: '10px',
- left: '',
- right: '10px',
- border: 'none',
- padding: '5px',
- opacity: '0.6',
- cursor: null,
- color: '#fff',
- backgroundColor: '#000',
- '-webkit-border-radius': '10px',
- '-moz-border-radius': '10px'
+ growlCSS: {
+ width: '350px',
+ top: '10px',
+ left: '',
+ right: '10px',
+ border: 'none',
+ padding: '5px',
+ opacity: 0.6,
+ cursor: 'default',
+ color: '#fff',
+ backgroundColor: '#000',
+ '-webkit-border-radius': '10px',
+ '-moz-border-radius': '10px'
},
-
- // z-index for the blocking overlay
- baseZ: 1000,
-
- // set these to true to have the message automatically centered
- centerX: true, // <-- only effects element blocking (page block controlled via css above)
- centerY: true,
-
- // allow body element to be stetched in ie6; this makes blocking look better
- // on "short" pages. disable if you wish to prevent changes to the body height
- allowBodyStretch: true,
-
- // be default blockUI will supress tab navigation from leaving blocking content;
- constrainTabKey: true,
-
- // fadeIn time in millis; set to 0 to disable fadeIn on block
- fadeIn: 200,
-
- // fadeOut time in millis; set to 0 to disable fadeOut on unblock
- fadeOut: 400,
-
+
+ // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
+ // (hat tip to Jorge H. N. de Vasconcelos)
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
+
+ // force usage of iframe in non-IE browsers (handy for blocking applets)
+ forceIframe: false,
+
+ // z-index for the blocking overlay
+ baseZ: 1000,
+
+ // set these to true to have the message automatically centered
+ centerX: true, // <-- only effects element blocking (page block controlled via css above)
+ centerY: true,
+
+ // allow body element to be stetched in ie6; this makes blocking look better
+ // on "short" pages. disable if you wish to prevent changes to the body height
+ allowBodyStretch: true,
+
+ // enable if you want key and mouse events to be disabled for content that is blocked
+ bindEvents: true,
+
+ // be default blockUI will supress tab navigation from leaving blocking content
+ // (if bindEvents is true)
+ constrainTabKey: true,
+
+ // fadeIn time in millis; set to 0 to disable fadeIn on block
+ fadeIn: 200,
+
+ // fadeOut time in millis; set to 0 to disable fadeOut on unblock
+ fadeOut: 400,
+
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
timeout: 0,
// disable if you don't want to show the overlay
showOverlay: true,
- // if true, focus will be placed in the first available input field when
- // page blocking
- focusInput: true,
-
- // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
- applyPlatformOpacityRules: true,
-
- // callback method invoked when unblocking has completed; the callback is
- // passed the element that has been unblocked (which is the window object for page
- // blocks) and the options that were passed to the unblock call:
- // onUnblock(element, options)
- onUnblock: null,
-
- // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
- quirksmodeOffsetHack: 4
+ // if true, focus will be placed in the first available input field when
+ // page blocking
+ focusInput: true,
+
+ // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
+ applyPlatformOpacityRules: true,
+
+ // callback method invoked when fadeIn has completed and blocking message is visible
+ onBlock: null,
+
+ // callback method invoked when unblocking has completed; the callback is
+ // passed the element that has been unblocked (which is the window object for page
+ // blocks) and the options that were passed to the unblock call:
+ // onUnblock(element, options)
+ onUnblock: null,
+
+ // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
+ quirksmodeOffsetHack: 4
};
// private data and functions follow...
-var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
var pageBlock = null;
var pageBlockEls = [];
function install(el, opts) {
- var full = (el == window);
- var msg = opts && opts.message !== undefined ? opts.message : undefined;
- opts = $.extend({}, $.blockUI.defaults, opts || {});
- opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
- var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
- msg = msg === undefined ? opts.message : msg;
-
- // remove the current block (if there is one)
- if (full && pageBlock)
- remove(window, {fadeOut:0});
-
- // if an existing element is being used as the blocking content then we capture
- // its current place in the DOM (and current display style) so we can restore
- // it when we unblock
- if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
- var node = msg.jquery ? msg[0] : msg;
- var data = {};
- $(el).data('blockUI.history', data);
- data.el = node;
- data.parent = node.parentNode;
- data.display = node.style.display;
- data.position = node.style.position;
+ var full = (el == window);
+ var msg = opts && opts.message !== undefined ? opts.message : undefined;
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
+ opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
+ var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
+ var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
+ msg = msg === undefined ? opts.message : msg;
+
+ // remove the current block (if there is one)
+ if (full && pageBlock)
+ remove(window, {fadeOut:0});
+
+ // if an existing element is being used as the blocking content then we capture
+ // its current place in the DOM (and current display style) so we can restore
+ // it when we unblock
+ if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
+ var node = msg.jquery ? msg[0] : msg;
+ var data = {};
+ $(el).data('blockUI.history', data);
+ data.el = node;
+ data.parent = node.parentNode;
+ data.display = node.style.display;
+ data.position = node.style.position;
if (data.parent)
data.parent.removeChild(node);
- }
-
- var z = opts.baseZ;
-
- // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
- // layer1 is the iframe layer which is used to supress bleed through of underlying content
- // layer2 is the overlay layer which has opacity and a wait cursor
- // layer3 is the message content that is displayed while blocking
-
- var lyr1 = ($.browser.msie) ? $('<iframe class="blockUI" style="z-index:'+ z++ +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false;"></iframe>')
- : $('<div class="blockUI" style="display:none"></div>');
- var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ z++ +';display:none;cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
- var lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')
- : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');
-
- // if we have a message, style it
- if (msg)
- lyr3.css(css);
-
- // style the overlay
- if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
- lyr2.css(opts.overlayCSS);
- lyr2.css('position', full ? 'fixed' : 'absolute');
-
- // make iframe layer transparent in IE
- if ($.browser.msie)
- lyr1.css('opacity','0.0');
-
- $([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
-
- // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
- var expr = $.browser.msie && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
- if (ie6 || expr) {
- // give body 100% height
- if (full && opts.allowBodyStretch && $.boxModel)
- $('html,body').css('height','100%');
-
- // fix ie6 issue when blocked element has a border width
- if ((ie6 || !$.boxModel) && !full) {
- var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
- var fixT = t ? '(0 - '+t+')' : 0;
- var fixL = l ? '(0 - '+l+')' : 0;
- }
-
- // simulate fixed position
- $.each([lyr1,lyr2,lyr3], function(i,o) {
- var s = o[0].style;
- s.position = 'absolute';
- if (i < 2) {
- full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
- : s.setExpression('height','this.parentNode.offsetHeight + "px"');
- full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
- : s.setExpression('width','this.parentNode.offsetWidth + "px"');
- if (fixL) s.setExpression('left', fixL);
- if (fixT) s.setExpression('top', fixT);
- }
- else if (opts.centerY) {
- if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
- s.marginTop = 0;
- }
+ }
+
+ var z = opts.baseZ;
+
+ // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
+ // layer1 is the iframe layer which is used to supress bleed through of underlying content
+ // layer2 is the overlay layer which has opacity and a wait cursor (by default)
+ // layer3 is the message content that is displayed while blocking
+
+ var lyr1 = ($.browser.msie || opts.forceIframe)
+ ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
+ : $('<div class="blockUI" style="display:none"></div>');
+ var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
+
+ var lyr3;
+ if (opts.theme && full) {
+ var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +
+ '<div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
+ '<div class="ui-widget-content ui-dialog-content"></div>' +
+ '</div>';
+ lyr3 = $(s);
+ }
+ else {
+ lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')
+ : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');
+ }
+
+ // if we have a message, style it
+ if (msg) {
+ if (opts.theme) {
+ lyr3.css(themedCSS);
+ lyr3.addClass('ui-widget-content');
+ }
+ else
+ lyr3.css(css);
+ }
+
+ // style the overlay
+ if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
+ lyr2.css(opts.overlayCSS);
+ lyr2.css('position', full ? 'fixed' : 'absolute');
+
+ // make iframe layer transparent in IE
+ if ($.browser.msie || opts.forceIframe)
+ lyr1.css('opacity',0.0);
+
+ //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
+ var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
+ $.each(layers, function() {
+ this.appendTo($par);
+ });
+
+ if (opts.theme && opts.draggable && $.fn.draggable) {
+ lyr3.draggable({
+ handle: '.ui-dialog-titlebar',
+ cancel: 'li'
+ });
+ }
+
+ // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
+ var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
+ if (ie6 || expr) {
+ // give body 100% height
+ if (full && opts.allowBodyStretch && $.boxModel)
+ $('html,body').css('height','100%');
+
+ // fix ie6 issue when blocked element has a border width
+ if ((ie6 || !$.boxModel) && !full) {
+ var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
+ var fixT = t ? '(0 - '+t+')' : 0;
+ var fixL = l ? '(0 - '+l+')' : 0;
+ }
+
+ // simulate fixed position
+ $.each([lyr1,lyr2,lyr3], function(i,o) {
+ var s = o[0].style;
+ s.position = 'absolute';
+ if (i < 2) {
+ full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
+ : s.setExpression('height','this.parentNode.offsetHeight + "px"');
+ full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
+ : s.setExpression('width','this.parentNode.offsetWidth + "px"');
+ if (fixL) s.setExpression('left', fixL);
+ if (fixT) s.setExpression('top', fixT);
+ }
+ else if (opts.centerY) {
+ if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
+ s.marginTop = 0;
+ }
else if (!opts.centerY && full) {
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
- s.setExpression('top',expression);
+ s.setExpression('top',expression);
}
- });
- }
-
- // show the message
- lyr3.append(msg);//.show();
- if (msg && (msg.jquery || msg.nodeType))
- $(msg).show();
+ });
+ }
+ // show the message
+ if (msg) {
+ if (opts.theme)
+ lyr3.find('.ui-widget-content').append(msg);
+ else
+ lyr3.append(msg);
+ if (msg.jquery || msg.nodeType)
+ $(msg).show();
+ }
+
+ if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
+ lyr1.show(); // opacity is zero
if (opts.fadeIn) {
- if ($.browser.msie && opts.showOverlay)
- lyr1.fadeIn(opts.fadeIn);
+ var cb = opts.onBlock ? opts.onBlock : noOp;
+ var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
+ var cb2 = msg ? cb : noOp;
if (opts.showOverlay)
- lyr2.fadeIn(opts.fadeIn);
- lyr3.fadeIn(opts.fadeIn);
+ lyr2._fadeIn(opts.fadeIn, cb1);
+ if (msg)
+ lyr3._fadeIn(opts.fadeIn, cb2);
}
else {
- if ($.browser.msie && opts.showOverlay)
- lyr1.show();
if (opts.showOverlay)
lyr2.show();
- lyr3.show();
+ if (msg)
+ lyr3.show();
+ if (opts.onBlock)
+ opts.onBlock();
}
- // bind key and mouse events
- bind(1, el, opts);
-
- if (full) {
- pageBlock = lyr3[0];
- pageBlockEls = $(':input:enabled:visible',pageBlock);
- if (opts.focusInput)
- setTimeout(focus, 20);
- }
- else
- center(lyr3[0], opts.centerX, opts.centerY);
+ // bind key and mouse events
+ bind(1, el, opts);
+
+ if (full) {
+ pageBlock = lyr3[0];
+ pageBlockEls = $(':input:enabled:visible',pageBlock);
+ if (opts.focusInput)
+ setTimeout(focus, 20);
+ }
+ else
+ center(lyr3[0], opts.centerX, opts.centerY);
if (opts.timeout) {
// auto-unblock
- setTimeout(function() {
+ var to = setTimeout(function() {
full ? $.unblockUI(opts) : $(el).unblock(opts);
}, opts.timeout);
+ $(el).data('blockUI.timeout', to);
}
};
// remove the block
function remove(el, opts) {
- var full = el == window;
- var data = $(el).data('blockUI.history');
- opts = $.extend({}, $.blockUI.defaults, opts || {});
- bind(0, el, opts); // unbind events
- var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);
-
- if (full)
- pageBlock = pageBlockEls = null;
-
- if (opts.fadeOut) {
- els.fadeOut(opts.fadeOut);
- setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
- }
- else
- reset(els, data, opts, el);
+ var full = (el == window);
+ var $el = $(el);
+ var data = $el.data('blockUI.history');
+ var to = $el.data('blockUI.timeout');
+ if (to) {
+ clearTimeout(to);
+ $el.removeData('blockUI.timeout');
+ }
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
+ bind(0, el, opts); // unbind events
+
+ var els;
+ if (full) // crazy selector to handle odd field errors in ie6/7
+ els = $('body').children().filter('.blockUI').add('body > .blockUI');
+ else
+ els = $('.blockUI', el);
+
+ if (full)
+ pageBlock = pageBlockEls = null;
+
+ if (opts.fadeOut) {
+ els.fadeOut(opts.fadeOut);
+ setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
+ }
+ else
+ reset(els, data, opts, el);
};
// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
- els.each(function(i,o) {
- // remove via DOM calls so we don't lose event handlers
- if (this.parentNode)
- this.parentNode.removeChild(this);
- });
-
- if (data && data.el) {
- data.el.style.display = data.display;
- data.el.style.position = data.position;
+ els.each(function(i,o) {
+ // remove via DOM calls so we don't lose event handlers
+ if (this.parentNode)
+ this.parentNode.removeChild(this);
+ });
+
+ if (data && data.el) {
+ data.el.style.display = data.display;
+ data.el.style.position = data.position;
if (data.parent)
data.parent.appendChild(data.el);
- $(data.el).removeData('blockUI.history');
- }
+ $(el).removeData('blockUI.history');
+ }
- if (typeof opts.onUnblock == 'function')
- opts.onUnblock(el,opts);
+ if (typeof opts.onUnblock == 'function')
+ opts.onUnblock(el,opts);
};
// bind/unbind the handler
function bind(b, el, opts) {
- var full = el == window, $el = $(el);
-
- // don't bother unbinding if there is nothing to unbind
- if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
- return;
- if (!full)
- $el.data('blockUI.isBlocked', b);
-
- if (b && !opts.showOverlay) // don't prevent events when overlay not in use
+ var full = el == window, $el = $(el);
+
+ // don't bother unbinding if there is nothing to unbind
+ if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
return;
+ if (!full)
+ $el.data('blockUI.isBlocked', b);
- // bind anchors and inputs for mouse and key events
- var events = 'mousedown mouseup keydown keypress';
- b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
+ // don't bind events when overlay is not in use or if bindEvents is false
+ if (!opts.bindEvents || (b && !opts.showOverlay))
+ return;
+
+ // bind anchors and inputs for mouse and key events
+ var events = 'mousedown mouseup keydown keypress';
+ b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
// former impl...
-// var $e = $('a,:input');
-// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
+// var $e = $('a,:input');
+// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
};
// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
- // allow tab navigation (conditionally)
- if (e.keyCode && e.keyCode == 9) {
- if (pageBlock && e.data.constrainTabKey) {
- var els = pageBlockEls;
- var fwd = !e.shiftKey && e.target == els[els.length-1];
- var back = e.shiftKey && e.target == els[0];
- if (fwd || back) {
- setTimeout(function(){focus(back)},10);
- return false;
- }
- }
- }
- // allow events within the message content
- if ($(e.target).parents('div.blockMsg').length > 0)
- return true;
-
- // allow events for content that is not being blocked
- return $(e.target).parents().children().filter('div.blockUI').length == 0;
+ // allow tab navigation (conditionally)
+ if (e.keyCode && e.keyCode == 9) {
+ if (pageBlock && e.data.constrainTabKey) {
+ var els = pageBlockEls;
+ var fwd = !e.shiftKey && e.target == els[els.length-1];
+ var back = e.shiftKey && e.target == els[0];
+ if (fwd || back) {
+ setTimeout(function(){focus(back)},10);
+ return false;
+ }
+ }
+ }
+ // allow events within the message content
+ if ($(e.target).parents('div.blockMsg').length > 0)
+ return true;
+
+ // allow events for content that is not being blocked
+ return $(e.target).parents().children().filter('div.blockUI').length == 0;
};
function focus(back) {
- if (!pageBlockEls)
- return;
- var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
- if (e)
- e.focus();
+ if (!pageBlockEls)
+ return;
+ var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
+ if (e)
+ e.focus();
};
function center(el, x, y) {
- var p = el.parentNode, s = el.style;
- var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
- var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
- if (x) s.left = l > 0 ? (l+'px') : '0';
- if (y) s.top = t > 0 ? (t+'px') : '0';
+ var p = el.parentNode, s = el.style;
+ var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
+ var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
+ if (x) s.left = l > 0 ? (l+'px') : '0';
+ if (y) s.top = t > 0 ? (t+'px') : '0';
};
-function sz(el, p) {
- return parseInt($.css(el,p))||0;
+function sz(el, p) {
+ return parseInt($.css(el,p))||0;
};
})(jQuery);
diff --git a/libs/jquery/original lib/jquery.js b/libs/jquery/original lib/jquery.js
index e3a442aa95..fff6776433 100644
--- a/libs/jquery/original lib/jquery.js
+++ b/libs/jquery/original lib/jquery.js
@@ -1,978 +1,1462 @@
/*!
- * jQuery JavaScript Library v1.3.2
+ * jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
- * Copyright (c) 2009 John Resig
- * Dual licensed under the MIT and GPL licenses.
- * http://docs.jquery.com/License
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
*
- * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
- * Revision: 6246
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Sat Feb 13 22:33:48 2010 -0500
*/
-(function(){
+(function( window, undefined ) {
+
+// Define a local copy of jQuery
+var jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+ },
-var
- // Will speed up references to window, and allows munging its name.
- window = this,
- // Will speed up references to undefined, and allows munging its name.
- undefined,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
+
// Map over the $ in case of overwrite
_$ = window.$,
- jQuery = window.jQuery = window.$ = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context );
- },
+ // Use the correct document accordingly with window argument (sandbox)
+ document = window.document,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
- quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
+ quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,
+
// Is it a simple selector
- isSimple = /^.[^:#\[\.,]*$/;
+ isSimple = /^.[^:#\[\.,]*$/,
+
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+
+ // Used for trimming whitespace
+ rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+
+ // Keep a UserAgent string for use with jQuery.browser
+ userAgent = navigator.userAgent,
+
+ // For matching the engine and version of the browser
+ browserMatch,
+
+ // Has the ready events already been bound?
+ readyBound = false,
+
+ // The functions to execute on DOM ready
+ readyList = [],
+
+ // The ready event handler
+ DOMContentLoaded,
+
+ // Save a reference to some core methods
+ toString = Object.prototype.toString,
+ hasOwnProperty = Object.prototype.hasOwnProperty,
+ push = Array.prototype.push,
+ slice = Array.prototype.slice,
+ indexOf = Array.prototype.indexOf;
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
- // Make sure that a selection was provided
- selector = selector || document;
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), or $(undefined)
+ if ( !selector ) {
+ return this;
+ }
// Handle $(DOMElement)
if ( selector.nodeType ) {
- this[0] = selector;
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // The body element only exists once, optimize finding it
+ if ( selector === "body" && !context ) {
+ this.context = document;
+ this[0] = document.body;
+ this.selector = "body";
this.length = 1;
- this.context = selector;
return this;
}
+
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
- var match = quickExpr.exec( selector );
+ match = quickExpr.exec( selector );
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
- if ( match[1] )
- selector = jQuery.clean( [ match[1] ], context );
+ if ( match[1] ) {
+ doc = (context ? context.ownerDocument || context : document);
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ ret = rsingleTag.exec( selector );
+
+ if ( ret ) {
+ if ( jQuery.isPlainObject( context ) ) {
+ selector = [ document.createElement( ret[1] ) ];
+ jQuery.fn.attr.call( selector, context, true );
+
+ } else {
+ selector = [ doc.createElement( ret[1] ) ];
+ }
+ } else {
+ ret = buildFragment( [ match[1] ], [ doc ] );
+ selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
+ }
+
+ return jQuery.merge( this, selector );
+
// HANDLE: $("#id")
- else {
- var elem = document.getElementById( match[3] );
-
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem && elem.id != match[3] )
- return jQuery().find( selector );
-
- // Otherwise, we inject the element directly into the jQuery object
- var ret = jQuery( elem || [] );
- ret.context = document;
- ret.selector = selector;
- return ret;
+ } else {
+ elem = document.getElementById( match[2] );
+
+ if ( elem ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
}
- // HANDLE: $(expr, [context])
- // (which is just equivalent to: $(content).find(expr)
- } else
+ // HANDLE: $("TAG")
+ } else if ( !context && /^\w+$/.test( selector ) ) {
+ this.selector = selector;
+ this.context = document;
+ selector = document.getElementsByTagName( selector );
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return (context || rootjQuery).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
return jQuery( context ).find( selector );
+ }
// HANDLE: $(function)
// Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) )
- return jQuery( document ).ready( selector );
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
- // Make sure that old selector state is passed along
- if ( selector.selector && selector.context ) {
+ if (selector.selector !== undefined) {
this.selector = selector.selector;
this.context = selector.context;
}
- return this.setArray(jQuery.isArray( selector ) ?
- selector :
- jQuery.makeArray(selector));
+ return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
- jquery: "1.3.2",
+ jquery: "1.4.2",
+
+ // The default length of a jQuery object is 0
+ length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
+ toArray: function() {
+ return slice.call( this, 0 );
+ },
+
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
- return num === undefined ?
+ return num == null ?
// Return a 'clean' array
- Array.prototype.slice.call( this ) :
+ this.toArray() :
// Return just the object
- this[ num ];
+ ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
- var ret = jQuery( elems );
+ var ret = jQuery();
+
+ if ( jQuery.isArray( elems ) ) {
+ push.apply( ret, elems );
+
+ } else {
+ jQuery.merge( ret, elems );
+ }
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
- if ( name === "find" )
+ if ( name === "find" ) {
ret.selector = this.selector + (this.selector ? " " : "") + selector;
- else if ( name )
+ } else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
// Return the newly-formed element set
return ret;
},
- // Force the current matched set of elements to become
- // the specified array of elements (destroying the stack in the process)
- // You should use pushStack() in order to do this, but maintain the stack
- setArray: function( elems ) {
- // Resetting the length to 0, then using the native Array push
- // is a super-fast way to populate an object with array-like properties
- this.length = 0;
- Array.prototype.push.apply( this, elems );
-
- return this;
- },
-
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
+
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem && elem.jquery ? elem[0] : elem
- , this );
- },
+ // If the DOM is already ready
+ if ( jQuery.isReady ) {
+ // Execute the function immediately
+ fn.call( document, jQuery );
- attr: function( name, value, type ) {
- var options = name;
+ // Otherwise, remember the function for later
+ } else if ( readyList ) {
+ // Add the function to the wait list
+ readyList.push( fn );
+ }
- // Look for the case where we're accessing a style value
- if ( typeof name === "string" )
- if ( value === undefined )
- return this[0] && jQuery[ type || "attr" ]( this[0], name );
+ return this;
+ },
+
+ eq: function( i ) {
+ return i === -1 ?
+ this.slice( i ) :
+ this.slice( i, +i + 1 );
+ },
- else {
- options = {};
- options[ name ] = value;
- }
+ first: function() {
+ return this.eq( 0 );
+ },
- // Check to see if we're setting style values
- return this.each(function(i){
- // Set all the styles
- for ( name in options )
- jQuery.attr(
- type ?
- this.style :
- this,
- name, jQuery.prop( this, options[ name ], type, i, name )
- );
- });
+ last: function() {
+ return this.eq( -1 );
},
- css: function( key, value ) {
- // ignore negative width and height values
- if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
- value = undefined;
- return this.attr( key, value, "curCSS" );
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ),
+ "slice", slice.call(arguments).join(",") );
},
- text: function( text ) {
- if ( typeof text !== "object" && text != null )
- return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || jQuery(null);
+ },
- var ret = "";
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
- jQuery.each( text || this, function(){
- jQuery.each( this.childNodes, function(){
- if ( this.nodeType != 8 )
- ret += this.nodeType != 1 ?
- this.nodeValue :
- jQuery.fn.text( [ this ] );
- });
- });
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
- return ret;
- },
+jQuery.extend = jQuery.fn.extend = function() {
+ // copy reference to target object
+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy;
- wrapAll: function( html ) {
- if ( this[0] ) {
- // The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).clone();
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
- if ( this[0].parentNode )
- wrap.insertBefore( this[0] );
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
- wrap.map(function(){
- var elem = this;
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
- while ( elem.firstChild )
- elem = elem.firstChild;
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
- return elem;
- }).append(this);
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging object literal values or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) {
+ var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src
+ : jQuery.isArray(copy) ? [] : {};
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
}
+ }
- return this;
- },
+ // Return the modified object
+ return target;
+};
- wrapInner: function( html ) {
- return this.each(function(){
- jQuery( this ).contents().wrapAll( html );
- });
+jQuery.extend({
+ noConflict: function( deep ) {
+ window.$ = _$;
+
+ if ( deep ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
},
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // Handle when the DOM is ready
+ ready: function() {
+ // Make sure that the DOM is not already loaded
+ if ( !jQuery.isReady ) {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready, 13 );
+ }
- wrap: function( html ) {
- return this.each(function(){
- jQuery( this ).wrapAll( html );
- });
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If there are functions bound, to execute
+ if ( readyList ) {
+ // Execute all of them
+ var fn, i = 0;
+ while ( (fn = readyList[ i++ ]) ) {
+ fn.call( document, jQuery );
+ }
+
+ // Reset the list of functions
+ readyList = null;
+ }
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.triggerHandler ) {
+ jQuery( document ).triggerHandler( "ready" );
+ }
+ }
},
+
+ bindReady: function() {
+ if ( readyBound ) {
+ return;
+ }
- append: function() {
- return this.domManip(arguments, true, function(elem){
- if (this.nodeType == 1)
- this.appendChild( elem );
- });
+ readyBound = true;
+
+ // Catch cases where $(document).ready() is called after the
+ // browser event has already occurred.
+ if ( document.readyState === "complete" ) {
+ return jQuery.ready();
+ }
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent("onreadystatechange", DOMContentLoaded);
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var toplevel = false;
+
+ try {
+ toplevel = window.frameElement == null;
+ } catch(e) {}
+
+ if ( document.documentElement.doScroll && toplevel ) {
+ doScrollCheck();
+ }
+ }
},
- prepend: function() {
- return this.domManip(arguments, true, function(elem){
- if (this.nodeType == 1)
- this.insertBefore( elem, this.firstChild );
- });
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return toString.call(obj) === "[object Function]";
},
- before: function() {
- return this.domManip(arguments, false, function(elem){
-//try{
- this.parentNode.insertBefore( elem, this );
-//}catch(e) {
-//}
- });
+ isArray: function( obj ) {
+ return toString.call(obj) === "[object Array]";
},
- after: function() {
- return this.domManip(arguments, false, function(elem){
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) {
+ return false;
+ }
+
+ // Not own constructor property must be Object
+ if ( obj.constructor
+ && !hasOwnProperty.call(obj, "constructor")
+ && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || hasOwnProperty.call( obj, key );
},
- end: function() {
- return this.prevObject || jQuery( [] );
+ isEmptyObject: function( obj ) {
+ for ( var name in obj ) {
+ return false;
+ }
+ return true;
},
+
+ error: function( msg ) {
+ throw msg;
+ },
+
+ parseJSON: function( data ) {
+ if ( typeof data !== "string" || !data ) {
+ return null;
+ }
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: [].push,
- sort: [].sort,
- splice: [].splice,
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
+ .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
+ .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
+
+ // Try to use the native JSON parser first
+ return window.JSON && window.JSON.parse ?
+ window.JSON.parse( data ) :
+ (new Function("return " + data))();
- find: function( selector ) {
- if ( this.length === 1 ) {
- var ret = this.pushStack( [], "find", selector );
- ret.length = 0;
- jQuery.find( selector, this[0], ret );
- return ret;
} else {
- return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
- return jQuery.find( selector, elem );
- })), "find", selector );
+ jQuery.error( "Invalid JSON: " + data );
}
},
- clone: function( events ) {
- // Do the clone
- var ret = this.map(function(){
- if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
- // IE copies events bound via attachEvent when
- // using cloneNode. Calling detachEvent on the
- // clone will also remove the events from the orignal
- // In order to get around this, we use innerHTML.
- // Unfortunately, this means some modifications to
- // attributes in IE that are actually only stored
- // as properties will not be copied (such as the
- // the name attribute on an input).
- var html = this.outerHTML;
- if ( !html ) {
- var div = this.ownerDocument.createElement("div");
- div.appendChild( this.cloneNode(true) );
- html = div.innerHTML;
- }
+ noop: function() {},
- return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
- } else
- return this.cloneNode(true);
- });
+ // Evalulates a script in a global context
+ globalEval: function( data ) {
+ if ( data && rnotwhite.test(data) ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
- // Copy the events from the original to the clone
- if ( events === true ) {
- var orig = this.find("*").andSelf(), i = 0;
+ script.type = "text/javascript";
- ret.find("*").andSelf().each(function(){
- if ( this.nodeName !== orig[i].nodeName )
- return;
+ if ( jQuery.support.scriptEval ) {
+ script.appendChild( document.createTextNode( data ) );
+ } else {
+ script.text = data;
+ }
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709).
+ head.insertBefore( script, head.firstChild );
+ head.removeChild( script );
+ }
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
+ },
- var events = jQuery.data( orig[i], "events" );
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0,
+ length = object.length,
+ isObj = length === undefined || jQuery.isFunction(object);
- for ( var type in events ) {
- for ( var handler in events[ type ] ) {
- jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
+ if ( args ) {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.apply( object[ name ], args ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.apply( object[ i++ ], args ) === false ) {
+ break;
}
}
+ }
- i++;
- });
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( var value = object[0];
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
+ }
}
- // Return the cloned set
- return ret;
+ return object;
},
- filter: function( selector ) {
- return this.pushStack(
- jQuery.isFunction( selector ) &&
- jQuery.grep(this, function(elem, i){
- return selector.call( elem, i );
- }) ||
-
- jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
- return elem.nodeType === 1;
- }) ), "filter", selector );
- },
-
- closest: function( selector ) {
- var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
- closer = 0;
-
- return this.map(function(){
- var cur = this;
- while ( cur && cur.ownerDocument ) {
- if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
- jQuery.data(cur, "closest", closer);
- return cur;
- }
- cur = cur.parentNode;
- closer++;
- }
- });
+ trim: function( text ) {
+ return (text || "").replace( rtrim, "" );
},
- not: function( selector ) {
- if ( typeof selector === "string" )
- // test special case where just one selector is passed in
- if ( isSimple.test( selector ) )
- return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
- else
- selector = jQuery.multiFilter( selector, this );
-
- var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
- return this.filter(function() {
- return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
- });
- },
+ // results is for internal usage only
+ makeArray: function( array, results ) {
+ var ret = results || [];
- add: function( selector ) {
- return this.pushStack( jQuery.unique( jQuery.merge(
- this.get(),
- typeof selector === "string" ?
- jQuery( selector ) :
- jQuery.makeArray( selector )
- )));
- },
+ if ( array != null ) {
+ // The window, strings (and functions) also have 'length'
+ // The extra typeof function check is to prevent crashes
+ // in Safari 2 (See: #3039)
+ if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) {
+ push.call( ret, array );
+ } else {
+ jQuery.merge( ret, array );
+ }
+ }
- is: function( selector ) {
- return !!selector && jQuery.multiFilter( selector, this ).length > 0;
+ return ret;
},
- hasClass: function( selector ) {
- return !!selector && this.is( "." + selector );
- },
+ inArray: function( elem, array ) {
+ if ( array.indexOf ) {
+ return array.indexOf( elem );
+ }
- val: function( value ) {
- if ( value === undefined ) {
- var elem = this[0];
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ if ( array[ i ] === elem ) {
+ return i;
+ }
+ }
- if ( elem ) {
- if( jQuery.nodeName( elem, 'option' ) )
- return (elem.attributes.value || {}).specified ? elem.value : elem.text;
+ return -1;
+ },
- // We need to handle select boxes special
- if ( jQuery.nodeName( elem, "select" ) ) {
- var index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type == "select-one";
+ merge: function( first, second ) {
+ var i = first.length, j = 0;
- // Nothing was selected
- if ( index < 0 )
- return null;
+ if ( typeof second.length === "number" ) {
+ for ( var l = second.length; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
- // Loop through all the selected options
- for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
- var option = options[ i ];
+ first.length = i;
- if ( option.selected ) {
- // Get the specifc value for the option
- value = jQuery(option).val();
+ return first;
+ },
- // We don't need an array for one selects
- if ( one )
- return value;
+ grep: function( elems, callback, inv ) {
+ var ret = [];
- // Multi-Selects return an array
- values.push( value );
- }
- }
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ if ( !inv !== !callback( elems[ i ], i ) ) {
+ ret.push( elems[ i ] );
+ }
+ }
- return values;
- }
+ return ret;
+ },
- // Everything else, we just grab the value
- return (elem.value || "").replace(/\r/g, "");
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var ret = [], value;
- }
+ // Go through the array, translating each of the items to their
+ // new value (or values).
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
- return undefined;
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
}
- if ( typeof value === "number" )
- value += '';
+ return ret.concat.apply( [], ret );
+ },
- return this.each(function(){
- if ( this.nodeType != 1 )
- return;
+ // A global GUID counter for objects
+ guid: 1,
- if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
- this.checked = (jQuery.inArray(this.value, value) >= 0 ||
- jQuery.inArray(this.name, value) >= 0);
+ proxy: function( fn, proxy, thisObject ) {
+ if ( arguments.length === 2 ) {
+ if ( typeof proxy === "string" ) {
+ thisObject = fn;
+ fn = thisObject[ proxy ];
+ proxy = undefined;
- else if ( jQuery.nodeName( this, "select" ) ) {
- var values = jQuery.makeArray(value);
+ } else if ( proxy && !jQuery.isFunction( proxy ) ) {
+ thisObject = proxy;
+ proxy = undefined;
+ }
+ }
- jQuery( "option", this ).each(function(){
- this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
- jQuery.inArray( this.text, values ) >= 0);
- });
+ if ( !proxy && fn ) {
+ proxy = function() {
+ return fn.apply( thisObject || this, arguments );
+ };
+ }
- if ( !values.length )
- this.selectedIndex = -1;
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ if ( fn ) {
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
+ }
- } else
- this.value = value;
- });
+ // So proxy can be declared as an argument
+ return proxy;
},
- html: function( value ) {
- return value === undefined ?
- (this[0] ?
- this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
- null) :
- this.empty().append( value );
- },
+ // Use of jQuery.browser is frowned upon.
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
+ uaMatch: function( ua ) {
+ ua = ua.toLowerCase();
- replaceWith: function( value ) {
- return this.after( value ).remove();
- },
+ var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
+ /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
+ /(msie) ([\w.]+)/.exec( ua ) ||
+ !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
+ [];
- eq: function( i ) {
- return this.slice( i, +i + 1 );
+ return { browser: match[1] || "", version: match[2] || "0" };
},
- slice: function() {
- return this.pushStack( Array.prototype.slice.apply( this, arguments ),
- "slice", Array.prototype.slice.call(arguments).join(",") );
- },
+ browser: {}
+});
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function(elem, i){
- return callback.call( elem, i, elem );
- }));
- },
+browserMatch = jQuery.uaMatch( userAgent );
+if ( browserMatch.browser ) {
+ jQuery.browser[ browserMatch.browser ] = true;
+ jQuery.browser.version = browserMatch.version;
+}
- andSelf: function() {
- return this.add( this.prevObject );
- },
+// Deprecated, use jQuery.browser.webkit instead
+if ( jQuery.browser.webkit ) {
+ jQuery.browser.safari = true;
+}
- domManip: function( args, table, callback ) {
- if ( this[0] ) {
- var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
- scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
- first = fragment.firstChild;
+if ( indexOf ) {
+ jQuery.inArray = function( elem, array ) {
+ return indexOf.call( array, elem );
+ };
+}
- if ( first )
- for ( var i = 0, l = this.length; i < l; i++ )
- callback.call( root(this[i], first), this.length > 1 || i > 0 ?
- fragment.cloneNode(true) : fragment );
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
- if ( scripts )
- jQuery.each( scripts, evalScript );
+// Cleanup functions for the document ready method
+if ( document.addEventListener ) {
+ DOMContentLoaded = function() {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ };
+
+} else if ( document.attachEvent ) {
+ DOMContentLoaded = function() {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
}
+ };
+}
- return this;
+// The DOM ready check for Internet Explorer
+function doScrollCheck() {
+ if ( jQuery.isReady ) {
+ return;
+ }
- function root( elem, cur ) {
- return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
- (elem.getElementsByTagName("tbody")[0] ||
- elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
- elem;
- }
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch( error ) {
+ setTimeout( doScrollCheck, 1 );
+ return;
}
-};
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
+ // and execute any waiting functions
+ jQuery.ready();
+}
function evalScript( i, elem ) {
- if ( elem.src )
+ if ( elem.src ) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
-
- else
+ } else {
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+ }
- if ( elem.parentNode )
+ if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
+ }
}
-function now(){
- return +new Date;
+// Mutifunctional method to get and set values to a collection
+// The value/s can be optionally by executed if its a function
+function access( elems, key, value, exec, fn, pass ) {
+ var length = elems.length;
+
+ // Setting many attributes
+ if ( typeof key === "object" ) {
+ for ( var k in key ) {
+ access( elems, k, key[k], exec, fn, value );
+ }
+ return elems;
+ }
+
+ // Setting one attribute
+ if ( value !== undefined ) {
+ // Optionally, function values get executed if exec is true
+ exec = !pass && exec && jQuery.isFunction(value);
+
+ for ( var i = 0; i < length; i++ ) {
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+ }
+
+ return elems;
+ }
+
+ // Getting an attribute
+ return length ? fn( elems[0], key ) : undefined;
}
-jQuery.extend = jQuery.fn.extend = function() {
- // copy reference to target object
- var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+function now() {
+ return (new Date).getTime();
+}
+(function() {
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
+ jQuery.support = {};
+
+ var root = document.documentElement,
+ script = document.createElement("script"),
+ div = document.createElement("div"),
+ id = "script" + now();
+
+ div.style.display = "none";
+ div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+
+ var all = div.getElementsByTagName("*"),
+ a = div.getElementsByTagName("a")[0];
+
+ // Can't get basic test support
+ if ( !all || !all.length || !a ) {
+ return;
}
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) )
- target = {};
+ jQuery.support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType === 3,
- // extend jQuery itself if only one argument is passed
- if ( length == i ) {
- target = this;
- --i;
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText insted)
+ style: /red/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.55$/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Make sure that if no value is specified for a checkbox
+ // that it defaults to "on".
+ // (WebKit defaults to "" instead)
+ checkOn: div.getElementsByTagName("input")[0].value === "on",
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
+
+ parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
+
+ // Will be defined later
+ deleteExpando: true,
+ checkClone: false,
+ scriptEval: false,
+ noCloneEvent: true,
+ boxModel: null
+ };
+
+ script.type = "text/javascript";
+ try {
+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
+ } catch(e) {}
+
+ root.insertBefore( script, root.firstChild );
+
+ // Make sure that the execution of code works by injecting a script
+ // tag with appendChild/createTextNode
+ // (IE doesn't support this, fails, and uses .text instead)
+ if ( window[ id ] ) {
+ jQuery.support.scriptEval = true;
+ delete window[ id ];
}
- for ( ; i < length; i++ )
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null )
- // Extend the base object
- for ( var name in options ) {
- var src = target[ name ], copy = options[ name ];
+ // Test to see if it's possible to delete an expando from an element
+ // Fails in Internet Explorer
+ try {
+ delete script.test;
+
+ } catch(e) {
+ jQuery.support.deleteExpando = false;
+ }
- // Prevent never-ending loop
- if ( target === copy )
- continue;
+ root.removeChild( script );
- // Recurse if we're merging object values
- if ( deep && copy && typeof copy === "object" && !copy.nodeType )
- target[ name ] = jQuery.extend( deep,
- // Never move original objects, clone them
- src || ( copy.length != null ? [ ] : { } )
- , copy );
+ if ( div.attachEvent && div.fireEvent ) {
+ div.attachEvent("onclick", function click() {
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ jQuery.support.noCloneEvent = false;
+ div.detachEvent("onclick", click);
+ });
+ div.cloneNode(true).fireEvent("onclick");
+ }
- // Don't bring in undefined values
- else if ( copy !== undefined )
- target[ name ] = copy;
+ div = document.createElement("div");
+ div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
- }
+ var fragment = document.createDocumentFragment();
+ fragment.appendChild( div.firstChild );
- // Return the modified object
- return target;
-};
+ // WebKit doesn't clone checked state correctly in fragments
+ jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
-// exclude the following css properties to add px
-var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
- // cache defaultView
- defaultView = document.defaultView || {},
- toString = Object.prototype.toString;
+ // Figure out if the W3C box model works as expected
+ // document.body must exist before we can do this
+ jQuery(function() {
+ var div = document.createElement("div");
+ div.style.width = div.style.paddingLeft = "1px";
-jQuery.extend({
- noConflict: function( deep ) {
- window.$ = _$;
+ document.body.appendChild( div );
+ jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
+ document.body.removeChild( div ).style.display = 'none';
- if ( deep )
- window.jQuery = _jQuery;
+ div = null;
+ });
- return jQuery;
- },
+ // Technique from Juriy Zaytsev
+ // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
+ var eventSupported = function( eventName ) {
+ var el = document.createElement("div");
+ eventName = "on" + eventName;
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return toString.call(obj) === "[object Function]";
- },
+ var isSupported = (eventName in el);
+ if ( !isSupported ) {
+ el.setAttribute(eventName, "return;");
+ isSupported = typeof el[eventName] === "function";
+ }
+ el = null;
- isArray: function( obj ) {
- return toString.call(obj) === "[object Array]";
- },
+ return isSupported;
+ };
+
+ jQuery.support.submitBubbles = eventSupported("submit");
+ jQuery.support.changeBubbles = eventSupported("change");
+
+ // release memory in IE
+ root = script = div = all = a = null;
+})();
- // check if an element is in a (or is an) XML document
- isXMLDoc: function( elem ) {
- return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
- !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
+jQuery.props = {
+ "for": "htmlFor",
+ "class": "className",
+ readonly: "readOnly",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ tabindex: "tabIndex",
+ usemap: "useMap",
+ frameborder: "frameBorder"
+};
+var expando = "jQuery" + now(), uuid = 0, windowData = {};
+
+jQuery.extend({
+ cache: {},
+
+ expando:expando,
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ "object": true,
+ "applet": true
},
- // Evalulates a script in a global context
- globalEval: function( data ) {
- if ( data && /\S/.test(data) ) {
- // Inspired by code by Andrea Giammarchi
- // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
- var head = document.getElementsByTagName("head")[0] || document.documentElement,
- script = document.createElement("script");
+ data: function( elem, name, data ) {
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ return;
+ }
- script.type = "text/javascript";
- if ( jQuery.support.scriptEval )
- script.appendChild( document.createTextNode( data ) );
- else
- script.text = data;
+ elem = elem == window ?
+ windowData :
+ elem;
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709).
- head.insertBefore( script, head.firstChild );
- head.removeChild( script );
+ var id = elem[ expando ], cache = jQuery.cache, thisCache;
+
+ if ( !id && typeof name === "string" && data === undefined ) {
+ return null;
}
- },
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
- },
+ // Compute a unique ID for the element
+ if ( !id ) {
+ id = ++uuid;
+ }
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0, length = object.length;
+ // Avoid generating a new cache unless none exists and we
+ // want to manipulate it.
+ if ( typeof name === "object" ) {
+ elem[ expando ] = id;
+ thisCache = cache[ id ] = jQuery.extend(true, {}, name);
- if ( args ) {
- if ( length === undefined ) {
- for ( name in object )
- if ( callback.apply( object[ name ], args ) === false )
- break;
- } else
- for ( ; i < length; )
- if ( callback.apply( object[ i++ ], args ) === false )
- break;
+ } else if ( !cache[ id ] ) {
+ elem[ expando ] = id;
+ cache[ id ] = {};
+ }
- // A special, fast, case for the most common use of each
- } else {
- if ( length === undefined ) {
- for ( name in object )
- if ( callback.call( object[ name ], name, object[ name ] ) === false )
- break;
- } else
- for ( var value = object[0];
- i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
+ thisCache = cache[ id ];
+
+ // Prevent overriding the named cache with undefined values
+ if ( data !== undefined ) {
+ thisCache[ name ] = data;
}
- return object;
+ return typeof name === "string" ? thisCache[ name ] : thisCache;
},
- prop: function( elem, value, type, i, name ) {
- // Handle executable functions
- if ( jQuery.isFunction( value ) )
- value = value.call( elem, i );
+ removeData: function( elem, name ) {
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ return;
+ }
- // Handle passing in a number to a CSS property
- return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
- value + "px" :
- value;
- },
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ];
+
+ // If we want to remove a specific section of the element's data
+ if ( name ) {
+ if ( thisCache ) {
+ // Remove the section of cache data
+ delete thisCache[ name ];
+
+ // If we've removed all the data, remove the element's cache
+ if ( jQuery.isEmptyObject(thisCache) ) {
+ jQuery.removeData( elem );
+ }
+ }
+
+ // Otherwise, we want to remove all of the element's data
+ } else {
+ if ( jQuery.support.deleteExpando ) {
+ delete elem[ jQuery.expando ];
- className: {
- // internal only, use addClass("class")
- add: function( elem, classNames ) {
- jQuery.each((classNames || "").split(/\s+/), function(i, className){
- if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
- elem.className += (elem.className ? " " : "") + className;
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( jQuery.expando );
+ }
+
+ // Completely remove the data cache
+ delete cache[ id ];
+ }
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ if ( typeof key === "undefined" && this.length ) {
+ return jQuery.data( this[0] );
+
+ } else if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
});
- },
+ }
- // internal only, use removeClass("class")
- remove: function( elem, classNames ) {
- if (elem.nodeType == 1)
- elem.className = classNames !== undefined ?
- jQuery.grep(elem.className.split(/\s+/), function(className){
- return !jQuery.className.has( classNames, className );
- }).join(" ") :
- "";
- },
+ var parts = key.split(".");
+ parts[1] = parts[1] ? "." + parts[1] : "";
- // internal only, use hasClass("class")
- has: function( elem, className ) {
- return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+ if ( value === undefined ) {
+ var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+ if ( data === undefined && this.length ) {
+ data = jQuery.data( this[0], key );
+ }
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ } else {
+ return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
+ jQuery.data( this, key, value );
+ });
}
},
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var old = {};
- // Remember the old values, and insert the new ones
- for ( var name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ if ( !elem ) {
+ return;
}
- callback.call( elem );
+ type = (type || "fx") + "queue";
+ var q = jQuery.data( elem, type );
- // Revert the old values
- for ( var name in options )
- elem.style[ name ] = old[ name ];
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( !data ) {
+ return q || [];
+ }
+
+ if ( !q || jQuery.isArray(data) ) {
+ q = jQuery.data( elem, type, jQuery.makeArray(data) );
+
+ } else {
+ q.push( data );
+ }
+
+ return q;
},
- css: function( elem, name, force, extra ) {
- if ( name == "width" || name == "height" ) {
- var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
+ dequeue: function( elem, type ) {
+ type = type || "fx";
- function getWH() {
- val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
+ var queue = jQuery.queue( elem, type ), fn = queue.shift();
- if ( extra === "border" )
- return;
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ }
- jQuery.each( which, function() {
- if ( !extra )
- val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
- if ( extra === "margin" )
- val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
- else
- val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
- });
+ if ( fn ) {
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift("inprogress");
}
- if ( elem.offsetWidth !== 0 )
- getWH();
- else
- jQuery.swap( elem, props, getWH );
+ fn.call(elem, function() {
+ jQuery.dequeue(elem, type);
+ });
+ }
+ }
+});
- return Math.max(0, Math.round(val));
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
}
- return jQuery.curCSS( elem, name, force );
- },
+ if ( data === undefined ) {
+ return jQuery.queue( this[0], type );
+ }
+ return this.each(function( i, elem ) {
+ var queue = jQuery.queue( this, type, data );
- curCSS: function( elem, name, force ) {
- var ret, style = elem.style;
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
- // We need to handle opacity special in IE
- if ( name == "opacity" && !jQuery.support.opacity ) {
- ret = jQuery.attr( style, "opacity" );
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function() {
+ var elem = this;
+ setTimeout(function() {
+ jQuery.dequeue( elem, type );
+ }, time );
+ });
+ },
- return ret == "" ?
- "1" :
- ret;
- }
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ }
+});
+var rclass = /[\n\t]/g,
+ rspace = /\s+/,
+ rreturn = /\r/g,
+ rspecialurl = /href|src|style/,
+ rtype = /(button|input)/i,
+ rfocusable = /(button|input|object|select|textarea)/i,
+ rclickable = /^(a|area)$/i,
+ rradiocheck = /radio|checkbox/;
- // Make sure we're using the right name for getting the float value
- if ( name.match( /float/i ) )
- name = styleFloat;
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return access( this, name, value, true, jQuery.attr );
+ },
- if ( !force && style && style[ name ] )
- ret = style[ name ];
+ removeAttr: function( name, fn ) {
+ return this.each(function(){
+ jQuery.attr( this, name, "" );
+ if ( this.nodeType === 1 ) {
+ this.removeAttribute( name );
+ }
+ });
+ },
- else if ( defaultView.getComputedStyle ) {
+ addClass: function( value ) {
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.addClass( value.call(this, i, self.attr("class")) );
+ });
+ }
- // Only "float" is needed here
- if ( name.match( /float/i ) )
- name = "float";
+ if ( value && typeof value === "string" ) {
+ var classNames = (value || "").split( rspace );
- name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ var elem = this[i];
- var computedStyle = defaultView.getComputedStyle( elem, null );
+ if ( elem.nodeType === 1 ) {
+ if ( !elem.className ) {
+ elem.className = value;
- if ( computedStyle )
- ret = computedStyle.getPropertyValue( name );
+ } else {
+ var className = " " + elem.className + " ", setClass = elem.className;
+ for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
+ if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
+ setClass += " " + classNames[c];
+ }
+ }
+ elem.className = jQuery.trim( setClass );
+ }
+ }
+ }
+ }
- // We should always get a number back from opacity
- if ( name == "opacity" && ret == "" )
- ret = "1";
+ return this;
+ },
- } else if ( elem.currentStyle ) {
- var camelCase = name.replace(/\-(\w)/g, function(all, letter){
- return letter.toUpperCase();
+ removeClass: function( value ) {
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.removeClass( value.call(this, i, self.attr("class")) );
});
+ }
- ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+ if ( (value && typeof value === "string") || value === undefined ) {
+ var classNames = (value || "").split(rspace);
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
- // Remember the original values
- var left = style.left, rsLeft = elem.runtimeStyle.left;
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ var elem = this[i];
- // Put in the new values to get a computed value out
- elem.runtimeStyle.left = elem.currentStyle.left;
- style.left = ret || 0;
- ret = style.pixelLeft + "px";
+ if ( elem.nodeType === 1 && elem.className ) {
+ if ( value ) {
+ var className = (" " + elem.className + " ").replace(rclass, " ");
+ for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
+ className = className.replace(" " + classNames[c] + " ", " ");
+ }
+ elem.className = jQuery.trim( className );
- // Revert the changed values
- style.left = left;
- elem.runtimeStyle.left = rsLeft;
+ } else {
+ elem.className = "";
+ }
+ }
}
}
- return ret;
+ return this;
},
- clean: function( elems, context, fragment ) {
- context = context || document;
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value, isBool = typeof stateVal === "boolean";
- // !context.createElement fails in IE with an error but returns typeof 'object'
- if ( typeof context.createElement === "undefined" )
- context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
-
- // If a single string is passed in and it's a single tag
- // just do a createElement and skip the rest
- if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
- var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
- if ( match )
- return [ context.createElement( match[1] ) ];
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
+ });
}
- var ret = [], scripts = [], div = context.createElement("div");
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className, i = 0, self = jQuery(this),
+ state = stateVal,
+ classNames = value.split( rspace );
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space seperated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
- jQuery.each(elems, function(i, elem){
- if ( typeof elem === "number" )
- elem += '';
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery.data( this, "__className__", this.className );
+ }
- if ( !elem )
- return;
+ // toggle whole className
+ this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
+ }
+ });
+ },
- // Convert html string into DOM nodes
- if ( typeof elem === "string" ) {
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
- return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
- all :
- front + "></" + tag + ">";
- });
+ hasClass: function( selector ) {
+ var className = " " + selector + " ";
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+ return true;
+ }
+ }
- // Trim whitespace, otherwise indexOf won't work as expected
- var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
+ return false;
+ },
- var wrap =
- // option or optgroup
- !tags.indexOf("<opt") &&
- [ 1, "<select multiple='multiple'>", "</select>" ] ||
+ val: function( value ) {
+ if ( value === undefined ) {
+ var elem = this[0];
- !tags.indexOf("<leg") &&
- [ 1, "<fieldset>", "</fieldset>" ] ||
+ if ( elem ) {
+ if ( jQuery.nodeName( elem, "option" ) ) {
+ return (elem.attributes.value || {}).specified ? elem.value : elem.text;
+ }
- tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
- [ 1, "<table>", "</table>" ] ||
+ // We need to handle select boxes special
+ if ( jQuery.nodeName( elem, "select" ) ) {
+ var index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type === "select-one";
- !tags.indexOf("<tr") &&
- [ 2, "<table><tbody>", "</tbody></table>" ] ||
+ // Nothing was selected
+ if ( index < 0 ) {
+ return null;
+ }
- // <thead> matched above
- (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
- [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
+ // Loop through all the selected options
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+ var option = options[ i ];
- !tags.indexOf("<col") &&
- [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
+ if ( option.selected ) {
+ // Get the specifc value for the option
+ value = jQuery(option).val();
- // IE can't serialize <link> and <script> tags normally
- !jQuery.support.htmlSerialize &&
- [ 1, "div<div>", "</div>" ] ||
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
- [ 0, "", "" ];
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
- // Go to html and back, then peel off extra wrappers
- div.innerHTML = wrap[1] + elem + wrap[2];
+ return values;
+ }
- // Move to the right depth
- while ( wrap[0]-- )
- div = div.lastChild;
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+
- // Remove IE's autoinserted <tbody> from table fragments
- if ( !jQuery.support.tbody ) {
+ // Everything else, we just grab the value
+ return (elem.value || "").replace(rreturn, "");
- // String was a <table>, *may* have spurious <tbody>
- var hasBody = /<tbody/i.test(elem),
- tbody = !tags.indexOf("<table") && !hasBody ?
- div.firstChild && div.firstChild.childNodes :
+ }
- // String was a bare <thead> or <tfoot>
- wrap[1] == "<table>" && !hasBody ?
- div.childNodes :
- [];
+ return undefined;
+ }
- for ( var j = tbody.length - 1; j >= 0 ; --j )
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
+ var isFunction = jQuery.isFunction(value);
- }
+ return this.each(function(i) {
+ var self = jQuery(this), val = value;
- // IE completely kills leading whitespace when innerHTML is used
- if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
- div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
- elem = jQuery.makeArray( div.childNodes );
+ if ( isFunction ) {
+ val = value.call(this, i, self.val());
}
- if ( elem.nodeType )
- ret.push( elem );
- else
- ret = jQuery.merge( ret, elem );
+ // Typecast each time if the value is a Function and the appended
+ // value is therefore different each time.
+ if ( typeof val === "number" ) {
+ val += "";
+ }
- });
+ if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
+ this.checked = jQuery.inArray( self.val(), val ) >= 0;
- if ( fragment ) {
- for ( var i = 0; ret[i]; i++ ) {
- if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
- scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
- } else {
- if ( ret[i].nodeType === 1 )
- ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
- fragment.appendChild( ret[i] );
+ } else if ( jQuery.nodeName( this, "select" ) ) {
+ var values = jQuery.makeArray(val);
+
+ jQuery( "option", this ).each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ this.selectedIndex = -1;
}
- }
- return scripts;
- }
+ } else {
+ this.value = val;
+ }
+ });
+ }
+});
- return ret;
+jQuery.extend({
+ attrFn: {
+ val: true,
+ css: true,
+ html: true,
+ text: true,
+ data: true,
+ width: true,
+ height: true,
+ offset: true
},
-
- attr: function( elem, name, value ) {
+
+ attr: function( elem, name, value, pass ) {
// don't set attributes on text and comment nodes
- if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
return undefined;
+ }
+
+ if ( pass && name in jQuery.attrFn ) {
+ return jQuery(elem)[name](value);
+ }
- var notxml = !jQuery.isXMLDoc( elem ),
+ var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
// Whether we are setting (or getting)
set = value !== undefined;
@@ -980,472 +1464,1209 @@ jQuery.extend({
name = notxml && jQuery.props[ name ] || name;
// Only do all the following if this is a node (faster for style)
- // IE elem.getAttribute passes even for style
- if ( elem.tagName ) {
-
+ if ( elem.nodeType === 1 ) {
// These attributes require special treatment
- var special = /href|src|style/.test( name );
+ var special = rspecialurl.test( name );
- // Safari mis-reports the default selected property of a hidden option
+ // Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
- if ( name == "selected" && elem.parentNode )
- elem.parentNode.selectedIndex;
+ if ( name === "selected" && !jQuery.support.optSelected ) {
+ var parent = elem.parentNode;
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ }
// If applicable, access the attribute via the DOM 0 way
if ( name in elem && notxml && !special ) {
- if ( set ){
+ if ( set ) {
// We can't allow the type property to be changed (since it causes problems in IE)
- if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
- throw "type property can't be changed";
+ if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
+ jQuery.error( "type property can't be changed" );
+ }
elem[ name ] = value;
}
// browsers index elements by id/name on forms, give priority to attributes.
- if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
+ if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
return elem.getAttributeNode( name ).nodeValue;
+ }
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- if ( name == "tabIndex" ) {
+ if ( name === "tabIndex" ) {
var attributeNode = elem.getAttributeNode( "tabIndex" );
- return attributeNode && attributeNode.specified
- ? attributeNode.value
- : elem.nodeName.match(/(button|input|object|select|textarea)/i)
- ? 0
- : elem.nodeName.match(/^(a|area)$/i) && elem.href
- ? 0
- : undefined;
+
+ return attributeNode && attributeNode.specified ?
+ attributeNode.value :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
}
return elem[ name ];
}
- if ( !jQuery.support.style && notxml && name == "style" )
- return jQuery.attr( elem.style, "cssText", value );
+ if ( !jQuery.support.style && notxml && name === "style" ) {
+ if ( set ) {
+ elem.style.cssText = "" + value;
+ }
+
+ return elem.style.cssText;
+ }
- if ( set )
+ if ( set ) {
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
+ }
- var attr = !jQuery.support.hrefNormalized && notxml && special
+ var attr = !jQuery.support.hrefNormalized && notxml && special ?
// Some attributes require a special call on IE
- ? elem.getAttribute( name, 2 )
- : elem.getAttribute( name );
+ elem.getAttribute( name, 2 ) :
+ elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return attr === null ? undefined : attr;
}
// elem is actually elem.style ... set the style
+ // Using attr for specific style information is now deprecated. Use style instead.
+ return jQuery.style( elem, name, value );
+ }
+});
+var rnamespaces = /\.(.*)$/,
+ fcleanup = function( nm ) {
+ return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
+ return "\\" + ch;
+ });
+ };
- // IE uses filters for opacity
- if ( !jQuery.support.opacity && name == "opacity" ) {
- if ( set ) {
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- elem.zoom = 1;
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code originated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
- // Set the alpha filter to set the opacity
- elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
- (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
- }
+ // Bind an event to an element
+ // Original by Dean Edwards
+ add: function( elem, types, handler, data ) {
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
- return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
- (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
- "";
+ // For whatever reason, IE has trouble passing the window object
+ // around, causing it to be cloned in the process
+ if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
+ elem = window;
}
- name = name.replace(/-([a-z])/ig, function(all, letter){
- return letter.toUpperCase();
- });
+ var handleObjIn, handleObj;
- if ( set )
- elem[ name ] = value;
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ }
- return elem[ name ];
- },
+ // Make sure that the function being executed has a unique ID
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
- trim: function( text ) {
- return (text || "").replace( /^\s+|\s+$/g, "" );
- },
+ // Init the element's event structure
+ var elemData = jQuery.data( elem );
- makeArray: function( array ) {
- var ret = [];
+ // If no elemData is found then we must be trying to bind to one of the
+ // banned noData elements
+ if ( !elemData ) {
+ return;
+ }
- if( array != null ){
- var i = array.length;
- // The window, strings (and functions) also have 'length'
- if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
- ret[0] = array;
- else
- while( i )
- ret[--i] = array[i];
+ var events = elemData.events = elemData.events || {},
+ eventHandle = elemData.handle, eventHandle;
+
+ if ( !eventHandle ) {
+ elemData.handle = eventHandle = function() {
+ // Handle the second event of a trigger and when
+ // an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
+ jQuery.event.handle.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
}
- return ret;
- },
+ // Add elem as a property of the handle function
+ // This is to prevent a memory leak with non-native events in IE.
+ eventHandle.elem = elem;
- inArray: function( elem, array ) {
- for ( var i = 0, length = array.length; i < length; i++ )
- // Use === because on IE, window == document
- if ( array[ i ] === elem )
- return i;
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = types.split(" ");
- return -1;
+ var type, i = 0, namespaces;
+
+ while ( (type = types[ i++ ]) ) {
+ handleObj = handleObjIn ?
+ jQuery.extend({}, handleObjIn) :
+ { handler: handler, data: data };
+
+ // Namespaced event handlers
+ if ( type.indexOf(".") > -1 ) {
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ handleObj.namespace = namespaces.slice(0).sort().join(".");
+
+ } else {
+ namespaces = [];
+ handleObj.namespace = "";
+ }
+
+ handleObj.type = type;
+ handleObj.guid = handler.guid;
+
+ // Get the current list of functions bound to this event
+ var handlers = events[ type ],
+ special = jQuery.event.special[ type ] || {};
+
+ // Init the event handler queue
+ if ( !handlers ) {
+ handlers = events[ type ] = [];
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add the function to the element's handler list
+ handlers.push( handleObj );
+
+ // Keep track of which events have been used, for global triggering
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
},
- merge: function( first, second ) {
- // We have to loop this way because IE & Opera overwrite the length
- // expando of getElementsByTagName
- var i = 0, elem, pos = first.length;
- // Also, we need to make sure that the correct elements are being returned
- // (IE returns comment nodes in a '*' query)
- if ( !jQuery.support.getAll ) {
- while ( (elem = second[ i++ ]) != null )
- if ( elem.nodeType != 8 )
- first[ pos++ ] = elem;
-
- } else
- while ( (elem = second[ i++ ]) != null )
- first[ pos++ ] = elem;
+ global: {},
- return first;
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, pos ) {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
+ elemData = jQuery.data( elem ),
+ events = elemData && elemData.events;
+
+ if ( !elemData || !events ) {
+ return;
+ }
+
+ // types is actually an event object here
+ if ( types && types.type ) {
+ handler = types.handler;
+ types = types.type;
+ }
+
+ // Unbind all events for the element
+ if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
+ types = types || "";
+
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types );
+ }
+
+ return;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).unbind("mouseover mouseout", fn);
+ types = types.split(" ");
+
+ while ( (type = types[ i++ ]) ) {
+ origType = type;
+ handleObj = null;
+ all = type.indexOf(".") < 0;
+ namespaces = [];
+
+ if ( !all ) {
+ // Namespaced event handlers
+ namespaces = type.split(".");
+ type = namespaces.shift();
+
+ namespace = new RegExp("(^|\\.)" +
+ jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)")
+ }
+
+ eventType = events[ type ];
+
+ if ( !eventType ) {
+ continue;
+ }
+
+ if ( !handler ) {
+ for ( var j = 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( all || namespace.test( handleObj.namespace ) ) {
+ jQuery.event.remove( elem, origType, handleObj.handler, j );
+ eventType.splice( j--, 1 );
+ }
+ }
+
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+
+ for ( var j = pos || 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( handler.guid === handleObj.guid ) {
+ // remove the given handler for the given type
+ if ( all || namespace.test( handleObj.namespace ) ) {
+ if ( pos == null ) {
+ eventType.splice( j--, 1 );
+ }
+
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+
+ if ( pos != null ) {
+ break;
+ }
+ }
+ }
+
+ // remove generic event handler if no more handlers exist
+ if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
+ removeEvent( elem, type, elemData.handle );
+ }
+
+ ret = null;
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ var handle = elemData.handle;
+ if ( handle ) {
+ handle.elem = null;
+ }
+
+ delete elemData.events;
+ delete elemData.handle;
+
+ if ( jQuery.isEmptyObject( elemData ) ) {
+ jQuery.removeData( elem );
+ }
+ }
},
- unique: function( array ) {
- var ret = [], done = {};
+ // bubbling is internal
+ trigger: function( event, data, elem /*, bubbling */ ) {
+ // Event object or event type
+ var type = event.type || event,
+ bubbling = arguments[3];
- try {
+ if ( !bubbling ) {
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[expando] ? event :
+ // Object literal
+ jQuery.extend( jQuery.Event(type), event ) :
+ // Just the event type (string)
+ jQuery.Event(type);
- for ( var i = 0, length = array.length; i < length; i++ ) {
- var id = jQuery.data( array[ i ] );
+ if ( type.indexOf("!") >= 0 ) {
+ event.type = type = type.slice(0, -1);
+ event.exclusive = true;
+ }
- if ( !done[ id ] ) {
- done[ id ] = true;
- ret.push( array[ i ] );
+ // Handle a global trigger
+ if ( !elem ) {
+ // Don't bubble custom events when global (to avoid too much overhead)
+ event.stopPropagation();
+
+ // Only trigger if we've ever bound an event for it
+ if ( jQuery.event.global[ type ] ) {
+ jQuery.each( jQuery.cache, function() {
+ if ( this.events && this.events[type] ) {
+ jQuery.event.trigger( event, data, this.handle.elem );
+ }
+ });
}
}
- } catch( e ) {
- ret = array;
+ // Handle triggering a single element
+
+ // don't do events on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return undefined;
+ }
+
+ // Clean up in case it is reused
+ event.result = undefined;
+ event.target = elem;
+
+ // Clone the incoming data, if any
+ data = jQuery.makeArray( data );
+ data.unshift( event );
+ }
+
+ event.currentTarget = elem;
+
+ // Trigger the event, it is assumed that "handle" is a function
+ var handle = jQuery.data( elem, "handle" );
+ if ( handle ) {
+ handle.apply( elem, data );
}
- return ret;
+ var parent = elem.parentNode || elem.ownerDocument;
+
+ // Trigger an inline bound script
+ try {
+ if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
+ if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
+ event.result = false;
+ }
+ }
+
+ // prevent IE from throwing an error for some elements with some event types, see #3533
+ } catch (e) {}
+
+ if ( !event.isPropagationStopped() && parent ) {
+ jQuery.event.trigger( event, data, parent, true );
+
+ } else if ( !event.isDefaultPrevented() ) {
+ var target = event.target, old,
+ isClick = jQuery.nodeName(target, "a") && type === "click",
+ special = jQuery.event.special[ type ] || {};
+
+ if ( (!special._default || special._default.call( elem, event ) === false) &&
+ !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
+
+ try {
+ if ( target[ type ] ) {
+ // Make sure that we don't accidentally re-trigger the onFOO events
+ old = target[ "on" + type ];
+
+ if ( old ) {
+ target[ "on" + type ] = null;
+ }
+
+ jQuery.event.triggered = true;
+ target[ type ]();
+ }
+
+ // prevent IE from throwing an error for some elements with some event types, see #3533
+ } catch (e) {}
+
+ if ( old ) {
+ target[ "on" + type ] = old;
+ }
+
+ jQuery.event.triggered = false;
+ }
+ }
},
- grep: function( elems, callback, inv ) {
- var ret = [];
+ handle: function( event ) {
+ var all, handlers, namespaces, namespace, events;
- // Go through the array, only saving the items
- // that pass the validator function
- for ( var i = 0, length = elems.length; i < length; i++ )
- if ( !inv != !callback( elems[ i ], i ) )
- ret.push( elems[ i ] );
+ event = arguments[0] = jQuery.event.fix( event || window.event );
+ event.currentTarget = this;
- return ret;
+ // Namespaced event handlers
+ all = event.type.indexOf(".") < 0 && !event.exclusive;
+
+ if ( !all ) {
+ namespaces = event.type.split(".");
+ event.type = namespaces.shift();
+ namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
+ }
+
+ var events = jQuery.data(this, "events"), handlers = events[ event.type ];
+
+ if ( events && handlers ) {
+ // Clone the handlers to prevent manipulation
+ handlers = handlers.slice(0);
+
+ for ( var j = 0, l = handlers.length; j < l; j++ ) {
+ var handleObj = handlers[ j ];
+
+ // Filter the functions by class
+ if ( all || namespace.test( handleObj.namespace ) ) {
+ // Pass in a reference to the handler function itself
+ // So that we can later remove it
+ event.handler = handleObj.handler;
+ event.data = handleObj.data;
+ event.handleObj = handleObj;
+
+ var ret = handleObj.handler.apply( this, arguments );
+
+ if ( ret !== undefined ) {
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+
+ if ( event.isImmediatePropagationStopped() ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return event.result;
},
- map: function( elems, callback ) {
- var ret = [];
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
- // Go through the array, translating each of the items to their
- // new value (or values).
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- var value = callback( elems[ i ], i );
+ fix: function( event ) {
+ if ( event[ expando ] ) {
+ return event;
+ }
- if ( value != null )
- ret[ ret.length ] = value;
+ // store a copy of the original event object
+ // and "clone" to set read-only properties
+ var originalEvent = event;
+ event = jQuery.Event( originalEvent );
+
+ for ( var i = this.props.length, prop; i; ) {
+ prop = this.props[ --i ];
+ event[ prop ] = originalEvent[ prop ];
}
- return ret.concat.apply( [], ret );
- }
-});
+ // Fix target property, if necessary
+ if ( !event.target ) {
+ event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+ }
-// Use of jQuery.browser is deprecated.
-// It's included for backwards compatibility and plugins,
-// although they should work to migrate away.
+ // check if target is a textnode (safari)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
-var userAgent = navigator.userAgent.toLowerCase();
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && event.fromElement ) {
+ event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
+ }
-// Figure out what browser is being used
-jQuery.browser = {
- version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
- safari: /webkit/.test( userAgent ),
- opera: /opera/.test( userAgent ),
- msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
- mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
-};
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && event.clientX != null ) {
+ var doc = document.documentElement, body = document.body;
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
+ }
-jQuery.each({
- parent: function(elem){return elem.parentNode;},
- parents: function(elem){return jQuery.dir(elem,"parentNode");},
- next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
- prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
- nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
- prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
- siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
- children: function(elem){return jQuery.sibling(elem.firstChild);},
- contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
-}, function(name, fn){
- jQuery.fn[ name ] = function( selector ) {
- var ret = jQuery.map( this, fn );
+ // Add which for key events
+ if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) {
+ event.which = event.charCode || event.keyCode;
+ }
- if ( selector && typeof selector == "string" )
- ret = jQuery.multiFilter( selector, ret );
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+ if ( !event.metaKey && event.ctrlKey ) {
+ event.metaKey = event.ctrlKey;
+ }
- return this.pushStack( jQuery.unique( ret ), name, selector );
- };
-});
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && event.button !== undefined ) {
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+ }
-jQuery.each({
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
-}, function(name, original){
- jQuery.fn[ name ] = function( selector ) {
- var ret = [], insert = jQuery( selector );
+ return event;
+ },
- for ( var i = 0, l = insert.length; i < l; i++ ) {
- var elems = (i > 0 ? this.clone(true) : this).get();
- jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
- ret = ret.concat( elems );
+ // Deprecated, use jQuery.guid instead
+ guid: 1E8,
+
+ // Deprecated, use jQuery.proxy instead
+ proxy: jQuery.proxy,
+
+ special: {
+ ready: {
+ // Make sure the ready event is setup
+ setup: jQuery.bindReady,
+ teardown: jQuery.noop
+ },
+
+ live: {
+ add: function( handleObj ) {
+ jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) );
+ },
+
+ remove: function( handleObj ) {
+ var remove = true,
+ type = handleObj.origType.replace(rnamespaces, "");
+
+ jQuery.each( jQuery.data(this, "events").live || [], function() {
+ if ( type === this.origType.replace(rnamespaces, "") ) {
+ remove = false;
+ return false;
+ }
+ });
+
+ if ( remove ) {
+ jQuery.event.remove( this, handleObj.origType, liveHandler );
+ }
+ }
+
+ },
+
+ beforeunload: {
+ setup: function( data, namespaces, eventHandle ) {
+ // We only want to do this special case on windows
+ if ( this.setInterval ) {
+ this.onbeforeunload = eventHandle;
+ }
+
+ return false;
+ },
+ teardown: function( namespaces, eventHandle ) {
+ if ( this.onbeforeunload === eventHandle ) {
+ this.onbeforeunload = null;
+ }
+ }
}
+ }
+};
- return this.pushStack( ret, name, selector );
+var removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ elem.removeEventListener( type, handle, false );
+ } :
+ function( elem, type, handle ) {
+ elem.detachEvent( "on" + type, handle );
};
-});
-jQuery.each({
- removeAttr: function( name ) {
- jQuery.attr( this, name, "" );
- if (this.nodeType == 1)
- this.removeAttribute( name );
- },
+jQuery.Event = function( src ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !this.preventDefault ) {
+ return new jQuery.Event( src );
+ }
- addClass: function( classNames ) {
- jQuery.className.add( this, classNames );
- },
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+ // Event type
+ } else {
+ this.type = src;
+ }
- removeClass: function( classNames ) {
- jQuery.className.remove( this, classNames );
- },
+ // timeStamp is buggy for some events on Firefox(#3843)
+ // So we won't rely on the native value
+ this.timeStamp = now();
+
+ // Mark it as fixed
+ this[ expando ] = true;
+};
- toggleClass: function( classNames, state ) {
- if( typeof state !== "boolean" )
- state = !jQuery.className.has( this, classNames );
- jQuery.className[ state ? "add" : "remove" ]( this, classNames );
+function returnFalse() {
+ return false;
+}
+function returnTrue() {
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+
+ // if preventDefault exists run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+ }
+ // otherwise set the returnValue property of the original event to false (IE)
+ e.returnValue = false;
},
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
- remove: function( selector ) {
- if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
- // Prevent memory leaks
- jQuery( "*", this ).add([this]).each(function(){
- jQuery.event.remove(this);
- jQuery.removeData(this);
- });
- if (this.parentNode)
- this.parentNode.removeChild( this );
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
}
+ // if stopPropagation exists run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
},
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
- empty: function() {
- // Remove element nodes and prevent memory leaks
- jQuery(this).children().remove();
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function( event ) {
+ // Check if mouse(over|out) are still within the same parent element
+ var parent = event.relatedTarget;
- // Remove any remaining nodes
- while ( this.firstChild )
- this.removeChild( this.firstChild );
- }
-}, function(name, fn){
- jQuery.fn[ name ] = function(){
- return this.each( fn, arguments );
+ // Firefox sometimes assigns relatedTarget a XUL element
+ // which we cannot access the parentNode property of
+ try {
+ // Traverse up the tree
+ while ( parent && parent !== this ) {
+ parent = parent.parentNode;
+ }
+
+ if ( parent !== this ) {
+ // set the correct event type
+ event.type = event.data;
+
+ // handle event if we actually just moused on to a non sub-element
+ jQuery.event.handle.apply( this, arguments );
+ }
+
+ // assuming we've left the element since we most likely mousedover a xul element
+ } catch(e) { }
+},
+
+// In case of event delegation, we only need to rename the event.type,
+// liveHandler will take care of the rest.
+delegate = function( event ) {
+ event.type = event.data;
+ jQuery.event.handle.apply( this, arguments );
+};
+
+// Create mouseenter and mouseleave events
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ setup: function( data ) {
+ jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
+ },
+ teardown: function( data ) {
+ jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
+ }
};
});
-// Helper function used by the dimensions and offset modules
-function num(elem, prop) {
- return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
+// submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function( data, namespaces ) {
+ if ( this.nodeName.toLowerCase() !== "form" ) {
+ jQuery.event.add(this, "click.specialSubmit", function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
+ return trigger( "submit", this, arguments );
+ }
+ });
+
+ jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
+ return trigger( "submit", this, arguments );
+ }
+ });
+
+ } else {
+ return false;
+ }
+ },
+
+ teardown: function( namespaces ) {
+ jQuery.event.remove( this, ".specialSubmit" );
+ }
+ };
+
}
-var expando = "jQuery" + now(), uuid = 0, windowData = {};
-jQuery.extend({
- cache: {},
+// change delegation, happens here so we have bind.
+if ( !jQuery.support.changeBubbles ) {
- data: function( elem, name, data ) {
- elem = elem == window ?
- windowData :
- elem;
+ var formElems = /textarea|input|select/i,
- var id = elem[ expando ];
+ changeFilters,
- // Compute a unique ID for the element
- if ( !id )
- id = elem[ expando ] = ++uuid;
+ getVal = function( elem ) {
+ var type = elem.type, val = elem.value;
- // Only generate the data cache if we're
- // trying to access or manipulate it
- if ( name && !jQuery.cache[ id ] )
- jQuery.cache[ id ] = {};
+ if ( type === "radio" || type === "checkbox" ) {
+ val = elem.checked;
- // Prevent overriding the named cache with undefined values
- if ( data !== undefined )
- jQuery.cache[ id ][ name ] = data;
+ } else if ( type === "select-multiple" ) {
+ val = elem.selectedIndex > -1 ?
+ jQuery.map( elem.options, function( elem ) {
+ return elem.selected;
+ }).join("-") :
+ "";
+
+ } else if ( elem.nodeName.toLowerCase() === "select" ) {
+ val = elem.selectedIndex;
+ }
- // Return the named cache data, or the ID for the element
- return name ?
- jQuery.cache[ id ][ name ] :
- id;
+ return val;
},
- removeData: function( elem, name ) {
- elem = elem == window ?
- windowData :
- elem;
+ testChange = function testChange( e ) {
+ var elem = e.target, data, val;
- var id = elem[ expando ];
+ if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
+ return;
+ }
- // If we want to remove a specific section of the element's data
- if ( name ) {
- if ( jQuery.cache[ id ] ) {
- // Remove the section of cache data
- delete jQuery.cache[ id ][ name ];
+ data = jQuery.data( elem, "_change_data" );
+ val = getVal(elem);
- // If we've removed all the data, remove the element's cache
- name = "";
+ // the current data will be also retrieved by beforeactivate
+ if ( e.type !== "focusout" || elem.type !== "radio" ) {
+ jQuery.data( elem, "_change_data", val );
+ }
+
+ if ( data === undefined || val === data ) {
+ return;
+ }
- for ( name in jQuery.cache[ id ] )
- break;
+ if ( data != null || val ) {
+ e.type = "change";
+ return jQuery.event.trigger( e, arguments[1], elem );
+ }
+ };
- if ( !name )
- jQuery.removeData( elem );
+ jQuery.event.special.change = {
+ filters: {
+ focusout: testChange,
+
+ click: function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
+ return testChange.call( this, e );
+ }
+ },
+
+ // Change has to be called before submit
+ // Keydown will be called before keypress, which is used in submit-event delegation
+ keydown: function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
+ (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
+ type === "select-multiple" ) {
+ return testChange.call( this, e );
+ }
+ },
+
+ // Beforeactivate happens also before the previous element is blurred
+ // with this event you can't trigger a change event, but you can store
+ // information/focus[in] is not needed anymore
+ beforeactivate: function( e ) {
+ var elem = e.target;
+ jQuery.data( elem, "_change_data", getVal(elem) );
}
+ },
- // Otherwise, we want to remove all of the element's data
- } else {
- // Clean up the element expando
- try {
- delete elem[ expando ];
- } catch(e){
- // IE has trouble directly removing the expando
- // but it's ok with using removeAttribute
- if ( elem.removeAttribute )
- elem.removeAttribute( expando );
+ setup: function( data, namespaces ) {
+ if ( this.type === "file" ) {
+ return false;
}
- // Completely remove the data cache
- delete jQuery.cache[ id ];
+ for ( var type in changeFilters ) {
+ jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
+ }
+
+ return formElems.test( this.nodeName );
+ },
+
+ teardown: function( namespaces ) {
+ jQuery.event.remove( this, ".specialChange" );
+
+ return formElems.test( this.nodeName );
}
- },
- queue: function( elem, type, data ) {
- if ( elem ){
+ };
- type = (type || "fx") + "queue";
+ changeFilters = jQuery.event.special.change.filters;
+}
- var q = jQuery.data( elem, type );
+function trigger( type, elem, args ) {
+ args[0].type = type;
+ return jQuery.event.handle.apply( elem, args );
+}
- if ( !q || jQuery.isArray(data) )
- q = jQuery.data( elem, type, jQuery.makeArray(data) );
- else if( data )
- q.push( data );
+// Create "bubbling" focus and blur events
+if ( document.addEventListener ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ this.addEventListener( orig, handler, true );
+ },
+ teardown: function() {
+ this.removeEventListener( orig, handler, true );
+ }
+ };
+ function handler( e ) {
+ e = jQuery.event.fix( e );
+ e.type = fix;
+ return jQuery.event.handle.call( this, e );
}
- return q;
- },
+ });
+}
- dequeue: function( elem, type ){
- var queue = jQuery.queue( elem, type ),
- fn = queue.shift();
+jQuery.each(["bind", "one"], function( i, name ) {
+ jQuery.fn[ name ] = function( type, data, fn ) {
+ // Handle object literals
+ if ( typeof type === "object" ) {
+ for ( var key in type ) {
+ this[ name ](key, data, type[key], fn);
+ }
+ return this;
+ }
+
+ if ( jQuery.isFunction( data ) ) {
+ fn = data;
+ data = undefined;
+ }
- if( !type || type === "fx" )
- fn = queue[0];
+ var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
+ jQuery( this ).unbind( event, handler );
+ return fn.apply( this, arguments );
+ }) : fn;
- if( fn !== undefined )
- fn.call(elem);
- }
+ if ( type === "unload" && name !== "one" ) {
+ this.one( type, data, fn );
+
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ jQuery.event.add( this[i], type, handler, data );
+ }
+ }
+
+ return this;
+ };
});
jQuery.fn.extend({
- data: function( key, value ){
- var parts = key.split(".");
- parts[1] = parts[1] ? "." + parts[1] : "";
-
- if ( value === undefined ) {
- var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+ unbind: function( type, fn ) {
+ // Handle object literals
+ if ( typeof type === "object" && !type.preventDefault ) {
+ for ( var key in type ) {
+ this.unbind(key, type[key]);
+ }
- if ( data === undefined && this.length )
- data = jQuery.data( this[0], key );
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ jQuery.event.remove( this[i], type, fn );
+ }
+ }
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
- } else
- return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
- jQuery.data( this, key, value );
- });
+ return this;
},
-
- removeData: function( key ){
- return this.each(function(){
- jQuery.removeData( this, key );
+
+ delegate: function( selector, types, data, fn ) {
+ return this.live( types, data, fn, selector );
+ },
+
+ undelegate: function( selector, types, fn ) {
+ if ( arguments.length === 0 ) {
+ return this.unbind( "live" );
+
+ } else {
+ return this.die( types, null, fn, selector );
+ }
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
});
},
- queue: function(type, data){
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
+
+ triggerHandler: function( type, data ) {
+ if ( this[0] ) {
+ var event = jQuery.Event( type );
+ event.preventDefault();
+ event.stopPropagation();
+ jQuery.event.trigger( event, data, this[0] );
+ return event.result;
}
+ },
- if ( data === undefined )
- return jQuery.queue( this[0], type );
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments, i = 1;
- return this.each(function(){
- var queue = jQuery.queue( this, type, data );
+ // link all the functions, so any of them can unbind this click handler
+ while ( i < args.length ) {
+ jQuery.proxy( fn, args[ i++ ] );
+ }
- if( type == "fx" && queue.length == 1 )
- queue[0].call(this);
- });
+ return this.click( jQuery.proxy( fn, function( event ) {
+ // Figure out which function to execute
+ var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+ jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ lastToggle ].apply( this, arguments ) || false;
+ }));
},
- dequeue: function(type){
- return this.each(function(){
- jQuery.dequeue( this, type );
- });
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
-});/*!
- * Sizzle CSS Selector Engine - v0.9.3
+});
+
+var liveMap = {
+ focus: "focusin",
+ blur: "focusout",
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+};
+
+jQuery.each(["live", "die"], function( i, name ) {
+ jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
+ var type, i = 0, match, namespaces, preType,
+ selector = origSelector || this.selector,
+ context = origSelector ? this : jQuery( this.context );
+
+ if ( jQuery.isFunction( data ) ) {
+ fn = data;
+ data = undefined;
+ }
+
+ types = (types || "").split(" ");
+
+ while ( (type = types[ i++ ]) != null ) {
+ match = rnamespaces.exec( type );
+ namespaces = "";
+
+ if ( match ) {
+ namespaces = match[0];
+ type = type.replace( rnamespaces, "" );
+ }
+
+ if ( type === "hover" ) {
+ types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
+ continue;
+ }
+
+ preType = type;
+
+ if ( type === "focus" || type === "blur" ) {
+ types.push( liveMap[ type ] + namespaces );
+ type = type + namespaces;
+
+ } else {
+ type = (liveMap[ type ] || type) + namespaces;
+ }
+
+ if ( name === "live" ) {
+ // bind live handler
+ context.each(function(){
+ jQuery.event.add( this, liveConvert( type, selector ),
+ { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
+ });
+
+ } else {
+ // unbind live handler
+ context.unbind( liveConvert( type, selector ), fn );
+ }
+ }
+
+ return this;
+ }
+});
+
+function liveHandler( event ) {
+ var stop, elems = [], selectors = [], args = arguments,
+ related, match, handleObj, elem, j, i, l, data,
+ events = jQuery.data( this, "events" );
+
+ // Make sure we avoid non-left-click bubbling in Firefox (#3861)
+ if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
+ return;
+ }
+
+ event.liveFired = this;
+
+ var live = events.live.slice(0);
+
+ for ( j = 0; j < live.length; j++ ) {
+ handleObj = live[j];
+
+ if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
+ selectors.push( handleObj.selector );
+
+ } else {
+ live.splice( j--, 1 );
+ }
+ }
+
+ match = jQuery( event.target ).closest( selectors, event.currentTarget );
+
+ for ( i = 0, l = match.length; i < l; i++ ) {
+ for ( j = 0; j < live.length; j++ ) {
+ handleObj = live[j];
+
+ if ( match[i].selector === handleObj.selector ) {
+ elem = match[i].elem;
+ related = null;
+
+ // Those two events require additional checking
+ if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
+ related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
+ }
+
+ if ( !related || related !== elem ) {
+ elems.push({ elem: elem, handleObj: handleObj });
+ }
+ }
+ }
+ }
+
+ for ( i = 0, l = elems.length; i < l; i++ ) {
+ match = elems[i];
+ event.currentTarget = match.elem;
+ event.data = match.handleObj.data;
+ event.handleObj = match.handleObj;
+
+ if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) {
+ stop = false;
+ break;
+ }
+ }
+
+ return stop;
+}
+
+function liveConvert( type, selector ) {
+ return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
+}
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( fn ) {
+ return fn ? this.bind( name, fn ) : this.trigger( name );
+ };
+
+ if ( jQuery.attrFn ) {
+ jQuery.attrFn[ name ] = true;
+ }
+});
+
+// Prevent memory leaks in IE
+// Window isn't included so as not to unbind existing unload events
+// More info:
+// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
+if ( window.attachEvent && !window.addEventListener ) {
+ window.attachEvent("onunload", function() {
+ for ( var id in jQuery.cache ) {
+ if ( jQuery.cache[ id ].handle ) {
+ // Try/Catch is to handle iframes being unloaded, see #4280
+ try {
+ jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+ } catch(e) {}
+ }
+ }
+ });
+}
+/*!
+ * Sizzle CSS Selector Engine - v1.0
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
done = 0,
- toString = Object.prototype.toString;
+ toString = Object.prototype.toString,
+ hasDuplicate = false,
+ baseHasDuplicate = true;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+// Thus far that includes Google Chrome.
+[0, 0].sort(function(){
+ baseHasDuplicate = false;
+ return 0;
+});
var Sizzle = function(selector, context, results, seed) {
results = results || [];
- context = context || document;
+ var origContext = context = context || document;
- if ( context.nodeType !== 1 && context.nodeType !== 9 )
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
-
+ }
+
if ( !selector || typeof selector !== "string" ) {
return results;
}
- var parts = [], m, set, checkSet, check, mode, extra, prune = true;
-
+ var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context),
+ soFar = selector;
+
// Reset the position of the chunker regexp (start from head)
- chunker.lastIndex = 0;
-
- while ( (m = chunker.exec(selector)) !== null ) {
+ while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
+ soFar = m[3];
+
parts.push( m[1] );
-
+
if ( m[2] ) {
- extra = RegExp.rightContext;
+ extra = m[3];
break;
}
}
@@ -1461,38 +2682,51 @@ var Sizzle = function(selector, context, results, seed) {
while ( parts.length ) {
selector = parts.shift();
- if ( Expr.relative[ selector ] )
+ if ( Expr.relative[ selector ] ) {
selector += parts.shift();
-
+ }
+
set = posProcess( selector, set );
}
}
} else {
- var ret = seed ?
- { expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
- set = Sizzle.filter( ret.expr, ret.set );
-
- if ( parts.length > 0 ) {
- checkSet = makeArray(set);
- } else {
- prune = false;
+ // Take a shortcut and set the context if the root selector is an ID
+ // (but not if it'll be faster if the inner selector is an ID)
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+ var ret = Sizzle.find( parts.shift(), context, contextXML );
+ context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
}
- while ( parts.length ) {
- var cur = parts.pop(), pop = cur;
+ if ( context ) {
+ var ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+ set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
- if ( !Expr.relative[ cur ] ) {
- cur = "";
+ if ( parts.length > 0 ) {
+ checkSet = makeArray(set);
} else {
- pop = parts.pop();
+ prune = false;
}
- if ( pop == null ) {
- pop = context;
- }
+ while ( parts.length ) {
+ var cur = parts.pop(), pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
- Expr.relative[ cur ]( checkSet, pop, isXML(context) );
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
+ }
+ } else {
+ checkSet = parts = [];
}
}
@@ -1501,13 +2735,13 @@ var Sizzle = function(selector, context, results, seed) {
}
if ( !checkSet ) {
- throw "Syntax error, unrecognized expression: " + (cur || selector);
+ Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
- } else if ( context.nodeType === 1 ) {
+ } else if ( context && context.nodeType === 1 ) {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
results.push( set[i] );
@@ -1525,17 +2759,22 @@ var Sizzle = function(selector, context, results, seed) {
}
if ( extra ) {
- Sizzle( extra, context, results, seed );
+ Sizzle( extra, origContext, results, seed );
+ Sizzle.uniqueSort( results );
+ }
- if ( sortOrder ) {
- hasDuplicate = false;
- results.sort(sortOrder);
+ return results;
+};
- if ( hasDuplicate ) {
- for ( var i = 1; i < results.length; i++ ) {
- if ( results[i] === results[i-1] ) {
- results.splice(i--, 1);
- }
+Sizzle.uniqueSort = function(results){
+ if ( sortOrder ) {
+ hasDuplicate = baseHasDuplicate;
+ results.sort(sortOrder);
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[i-1] ) {
+ results.splice(i--, 1);
}
}
}
@@ -1557,9 +2796,10 @@ Sizzle.find = function(expr, context, isXML){
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var type = Expr.order[i], match;
-
- if ( (match = Expr.match[ type ].exec( expr )) ) {
- var left = RegExp.leftContext;
+
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+ var left = match[1];
+ match.splice(1,1);
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace(/\\/g, "");
@@ -1585,11 +2825,17 @@ Sizzle.filter = function(expr, set, inplace, not){
while ( expr && set.length ) {
for ( var type in Expr.filter ) {
- if ( (match = Expr.match[ type ].exec( expr )) != null ) {
- var filter = Expr.filter[ type ], found, item;
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+ var filter = Expr.filter[ type ], found, item, left = match[1];
anyFound = false;
- if ( curLoop == result ) {
+ match.splice(1,1);
+
+ if ( left.substr( left.length - 1 ) === "\\" ) {
+ continue;
+ }
+
+ if ( curLoop === result ) {
result = [];
}
@@ -1640,9 +2886,9 @@ Sizzle.filter = function(expr, set, inplace, not){
}
// Improper expression
- if ( expr == old ) {
+ if ( expr === old ) {
if ( anyFound == null ) {
- throw "Syntax error, unrecognized expression: " + expr;
+ Sizzle.error( expr );
} else {
break;
}
@@ -1654,18 +2900,23 @@ Sizzle.filter = function(expr, set, inplace, not){
return curLoop;
};
+Sizzle.error = function( msg ) {
+ throw "Syntax error, unrecognized expression: " + msg;
+};
+
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
- ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
- CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
- NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
- TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
+ ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
- PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
+ leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
@@ -1676,20 +2927,20 @@ var Expr = Sizzle.selectors = {
}
},
relative: {
- "+": function(checkSet, part, isXML){
+ "+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !/\W/.test(part),
isPartStrNotTag = isPartStr && !isTag;
- if ( isTag && !isXML ) {
- part = part.toUpperCase();
+ if ( isTag ) {
+ part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
- checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
@@ -1699,17 +2950,17 @@ var Expr = Sizzle.selectors = {
Sizzle.filter( part, checkSet, true );
}
},
- ">": function(checkSet, part, isXML){
+ ">": function(checkSet, part){
var isPartStr = typeof part === "string";
if ( isPartStr && !/\W/.test(part) ) {
- part = isXML ? part : part.toUpperCase();
+ part = part.toLowerCase();
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
- checkSet[i] = parent.nodeName === part ? parent : false;
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
@@ -1730,8 +2981,8 @@ var Expr = Sizzle.selectors = {
"": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
- if ( !part.match(/\W/) ) {
- var nodeCheck = part = isXML ? part : part.toUpperCase();
+ if ( typeof part === "string" && !/\W/.test(part) ) {
+ var nodeCheck = part = part.toLowerCase();
checkFn = dirNodeCheck;
}
@@ -1740,8 +2991,8 @@ var Expr = Sizzle.selectors = {
"~": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
- if ( typeof part === "string" && !part.match(/\W/) ) {
- var nodeCheck = part = isXML ? part : part.toUpperCase();
+ if ( typeof part === "string" && !/\W/.test(part) ) {
+ var nodeCheck = part = part.toLowerCase();
checkFn = dirNodeCheck;
}
@@ -1755,7 +3006,7 @@ var Expr = Sizzle.selectors = {
return m ? [m] : [];
}
},
- NAME: function(match, context, isXML){
+ NAME: function(match, context){
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [], results = context.getElementsByName(match[1]);
@@ -1782,9 +3033,10 @@ var Expr = Sizzle.selectors = {
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
- if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
- if ( !inplace )
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
+ if ( !inplace ) {
result.push( elem );
+ }
} else if ( inplace ) {
curLoop[i] = false;
}
@@ -1797,14 +3049,13 @@ var Expr = Sizzle.selectors = {
return match[1].replace(/\\/g, "");
},
TAG: function(match, curLoop){
- for ( var i = 0; curLoop[i] === false; i++ ){}
- return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
+ return match[1].toLowerCase();
},
CHILD: function(match){
- if ( match[1] == "nth" ) {
+ if ( match[1] === "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
- match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
@@ -1819,7 +3070,7 @@ var Expr = Sizzle.selectors = {
},
ATTR: function(match, curLoop, inplace, result, not, isXML){
var name = match[1].replace(/\\/g, "");
-
+
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
@@ -1833,7 +3084,7 @@ var Expr = Sizzle.selectors = {
PSEUDO: function(match, curLoop, inplace, result, not){
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
- if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
@@ -1845,7 +3096,7 @@ var Expr = Sizzle.selectors = {
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
-
+
return match;
},
POS: function(match){
@@ -1906,7 +3157,7 @@ var Expr = Sizzle.selectors = {
return "reset" === elem.type;
},
button: function(elem){
- return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
+ return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
},
input: function(elem){
return /input|select|textarea|button/i.test(elem.nodeName);
@@ -1932,10 +3183,10 @@ var Expr = Sizzle.selectors = {
return i > match[3] - 0;
},
nth: function(elem, i, match){
- return match[3] - 0 == i;
+ return match[3] - 0 === i;
},
eq: function(elem, i, match){
- return match[3] - 0 == i;
+ return match[3] - 0 === i;
}
},
filter: {
@@ -1945,7 +3196,7 @@ var Expr = Sizzle.selectors = {
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
- return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
+ return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
@@ -1956,6 +3207,8 @@ var Expr = Sizzle.selectors = {
}
return true;
+ } else {
+ Sizzle.error( "Syntax error, unrecognized expression: " + name );
}
},
CHILD: function(elem, match){
@@ -1963,41 +3216,47 @@ var Expr = Sizzle.selectors = {
switch (type) {
case 'only':
case 'first':
- while (node = node.previousSibling) {
- if ( node.nodeType === 1 ) return false;
+ while ( (node = node.previousSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ if ( type === "first" ) {
+ return true;
}
- if ( type == 'first') return true;
node = elem;
case 'last':
- while (node = node.nextSibling) {
- if ( node.nodeType === 1 ) return false;
+ while ( (node = node.nextSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
}
return true;
case 'nth':
var first = match[2], last = match[3];
- if ( first == 1 && last == 0 ) {
+ if ( first === 1 && last === 0 ) {
return true;
}
-
+
var doneName = match[0],
parent = elem.parentNode;
-
+
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
- }
+ }
parent.sizcache = doneName;
}
-
+
var diff = elem.nodeIndex - last;
- if ( first == 0 ) {
- return diff == 0;
+ if ( first === 0 ) {
+ return diff === 0;
} else {
- return ( diff % first == 0 && diff / first >= 0 );
+ return ( diff % first === 0 && diff / first >= 0 );
}
}
},
@@ -2005,7 +3264,7 @@ var Expr = Sizzle.selectors = {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function(elem, match){
- return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
},
CLASS: function(elem, match){
return (" " + (elem.className || elem.getAttribute("class")) + " ")
@@ -2033,7 +3292,7 @@ var Expr = Sizzle.selectors = {
!check ?
value && result !== false :
type === "!=" ?
- value != check :
+ value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
@@ -2055,24 +3314,29 @@ var Expr = Sizzle.selectors = {
var origPOS = Expr.match.POS;
for ( var type in Expr.match ) {
- Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){
+ return "\\" + (num - 0 + 1);
+ }));
}
var makeArray = function(array, results) {
- array = Array.prototype.slice.call( array );
+ array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
-
+
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
try {
- Array.prototype.slice.call( document.documentElement.childNodes );
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch(e){
@@ -2101,6 +3365,13 @@ var sortOrder;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+ if ( a == b ) {
+ hasDuplicate = true;
+ }
+ return a.compareDocumentPosition ? -1 : 1;
+ }
+
var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
if ( ret === 0 ) {
hasDuplicate = true;
@@ -2109,6 +3380,13 @@ if ( document.documentElement.compareDocumentPosition ) {
};
} else if ( "sourceIndex" in document.documentElement ) {
sortOrder = function( a, b ) {
+ if ( !a.sourceIndex || !b.sourceIndex ) {
+ if ( a == b ) {
+ hasDuplicate = true;
+ }
+ return a.sourceIndex ? -1 : 1;
+ }
+
var ret = a.sourceIndex - b.sourceIndex;
if ( ret === 0 ) {
hasDuplicate = true;
@@ -2117,11 +3395,18 @@ if ( document.documentElement.compareDocumentPosition ) {
};
} else if ( document.createRange ) {
sortOrder = function( a, b ) {
+ if ( !a.ownerDocument || !b.ownerDocument ) {
+ if ( a == b ) {
+ hasDuplicate = true;
+ }
+ return a.ownerDocument ? -1 : 1;
+ }
+
var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
- aRange.selectNode(a);
- aRange.collapse(true);
- bRange.selectNode(b);
- bRange.collapse(true);
+ aRange.setStart(a, 0);
+ aRange.setEnd(a, 0);
+ bRange.setStart(b, 0);
+ bRange.setEnd(b, 0);
var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
if ( ret === 0 ) {
hasDuplicate = true;
@@ -2130,13 +3415,33 @@ if ( document.documentElement.compareDocumentPosition ) {
};
}
+// Utility function for retreiving the text value of an array of DOM nodes
+function getText( elems ) {
+ var ret = "", elem;
+
+ for ( var i = 0; elems[i]; i++ ) {
+ elem = elems[i];
+
+ // Get the text from text nodes and CDATA nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
+ ret += elem.nodeValue;
+
+ // Traverse everything else, except comment nodes
+ } else if ( elem.nodeType !== 8 ) {
+ ret += getText( elem.childNodes );
+ }
+ }
+
+ return ret;
+}
+
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
- var form = document.createElement("form"),
+ var form = document.createElement("div"),
id = "script" + (new Date).getTime();
- form.innerHTML = "<input name='" + id + "'/>";
+ form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
var root = document.documentElement;
@@ -2144,7 +3449,7 @@ if ( document.documentElement.compareDocumentPosition ) {
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
- if ( !!document.getElementById( id ) ) {
+ if ( document.getElementById( id ) ) {
Expr.find.ID = function(match, context, isXML){
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
@@ -2159,6 +3464,7 @@ if ( document.documentElement.compareDocumentPosition ) {
}
root.removeChild( form );
+ root = form = null; // release memory in IE
})();
(function(){
@@ -2199,69 +3505,75 @@ if ( document.documentElement.compareDocumentPosition ) {
return elem.getAttribute("href", 2);
};
}
-})();
-
-if ( document.querySelectorAll ) (function(){
- var oldSizzle = Sizzle, div = document.createElement("div");
- div.innerHTML = "<p class='TEST'></p>";
- // Safari can't handle uppercase or unicode characters when
- // in quirks mode.
- if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
- return;
- }
+ div = null; // release memory in IE
+})();
- Sizzle = function(query, context, extra, seed){
- context = context || document;
+if ( document.querySelectorAll ) {
+ (function(){
+ var oldSizzle = Sizzle, div = document.createElement("div");
+ div.innerHTML = "<p class='TEST'></p>";
- // Only use querySelectorAll on non-XML documents
- // (ID selectors don't work in non-HTML documents)
- if ( !seed && context.nodeType === 9 && !isXML(context) ) {
- try {
- return makeArray( context.querySelectorAll(query), extra );
- } catch(e){}
+ // Safari can't handle uppercase or unicode characters when
+ // in quirks mode.
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+ return;
}
+
+ Sizzle = function(query, context, extra, seed){
+ context = context || document;
+
+ // Only use querySelectorAll on non-XML documents
+ // (ID selectors don't work in non-HTML documents)
+ if ( !seed && context.nodeType === 9 && !isXML(context) ) {
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(e){}
+ }
+
+ return oldSizzle(query, context, extra, seed);
+ };
- return oldSizzle(query, context, extra, seed);
- };
+ for ( var prop in oldSizzle ) {
+ Sizzle[ prop ] = oldSizzle[ prop ];
+ }
- Sizzle.find = oldSizzle.find;
- Sizzle.filter = oldSizzle.filter;
- Sizzle.selectors = oldSizzle.selectors;
- Sizzle.matches = oldSizzle.matches;
-})();
+ div = null; // release memory in IE
+ })();
+}
-if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
+(function(){
var div = document.createElement("div");
+
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
- if ( div.getElementsByClassName("e").length === 0 )
+ // Also, make sure that getElementsByClassName actually exists
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
+ }
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
- if ( div.getElementsByClassName("e").length === 1 )
+ if ( div.getElementsByClassName("e").length === 1 ) {
return;
-
+ }
+
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function(match, context, isXML) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
+
+ div = null; // release memory in IE
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- var sibDir = dir == "previousSibling" && !isXML;
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
- if ( sibDir && elem.nodeType === 1 ){
- elem.sizcache = doneName;
- elem.sizset = i;
- }
elem = elem[dir];
var match = false;
@@ -2276,7 +3588,7 @@ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
elem.sizset = i;
}
- if ( elem.nodeName === cur ) {
+ if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
@@ -2290,14 +3602,9 @@ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- var sibDir = dir == "previousSibling" && !isXML;
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
- if ( sibDir && elem.nodeType === 1 ) {
- elem.sizcache = doneName;
- elem.sizset = i;
- }
elem = elem[dir];
var match = false;
@@ -2332,15 +3639,17 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
}
}
-var contains = document.compareDocumentPosition ? function(a, b){
- return a.compareDocumentPosition(b) & 16;
+var contains = document.compareDocumentPosition ? function(a, b){
+ return !!(a.compareDocumentPosition(b) & 16);
} : function(a, b){
return a !== b && (a.contains ? a.contains(b) : true);
};
var isXML = function(elem){
- return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
- !!elem.ownerDocument && isXML( elem.ownerDocument );
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function(selector, context){
@@ -2365,872 +3674,1122 @@ var posProcess = function(selector, context){
// EXPOSE
jQuery.find = Sizzle;
-jQuery.filter = Sizzle.filter;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = getText;
+jQuery.isXMLDoc = isXML;
+jQuery.contains = contains;
-Sizzle.selectors.filters.hidden = function(elem){
- return elem.offsetWidth === 0 || elem.offsetHeight === 0;
-};
+return;
-Sizzle.selectors.filters.visible = function(elem){
- return elem.offsetWidth > 0 || elem.offsetHeight > 0;
-};
+window.Sizzle = Sizzle;
-Sizzle.selectors.filters.animated = function(elem){
- return jQuery.grep(jQuery.timers, function(fn){
- return elem === fn.elem;
- }).length;
-};
+})();
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prevUntil|prevAll)/,
+ // Note: This RegExp should be improved, or likely pulled from Sizzle
+ rmultiselector = /,/,
+ slice = Array.prototype.slice;
+
+// Implement the identical functionality for filter and not
+var winnow = function( elements, qualifier, keep ) {
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return !!qualifier.call( elem, i, elem ) === keep;
+ });
-jQuery.multiFilter = function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return (elem === qualifier) === keep;
+ });
- return Sizzle.matches(expr, elems);
-};
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
-jQuery.dir = function( elem, dir ){
- var matched = [], cur = elem[dir];
- while ( cur && cur != document ) {
- if ( cur.nodeType == 1 )
- matched.push( cur );
- cur = cur[dir];
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
}
- return matched;
+
+ return jQuery.grep(elements, function( elem, i ) {
+ return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
+ });
};
-jQuery.nth = function(cur, result, dir, elem){
- result = result || 1;
- var num = 0;
+jQuery.fn.extend({
+ find: function( selector ) {
+ var ret = this.pushStack( "", "find", selector ), length = 0;
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ length = ret.length;
+ jQuery.find( selector, this[i], ret );
+
+ if ( i > 0 ) {
+ // Make sure that the results are unique
+ for ( var n = length; n < ret.length; n++ ) {
+ for ( var r = 0; r < length; r++ ) {
+ if ( ret[r] === ret[n] ) {
+ ret.splice(n--, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
- for ( ; cur; cur = cur[dir] )
- if ( cur.nodeType == 1 && ++num == result )
- break;
+ return ret;
+ },
- return cur;
-};
+ has: function( target ) {
+ var targets = jQuery( target );
+ return this.filter(function() {
+ for ( var i = 0, l = targets.length; i < l; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
-jQuery.sibling = function(n, elem){
- var r = [];
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false), "not", selector);
+ },
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType == 1 && n != elem )
- r.push( n );
- }
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
+ },
+
+ is: function( selector ) {
+ return !!selector && jQuery.filter( selector, this ).length > 0;
+ },
- return r;
-};
+ closest: function( selectors, context ) {
+ if ( jQuery.isArray( selectors ) ) {
+ var ret = [], cur = this[0], match, matches = {}, selector;
-return;
+ if ( cur && selectors.length ) {
+ for ( var i = 0, l = selectors.length; i < l; i++ ) {
+ selector = selectors[i];
-window.Sizzle = Sizzle;
+ if ( !matches[selector] ) {
+ matches[selector] = jQuery.expr.match.POS.test( selector ) ?
+ jQuery( selector, context || this.context ) :
+ selector;
+ }
+ }
-})();
-/*
- * A number of helper functions used for managing events.
- * Many of the ideas behind this code originated from
- * Dean Edwards' addEvent library.
- */
-jQuery.event = {
+ while ( cur && cur.ownerDocument && cur !== context ) {
+ for ( selector in matches ) {
+ match = matches[selector];
- // Bind an event to an element
- // Original by Dean Edwards
- add: function(elem, types, handler, data) {
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
- return;
+ if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
+ ret.push({ selector: selector, elem: cur });
+ delete matches[selector];
+ }
+ }
+ cur = cur.parentNode;
+ }
+ }
- // For whatever reason, IE has trouble passing the window object
- // around, causing it to be cloned in the process
- if ( elem.setInterval && elem != window )
- elem = window;
+ return ret;
+ }
- // Make sure that the function being executed has a unique ID
- if ( !handler.guid )
- handler.guid = this.guid++;
+ var pos = jQuery.expr.match.POS.test( selectors ) ?
+ jQuery( selectors, context || this.context ) : null;
- // if data is passed, bind to handler
- if ( data !== undefined ) {
- // Create temporary function pointer to original handler
- var fn = handler;
+ return this.map(function( i, cur ) {
+ while ( cur && cur.ownerDocument && cur !== context ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) {
+ return cur;
+ }
+ cur = cur.parentNode;
+ }
+ return null;
+ });
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+ if ( !elem || typeof elem === "string" ) {
+ return jQuery.inArray( this[0],
+ // If it receives a string, the selector is used
+ // If it receives nothing, the siblings are used
+ elem ? jQuery( elem ) : this.parent().children() );
+ }
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context || this.context ) :
+ jQuery.makeArray( selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
+ all :
+ jQuery.unique( all ) );
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ }
+});
- // Create unique handler function, wrapped around original handler
- handler = this.proxy( fn );
+// A painfully simple check to see if an element is disconnected
+// from a document (should be improved, where feasible).
+function isDisconnected( node ) {
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;
+}
- // Store data in unique handler
- handler.data = data;
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return jQuery.nth( elem, 2, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return jQuery.nth( elem, 2, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( elem.parentNode.firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.makeArray( elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
}
- // Init the element's event structure
- var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
- handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
- // Handle the second event of a trigger and when
- // an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
- jQuery.event.handle.apply(arguments.callee.elem, arguments) :
- undefined;
- });
- // Add elem as a property of the handle function
- // This is to prevent a memory leak with non-native
- // event in IE.
- handle.elem = elem;
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- jQuery.each(types.split(/\s+/), function(index, type) {
- // Namespaced event handlers
- var namespaces = type.split(".");
- type = namespaces.shift();
- handler.type = namespaces.slice().sort().join(".");
+ ret = this.length > 1 ? jQuery.unique( ret ) : ret;
- // Get the current list of functions bound to this event
- var handlers = events[type];
+ if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
- if ( jQuery.event.specialAll[type] )
- jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
+ return this.pushStack( ret, name, slice.call(arguments).join(",") );
+ };
+});
- // Init the event handler queue
- if (!handlers) {
- handlers = events[type] = {};
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
- // Check for a special event handler
- // Only use addEventListener/attachEvent if the special
- // events handler returns false
- if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
- // Bind the global event handler to the element
- if (elem.addEventListener)
- elem.addEventListener(type, handle, false);
- else if (elem.attachEvent)
- elem.attachEvent("on" + type, handle);
- }
+ return jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [], cur = elem[dir];
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
}
+ cur = cur[dir];
+ }
+ return matched;
+ },
- // Add the function to the element's handler list
- handlers[handler.guid] = handler;
+ nth: function( cur, result, dir, elem ) {
+ result = result || 1;
+ var num = 0;
- // Keep track of which events have been used, for global triggering
- jQuery.event.global[type] = true;
- });
+ for ( ; cur; cur = cur[dir] ) {
+ if ( cur.nodeType === 1 && ++num === result ) {
+ break;
+ }
+ }
- // Nullify elem to prevent memory leaks in IE
- elem = null;
+ return cur;
},
- guid: 1,
- global: {},
+ sibling: function( n, elem ) {
+ var r = [];
- // Detach an event or set of events from an element
- remove: function(elem, types, handler) {
- // don't do events on text and comment nodes
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
- return;
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
- var events = jQuery.data(elem, "events"), ret, index;
+ return r;
+ }
+});
+var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g,
+ rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnocache = /<script|<object|<embed|<option|<style/i,
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
+ fcloseTag = function( all, front, tag ) {
+ return rselfClosing.test( tag ) ?
+ all :
+ front + "></" + tag + ">";
+ },
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ area: [ 1, "<map>", "</map>" ],
+ _default: [ 0, "", "" ]
+ };
- if ( events ) {
- // Unbind all events for the element
- if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
- for ( var type in events )
- this.remove( elem, type + (types || "") );
- else {
- // types is actually an event object here
- if ( types.type ) {
- handler = types.handler;
- types = types.type;
- }
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
- // Handle multiple events seperated by a space
- // jQuery(...).unbind("mouseover mouseout", fn);
- jQuery.each(types.split(/\s+/), function(index, type){
- // Namespaced event handlers
- var namespaces = type.split(".");
- type = namespaces.shift();
- var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
-
- if ( events[type] ) {
- // remove the given handler for the given type
- if ( handler )
- delete events[type][handler.guid];
-
- // remove all handlers for the given type
- else
- for ( var handle in events[type] )
- // Handle the removal of namespaced events
- if ( namespace.test(events[type][handle].type) )
- delete events[type][handle];
-
- if ( jQuery.event.specialAll[type] )
- jQuery.event.specialAll[type].teardown.call(elem, namespaces);
-
- // remove generic event handler if no more handlers exist
- for ( ret in events[type] ) break;
- if ( !ret ) {
- if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
- if (elem.removeEventListener)
- elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
- else if (elem.detachEvent)
- elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
- }
- ret = null;
- delete events[type];
- }
- }
- });
- }
+// IE can't serialize <link> and <script> tags normally
+if ( !jQuery.support.htmlSerialize ) {
+ wrapMap._default = [ 1, "div<div>", "</div>" ];
+}
- // Remove the expando if it's no longer used
- for ( ret in events ) break;
- if ( !ret ) {
- var handle = jQuery.data( elem, "handle" );
- if ( handle ) handle.elem = null;
- jQuery.removeData( elem, "events" );
- jQuery.removeData( elem, "handle" );
- }
+jQuery.fn.extend({
+ text: function( text ) {
+ if ( jQuery.isFunction(text) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.text( text.call(this, i, self.text()) );
+ });
}
+
+ if ( typeof text !== "object" && text !== undefined ) {
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+ }
+
+ return jQuery.text( this );
},
- // bubbling is internal
- trigger: function( event, data, elem, bubbling ) {
- // Event object or event type
- var type = event.type || event;
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
- if( !bubbling ){
- event = typeof event === "object" ?
- // jQuery.Event object
- event[expando] ? event :
- // Object literal
- jQuery.extend( jQuery.Event(type), event ) :
- // Just the event type (string)
- jQuery.Event(type);
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
- if ( type.indexOf("!") >= 0 ) {
- event.type = type = type.slice(0, -1);
- event.exclusive = true;
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
}
- // Handle a global trigger
- if ( !elem ) {
- // Don't bubble custom events when global (to avoid too much overhead)
- event.stopPropagation();
- // Only trigger if we've ever bound an event for it
- if ( this.global[type] )
- jQuery.each( jQuery.cache, function(){
- if ( this.events && this.events[type] )
- jQuery.event.trigger( event, data, this.handle.elem );
- });
- }
+ wrap.map(function() {
+ var elem = this;
- // Handle triggering a single element
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
- // don't do events on text and comment nodes
- if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
- return undefined;
+ return elem;
+ }).append(this);
+ }
- // Clean up in case it is reused
- event.result = undefined;
- event.target = elem;
+ return this;
+ },
- // Clone the incoming data, if any
- data = jQuery.makeArray(data);
- data.unshift( event );
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
}
- event.currentTarget = elem;
+ return this.each(function() {
+ var self = jQuery( this ), contents = self.contents();
- // Trigger the event, it is assumed that "handle" is a function
- var handle = jQuery.data(elem, "handle");
- if ( handle )
- handle.apply( elem, data );
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
- // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
- if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
- event.result = false;
+ wrap: function( html ) {
+ return this.each(function() {
+ jQuery( this ).wrapAll( html );
+ });
+ },
- // Trigger the native events (except for clicks on links)
- if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
- this.triggered = true;
- try {
- elem[ type ]();
- // prevent IE from throwing an error for some hidden elements
- } catch (e) {}
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this );
+ });
+ } else if ( arguments.length ) {
+ var set = jQuery(arguments[0]);
+ set.push.apply( set, this.toArray() );
+ return this.pushStack( set, "before", arguments );
}
+ },
- this.triggered = false;
+ after: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ } else if ( arguments.length ) {
+ var set = this.pushStack( this, "after", arguments );
+ set.push.apply( set, jQuery(arguments[0]).toArray() );
+ return set;
+ }
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ jQuery.cleanData( [ elem ] );
+ }
- if ( !event.isPropagationStopped() ) {
- var parent = elem.parentNode || elem.ownerDocument;
- if ( parent )
- jQuery.event.trigger(event, data, parent, true);
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+ }
}
+
+ return this;
},
- handle: function(event) {
- // returned undefined or false
- var all, handlers;
+ empty: function() {
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ }
- event = arguments[0] = jQuery.event.fix( event || window.event );
- event.currentTarget = this;
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+ }
+
+ return this;
+ },
- // Namespaced event handlers
- var namespaces = event.type.split(".");
- event.type = namespaces.shift();
+ clone: function( events ) {
+ // Do the clone
+ var ret = this.map(function() {
+ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
+ // IE copies events bound via attachEvent when
+ // using cloneNode. Calling detachEvent on the
+ // clone will also remove the events from the orignal
+ // In order to get around this, we use innerHTML.
+ // Unfortunately, this means some modifications to
+ // attributes in IE that are actually only stored
+ // as properties will not be copied (such as the
+ // the name attribute on an input).
+ var html = this.outerHTML, ownerDocument = this.ownerDocument;
+ if ( !html ) {
+ var div = ownerDocument.createElement("div");
+ div.appendChild( this.cloneNode(true) );
+ html = div.innerHTML;
+ }
- // Cache this now, all = true means, any handler
- all = !namespaces.length && !event.exclusive;
+ return jQuery.clean([html.replace(rinlinejQuery, "")
+ // Handle the case in IE 8 where action=/test/> self-closes a tag
+ .replace(/=([^="'>\s]+\/)>/g, '="$1">')
+ .replace(rleadingWhitespace, "")], ownerDocument)[0];
+ } else {
+ return this.cloneNode(true);
+ }
+ });
- var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
+ // Copy the events from the original to the clone
+ if ( events === true ) {
+ cloneCopyEvent( this, ret );
+ cloneCopyEvent( this.find("*"), ret.find("*") );
+ }
- handlers = ( jQuery.data(this, "events") || {} )[event.type];
+ // Return the cloned set
+ return ret;
+ },
- for ( var j in handlers ) {
- var handler = handlers[j];
+ html: function( value ) {
+ if ( value === undefined ) {
+ return this[0] && this[0].nodeType === 1 ?
+ this[0].innerHTML.replace(rinlinejQuery, "") :
+ null;
- // Filter the functions by class
- if ( all || namespace.test(handler.type) ) {
- // Pass in a reference to the handler function itself
- // So that we can later remove it
- event.handler = handler;
- event.data = handler.data;
+ // See if we can take a shortcut and just use innerHTML
+ } else if ( typeof value === "string" && !rnocache.test( value ) &&
+ (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
+ !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
- var ret = handler.apply(this, arguments);
+ value = value.replace(rxhtmlTag, fcloseTag);
- if( ret !== undefined ){
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
+ try {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( this[i].nodeType === 1 ) {
+ jQuery.cleanData( this[i].getElementsByTagName("*") );
+ this[i].innerHTML = value;
}
}
- if( event.isImmediatePropagationStopped() )
- break;
-
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {
+ this.empty().append( value );
}
+
+ } else if ( jQuery.isFunction( value ) ) {
+ this.each(function(i){
+ var self = jQuery(this), old = self.html();
+ self.empty().append(function(){
+ return value.call( this, i, old );
+ });
+ });
+
+ } else {
+ this.empty().append( value );
}
+
+ return this;
},
- props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+ replaceWith: function( value ) {
+ if ( this[0] && this[0].parentNode ) {
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function(i) {
+ var self = jQuery(this), old = self.html();
+ self.replaceWith( value.call( this, i, old ) );
+ });
+ }
- fix: function(event) {
- if ( event[expando] )
- return event;
+ if ( typeof value !== "string" ) {
+ value = jQuery(value).detach();
+ }
- // store a copy of the original event object
- // and "clone" to set read-only properties
- var originalEvent = event;
- event = jQuery.Event( originalEvent );
+ return this.each(function() {
+ var next = this.nextSibling, parent = this.parentNode;
- for ( var i = this.props.length, prop; i; ){
- prop = this.props[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
+ jQuery(this).remove();
- // Fix target property, if necessary
- if ( !event.target )
- event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+ if ( next ) {
+ jQuery(next).before( value );
+ } else {
+ jQuery(parent).append( value );
+ }
+ });
+ } else {
+ return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
+ }
+ },
- // check if target is a textnode (safari)
- if ( event.target.nodeType == 3 )
- event.target = event.target.parentNode;
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && event.fromElement )
- event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
+ domManip: function( args, table, callback ) {
+ var results, first, value = args[0], scripts = [], fragment, parent;
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && event.clientX != null ) {
- var doc = document.documentElement, body = document.body;
- event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
- event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
+ return this.each(function() {
+ jQuery(this).domManip( args, table, callback, true );
+ });
}
- // Add which for key events
- if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
- event.which = event.charCode || event.keyCode;
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ args[0] = value.call(this, i, table ? self.html() : undefined);
+ self.domManip( args, table, callback );
+ });
+ }
- // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
- if ( !event.metaKey && event.ctrlKey )
- event.metaKey = event.ctrlKey;
+ if ( this[0] ) {
+ parent = value && value.parentNode;
- // Add which for click: 1 == left; 2 == middle; 3 == right
- // Note: button is not normalized, so don't use it
- if ( !event.which && event.button )
- event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+ // If we're in a fragment, just use that instead of building a new one
+ if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
+ results = { fragment: parent };
- return event;
- },
+ } else {
+ results = buildFragment( args, this, scripts );
+ }
+
+ fragment = results.fragment;
+
+ if ( fragment.childNodes.length === 1 ) {
+ first = fragment = fragment.firstChild;
+ } else {
+ first = fragment.firstChild;
+ }
- proxy: function( fn, proxy ){
- proxy = proxy || function(){ return fn.apply(this, arguments); };
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
- // So proxy can be declared as an argument
- return proxy;
- },
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ callback.call(
+ table ?
+ root(this[i], first) :
+ this[i],
+ i > 0 || results.cacheable || this.length > 1 ?
+ fragment.cloneNode(true) :
+ fragment
+ );
+ }
+ }
- special: {
- ready: {
- // Make sure the ready event is setup
- setup: bindReady,
- teardown: function() {}
+ if ( scripts.length ) {
+ jQuery.each( scripts, evalScript );
+ }
}
- },
- specialAll: {
- live: {
- setup: function( selector, namespaces ){
- jQuery.event.add( this, namespaces[0], liveHandler );
- },
- teardown: function( namespaces ){
- if ( namespaces.length ) {
- var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
-
- jQuery.each( (jQuery.data(this, "events").live || {}), function(){
- if ( name.test(this.type) )
- remove++;
- });
+ return this;
- if ( remove < 1 )
- jQuery.event.remove( this, namespaces[0], liveHandler );
- }
- }
+ function root( elem, cur ) {
+ return jQuery.nodeName(elem, "table") ?
+ (elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+ elem;
}
}
-};
+});
-jQuery.Event = function( src ){
- // Allow instantiation without the 'new' keyword
- if( !this.preventDefault )
- return new jQuery.Event(src);
+function cloneCopyEvent(orig, ret) {
+ var i = 0;
- // Event object
- if( src && src.type ){
- this.originalEvent = src;
- this.type = src.type;
- // Event type
- }else
- this.type = src;
+ ret.each(function() {
+ if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
+ return;
+ }
- // timeStamp is buggy for some events on Firefox(#3843)
- // So we won't rely on the native value
- this.timeStamp = now();
+ var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
- // Mark it as fixed
- this[expando] = true;
-};
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
-function returnFalse(){
- return false;
-}
-function returnTrue(){
- return true;
+ for ( var type in events ) {
+ for ( var handler in events[ type ] ) {
+ jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
+ }
+ }
+ }
+ });
}
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
+function buildFragment( args, nodes, scripts ) {
+ var fragment, cacheable, cacheresults,
+ doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
+
+ // Only cache "small" (1/2 KB) strings that are associated with the main document
+ // Cloning options loses the selected state, so don't cache them
+ // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
+ // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
+ if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
+ !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
+
+ cacheable = true;
+ cacheresults = jQuery.fragments[ args[0] ];
+ if ( cacheresults ) {
+ if ( cacheresults !== 1 ) {
+ fragment = cacheresults;
+ }
+ }
+ }
- var e = this.originalEvent;
- if( !e )
- return;
- // if preventDefault exists run it on the original event
- if (e.preventDefault)
- e.preventDefault();
- // otherwise set the returnValue property of the original event to false (IE)
- e.returnValue = false;
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
+ if ( !fragment ) {
+ fragment = doc.createDocumentFragment();
+ jQuery.clean( args, doc, fragment, scripts );
+ }
- var e = this.originalEvent;
- if( !e )
- return;
- // if stopPropagation exists run it on the original event
- if (e.stopPropagation)
- e.stopPropagation();
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation:function(){
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-// Checks if an event happened on an element within another element
-// Used in jQuery.event.special.mouseenter and mouseleave handlers
-var withinElement = function(event) {
- // Check if mouse(over|out) are still within the same parent element
- var parent = event.relatedTarget;
- // Traverse up the tree
- while ( parent && parent != this )
- try { parent = parent.parentNode; }
- catch(e) { parent = this; }
-
- if( parent != this ){
- // set the correct event type
- event.type = event.data;
- // handle event if we actually just moused on to a non sub-element
- jQuery.event.handle.apply( this, arguments );
+ if ( cacheable ) {
+ jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
}
-};
+
+ return { fragment: fragment, cacheable: cacheable };
+}
+
+jQuery.fragments = {};
jQuery.each({
- mouseover: 'mouseenter',
- mouseout: 'mouseleave'
-}, function( orig, fix ){
- jQuery.event.special[ fix ] = {
- setup: function(){
- jQuery.event.add( this, orig, withinElement, fix );
- },
- teardown: function(){
- jQuery.event.remove( this, orig, withinElement );
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = [], insert = jQuery( selector ),
+ parent = this.length === 1 && this[0].parentNode;
+
+ if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
+ insert[ original ]( this[0] );
+ return this;
+
+ } else {
+ for ( var i = 0, l = insert.length; i < l; i++ ) {
+ var elems = (i > 0 ? this.clone(true) : this).get();
+ jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
+ ret = ret.concat( elems );
+ }
+
+ return this.pushStack( ret, name, insert.selector );
}
};
});
-jQuery.fn.extend({
- bind: function( type, data, fn ) {
- return type == "unload" ? this.one(type, data, fn) : this.each(function(){
- jQuery.event.add( this, type, fn || data, fn && data );
- });
- },
+jQuery.extend({
+ clean: function( elems, context, fragment, scripts ) {
+ context = context || document;
- one: function( type, data, fn ) {
- var one = jQuery.event.proxy( fn || data, function(event) {
- jQuery(this).unbind(event, one);
- return (fn || data).apply( this, arguments );
- });
- return this.each(function(){
- jQuery.event.add( this, type, one, fn && data);
- });
- },
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if ( typeof context.createElement === "undefined" ) {
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+ }
- unbind: function( type, fn ) {
- return this.each(function(){
- jQuery.event.remove( this, type, fn );
- });
- },
+ var ret = [];
- trigger: function( type, data ) {
- return this.each(function(){
- jQuery.event.trigger( type, data, this );
- });
- },
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ if ( typeof elem === "number" ) {
+ elem += "";
+ }
- triggerHandler: function( type, data ) {
- if( this[0] ){
- var event = jQuery.Event(type);
- event.preventDefault();
- event.stopPropagation();
- jQuery.event.trigger( event, data, this[0] );
- return event.result;
- }
- },
+ if ( !elem ) {
+ continue;
+ }
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments, i = 1;
+ // Convert html string into DOM nodes
+ if ( typeof elem === "string" && !rhtml.test( elem ) ) {
+ elem = context.createTextNode( elem );
- // link all the functions, so any of them can unbind this click handler
- while( i < args.length )
- jQuery.event.proxy( fn, args[i++] );
+ } else if ( typeof elem === "string" ) {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(rxhtmlTag, fcloseTag);
- return this.click( jQuery.event.proxy( fn, function(event) {
- // Figure out which function to execute
- this.lastToggle = ( this.lastToggle || 0 ) % i;
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
+ wrap = wrapMap[ tag ] || wrapMap._default,
+ depth = wrap[0],
+ div = context.createElement("div");
- // Make sure that clicks stop
- event.preventDefault();
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
- // and execute the function
- return args[ this.lastToggle++ ].apply( this, arguments ) || false;
- }));
- },
+ // Move to the right depth
+ while ( depth-- ) {
+ div = div.lastChild;
+ }
- hover: function(fnOver, fnOut) {
- return this.mouseenter(fnOver).mouseleave(fnOut);
- },
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
- ready: function(fn) {
- // Attach the listeners
- bindReady();
+ // String was a <table>, *may* have spurious <tbody>
+ var hasBody = rtbody.test(elem),
+ tbody = tag === "table" && !hasBody ?
+ div.firstChild && div.firstChild.childNodes :
- // If the DOM is already ready
- if ( jQuery.isReady )
- // Execute the function immediately
- fn.call( document, jQuery );
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !hasBody ?
+ div.childNodes :
+ [];
- // Otherwise, remember the function for later
- else
- // Add the function to the wait list
- jQuery.readyList.push( fn );
+ for ( var j = tbody.length - 1; j >= 0 ; --j ) {
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+ }
+ }
- return this;
- },
+ }
- live: function( type, fn ){
- var proxy = jQuery.event.proxy( fn );
- proxy.guid += this.selector + type;
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
+ }
- jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
+ elem = div.childNodes;
+ }
- return this;
+ if ( elem.nodeType ) {
+ ret.push( elem );
+ } else {
+ ret = jQuery.merge( ret, elem );
+ }
+ }
+
+ if ( fragment ) {
+ for ( var i = 0; ret[i]; i++ ) {
+ if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
+ scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
+
+ } else {
+ if ( ret[i].nodeType === 1 ) {
+ ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
+ }
+ fragment.appendChild( ret[i] );
+ }
+ }
+ }
+
+ return ret;
},
+
+ cleanData: function( elems ) {
+ var data, id, cache = jQuery.cache,
+ special = jQuery.event.special,
+ deleteExpando = jQuery.support.deleteExpando;
+
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ id = elem[ jQuery.expando ];
+
+ if ( id ) {
+ data = cache[ id ];
+
+ if ( data.events ) {
+ for ( var type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ } else {
+ removeEvent( elem, type, data.handle );
+ }
+ }
+ }
+
+ if ( deleteExpando ) {
+ delete elem[ jQuery.expando ];
- die: function( type, fn ){
- jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
- return this;
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( jQuery.expando );
+ }
+
+ delete cache[ id ];
+ }
+ }
}
});
+// exclude the following css properties to add px
+var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+ ralpha = /alpha\([^)]*\)/,
+ ropacity = /opacity=([^)]*)/,
+ rfloat = /float/i,
+ rdashAlpha = /-([a-z])/ig,
+ rupper = /([A-Z])/g,
+ rnumpx = /^-?\d+(?:px)?$/i,
+ rnum = /^-?\d/,
+
+ cssShow = { position: "absolute", visibility: "hidden", display:"block" },
+ cssWidth = [ "Left", "Right" ],
+ cssHeight = [ "Top", "Bottom" ],
+
+ // cache check for defaultView.getComputedStyle
+ getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
+ // normalize float css property
+ styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat",
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ };
-function liveHandler( event ){
- var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
- stop = true,
- elems = [];
-
- jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
- if ( check.test(fn.type) ) {
- var elem = jQuery(event.target).closest(fn.data)[0];
- if ( elem )
- elems.push({ elem: elem, fn: fn });
+jQuery.fn.css = function( name, value ) {
+ return access( this, name, value, true, function( elem, name, value ) {
+ if ( value === undefined ) {
+ return jQuery.curCSS( elem, name );
+ }
+
+ if ( typeof value === "number" && !rexclude.test(name) ) {
+ value += "px";
}
- });
-
- elems.sort(function(a,b) {
- return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
- });
- jQuery.each(elems, function(){
- if ( this.fn.call(this.elem, event, this.fn.data) === false )
- return (stop = false);
+ jQuery.style( elem, name, value );
});
+};
- return stop;
-}
+jQuery.extend({
+ style: function( elem, name, value ) {
+ // don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return undefined;
+ }
-function liveConvert(type, selector){
- return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
-}
+ // ignore negative width and height values #1599
+ if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) {
+ value = undefined;
+ }
-jQuery.extend({
- isReady: false,
- readyList: [],
- // Handle when the DOM is ready
- ready: function() {
- // Make sure that the DOM is not already loaded
- if ( !jQuery.isReady ) {
- // Remember that the DOM is ready
- jQuery.isReady = true;
+ var style = elem.style || elem, set = value !== undefined;
- // If there are functions bound, to execute
- if ( jQuery.readyList ) {
- // Execute all of them
- jQuery.each( jQuery.readyList, function(){
- this.call( document, jQuery );
- });
+ // IE uses filters for opacity
+ if ( !jQuery.support.opacity && name === "opacity" ) {
+ if ( set ) {
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
- // Reset the list of functions
- jQuery.readyList = null;
+ // Set the alpha filter to set the opacity
+ var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
+ var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
+ style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
}
- // Trigger any bound ready events
- jQuery(document).triggerHandler("ready");
+ return style.filter && style.filter.indexOf("opacity=") >= 0 ?
+ (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
+ "";
}
- }
-});
-var readyBound = false;
+ // Make sure we're using the right name for getting the float value
+ if ( rfloat.test( name ) ) {
+ name = styleFloat;
+ }
-function bindReady(){
- if ( readyBound ) return;
- readyBound = true;
+ name = name.replace(rdashAlpha, fcamelCase);
- // Mozilla, Opera and webkit nightlies currently support this event
- if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", function(){
- document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
- jQuery.ready();
- }, false );
+ if ( set ) {
+ style[ name ] = value;
+ }
- // If IE event model is used
- } else if ( document.attachEvent ) {
- // ensure firing before onload,
- // maybe late but safe also for iframes
- document.attachEvent("onreadystatechange", function(){
- if ( document.readyState === "complete" ) {
- document.detachEvent( "onreadystatechange", arguments.callee );
- jQuery.ready();
- }
- });
+ return style[ name ];
+ },
- // If IE and not an iframe
- // continually check to see if the document is ready
- if ( document.documentElement.doScroll && window == window.top ) (function(){
- if ( jQuery.isReady ) return;
+ css: function( elem, name, force, extra ) {
+ if ( name === "width" || name === "height" ) {
+ var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight;
- try {
- // If IE is used, use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- document.documentElement.doScroll("left");
- } catch( error ) {
- setTimeout( arguments.callee, 0 );
- return;
+ function getWH() {
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
+
+ if ( extra === "border" ) {
+ return;
+ }
+
+ jQuery.each( which, function() {
+ if ( !extra ) {
+ val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+ }
+
+ if ( extra === "margin" ) {
+ val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
+ } else {
+ val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+ }
+ });
}
- // and execute any waiting functions
- jQuery.ready();
- })();
- }
+ if ( elem.offsetWidth !== 0 ) {
+ getWH();
+ } else {
+ jQuery.swap( elem, props, getWH );
+ }
- // A fallback to window.onload, that will always work
- jQuery.event.add( window, "load", jQuery.ready );
-}
+ return Math.max(0, Math.round(val));
+ }
-jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
- "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
- "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
+ return jQuery.curCSS( elem, name, force );
+ },
- // Handle event binding
- jQuery.fn[name] = function(fn){
- return fn ? this.bind(name, fn) : this.trigger(name);
- };
-});
+ curCSS: function( elem, name, force ) {
+ var ret, style = elem.style, filter;
-// Prevent memory leaks in IE
-// And prevent errors on refresh with events like mouseover in other browsers
-// Window isn't included so as not to unbind existing unload events
-jQuery( window ).bind( 'unload', function(){
- for ( var id in jQuery.cache )
- // Skip the window
- if ( id != 1 && jQuery.cache[ id ].handle )
- jQuery.event.remove( jQuery.cache[ id ].handle.elem );
-});
-(function(){
+ // IE uses filters for opacity
+ if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) {
+ ret = ropacity.test(elem.currentStyle.filter || "") ?
+ (parseFloat(RegExp.$1) / 100) + "" :
+ "";
- jQuery.support = {};
+ return ret === "" ?
+ "1" :
+ ret;
+ }
- var root = document.documentElement,
- script = document.createElement("script"),
- div = document.createElement("div"),
- id = "script" + (new Date).getTime();
+ // Make sure we're using the right name for getting the float value
+ if ( rfloat.test( name ) ) {
+ name = styleFloat;
+ }
- div.style.display = "none";
- div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
+ if ( !force && style && style[ name ] ) {
+ ret = style[ name ];
- var all = div.getElementsByTagName("*"),
- a = div.getElementsByTagName("a")[0];
+ } else if ( getComputedStyle ) {
- // Can't get basic test support
- if ( !all || !all.length || !a ) {
- return;
- }
+ // Only "float" is needed here
+ if ( rfloat.test( name ) ) {
+ name = "float";
+ }
- jQuery.support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: div.firstChild.nodeType == 3,
+ name = name.replace( rupper, "-$1" ).toLowerCase();
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName("tbody").length,
+ var defaultView = elem.ownerDocument.defaultView;
- // Make sure that you can get all elements in an <object> element
- // IE 7 always returns no results
- objectAll: !!div.getElementsByTagName("object")[0]
- .getElementsByTagName("*").length,
+ if ( !defaultView ) {
+ return null;
+ }
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName("link").length,
+ var computedStyle = defaultView.getComputedStyle( elem, null );
- // Get the style information from getAttribute
- // (IE uses .cssText insted)
- style: /red/.test( a.getAttribute("style") ),
+ if ( computedStyle ) {
+ ret = computedStyle.getPropertyValue( name );
+ }
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: a.getAttribute("href") === "/a",
+ // We should always get a number back from opacity
+ if ( name === "opacity" && ret === "" ) {
+ ret = "1";
+ }
- // Make sure that element opacity exists
- // (IE uses filter instead)
- opacity: a.style.opacity === "0.5",
+ } else if ( elem.currentStyle ) {
+ var camelCase = name.replace(rdashAlpha, fcamelCase);
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
+ ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
- // Will be defined later
- scriptEval: false,
- noCloneEvent: true,
- boxModel: null
- };
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
- script.type = "text/javascript";
- try {
- script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
- } catch(e){}
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
+ // Remember the original values
+ var left = style.left, rsLeft = elem.runtimeStyle.left;
- root.insertBefore( script, root.firstChild );
+ // Put in the new values to get a computed value out
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ style.left = camelCase === "fontSize" ? "1em" : (ret || 0);
+ ret = style.pixelLeft + "px";
- // Make sure that the execution of code works by injecting a script
- // tag with appendChild/createTextNode
- // (IE doesn't support this, fails, and uses .text instead)
- if ( window[ id ] ) {
- jQuery.support.scriptEval = true;
- delete window[ id ];
- }
+ // Revert the changed values
+ style.left = left;
+ elem.runtimeStyle.left = rsLeft;
+ }
+ }
- root.removeChild( script );
+ return ret;
+ },
- if ( div.attachEvent && div.fireEvent ) {
- div.attachEvent("onclick", function(){
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- jQuery.support.noCloneEvent = false;
- div.detachEvent("onclick", arguments.callee);
- });
- div.cloneNode(true).fireEvent("onclick");
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( var name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ callback.call( elem );
+
+ // Revert the old values
+ for ( var name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
}
+});
- // Figure out if the W3C box model works as expected
- // document.body must exist before we can do this
- jQuery(function(){
- var div = document.createElement("div");
- div.style.width = div.style.paddingLeft = "1px";
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ var width = elem.offsetWidth, height = elem.offsetHeight,
+ skip = elem.nodeName.toLowerCase() === "tr";
- document.body.appendChild( div );
- jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
- document.body.removeChild( div ).style.display = 'none';
- });
-})();
+ return width === 0 && height === 0 && !skip ?
+ true :
+ width > 0 && height > 0 && !skip ?
+ false :
+ jQuery.curCSS(elem, "display") === "none";
+ };
-var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+var jsc = now(),
+ rscript = /<script(.|\s)*?\/script>/gi,
+ rselectTextarea = /select|textarea/i,
+ rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,
+ jsre = /=\?(&|$)/,
+ rquery = /\?/,
+ rts = /(\?|&)_=.*?(&|$)/,
+ rurl = /^(\w+:)?\/\/([^\/?#]+)/,
+ r20 = /%20/g,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load;
-jQuery.props = {
- "for": "htmlFor",
- "class": "className",
- "float": styleFloat,
- cssFloat: styleFloat,
- styleFloat: styleFloat,
- readonly: "readOnly",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- rowspan: "rowSpan",
- tabindex: "tabIndex"
-};
jQuery.fn.extend({
- // Keep a copy of the old load
- _load: jQuery.fn.load,
-
load: function( url, params, callback ) {
- if ( typeof url !== "string" )
- return this._load( url );
+ if ( typeof url !== "string" ) {
+ return _load.call( this, url );
+
+ // Don't do a request if no elements are being requested
+ } else if ( !this.length ) {
+ return this;
+ }
var off = url.indexOf(" ");
if ( off >= 0 ) {
@@ -3242,7 +4801,7 @@ jQuery.fn.extend({
var type = "GET";
// If the second parameter was provided
- if ( params )
+ if ( params ) {
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
@@ -3250,10 +4809,11 @@ jQuery.fn.extend({
params = null;
// Otherwise, build a param string
- } else if( typeof params === "object" ) {
- params = jQuery.param( params );
+ } else if ( typeof params === "object" ) {
+ params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
+ }
var self = this;
@@ -3263,27 +4823,30 @@ jQuery.fn.extend({
type: type,
dataType: "html",
data: params,
- complete: function(res, status){
+ complete: function( res, status ) {
// If successful, inject the HTML into all the matched elements
- if ( status == "success" || status == "notmodified" )
+ if ( status === "success" || status === "notmodified" ) {
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
- jQuery("<div/>")
+ jQuery("<div />")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
- .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
+ .append(res.responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
res.responseText );
+ }
- if( callback )
+ if ( callback ) {
self.each( callback, [res.responseText, status, res] );
+ }
}
});
+
return this;
},
@@ -3291,40 +4854,41 @@ jQuery.fn.extend({
return jQuery.param(this.serializeArray());
},
serializeArray: function() {
- return this.map(function(){
+ return this.map(function() {
return this.elements ? jQuery.makeArray(this.elements) : this;
})
- .filter(function(){
+ .filter(function() {
return this.name && !this.disabled &&
- (this.checked || /select|textarea/i.test(this.nodeName) ||
- /text|hidden|password|search/i.test(this.type));
+ (this.checked || rselectTextarea.test(this.nodeName) ||
+ rinput.test(this.type));
})
- .map(function(i, elem){
+ .map(function( i, elem ) {
var val = jQuery(this).val();
- return val == null ? null :
+
+ return val == null ?
+ null :
jQuery.isArray(val) ?
- jQuery.map( val, function(val, i){
- return {name: elem.name, value: val};
+ jQuery.map( val, function( val, i ) {
+ return { name: elem.name, value: val };
}) :
- {name: elem.name, value: val};
+ { name: elem.name, value: val };
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
-jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
- jQuery.fn[o] = function(f){
+jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
+ jQuery.fn[o] = function( f ) {
return this.bind(o, f);
};
});
-var jsc = now();
-
jQuery.extend({
get: function( url, data, callback, type ) {
- // shift arguments if data argument was ommited
+ // shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
callback = data;
data = null;
}
@@ -3347,7 +4911,9 @@ jQuery.extend({
},
post: function( url, data, callback, type ) {
+ // shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
callback = data;
data = {};
}
@@ -3377,13 +4943,21 @@ jQuery.extend({
data: null,
username: null,
password: null,
+ traditional: false,
*/
// Create the request object; Microsoft failed to properly
- // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+ // implement the XMLHttpRequest in IE7 (can't request local files),
+ // so we use the ActiveXObject when it is available
// This function can be overriden by calling jQuery.ajaxSetup
- xhr:function(){
- return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
- },
+ xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
+ function() {
+ return new window.XMLHttpRequest();
+ } :
+ function() {
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch(e) {}
+ },
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
@@ -3396,36 +4970,41 @@ jQuery.extend({
// Last-Modified header cache for next request
lastModified: {},
+ etag: {},
- ajax: function( s ) {
- // Extend the settings, but re-extend 's' so that it can be
- // checked again later (in the test suite, specifically)
- s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
-
- var jsonp, jsre = /=\?(&|$)/g, status, data,
+ ajax: function( origSettings ) {
+ var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
+
+ var jsonp, status, data,
+ callbackContext = origSettings && origSettings.context || s,
type = s.type.toUpperCase();
// convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" )
- s.data = jQuery.param(s.data);
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
// Handle JSONP Parameter Callbacks
- if ( s.dataType == "jsonp" ) {
- if ( type == "GET" ) {
- if ( !s.url.match(jsre) )
- s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
- } else if ( !s.data || !s.data.match(jsre) )
+ if ( s.dataType === "jsonp" ) {
+ if ( type === "GET" ) {
+ if ( !jsre.test( s.url ) ) {
+ s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+ }
+ } else if ( !s.data || !jsre.test(s.data) ) {
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+ }
s.dataType = "json";
}
// Build temporary JSONP function
- if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
- jsonp = "jsonp" + jsc++;
+ if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
+ jsonp = s.jsonpCallback || ("jsonp" + jsc++);
// Replace the =? sequence both in the query string and the data
- if ( s.data )
+ if ( s.data ) {
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+ }
+
s.url = s.url.replace(jsre, "=" + jsonp + "$1");
// We need to make sure
@@ -3433,75 +5012,85 @@ jQuery.extend({
s.dataType = "script";
// Handle JSONP-style loading
- window[ jsonp ] = function(tmp){
+ window[ jsonp ] = window[ jsonp ] || function( tmp ) {
data = tmp;
success();
complete();
// Garbage collect
window[ jsonp ] = undefined;
- try{ delete window[ jsonp ]; } catch(e){}
- if ( head )
+
+ try {
+ delete window[ jsonp ];
+ } catch(e) {}
+
+ if ( head ) {
head.removeChild( script );
+ }
};
}
- if ( s.dataType == "script" && s.cache == null )
+ if ( s.dataType === "script" && s.cache === null ) {
s.cache = false;
+ }
- if ( s.cache === false && type == "GET" ) {
+ if ( s.cache === false && type === "GET" ) {
var ts = now();
+
// try replacing _= if it is there
- var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
+ var ret = s.url.replace(rts, "$1_=" + ts + "$2");
+
// if nothing was replaced, add timestamp to the end
- s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
+ s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
}
// If data is available, append data to url for get requests
- if ( s.data && type == "GET" ) {
- s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
-
- // IE likes to send both get and post data, prevent this
- s.data = null;
+ if ( s.data && type === "GET" ) {
+ s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
}
// Watch for a new set of requests
- if ( s.global && ! jQuery.active++ )
+ if ( s.global && ! jQuery.active++ ) {
jQuery.event.trigger( "ajaxStart" );
+ }
// Matches an absolute URL, and saves the domain
- var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
+ var parts = rurl.exec( s.url ),
+ remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
// If we're requesting a remote document
// and trying to load JSON or Script with a GET
- if ( s.dataType == "script" && type == "GET" && parts
- && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
-
- var head = document.getElementsByTagName("head")[0];
+ if ( s.dataType === "script" && type === "GET" && remote ) {
+ var head = document.getElementsByTagName("head")[0] || document.documentElement;
var script = document.createElement("script");
script.src = s.url;
- if (s.scriptCharset)
+ if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
+ }
// Handle Script loading
if ( !jsonp ) {
var done = false;
// Attach handlers for all browsers
- script.onload = script.onreadystatechange = function(){
+ script.onload = script.onreadystatechange = function() {
if ( !done && (!this.readyState ||
- this.readyState == "loaded" || this.readyState == "complete") ) {
+ this.readyState === "loaded" || this.readyState === "complete") ) {
done = true;
success();
complete();
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
- head.removeChild( script );
+ if ( head && script.parentNode ) {
+ head.removeChild( script );
+ }
}
};
}
- head.appendChild(script);
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709 and #4378).
+ head.insertBefore( script, head.firstChild );
// We handle everything using the script element injection
return undefined;
@@ -3512,158 +5101,197 @@ jQuery.extend({
// Create the request object
var xhr = s.xhr();
+ if ( !xhr ) {
+ return;
+ }
+
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
- if( s.username )
+ if ( s.username ) {
xhr.open(type, s.url, s.async, s.username, s.password);
- else
+ } else {
xhr.open(type, s.url, s.async);
+ }
// Need an extra try/catch for cross domain requests in Firefox 3
try {
// Set the correct header, if data is being sent
- if ( s.data )
+ if ( s.data || origSettings && origSettings.contentType ) {
xhr.setRequestHeader("Content-Type", s.contentType);
+ }
- // Set the If-Modified-Since header, if ifModified mode.
- if ( s.ifModified )
- xhr.setRequestHeader("If-Modified-Since",
- jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[s.url] ) {
+ xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
+ }
+
+ if ( jQuery.etag[s.url] ) {
+ xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
+ }
+ }
// Set header so the called script knows that it's an XMLHttpRequest
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ // Only send the header if it's not a remote XHR
+ if ( !remote ) {
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ }
// Set the Accepts header for the server, depending on the dataType
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
s.accepts[ s.dataType ] + ", */*" :
s.accepts._default );
- } catch(e){}
+ } catch(e) {}
// Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
+ if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) {
// Handle the global AJAX counter
- if ( s.global && ! --jQuery.active )
+ if ( s.global && ! --jQuery.active ) {
jQuery.event.trigger( "ajaxStop" );
+ }
+
// close opended socket
xhr.abort();
return false;
}
- if ( s.global )
- jQuery.event.trigger("ajaxSend", [xhr, s]);
+ if ( s.global ) {
+ trigger("ajaxSend", [xhr, s]);
+ }
// Wait for a response to come back
- var onreadystatechange = function(isTimeout){
- // The request was aborted, clear the interval and decrement jQuery.active
- if (xhr.readyState == 0) {
- if (ival) {
- // clear poll interval
- clearInterval(ival);
- ival = null;
- // Handle the global AJAX counter
- if ( s.global && ! --jQuery.active )
- jQuery.event.trigger( "ajaxStop" );
+ var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
+ // The request was aborted
+ if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
+ // Opera doesn't call onreadystatechange before this point
+ // so we simulate the call
+ if ( !requestDone ) {
+ complete();
}
+
+ requestDone = true;
+ if ( xhr ) {
+ xhr.onreadystatechange = jQuery.noop;
+ }
+
// The transfer is complete and the data is available, or the request timed out
- } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
+ } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
requestDone = true;
+ xhr.onreadystatechange = jQuery.noop;
- // clear poll interval
- if (ival) {
- clearInterval(ival);
- ival = null;
- }
+ status = isTimeout === "timeout" ?
+ "timeout" :
+ !jQuery.httpSuccess( xhr ) ?
+ "error" :
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
+ "notmodified" :
+ "success";
- status = isTimeout == "timeout" ? "timeout" :
- !jQuery.httpSuccess( xhr ) ? "error" :
- s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
- "success";
+ var errMsg;
- if ( status == "success" ) {
+ if ( status === "success" ) {
// Watch for, and catch, XML document parse errors
try {
// process the data (runs the xml through httpData regardless of callback)
data = jQuery.httpData( xhr, s.dataType, s );
- } catch(e) {
+ } catch(err) {
status = "parsererror";
+ errMsg = err;
}
}
// Make sure that the request was successful or notmodified
- if ( status == "success" ) {
- // Cache Last-Modified header, if ifModified mode.
- var modRes;
- try {
- modRes = xhr.getResponseHeader("Last-Modified");
- } catch(e) {} // swallow exception thrown by FF if header is not available
-
- if ( s.ifModified && modRes )
- jQuery.lastModified[s.url] = modRes;
-
+ if ( status === "success" || status === "notmodified" ) {
// JSONP handles its own success callback
- if ( !jsonp )
+ if ( !jsonp ) {
success();
- } else
- jQuery.handleError(s, xhr, status);
+ }
+ } else {
+ jQuery.handleError(s, xhr, status, errMsg);
+ }
// Fire the complete handlers
complete();
- if ( isTimeout )
+ if ( isTimeout === "timeout" ) {
xhr.abort();
+ }
// Stop memory leaks
- if ( s.async )
+ if ( s.async ) {
xhr = null;
+ }
}
};
- if ( s.async ) {
- // don't attach the handler to the request, just poll it instead
- var ival = setInterval(onreadystatechange, 13);
+ // Override the abort handler, if we can (IE doesn't allow it, but that's OK)
+ // Opera doesn't fire onreadystatechange at all on abort
+ try {
+ var oldAbort = xhr.abort;
+ xhr.abort = function() {
+ if ( xhr ) {
+ oldAbort.call( xhr );
+ }
- // Timeout checker
- if ( s.timeout > 0 )
- setTimeout(function(){
- // Check to see if the request is still happening
- if ( xhr && !requestDone )
- onreadystatechange( "timeout" );
- }, s.timeout);
+ onreadystatechange( "abort" );
+ };
+ } catch(e) { }
+
+ // Timeout checker
+ if ( s.async && s.timeout > 0 ) {
+ setTimeout(function() {
+ // Check to see if the request is still happening
+ if ( xhr && !requestDone ) {
+ onreadystatechange( "timeout" );
+ }
+ }, s.timeout);
}
// Send the data
try {
- xhr.send(s.data);
+ xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null );
} catch(e) {
jQuery.handleError(s, xhr, null, e);
+ // Fire the complete handlers
+ complete();
}
// firefox 1.5 doesn't fire statechange for sync requests
- if ( !s.async )
+ if ( !s.async ) {
onreadystatechange();
+ }
- function success(){
+ function success() {
// If a local callback was specified, fire it and pass it the data
- if ( s.success )
- s.success( data, status );
+ if ( s.success ) {
+ s.success.call( callbackContext, data, status, xhr );
+ }
// Fire the global callback
- if ( s.global )
- jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
+ if ( s.global ) {
+ trigger( "ajaxSuccess", [xhr, s] );
+ }
}
- function complete(){
+ function complete() {
// Process result
- if ( s.complete )
- s.complete(xhr, status);
+ if ( s.complete ) {
+ s.complete.call( callbackContext, xhr, status);
+ }
// The request was completed
- if ( s.global )
- jQuery.event.trigger( "ajaxComplete", [xhr, s] );
+ if ( s.global ) {
+ trigger( "ajaxComplete", [xhr, s] );
+ }
// Handle the global AJAX counter
- if ( s.global && ! --jQuery.active )
+ if ( s.global && ! --jQuery.active ) {
jQuery.event.trigger( "ajaxStop" );
+ }
+ }
+
+ function trigger(type, args) {
+ (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
}
// return XMLHttpRequest to allow aborting the request etc.
@@ -3672,11 +5300,14 @@ jQuery.extend({
handleError: function( s, xhr, status, e ) {
// If a local callback was specified, fire it
- if ( s.error ) s.error( xhr, status, e );
+ if ( s.error ) {
+ s.error.call( s.context || s, xhr, status, e );
+ }
// Fire the global callback
- if ( s.global )
- jQuery.event.trigger( "ajaxError", [xhr, s, e] );
+ if ( s.global ) {
+ (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
+ }
},
// Counter for holding the number of active queries
@@ -3686,46 +5317,57 @@ jQuery.extend({
httpSuccess: function( xhr ) {
try {
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
- return !xhr.status && location.protocol == "file:" ||
- ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
- } catch(e){}
+ return !xhr.status && location.protocol === "file:" ||
+ // Opera returns 0 when status is 304
+ ( xhr.status >= 200 && xhr.status < 300 ) ||
+ xhr.status === 304 || xhr.status === 1223 || xhr.status === 0;
+ } catch(e) {}
+
return false;
},
// Determines if an XMLHttpRequest returns NotModified
httpNotModified: function( xhr, url ) {
- try {
- var xhrRes = xhr.getResponseHeader("Last-Modified");
+ var lastModified = xhr.getResponseHeader("Last-Modified"),
+ etag = xhr.getResponseHeader("Etag");
- // Firefox always returns 200. check Last-Modified date
- return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
- } catch(e){}
- return false;
+ if ( lastModified ) {
+ jQuery.lastModified[url] = lastModified;
+ }
+
+ if ( etag ) {
+ jQuery.etag[url] = etag;
+ }
+
+ // Opera returns 0 when status is 304
+ return xhr.status === 304 || xhr.status === 0;
},
httpData: function( xhr, type, s ) {
- var ct = xhr.getResponseHeader("content-type"),
- xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
+ var ct = xhr.getResponseHeader("content-type") || "",
+ xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
data = xml ? xhr.responseXML : xhr.responseText;
- if ( xml && data.documentElement.tagName == "parsererror" )
- throw "parsererror";
+ if ( xml && data.documentElement.nodeName === "parsererror" ) {
+ jQuery.error( "parsererror" );
+ }
// Allow a pre-filtering function to sanitize the response
- // s != null is checked to keep backwards compatibility
- if( s && s.dataFilter )
+ // s is checked to keep backwards compatibility
+ if ( s && s.dataFilter ) {
data = s.dataFilter( data, type );
+ }
// The filter can actually parse the response
- if( typeof data === "string" ){
+ if ( typeof data === "string" ) {
+ // Get the JavaScript object, if JSON is used.
+ if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
+ data = jQuery.parseJSON( data );
// If the type is "script", eval it in global context
- if ( type == "script" )
+ } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
jQuery.globalEval( data );
-
- // Get the JavaScript object, if JSON is used.
- if ( type == "json" )
- data = window["eval"]("(" + data + ")");
+ }
}
return data;
@@ -3733,39 +5375,73 @@ jQuery.extend({
// Serialize an array of form elements or a set of
// key/values into a query string
- param: function( a ) {
- var s = [ ];
-
- function add( key, value ){
- s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
- };
-
- // If an array was passed in, assume that it is an array
- // of form elements
- if ( jQuery.isArray(a) || a.jquery )
+ param: function( a, traditional ) {
+ var s = [];
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray(a) || a.jquery ) {
// Serialize the form elements
- jQuery.each( a, function(){
+ jQuery.each( a, function() {
add( this.name, this.value );
});
-
- // Otherwise, assume that it's an object of key/value pairs
- else
- // Serialize the key/values
- for ( var j in a )
- // If the value is an array then the key names need to be repeated
- if ( jQuery.isArray(a[j]) )
- jQuery.each( a[j], function(){
- add( j, this );
- });
- else
- add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( var prefix in a ) {
+ buildParams( prefix, a[prefix] );
+ }
+ }
// Return the resulting serialization
- return s.join("&").replace(/%20/g, "+");
- }
+ return s.join("&").replace(r20, "+");
+
+ function buildParams( prefix, obj ) {
+ if ( jQuery.isArray(obj) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || /\[\]$/.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+ } else {
+ // If array item is non-scalar (array or object), encode its
+ // numeric index to resolve deserialization ambiguity issues.
+ // Note that rack (as of 1.0.0) can't currently deserialize
+ // nested arrays properly, and attempting to do so may cause
+ // a server error. Possible fixes are to modify rack's
+ // deserialization algorithm or to provide an option or flag
+ // to force array serialization to be shallow.
+ buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
+ }
+ });
+
+ } else if ( !traditional && obj != null && typeof obj === "object" ) {
+ // Serialize object item.
+ jQuery.each( obj, function( k, v ) {
+ buildParams( prefix + "[" + k + "]", v );
+ });
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+ }
+ function add( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction(value) ? value() : value;
+ s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
+ }
+ }
});
var elemdisplay = {},
+ rfxtypes = /toggle|show|hide/,
+ rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/,
timerId,
fxAttrs = [
// height animations
@@ -3776,39 +5452,35 @@ var elemdisplay = {},
[ "opacity" ]
];
-function genFx( type, num ){
- var obj = {};
- jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
- obj[ this ] = type;
- });
- return obj;
-}
-
jQuery.fn.extend({
- show: function(speed,callback){
- if ( speed ) {
+ show: function( speed, callback ) {
+ if ( speed || speed === 0) {
return this.animate( genFx("show", 3), speed, callback);
+
} else {
- for ( var i = 0, l = this.length; i < l; i++ ){
+ for ( var i = 0, l = this.length; i < l; i++ ) {
var old = jQuery.data(this[i], "olddisplay");
this[i].style.display = old || "";
if ( jQuery.css(this[i], "display") === "none" ) {
- var tagName = this[i].tagName, display;
+ var nodeName = this[i].nodeName, display;
+
+ if ( elemdisplay[ nodeName ] ) {
+ display = elemdisplay[ nodeName ];
- if ( elemdisplay[ tagName ] ) {
- display = elemdisplay[ tagName ];
} else {
- var elem = jQuery("<" + tagName + " />").appendTo("body");
+ var elem = jQuery("<" + nodeName + " />").appendTo("body");
display = elem.css("display");
- if ( display === "none" )
+
+ if ( display === "none" ) {
display = "block";
+ }
elem.remove();
- elemdisplay[ tagName ] = display;
+ elemdisplay[ nodeName ] = display;
}
jQuery.data(this[i], "olddisplay", display);
@@ -3817,28 +5489,30 @@ jQuery.fn.extend({
// Set the display of the elements in a second loop
// to avoid the constant reflow
- for ( var i = 0, l = this.length; i < l; i++ ){
- this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
+ for ( var j = 0, k = this.length; j < k; j++ ) {
+ this[j].style.display = jQuery.data(this[j], "olddisplay") || "";
}
return this;
}
},
- hide: function(speed,callback){
- if ( speed ) {
+ hide: function( speed, callback ) {
+ if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, callback);
+
} else {
- for ( var i = 0, l = this.length; i < l; i++ ){
+ for ( var i = 0, l = this.length; i < l; i++ ) {
var old = jQuery.data(this[i], "olddisplay");
- if ( !old && old !== "none" )
+ if ( !old && old !== "none" ) {
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
+ }
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
- for ( var i = 0, l = this.length; i < l; i++ ){
- this[i].style.display = "none";
+ for ( var j = 0, k = this.length; j < k; j++ ) {
+ this[j].style.display = "none";
}
return this;
@@ -3848,77 +5522,107 @@ jQuery.fn.extend({
// Save the old toggle function
_toggle: jQuery.fn.toggle,
- toggle: function( fn, fn2 ){
+ toggle: function( fn, fn2 ) {
var bool = typeof fn === "boolean";
- return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
- this._toggle.apply( this, arguments ) :
- fn == null || bool ?
- this.each(function(){
- var state = bool ? fn : jQuery(this).is(":hidden");
- jQuery(this)[ state ? "show" : "hide" ]();
- }) :
- this.animate(genFx("toggle", 3), fn, fn2);
+ if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
+ this._toggle.apply( this, arguments );
+
+ } else if ( fn == null || bool ) {
+ this.each(function() {
+ var state = bool ? fn : jQuery(this).is(":hidden");
+ jQuery(this)[ state ? "show" : "hide" ]();
+ });
+
+ } else {
+ this.animate(genFx("toggle", 3), fn, fn2);
+ }
+
+ return this;
},
- fadeTo: function(speed,to,callback){
- return this.animate({opacity: to}, speed, callback);
+ fadeTo: function( speed, to, callback ) {
+ return this.filter(":hidden").css("opacity", 0).show().end()
+ .animate({opacity: to}, speed, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed(speed, easing, callback);
- return this[ optall.queue === false ? "each" : "queue" ](function(){
+ if ( jQuery.isEmptyObject( prop ) ) {
+ return this.each( optall.complete );
+ }
+ return this[ optall.queue === false ? "each" : "queue" ](function() {
var opt = jQuery.extend({}, optall), p,
- hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
+ hidden = this.nodeType === 1 && jQuery(this).is(":hidden"),
self = this;
for ( p in prop ) {
- if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
+ var name = p.replace(rdashAlpha, fcamelCase);
+
+ if ( p !== name ) {
+ prop[ name ] = prop[ p ];
+ delete prop[ p ];
+ p = name;
+ }
+
+ if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
return opt.complete.call(this);
+ }
- if ( ( p == "height" || p == "width" ) && this.style ) {
+ if ( ( p === "height" || p === "width" ) && this.style ) {
// Store display property
opt.display = jQuery.css(this, "display");
// Make sure that nothing sneaks out
opt.overflow = this.style.overflow;
}
+
+ if ( jQuery.isArray( prop[p] ) ) {
+ // Create (if needed) and add to specialEasing
+ (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
+ prop[p] = prop[p][0];
+ }
}
- if ( opt.overflow != null )
+ if ( opt.overflow != null ) {
this.style.overflow = "hidden";
+ }
opt.curAnim = jQuery.extend({}, prop);
- jQuery.each( prop, function(name, val){
+ jQuery.each( prop, function( name, val ) {
var e = new jQuery.fx( self, opt, name );
- if ( /toggle|show|hide/.test(val) )
- e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
- else {
- var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
+ if ( rfxtypes.test(val) ) {
+ e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+
+ } else {
+ var parts = rfxnum.exec(val),
start = e.cur(true) || 0;
if ( parts ) {
- var end = parseFloat(parts[2]),
+ var end = parseFloat( parts[2] ),
unit = parts[3] || "px";
// We need to compute starting value
- if ( unit != "px" ) {
+ if ( unit !== "px" ) {
self.style[ name ] = (end || 1) + unit;
start = ((end || 1) / e.cur(true)) * start;
self.style[ name ] = start + unit;
}
// If a +=/-= token was provided, we're doing a relative animation
- if ( parts[1] )
- end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
+ if ( parts[1] ) {
+ end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
+ }
e.custom( start, end, unit );
- } else
+
+ } else {
e.custom( start, val, "" );
+ }
}
});
@@ -3927,26 +5631,31 @@ jQuery.fn.extend({
});
},
- stop: function(clearQueue, gotoEnd){
+ stop: function( clearQueue, gotoEnd ) {
var timers = jQuery.timers;
- if (clearQueue)
+ if ( clearQueue ) {
this.queue([]);
+ }
- this.each(function(){
+ this.each(function() {
// go in reverse order so anything added to the queue during the loop is ignored
- for ( var i = timers.length - 1; i >= 0; i-- )
- if ( timers[i].elem == this ) {
- if (gotoEnd)
+ for ( var i = timers.length - 1; i >= 0; i-- ) {
+ if ( timers[i].elem === this ) {
+ if (gotoEnd) {
// force the next step to be the last
timers[i](true);
+ }
+
timers.splice(i, 1);
}
+ }
});
// start the next in the queue if the last step wasn't forced
- if (!gotoEnd)
+ if ( !gotoEnd ) {
this.dequeue();
+ }
return this;
}
@@ -3960,16 +5669,15 @@ jQuery.each({
slideToggle: genFx("toggle", 1),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" }
-}, function( name, props ){
- jQuery.fn[ name ] = function( speed, callback ){
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, callback ) {
return this.animate( props, speed, callback );
};
});
jQuery.extend({
-
- speed: function(speed, easing, fn) {
- var opt = typeof speed === "object" ? speed : {
+ speed: function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? speed : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
@@ -3981,11 +5689,13 @@ jQuery.extend({
// Queueing
opt.old = opt.complete;
- opt.complete = function(){
- if ( opt.queue !== false )
+ opt.complete = function() {
+ if ( opt.queue !== false ) {
jQuery(this).dequeue();
- if ( jQuery.isFunction( opt.old ) )
+ }
+ if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
+ }
};
return opt;
@@ -4002,42 +5712,45 @@ jQuery.extend({
timers: [],
- fx: function( elem, options, prop ){
+ fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
- if ( !options.orig )
+ if ( !options.orig ) {
options.orig = {};
+ }
}
});
jQuery.fx.prototype = {
-
// Simple function for setting a style value
- update: function(){
- if ( this.options.step )
+ update: function() {
+ if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
+ }
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
// Set display property to block for height/width animations
- if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
+ if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
this.elem.style.display = "block";
+ }
},
// Get the current size
- cur: function(force){
- if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
+ cur: function( force ) {
+ if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
return this.elem[ this.prop ];
+ }
var r = parseFloat(jQuery.css(this.elem, this.prop, force));
return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
},
// Start an animation from one number to another
- custom: function(from, to, unit){
+ custom: function( from, to, unit ) {
this.startTime = now();
this.start = from;
this.end = to;
@@ -4046,47 +5759,36 @@ jQuery.fx.prototype = {
this.pos = this.state = 0;
var self = this;
- function t(gotoEnd){
+ function t( gotoEnd ) {
return self.step(gotoEnd);
}
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval(function(){
- var timers = jQuery.timers;
-
- for ( var i = 0; i < timers.length; i++ )
- if ( !timers[i]() )
- timers.splice(i--, 1);
-
- if ( !timers.length ) {
- clearInterval( timerId );
- timerId = undefined;
- }
- }, 13);
+ timerId = setInterval(jQuery.fx.tick, 13);
}
},
// Simple 'show' function
- show: function(){
+ show: function() {
// Remember where we started, so that we can go back to it later
- this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any
// flash of content
- this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
+ this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
// Start by showing the element
- jQuery(this.elem).show();
+ jQuery( this.elem ).show();
},
// Simple 'hide' function
- hide: function(){
+ hide: function() {
// Remember where we started, so that we can go back to it later
- this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
@@ -4094,8 +5796,8 @@ jQuery.fx.prototype = {
},
// Each step of an animation
- step: function(gotoEnd){
- var t = now();
+ step: function( gotoEnd ) {
+ var t = now(), done = true;
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
this.now = this.end;
@@ -4104,10 +5806,11 @@ jQuery.fx.prototype = {
this.options.curAnim[ this.prop ] = true;
- var done = true;
- for ( var i in this.options.curAnim )
- if ( this.options.curAnim[i] !== true )
+ for ( var i in this.options.curAnim ) {
+ if ( this.options.curAnim[i] !== true ) {
done = false;
+ }
+ }
if ( done ) {
if ( this.options.display != null ) {
@@ -4115,31 +5818,40 @@ jQuery.fx.prototype = {
this.elem.style.overflow = this.options.overflow;
// Reset the display
- this.elem.style.display = this.options.display;
- if ( jQuery.css(this.elem, "display") == "none" )
+ var old = jQuery.data(this.elem, "olddisplay");
+ this.elem.style.display = old ? old : this.options.display;
+
+ if ( jQuery.css(this.elem, "display") === "none" ) {
this.elem.style.display = "block";
+ }
}
// Hide the element if the "hide" operation was done
- if ( this.options.hide )
+ if ( this.options.hide ) {
jQuery(this.elem).hide();
+ }
// Reset the properties, if the item has been hidden or shown
- if ( this.options.hide || this.options.show )
- for ( var p in this.options.curAnim )
- jQuery.attr(this.elem.style, p, this.options.orig[p]);
+ if ( this.options.hide || this.options.show ) {
+ for ( var p in this.options.curAnim ) {
+ jQuery.style(this.elem, p, this.options.orig[p]);
+ }
+ }
// Execute the complete function
this.options.complete.call( this.elem );
}
return false;
+
} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
// Perform the easing function, defaults to swing
- this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
+ var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
+ var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
+ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);
// Perform the next step of the animation
@@ -4148,232 +5860,381 @@ jQuery.fx.prototype = {
return true;
}
-
};
jQuery.extend( jQuery.fx, {
- speeds:{
+ tick: function() {
+ var timers = jQuery.timers;
+
+ for ( var i = 0; i < timers.length; i++ ) {
+ if ( !timers[i]() ) {
+ timers.splice(i--, 1);
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ },
+
+ stop: function() {
+ clearInterval( timerId );
+ timerId = null;
+ },
+
+ speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
- step: {
- opacity: function(fx){
- jQuery.attr(fx.elem.style, "opacity", fx.now);
+ step: {
+ opacity: function( fx ) {
+ jQuery.style(fx.elem, "opacity", fx.now);
},
- _default: function(fx){
- if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
- else
+ _default: function( fx ) {
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
+ fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
+ } else {
fx.elem[ fx.prop ] = fx.now;
+ }
}
}
});
-if ( document.documentElement["getBoundingClientRect"] )
- jQuery.fn.offset = function() {
- if ( !this[0] ) return { top: 0, left: 0 };
- if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
- var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+
+function genFx( type, num ) {
+ var obj = {};
+
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
+ obj[ this ] = type;
+ });
+
+ return obj;
+}
+if ( "getBoundingClientRect" in document.documentElement ) {
+ jQuery.fn.offset = function( options ) {
+ var elem = this[0];
+
+ if ( options ) {
+ return this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ if ( !elem || !elem.ownerDocument ) {
+ return null;
+ }
+
+ if ( elem === elem.ownerDocument.body ) {
+ return jQuery.offset.bodyOffset( elem );
+ }
+
+ var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement,
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
- top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
- left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
+ top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
+ left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
+
return { top: top, left: left };
};
-else
- jQuery.fn.offset = function() {
- if ( !this[0] ) return { top: 0, left: 0 };
- if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
- jQuery.offset.initialized || jQuery.offset.initialize();
- var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
+} else {
+ jQuery.fn.offset = function( options ) {
+ var elem = this[0];
+
+ if ( options ) {
+ return this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ if ( !elem || !elem.ownerDocument ) {
+ return null;
+ }
+
+ if ( elem === elem.ownerDocument.body ) {
+ return jQuery.offset.bodyOffset( elem );
+ }
+
+ jQuery.offset.initialize();
+
+ var offsetParent = elem.offsetParent, prevOffsetParent = elem,
doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
body = doc.body, defaultView = doc.defaultView,
- prevComputedStyle = defaultView.getComputedStyle(elem, null),
+ prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop, left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
- computedStyle = defaultView.getComputedStyle(elem, null);
- top -= elem.scrollTop, left -= elem.scrollLeft;
+ if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
+ break;
+ }
+
+ computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
+ top -= elem.scrollTop;
+ left -= elem.scrollLeft;
+
if ( elem === offsetParent ) {
- top += elem.offsetTop, left += elem.offsetLeft;
- if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
- top += parseInt( computedStyle.borderTopWidth, 10) || 0,
- left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
+ top += elem.offsetTop;
+ left += elem.offsetLeft;
+
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
}
- if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
- top += parseInt( computedStyle.borderTopWidth, 10) || 0,
- left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
+
+ if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
prevComputedStyle = computedStyle;
}
- if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
- top += body.offsetTop,
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
+ top += body.offsetTop;
left += body.offsetLeft;
+ }
- if ( prevComputedStyle.position === "fixed" )
- top += Math.max(docElem.scrollTop, body.scrollTop),
- left += Math.max(docElem.scrollLeft, body.scrollLeft);
+ if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
+ top += Math.max( docElem.scrollTop, body.scrollTop );
+ left += Math.max( docElem.scrollLeft, body.scrollLeft );
+ }
return { top: top, left: left };
};
+}
jQuery.offset = {
initialize: function() {
- if ( this.initialized ) return;
- var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
- html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
+ var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0,
+ html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
- rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
- for ( prop in rules ) container.style[prop] = rules[prop];
+ jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
container.innerHTML = html;
- body.insertBefore(container, body.firstChild);
- innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
+ body.insertBefore( container, body.firstChild );
+ innerDiv = container.firstChild;
+ checkDiv = innerDiv.firstChild;
+ td = innerDiv.nextSibling.firstChild.firstChild;
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
- innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
+ checkDiv.style.position = "fixed", checkDiv.style.top = "20px";
+ // safari subtracts parent border width here which is 5px
+ this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
+ checkDiv.style.position = checkDiv.style.top = "";
+
+ innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative";
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
- body.style.marginTop = '1px';
- this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
- body.style.marginTop = bodyMarginTop;
+ this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
- body.removeChild(container);
- this.initialized = true;
+ body.removeChild( container );
+ body = container = innerDiv = checkDiv = table = td = null;
+ jQuery.offset.initialize = jQuery.noop;
},
- bodyOffset: function(body) {
- jQuery.offset.initialized || jQuery.offset.initialize();
+ bodyOffset: function( body ) {
var top = body.offsetTop, left = body.offsetLeft;
- if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
- top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
- left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
+
+ jQuery.offset.initialize();
+
+ if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
+ top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0;
+ left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0;
+ }
+
return { top: top, left: left };
+ },
+
+ setOffset: function( elem, options, i ) {
+ // set position first, in-case top/left are set even on static elem
+ if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) {
+ elem.style.position = "relative";
+ }
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
+ curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0;
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ var props = {
+ top: (options.top - curOffset.top) + curTop,
+ left: (options.left - curOffset.left) + curLeft
+ };
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
}
};
jQuery.fn.extend({
position: function() {
- var left = 0, top = 0, results;
-
- if ( this[0] ) {
- // Get *real* offsetParent
- var offsetParent = this.offsetParent(),
-
- // Get correct offsets
- offset = this.offset(),
- parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
-
- // Subtract element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= num( this, 'marginTop' );
- offset.left -= num( this, 'marginLeft' );
-
- // Add offsetParent borders
- parentOffset.top += num( offsetParent, 'borderTopWidth' );
- parentOffset.left += num( offsetParent, 'borderLeftWidth' );
-
- // Subtract the two offsets
- results = {
- top: offset.top - parentOffset.top,
- left: offset.left - parentOffset.left
- };
+ if ( !this[0] ) {
+ return null;
}
- return results;
+ var elem = this[0],
+
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
+ offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;
+
+ // Add offsetParent borders
+ parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
+ parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;
+
+ // Subtract the two offsets
+ return {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
},
offsetParent: function() {
- var offsetParent = this[0].offsetParent || document.body;
- while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
- offsetParent = offsetParent.offsetParent;
- return jQuery(offsetParent);
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.body;
+ while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent;
+ });
}
});
// Create scrollLeft and scrollTop methods
-jQuery.each( ['Left', 'Top'], function(i, name) {
- var method = 'scroll' + name;
+jQuery.each( ["Left", "Top"], function( i, name ) {
+ var method = "scroll" + name;
jQuery.fn[ method ] = function(val) {
- if (!this[0]) return null;
-
- return val !== undefined ?
+ var elem = this[0], win;
+
+ if ( !elem ) {
+ return null;
+ }
+ if ( val !== undefined ) {
// Set the scroll offset
- this.each(function() {
- this == window || this == document ?
- window.scrollTo(
- !i ? val : jQuery(window).scrollLeft(),
- i ? val : jQuery(window).scrollTop()
- ) :
+ return this.each(function() {
+ win = getWindow( this );
+
+ if ( win ) {
+ win.scrollTo(
+ !i ? val : jQuery(win).scrollLeft(),
+ i ? val : jQuery(win).scrollTop()
+ );
+
+ } else {
this[ method ] = val;
- }) :
+ }
+ });
+ } else {
+ win = getWindow( elem );
// Return the scroll offset
- this[0] == window || this[0] == document ?
- self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
- jQuery.boxModel && document.documentElement[ method ] ||
- document.body[ method ] :
- this[0][ method ];
+ return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
+ jQuery.support.boxModel && win.document.documentElement[ method ] ||
+ win.document.body[ method ] :
+ elem[ method ];
+ }
};
});
+
+function getWindow( elem ) {
+ return ("scrollTo" in elem && elem.document) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
-jQuery.each([ "Height", "Width" ], function(i, name){
+jQuery.each([ "Height", "Width" ], function( i, name ) {
- var tl = i ? "Left" : "Top", // top or left
- br = i ? "Right" : "Bottom", // bottom or right
- lower = name.toLowerCase();
+ var type = name.toLowerCase();
// innerHeight and innerWidth
- jQuery.fn["inner" + name] = function(){
+ jQuery.fn["inner" + name] = function() {
return this[0] ?
- jQuery.css( this[0], lower, false, "padding" ) :
+ jQuery.css( this[0], type, false, "padding" ) :
null;
};
// outerHeight and outerWidth
- jQuery.fn["outer" + name] = function(margin) {
+ jQuery.fn["outer" + name] = function( margin ) {
return this[0] ?
- jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
+ jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
null;
};
- var type = name.toLowerCase();
-
jQuery.fn[ type ] = function( size ) {
// Get window width or height
- return this[0] == window ?
+ var elem = this[0];
+ if ( !elem ) {
+ return size == null ? null : this;
+ }
+
+ if ( jQuery.isFunction( size ) ) {
+ return this.each(function( i ) {
+ var self = jQuery( this );
+ self[ type ]( size.call( this, i, self[ type ]() ) );
+ });
+ }
+
+ return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
- document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
- document.body[ "client" + name ] :
+ elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
+ elem.document.body[ "client" + name ] :
// Get document width or height
- this[0] == document ?
+ (elem.nodeType === 9) ? // is it a document
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
Math.max(
- document.documentElement["client" + name],
- document.body["scroll" + name], document.documentElement["scroll" + name],
- document.body["offset" + name], document.documentElement["offset" + name]
+ elem.documentElement["client" + name],
+ elem.body["scroll" + name], elem.documentElement["scroll" + name],
+ elem.body["offset" + name], elem.documentElement["offset" + name]
) :
// Get or set width or height on the element
size === undefined ?
// Get width or height on the element
- (this.length ? jQuery.css( this[0], type ) : null) :
+ jQuery.css( elem, type ) :
// Set the width or height on the element (default to pixels if value is unitless)
this.css( type, typeof size === "string" ? size : size + "px" );
};
});
-})();
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+})(window);
diff --git a/libs/jquery/stop.png b/libs/jquery/stop.png
deleted file mode 100644
index 644895c21e..0000000000
--- a/libs/jquery/stop.png
+++ /dev/null
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-anim_basic_16x16.gif b/libs/jquery/themes/base/images/ui-anim_basic_16x16.gif
new file mode 100644
index 0000000000..085ccaecaf
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-anim_basic_16x16.gif
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png b/libs/jquery/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
new file mode 100644
index 0000000000..5b5dab2ab7
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-bg_flat_75_ffffff_40x100.png b/libs/jquery/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
new file mode 100644
index 0000000000..ac8b229af9
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png b/libs/jquery/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
new file mode 100644
index 0000000000..ad3d6346e0
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-bg_glass_65_ffffff_1x400.png b/libs/jquery/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
new file mode 100644
index 0000000000..42ccba269b
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-bg_glass_75_dadada_1x400.png b/libs/jquery/themes/base/images/ui-bg_glass_75_dadada_1x400.png
new file mode 100644
index 0000000000..5a46b47cb1
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-bg_glass_75_dadada_1x400.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png b/libs/jquery/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
new file mode 100644
index 0000000000..86c2baa655
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png b/libs/jquery/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
new file mode 100644
index 0000000000..4443fdc1a1
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/libs/jquery/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
new file mode 100644
index 0000000000..7c9fa6c6ed
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-icons_222222_256x240.png b/libs/jquery/themes/base/images/ui-icons_222222_256x240.png
new file mode 100644
index 0000000000..ee039dc096
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-icons_222222_256x240.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-icons_2e83ff_256x240.png b/libs/jquery/themes/base/images/ui-icons_2e83ff_256x240.png
new file mode 100644
index 0000000000..45e8928e52
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-icons_2e83ff_256x240.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-icons_454545_256x240.png b/libs/jquery/themes/base/images/ui-icons_454545_256x240.png
new file mode 100644
index 0000000000..7ec70d11bf
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-icons_454545_256x240.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-icons_888888_256x240.png b/libs/jquery/themes/base/images/ui-icons_888888_256x240.png
new file mode 100644
index 0000000000..5ba708c391
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-icons_888888_256x240.png
Binary files differ
diff --git a/libs/jquery/themes/base/images/ui-icons_cd0a0a_256x240.png b/libs/jquery/themes/base/images/ui-icons_cd0a0a_256x240.png
new file mode 100644
index 0000000000..7930a55809
--- /dev/null
+++ b/libs/jquery/themes/base/images/ui-icons_cd0a0a_256x240.png
Binary files differ
diff --git a/libs/jquery/themes/base/jquery-ui.css b/libs/jquery/themes/base/jquery-ui.css
new file mode 100644
index 0000000000..763bf311a4
--- /dev/null
+++ b/libs/jquery/themes/base/jquery-ui.css
@@ -0,0 +1,487 @@
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+*/
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+/* Accordion
+----------------------------------*/
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+/* IE7-/Win - Fix extra vertical space in lists */
+.ui-accordion a { zoom: 1; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }/* Autocomplete
+----------------------------------*/
+.ui-autocomplete { position: absolute; cursor: default; }
+.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/* Menu
+----------------------------------*/
+.ui-menu {
+ list-style:none;
+ padding: 2px;
+ margin: 0;
+ display:block;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+ margin:0;
+ padding: 0;
+ zoom: 1;
+ float: left;
+ clear: left;
+ width: 100%;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration:none;
+ display:block;
+ padding:.2em .4em;
+ line-height:1.5;
+ zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+/* Button
+----------------------------------*/
+
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; }
+button.ui-button-icons-only { width: 3.7em; }
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4; }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+
+
+
+
+
+/* Datepicker
+----------------------------------*/
+.ui-datepicker { width: 17em; padding: .2em .2em 0; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+}/* Dialog
+----------------------------------*/
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; }
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/* Progressbar
+----------------------------------*/
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
+----------------------------------*/
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Selectable
+----------------------------------*/
+.ui-selectable-helper { border:1px dotted black }
+/* Slider
+----------------------------------*/
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
+----------------------------------*/
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+* To view and modify this theme, visit http://jqueryui.com/themeroller/
+*/
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
+.ui-widget-content a { color: #222222/*{fcContent}*/; }
+.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
+.ui-widget-header a { color: #222222/*{fcHeader}*/; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-top { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-right { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-left { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-all { -moz-border-radius: 4px/*{cornerRadius}*/; -webkit-border-radius: 4px/*{cornerRadius}*/; border-radius: 4px/*{cornerRadius}*/; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
+.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; } \ No newline at end of file
diff --git a/libs/jquery/thickbox-loading.gif b/libs/jquery/thickbox-loading.gif
deleted file mode 100644
index 82290f4833..0000000000
--- a/libs/jquery/thickbox-loading.gif
+++ /dev/null
Binary files differ
diff --git a/libs/jquery/thickbox.css b/libs/jquery/thickbox.css
deleted file mode 100644
index 1f58bc6785..0000000000
--- a/libs/jquery/thickbox.css
+++ /dev/null
@@ -1,194 +0,0 @@
-/* ----------------------------------------------------------------------------------------------------------------*/
- /* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
- /* ----------------------------------------------------------------------------------------------------------------*/
- /* ----------------------------------------------------------------------------------------------------------------*/
- /* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
- /* ----------------------------------------------------------------------------------------------------------------*/
-#TB_window {
- font: 12px Arial, Helvetica, sans-serif;
- color: #333333;
-}
-
-#TB_secondLine {
- font: 10px Arial, Helvetica, sans-serif;
- color: #666666;
-}
-
-#TB_window a:link {
- color: #666666;
-}
-
-#TB_window a:visited {
- color: #666666;
-}
-
-#TB_window a:hover {
- color: #000;
-}
-
-#TB_window a:active {
- color: #666666;
-}
-
-#TB_window a:focus {
- color: #666666;
-}
-
-/* ----------------------------------------------------------------------------------------------------------------*/
- /* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
- /* ----------------------------------------------------------------------------------------------------------------*/
-#TB_overlay {
- position: fixed;
- z-index: 100;
- top: 0px;
- left: 0px;
- height: 100%;
- width: 100%;
-}
-
-.TB_overlayMacFFBGHack {
- background: url(libs/jquery/macFFBgHack.png) repeat;
-}
-
-.TB_overlayBG {
- background-color: #000;
- filter: alpha(opacity = 75);
- -moz-opacity: 0.75;
- opacity: 0.75;
-}
-
-* html #TB_overlay { /* ie6 hack */
- position: absolute;
- height: expression(document . body . scrollHeight > document . body .
- offsetHeight ? document . body . scrollHeight : document
- . body .
- offsetHeight + 'px');
-}
-
-#TB_window {
- position: fixed;
- background: #ffffff;
- z-index: 102;
- color: #000000;
- display: none;
- border: 4px solid #525252;
- text-align: left;
- top: 50%;
- left: 50%;
-}
-
-* html #TB_window { /* ie6 hack */
- position: absolute;
- margin-top: expression(0 - parseInt(this . offsetHeight/ 2) +
- (
- TBWindowMargin = document . documentElement && document .
- documentElement . scrollTop || document . body . scrollTop
- ) +
- 'px' );
-}
-
-#TB_window img#TB_Image {
- display: block;
- margin: 15px 0 0 15px;
- border-right: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
- border-top: 1px solid #666;
- border-left: 1px solid #666;
-}
-
-#TB_caption {
- height: 25px;
- padding: 7px 30px 10px 25px;
- float: left;
-}
-
-#TB_closeWindow {
- height: 25px;
- padding: 11px 25px 10px 0;
- float: right;
-}
-
-#TB_closeAjaxWindow {
- padding: 7px 10px 5px 0;
- margin-bottom: 1px;
- text-align: right;
- float: right;
-}
-
-#TB_ajaxWindowTitle {
- float: left;
- padding: 7px 0 5px 10px;
- margin-bottom: 1px;
-}
-
-#TB_title {
- background-color: #e8e8e8;
- height: 27px;
-}
-
-#TB_ajaxContent {
- clear: both;
- padding: 2px 15px 15px 15px;
- overflow: auto;
- text-align: left;
- line-height: 1.4em;
-}
-
-#TB_ajaxContent.TB_modal {
- padding: 15px;
-}
-
-#TB_ajaxContent p {
- padding: 5px 0px 5px 0px;
-}
-
-#TB_load {
- position: fixed;
- display: none;
- height: 13px;
- width: 208px;
- z-index: 103;
- top: 50%;
- left: 50%;
- margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
-}
-
-* html #TB_load { /* ie6 hack */
- position: absolute;
- margin-top: expression(0 - parseInt(this . offsetHeight/ 2) +
- (
- TBWindowMargin = document . documentElement && document .
- documentElement . scrollTop || document . body . scrollTop
- ) +
- 'px' );
-}
-
-#TB_HideSelect {
- z-index: 99;
- position: fixed;
- top: 0;
- left: 0;
- background-color: #fff;
- border: none;
- filter: alpha(opacity = 0);
- -moz-opacity: 0;
- opacity: 0;
- height: 100%;
- width: 100%;
-}
-
-* html #TB_HideSelect { /* ie6 hack */
- position: absolute;
- height: expression(document . body . scrollHeight > document . body .
- offsetHeight ? document . body . scrollHeight : document
- . body .
- offsetHeight + 'px');
-}
-
-#TB_iframeContent {
- clear: both;
- border: none;
- margin-bottom: -1px;
- margin-top: 1px;
- _margin-bottom: 1px;
-}
diff --git a/libs/jquery/thickbox.js b/libs/jquery/thickbox.js
deleted file mode 100644
index d2cf5404a6..0000000000
--- a/libs/jquery/thickbox.js
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Thickbox 3.1 - One Box To Rule Them All.
- * By Cody Lindley (http://www.codylindley.com)
- * Copyright (c) 2007 cody lindley
- * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
-*/
-
-var tb_pathToImage = "libs/jquery/thickbox-loading.gif";
-
-/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
-
-//on page load call tb_init
-$(document).ready(function(){
- tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
- imgLoader = new Image();// preload image
- imgLoader.src = tb_pathToImage;
-});
-
-//add thickbox to href & area elements that have a class of .thickbox
-function tb_init(domChunk){
- $(domChunk).click(function(){
- var t = this.title || this.name || null;
- var a = this.href || this.alt;
- var g = this.rel || false;
- tb_show(t,a,g);
- this.blur();
- return false;
- });
-}
-
-function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
-
- try {
- if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
- $("body","html").css({height: "100%", width: "100%"});
- $("html").css("overflow","hidden");
- if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
- $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
- $("#TB_overlay").click(tb_remove);
- }
- }else{//all others
- if(document.getElementById("TB_overlay") === null){
- $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
- $("#TB_overlay").click(tb_remove);
- }
- }
-
- if(tb_detectMacXFF()){
- $("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
- }else{
- $("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
- }
-
- if(caption===null){caption="";}
- $("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
- $('#TB_load').show();//show loader
-
- var baseURL;
- if(url.indexOf("?")!==-1){ //ff there is a query string involved
- baseURL = url.substr(0, url.indexOf("?"));
- }else{
- baseURL = url;
- }
-
- var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
- var urlType = baseURL.toLowerCase().match(urlString);
-
- if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
-
- TB_PrevCaption = "";
- TB_PrevURL = "";
- TB_PrevHTML = "";
- TB_NextCaption = "";
- TB_NextURL = "";
- TB_NextHTML = "";
- TB_imageCount = "";
- TB_FoundURL = false;
- if(imageGroup){
- TB_TempArray = $("a[@rel="+imageGroup+"]").get();
- for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
- var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
- if (!(TB_TempArray[TB_Counter].href == url)) {
- if (TB_FoundURL) {
- TB_NextCaption = TB_TempArray[TB_Counter].title;
- TB_NextURL = TB_TempArray[TB_Counter].href;
- TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
- } else {
- TB_PrevCaption = TB_TempArray[TB_Counter].title;
- TB_PrevURL = TB_TempArray[TB_Counter].href;
- TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
- }
- } else {
- TB_FoundURL = true;
- TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
- }
- }
- }
-
- imgPreloader = new Image();
- imgPreloader.onload = function(){
- imgPreloader.onload = null;
-
- // Resizing large images - orginal by Christian Montoya edited by me.
- var pagesize = tb_getPageSize();
- var x = pagesize[0] - 150;
- var y = pagesize[1] - 150;
- var imageWidth = imgPreloader.width;
- var imageHeight = imgPreloader.height;
- if (imageWidth > x) {
- imageHeight = imageHeight * (x / imageWidth);
- imageWidth = x;
- if (imageHeight > y) {
- imageWidth = imageWidth * (y / imageHeight);
- imageHeight = y;
- }
- } else if (imageHeight > y) {
- imageWidth = imageWidth * (y / imageHeight);
- imageHeight = y;
- if (imageWidth > x) {
- imageHeight = imageHeight * (x / imageWidth);
- imageWidth = x;
- }
- }
- // End Resizing
-
- TB_WIDTH = imageWidth + 30;
- TB_HEIGHT = imageHeight + 60;
- $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='libs/jquery/stop.png' alt='close' /></a></div>");
-
- $("#TB_closeWindowButton").click(tb_remove);
-
- if (!(TB_PrevHTML === "")) {
- function goPrev(){
- if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
- $("#TB_window").remove();
- $("body").append("<div id='TB_window'></div>");
- tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
- return false;
- }
- $("#TB_prev").click(goPrev);
- }
-
- if (!(TB_NextHTML === "")) {
- function goNext(){
- $("#TB_window").remove();
- $("body").append("<div id='TB_window'></div>");
- tb_show(TB_NextCaption, TB_NextURL, imageGroup);
- return false;
- }
- $("#TB_next").click(goNext);
-
- }
-
- document.onkeydown = function(e){
- if (e == null) { // ie
- keycode = event.keyCode;
- } else { // mozilla
- keycode = e.which;
- }
- if(keycode == 27){ // close
- tb_remove();
- } else if(keycode == 190){ // display previous image
- if(!(TB_NextHTML == "")){
- document.onkeydown = "";
- goNext();
- }
- } else if(keycode == 188){ // display next image
- if(!(TB_PrevHTML == "")){
- document.onkeydown = "";
- goPrev();
- }
- }
- };
-
- tb_position();
- $("#TB_load").remove();
- $("#TB_ImageOff").click(tb_remove);
- $("#TB_window").css({display:"block"}); //for safari using css instead of show
- };
-
- imgPreloader.src = url;
- }else{//code to show html
-
- var queryString = url.replace(/^[^\?]+\??/,'');
- var params = tb_parseQuery( queryString );
-
- TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
- TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
- ajaxContentW = TB_WIDTH - 30;
- ajaxContentH = TB_HEIGHT - 45;
-
- if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
- urlNoQuery = url.split('TB_');
- $("#TB_iframeContent").remove();
- if(params['modal'] != "true"){//iframe no modal
- $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='libs/jquery/stop.png' alt='close' /></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
- }else{//iframe modal
- $("#TB_overlay").unbind();
- $("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
- }
- }else{// not an iframe, ajax
- if($("#TB_window").css("display") != "block"){
- if(params['modal'] != "true"){//ajax no modal
- $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><img src='libs/jquery/stop.png' alt='close' /></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
- }else{//ajax modal
- $("#TB_overlay").unbind();
- $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
- }
- }else{//this means the window is already up, we are just loading new content via ajax
- $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
- $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
- $("#TB_ajaxContent")[0].scrollTop = 0;
- $("#TB_ajaxWindowTitle").html(caption);
- }
- }
-
- $("#TB_closeWindowButton").click(tb_remove);
-
- if(url.indexOf('TB_inline') != -1){
- $("#TB_ajaxContent").append($('#' + params['inlineId']).children());
- $("#TB_window").unload(function () {
- $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
- });
- tb_position();
- $("#TB_load").remove();
- $("#TB_window").css({display:"block"});
- }else if(url.indexOf('TB_iframe') != -1){
- tb_position();
- if($.browser.safari){//safari needs help because it will not fire iframe onload
- $("#TB_load").remove();
- $("#TB_window").css({display:"block"});
- }
- }else{
- $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
- tb_position();
- $("#TB_load").remove();
- tb_init("#TB_ajaxContent a.thickbox");
- $("#TB_window").css({display:"block"});
- });
- }
-
- }
-
- if(!params['modal']){
- document.onkeyup = function(e){
- if (e == null) { // ie
- keycode = event.keyCode;
- } else { // mozilla
- keycode = e.which;
- }
- if(keycode == 27){ // close
- tb_remove();
- }
- };
- }
-
- } catch(e) {
- //nothing here
- }
-}
-
-//helper functions below
-function tb_showIframe(){
- $("#TB_load").remove();
- $("#TB_window").css({display:"block"});
-}
-
-function tb_remove() {
- $("#TB_imageOff").unbind("click");
- $("#TB_closeWindowButton").unbind("click");
- $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
- $("#TB_load").remove();
- if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
- $("body","html").css({height: "auto", width: "auto"});
- $("html").css("overflow","");
- }
- document.onkeydown = "";
- document.onkeyup = "";
- return false;
-}
-
-function tb_position() {
-$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
- if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
- $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
- }
-}
-
-function tb_parseQuery ( query ) {
- var Params = {};
- if ( ! query ) {return Params;}// return empty object
- var Pairs = query.split(/[;&]/);
- for ( var i = 0; i < Pairs.length; i++ ) {
- var KeyVal = Pairs[i].split('=');
- if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
- var key = unescape( KeyVal[0] );
- var val = unescape( KeyVal[1] );
- val = val.replace(/\+/g, ' ');
- Params[key] = val;
- }
- return Params;
-}
-
-function tb_getPageSize(){
- var de = document.documentElement;
- var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
- var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
- arrayPageSize = [w,h];
- return arrayPageSize;
-}
-
-function tb_detectMacXFF() {
- var userAgent = navigator.userAgent.toLowerCase();
- if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
- return true;
- }
-}
-
-
diff --git a/libs/json/json.js b/libs/json/json.js
deleted file mode 100644
index 935bd40ce8..0000000000
--- a/libs/json/json.js
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- json.js
- 2007-08-19
-
- Public Domain
-
- This file adds these methods to JavaScript:
-
- array.toJSONString(whitelist)
- boolean.toJSONString()
- date.toJSONString()
- number.toJSONString()
- object.toJSONString(whitelist)
- string.toJSONString()
- These methods produce a JSON text from a JavaScript value.
- It must not contain any cyclical references. Illegal values
- will be excluded.
-
- The default conversion for dates is to an ISO string. You can
- add a toJSONString method to any date object to get a different
- representation.
-
- The object and array methods can take an optional whitelist
- argument. A whitelist is an array of strings. If it is provided,
- keys in objects not found in the whitelist are excluded.
-
- string.parseJSON(filter)
- This method parses a JSON text to produce an object or
- array. It can throw a SyntaxError exception.
-
- The optional filter parameter is a function which can filter and
- transform the results. It receives each of the keys and values, and
- its return value is used instead of the original value. If it
- returns what it received, then structure is not modified. If it
- returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. If a key contains the string 'date' then
- // convert the value to a date.
-
- myData = text.parseJSON(function (key, value) {
- return key.indexOf('date') >= 0 ? new Date(value) : value;
- });
-
- It is expected that these methods will formally become part of the
- JavaScript Programming Language in the Fourth Edition of the
- ECMAScript standard in 2008.
-
- This file will break programs with improper for..in loops. See
- http://yuiblog.com/blog/2006/09/26/for-in-intrigue/
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-
- Use your own copy. It is extremely unwise to load untrusted third party
- code into your pages.
-*/
-
-/*jslint evil: true */
-
-// Augment the basic prototypes if they have not already been augmented.
-
-if (!Object.prototype.toJSONString) {
-
- Array.prototype.toJSONString = function (w) {
- var a = [], // The array holding the partial texts.
- i, // Loop counter.
- l = this.length,
- v; // The value to be stringified.
-
-// For each value in this array...
-
- for (i = 0; i < l; i += 1) {
- v = this[i];
- switch (typeof v) {
- case 'object':
-
-// Serialize a JavaScript object value. Ignore objects thats lack the
-// toJSONString method. Due to a specification error in ECMAScript,
-// typeof null is 'object', so watch out for that case.
-
- if (v) {
- if (typeof v.toJSONString === 'function') {
- a.push(v.toJSONString(w));
- }
- } else {
- a.push('null');
- }
- break;
-
- case 'string':
- case 'number':
- case 'boolean':
- a.push(v.toJSONString());
-
-// Values without a JSON representation are ignored.
-
- }
- }
-
-// Join all of the member texts together and wrap them in brackets.
-
- return '[' + a.join(',') + ']';
- };
-
-
- Boolean.prototype.toJSONString = function () {
- return String(this);
- };
-
-
- Date.prototype.toJSONString = function () {
-
-// Eventually, this method will be based on the date.toISOString method.
-
- function f(n) {
-
-// Format integers to have at least two digits.
-
- return n < 10 ? '0' + n : n;
- }
-
- return '"' + this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z"';
- };
-
-
- Number.prototype.toJSONString = function () {
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(this) ? String(this) : 'null';
- };
-
-
- Object.prototype.toJSONString = function (w) {
- var a = [], // The array holding the partial texts.
- k, // The current key.
- i, // The loop counter.
- v; // The current value.
-
-// If a whitelist (array of keys) is provided, use it assemble the components
-// of the object.
-
- if (w) {
- for (i = 0; i < w.length; i += 1) {
- k = w[i];
- if (typeof k === 'string') {
- v = this[k];
- switch (typeof v) {
- case 'object':
-
-// Serialize a JavaScript object value. Ignore objects that lack the
-// toJSONString method. Due to a specification error in ECMAScript,
-// typeof null is 'object', so watch out for that case.
-
- if (v) {
- if (typeof v.toJSONString === 'function') {
- a.push(k.toJSONString() + ':' +
- v.toJSONString(w));
- }
- } else {
- a.push(k.toJSONString() + ':null');
- }
- break;
-
- case 'string':
- case 'number':
- case 'boolean':
- a.push(k.toJSONString() + ':' + v.toJSONString());
-
-// Values without a JSON representation are ignored.
-
- }
- }
- }
- } else {
-
-// Iterate through all of the keys in the object, ignoring the proto chain
-// and keys that are not strings.
-
- for (k in this) {
- if (typeof k === 'string' &&
- Object.prototype.hasOwnProperty.apply(this, [k])) {
- v = this[k];
- switch (typeof v) {
- case 'object':
-
-// Serialize a JavaScript object value. Ignore objects that lack the
-// toJSONString method. Due to a specification error in ECMAScript,
-// typeof null is 'object', so watch out for that case.
-
- if (v) {
- if (typeof v.toJSONString === 'function') {
- a.push(k.toJSONString() + ':' +
- v.toJSONString());
- }
- } else {
- a.push(k.toJSONString() + ':null');
- }
- break;
-
- case 'string':
- case 'number':
- case 'boolean':
- a.push(k.toJSONString() + ':' + v.toJSONString());
-
-// Values without a JSON representation are ignored.
-
- }
- }
- }
- }
-
-// Join all of the member texts together and wrap them in braces.
-
- return '{' + a.join(',') + '}';
- };
-
-
- (function (s) {
-
-// Augment String.prototype. We do this in an immediate anonymous function to
-// avoid defining global variables.
-
-// m is a table of character substitutions.
-
- var m = {
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- };
-
-
- s.parseJSON = function (filter) {
- var j;
-
- function walk(k, v) {
- var i;
- if (v && typeof v === 'object') {
- for (i in v) {
- if (Object.prototype.hasOwnProperty.apply(v, [i])) {
- v[i] = walk(i, v[i]);
- }
- }
- }
- return filter(k, v);
- }
-
-
-// Parsing happens in three stages. In the first stage, we run the text against
-// a regular expression which looks for non-JSON characters. We are especially
-// concerned with '()' and 'new' because they can cause invocation, and '='
-// because it can cause mutation. But just to be safe, we will reject all
-// unexpected characters.
-
-// We split the first stage into 3 regexp operations in order to work around
-// crippling deficiencies in Safari's regexp engine. First we replace all
-// backslash pairs with '@' (a non-JSON character). Second we delete all of
-// the string literals. Third, we look to see if only JSON characters
-// remain. If so, then the text is safe for eval.
-
- if (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(this.
- replace(/\\./g, '@').
- replace(/"[^"\\\n\r]*"/g, ''))) {
-
-// In the second stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + this + ')');
-
-// In the optional third stage, we recursively walk the new structure, passing
-// each name/value pair to a filter function for possible transformation.
-
- return typeof filter === 'function' ? walk('', j) : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('parseJSON');
- };
-
-
- s.toJSONString = function () {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can simply slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe
-// sequences.
-
- if (/["\\\x00-\x1f]/.test(this)) {
- return '"' + this.replace(/[\x00-\x1f\\"]/g, function (a) {
- var c = m[a];
- if (c) {
- return c;
- }
- c = a.charCodeAt();
- return '\\u00' +
- Math.floor(c / 16).toString(16) +
- (c % 16).toString(16);
- }) + '"';
- }
- return '"' + this + '"';
- };
- })(String.prototype);
-}
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_bar.php b/libs/open-flash-chart/php-ofc-library/ofc_bar.php
index 6ddda42749..728420c503 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_bar.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_bar.php
@@ -1,6 +1,6 @@
<?php
-include_once 'ofc_bar_base.php';
+include_once dirname(__FILE__) . '/ofc_bar_base.php';
class bar_value
{
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_bar_3d.php b/libs/open-flash-chart/php-ofc-library/ofc_bar_3d.php
index 47552184ce..9b7f697615 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_bar_3d.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_bar_3d.php
@@ -1,6 +1,6 @@
<?php
-include_once 'ofc_bar_base.php';
+include_once dirname(__FILE__) . '/ofc_bar_base.php';
class bar_3d_value
{
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_bar_filled.php b/libs/open-flash-chart/php-ofc-library/ofc_bar_filled.php
index 837c1fc458..2439bd2159 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_bar_filled.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_bar_filled.php
@@ -1,6 +1,6 @@
<?php
-include_once 'ofc_bar_base.php';
+include_once dirname(__FILE__) . '/ofc_bar_base.php';
class bar_filled_value extends bar_value
{
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_bar_glass.php b/libs/open-flash-chart/php-ofc-library/ofc_bar_glass.php
index e833501519..bc330d3c74 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_bar_glass.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_bar_glass.php
@@ -1,6 +1,6 @@
<?php
-include_once 'ofc_bar_base.php';
+include_once dirname(__FILE__) . '/ofc_bar_base.php';
class bar_on_show
{
@@ -128,4 +128,4 @@ class bar_3d extends bar_base
$this->type = "bar_3d";
parent::bar_base();
}
-} \ No newline at end of file
+}
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_bar_sketch.php b/libs/open-flash-chart/php-ofc-library/ofc_bar_sketch.php
index ce1bcccf8a..2bad3a3b75 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_bar_sketch.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_bar_sketch.php
@@ -1,6 +1,6 @@
<?php
-include_once 'ofc_bar_base.php';
+include_once dirname(__FILE__) . '/ofc_bar_base.php';
class bar_sketch extends bar_base
{
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_bar_stack.php b/libs/open-flash-chart/php-ofc-library/ofc_bar_stack.php
index 3d9f8d9f0c..5977409982 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_bar_stack.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_bar_stack.php
@@ -1,6 +1,6 @@
<?php
-include_once 'ofc_bar_base.php';
+include_once dirname(__FILE__) . '/ofc_bar_base.php';
class bar_stack extends bar_base
{
@@ -52,4 +52,4 @@ class bar_stack_key
$tmp = 'font-size';
$this->$tmp = $font_size;
}
-} \ No newline at end of file
+}
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_candle.php b/libs/open-flash-chart/php-ofc-library/ofc_candle.php
index 21ad67f8d3..7ed047f843 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_candle.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_candle.php
@@ -1,6 +1,6 @@
<?php
-include_once 'ofc_bar_base.php';
+include_once dirname(__FILE__) . '/ofc_bar_base.php';
class candle_value
{
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_tooltip.php b/libs/open-flash-chart/php-ofc-library/ofc_tooltip.php
index 3104ee33b9..21f8aa2ecd 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_tooltip.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_tooltip.php
@@ -1,6 +1,6 @@
<?php
-include_once 'ofc_bar_base.php';
+include_once dirname(__FILE__) . '/ofc_bar_base.php';
class tooltip
{
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_y_axis_label.php b/libs/open-flash-chart/php-ofc-library/ofc_y_axis_label.php
index bded9b84e5..f2616f537e 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_y_axis_label.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_y_axis_label.php
@@ -1,38 +1,38 @@
-<?php
-
-/**
- * y_axis_label see y_axis_labels
- */
-class y_axis_label
-{
- function y_axis_label( $y, $text)
- {
- $this->y = $y;
- $this->set_text( $text );
- }
-
- function set_text( $text )
- {
- $this->text = $text;
- }
-
- function set_colour( $colour )
- {
- $this->colour = $colour;
- }
-
- function set_size( $size )
- {
- $this->size = $size;
- }
-
- function set_rotate( $rotate )
- {
- $this->rotate = $rotate;
- }
-
- function set_vertical()
- {
- $this->rotate = "vertical";
- }
+<?php
+
+/**
+ * y_axis_label see y_axis_labels
+ */
+class y_axis_label
+{
+ function y_axis_label( $y, $text)
+ {
+ $this->y = $y;
+ $this->set_text( $text );
+ }
+
+ function set_text( $text )
+ {
+ $this->text = $text;
+ }
+
+ function set_colour( $colour )
+ {
+ $this->colour = $colour;
+ }
+
+ function set_size( $size )
+ {
+ $this->size = $size;
+ }
+
+ function set_rotate( $rotate )
+ {
+ $this->rotate = $rotate;
+ }
+
+ function set_vertical()
+ {
+ $this->rotate = "vertical";
+ }
} \ No newline at end of file
diff --git a/libs/open-flash-chart/php-ofc-library/ofc_y_axis_labels.php b/libs/open-flash-chart/php-ofc-library/ofc_y_axis_labels.php
index 75f777e532..c0708ab219 100644
--- a/libs/open-flash-chart/php-ofc-library/ofc_y_axis_labels.php
+++ b/libs/open-flash-chart/php-ofc-library/ofc_y_axis_labels.php
@@ -1,57 +1,57 @@
-<?php
-
-class y_axis_labels
-{
- function y_axis_labels(){}
-
- /**
- * @param $steps which labels are generated
- */
- function set_steps( $steps )
- {
- $this->steps = $steps;
- }
-
- /**
- *
- * @param $labels as an array of [y_axis_label or string]
- */
- function set_labels( $labels )
- {
- $this->labels = $labels;
- }
-
- function set_colour( $colour )
- {
- $this->colour = $colour;
- }
-
- /**
- * font size in pixels
- */
- function set_size( $size )
- {
- $this->size = $size;
- }
-
- /**
- * rotate labels
- */
- function set_vertical()
- {
- $this->rotate = 270;
- }
-
- function rotate( $angle )
- {
- $this->rotate = $angle;
- }
-
- /**
- * @param $text default text that all labels inherit
- */
- function set_text( $text )
- {
- $this->text = $text;
- }
+<?php
+
+class y_axis_labels
+{
+ function y_axis_labels(){}
+
+ /**
+ * @param $steps which labels are generated
+ */
+ function set_steps( $steps )
+ {
+ $this->steps = $steps;
+ }
+
+ /**
+ *
+ * @param $labels as an array of [y_axis_label or string]
+ */
+ function set_labels( $labels )
+ {
+ $this->labels = $labels;
+ }
+
+ function set_colour( $colour )
+ {
+ $this->colour = $colour;
+ }
+
+ /**
+ * font size in pixels
+ */
+ function set_size( $size )
+ {
+ $this->size = $size;
+ }
+
+ /**
+ * rotate labels
+ */
+ function set_vertical()
+ {
+ $this->rotate = 270;
+ }
+
+ function rotate( $angle )
+ {
+ $this->rotate = $angle;
+ }
+
+ /**
+ * @param $text default text that all labels inherit
+ */
+ function set_text( $text )
+ {
+ $this->text = $text;
+ }
} \ No newline at end of file
diff --git a/libs/open-flash-chart/php-ofc-library/open-flash-chart.php b/libs/open-flash-chart/php-ofc-library/open-flash-chart.php
index b017097d00..9ba0db6d59 100644
--- a/libs/open-flash-chart/php-ofc-library/open-flash-chart.php
+++ b/libs/open-flash-chart/php-ofc-library/open-flash-chart.php
@@ -10,55 +10,55 @@
//
if (! function_exists('json_encode'))
{
- include_once 'JSON.php';
+ include_once dirname(__FILE__) . '/JSON.php';
}
-include_once 'json_format.php';
+include_once dirname(__FILE__) . '/json_format.php';
// ofc classes
-include_once 'ofc_title.php';
-include_once 'ofc_y_axis_base.php';
-include_once 'ofc_y_axis.php';
-include_once 'ofc_y_axis_right.php';
-include_once 'ofc_y_axis_labels.php';
-include_once 'ofc_y_axis_label.php';
-include_once 'ofc_x_axis.php';
+include_once dirname(__FILE__) . '/ofc_title.php';
+include_once dirname(__FILE__) . '/ofc_y_axis_base.php';
+include_once dirname(__FILE__) . '/ofc_y_axis.php';
+include_once dirname(__FILE__) . '/ofc_y_axis_right.php';
+include_once dirname(__FILE__) . '/ofc_y_axis_labels.php';
+include_once dirname(__FILE__) . '/ofc_y_axis_label.php';
+include_once dirname(__FILE__) . '/ofc_x_axis.php';
-include_once 'ofc_pie.php';
-//include_once 'ofc_bar.php';
-include_once 'ofc_bar_glass.php';
-include_once 'ofc_bar_filled.php';
-include_once 'ofc_bar_stack.php';
-//include_once 'ofc_bar_3d.php';
-include_once 'ofc_hbar.php';
-include_once 'ofc_line_base.php';
-include_once 'ofc_line.php';
-//include_once 'ofc_line_dot.php';
-//include_once 'ofc_line_hollow.php';
-include_once 'ofc_candle.php';
-include_once 'ofc_area_base.php';
-include_once 'ofc_tags.php';
-include_once 'ofc_arrow.php';
-//include_once 'ofc_area_hollow.php';
-//include_once 'ofc_area_line.php';
+include_once dirname(__FILE__) . '/ofc_pie.php';
+//include_once dirname(__FILE__) . '/ofc_bar.php';
+include_once dirname(__FILE__) . '/ofc_bar_glass.php';
+include_once dirname(__FILE__) . '/ofc_bar_filled.php';
+include_once dirname(__FILE__) . '/ofc_bar_stack.php';
+//include_once dirname(__FILE__) . '/ofc_bar_3d.php';
+include_once dirname(__FILE__) . '/ofc_hbar.php';
+include_once dirname(__FILE__) . '/ofc_line_base.php';
+include_once dirname(__FILE__) . '/ofc_line.php';
+//include_once dirname(__FILE__) . '/ofc_line_dot.php';
+//include_once dirname(__FILE__) . '/ofc_line_hollow.php';
+include_once dirname(__FILE__) . '/ofc_candle.php';
+include_once dirname(__FILE__) . '/ofc_area_base.php';
+include_once dirname(__FILE__) . '/ofc_tags.php';
+include_once dirname(__FILE__) . '/ofc_arrow.php';
+//include_once dirname(__FILE__) . '/ofc_area_hollow.php';
+//include_once dirname(__FILE__) . '/ofc_area_line.php';
-include_once 'ofc_x_legend.php';
-include_once 'ofc_y_legend.php';
-include_once 'ofc_bar_sketch.php';
-include_once 'ofc_scatter.php';
-include_once 'ofc_scatter_line.php';
-include_once 'ofc_x_axis_labels.php';
-include_once 'ofc_x_axis_label.php';
-include_once 'ofc_tooltip.php';
-include_once 'ofc_shape.php';
-include_once 'ofc_radar_axis.php';
-include_once 'ofc_radar_axis_labels.php';
-include_once 'ofc_radar_spoke_labels.php';
-include_once 'ofc_line_style.php';
+include_once dirname(__FILE__) . '/ofc_x_legend.php';
+include_once dirname(__FILE__) . '/ofc_y_legend.php';
+include_once dirname(__FILE__) . '/ofc_bar_sketch.php';
+include_once dirname(__FILE__) . '/ofc_scatter.php';
+include_once dirname(__FILE__) . '/ofc_scatter_line.php';
+include_once dirname(__FILE__) . '/ofc_x_axis_labels.php';
+include_once dirname(__FILE__) . '/ofc_x_axis_label.php';
+include_once dirname(__FILE__) . '/ofc_tooltip.php';
+include_once dirname(__FILE__) . '/ofc_shape.php';
+include_once dirname(__FILE__) . '/ofc_radar_axis.php';
+include_once dirname(__FILE__) . '/ofc_radar_axis_labels.php';
+include_once dirname(__FILE__) . '/ofc_radar_spoke_labels.php';
+include_once dirname(__FILE__) . '/ofc_line_style.php';
-include_once 'dot_base.php';
-include_once 'ofc_menu.php';
+include_once dirname(__FILE__) . '/dot_base.php';
+include_once dirname(__FILE__) . '/ofc_menu.php';
class open_flash_chart
{
@@ -175,4 +175,4 @@ class open_flash_chart
//
// there is no PHP end tag so we don't mess the headers up!
-// \ No newline at end of file
+//
diff --git a/libs/sparkline/LICENSE b/libs/sparkline/LICENSE-BSD.txt
index f254056552..b990fd0ae0 100644
--- a/libs/sparkline/LICENSE
+++ b/libs/sparkline/LICENSE-BSD.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2004 James Byers <jbyers@users.sf.net>
+Copyright (c) 2004 James Byers <jbyers@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/libs/sparkline/LICENSE-GPL.txt b/libs/sparkline/LICENSE-GPL.txt
new file mode 100644
index 0000000000..11dddd00ef
--- /dev/null
+++ b/libs/sparkline/LICENSE-GPL.txt
@@ -0,0 +1,278 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
diff --git a/libs/sparkline/lib/Sparkline.php b/libs/sparkline/lib/Sparkline.php
index 1641d7535d..d748538c54 100644
--- a/libs/sparkline/lib/Sparkline.php
+++ b/libs/sparkline/lib/Sparkline.php
@@ -60,8 +60,8 @@ class Sparkline extends Object {
//
$this->graphAreaPx = array(array($this->graphAreaPx[0][0],
$this->graphAreaPx[0][1]),
- array($this->graphAreaPx[1][0] + $x, //FIX FROM PIWIK
- $this->graphAreaPx[1][1] + $y)); //FIX FROM PIWIK
+ array($this->graphAreaPx[1][0] + $x - 1,
+ $this->graphAreaPx[1][1] + $y - 1));
$this->imageHandle = $this->CreateImageHandle($x, $y);
@@ -356,12 +356,9 @@ class Sparkline extends Object {
}
function DrawTextRelative($string, $x, $y, $color, $position, $padding = 2, $font = FONT_1, $handle = false) {
- if(empty($string))
- {
- return;
- }
$this->Debug("Sparkline :: DrawTextRelative('$string', $x, $y, '$color', $position, $font, $padding)", DEBUG_DRAW);
- if (!$this->IsError() &&
+
+ if (!empty($string) && !$this->IsError() &&
$colorHandle = $this->GetColorHandle($color)) {
if ($handle === false) $handle = $this->imageHandle;
diff --git a/libs/sparkline/lib/Sparkline_Bar.php b/libs/sparkline/lib/Sparkline_Bar.php
index f1442a044e..ca8cca0aa3 100644
--- a/libs/sparkline/lib/Sparkline_Bar.php
+++ b/libs/sparkline/lib/Sparkline_Bar.php
@@ -67,8 +67,12 @@ class Sparkline_Bar extends Sparkline {
// data setting
//
function SetData($x, $y, $color = null, $underscore = false, $series = 1) {
- $x = trim($x);
- $y = trim($y);
+ if(!is_numeric($x)) {
+ $x = trim($x);
+ }
+ if(!is_numeric($y)) {
+ $y = trim($y);
+ }
$this->Debug("Sparkline_Bar :: SetData($x, $y, $series)", DEBUG_SET);
diff --git a/libs/sparkline/lib/Sparkline_Line.php b/libs/sparkline/lib/Sparkline_Line.php
index 16690f4803..292b3b3ed8 100644
--- a/libs/sparkline/lib/Sparkline_Line.php
+++ b/libs/sparkline/lib/Sparkline_Line.php
@@ -39,8 +39,12 @@ class Sparkline_Line extends Sparkline {
// data setting
//
function SetData($x, $y, $series = 1) {
- $x = trim($x);
- $y = trim($y);
+ if(!is_numeric($x)) {
+ $x = trim($x);
+ }
+ if(!is_numeric($y)) {
+ $y = trim($y);
+ }
$this->Debug("Sparkline_Line :: SetData($x, $y, $series)", DEBUG_SET);
@@ -95,16 +99,18 @@ class Sparkline_Line extends Sparkline {
}
if (!isset($this->yMax)) {
- $this->yMax = $this->dataSeriesStats[$series]['yMax'] + ($this->yMin * -1);
+ $this->yMax = $this->dataSeriesStats[$series]['yMax'];
}
if (!isset($this->xMax)) {
$this->xMax = $this->dataSeriesStats[$series]['xMax'];
}
+ $this->yRange = $this->yMax + ($this->yMin * -1);
+
for ($i = 0; $i < sizeof($this->dataSeries[$series]); $i++) {
- $y = round(($this->dataSeries[$series][$i] + ($this->yMin * -1)) * ($yBound / $this->yMax));
- $x = round($i * $xBound / (sizeof($this->dataSeries[$series]) ));
+ $y = round(($this->dataSeries[$series][$i] + ($this->yMin * -1)) * (($yBound-1) / $this->yRange));
+ $x = round($i * $xBound / (sizeof($this->dataSeries[$series])));
$this->dataSeriesConverted[$series][] = array($x, $y);
$this->Debug("Sparkline :: ConvertDataSeries series $series value $i ($x, $y)", DEBUG_SET);
}
@@ -167,8 +173,8 @@ class Sparkline_Line extends Sparkline {
// draw features
//
while (list(, $v) = each($this->featurePoint)) {
- $pxY = round(($v['ptY'] + ($this->yMin * -1)) * ($this->GetGraphHeight() / $this->yMax));
- $pxX = round($v['ptX'] * $this->GetGraphWidth() / $this->dataSeriesStats[1]['xMax']);
+ $pxY = round(($v['ptY'] + ($this->yMin * -1)) * ($this->GetGraphHeight() / $this->yRange));
+ $pxX = round($v['ptX'] * $this->GetGraphWidth() / sizeof($this->dataSeries[1]));
$this->DrawCircleFilled($pxX + $this->graphAreaPx[0][0],
$pxY + $this->graphAreaPx[0][1],
@@ -257,8 +263,8 @@ class Sparkline_Line extends Sparkline {
// draw features
//
while (list(, $v) = each($this->featurePoint)) {
- $pxY = round(($v['ptY'] + ($this->yMin * -1)) * ($this->GetGraphHeight() / $this->yMax));
- $pxX = round($v['ptX'] * $this->GetGraphWidth() / $this->dataSeriesStats[1]['xMax']);
+ $pxY = round(($v['ptY'] + ($this->yMin * -1)) * ($this->GetGraphHeight() / $this->yRange));
+ $pxX = round($v['ptX'] * $this->GetGraphWidth() / sizeof($this->dataSeries[1]));
$this->DrawCircleFilled($pxX + $this->graphAreaPx[0][0],
$pxY + $this->graphAreaPx[0][1],
diff --git a/libs/upgradephp/common.php b/libs/upgradephp/common.php
new file mode 100644
index 0000000000..14552fb113
--- /dev/null
+++ b/libs/upgradephp/common.php
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
+ * @version $Id$
+ *
+ * @package Piwik
+ */
+
+/**
+ * Sets the default client character set.
+ *
+ * @compat
+ * Procedural style
+ * @bugs
+ * PHP documentation says this function exists in PHP 5 >= 5.0.5,
+ * but it also depends on the versions of external libraries, e.g.,
+ * php_mysqli.dll and libmysql.dll.
+ *
+ * @param $link mysqli MySQLi connection resource
+ * @param $charset string Character set
+ * @return bool TRUE on success, FALSE on failure
+ */
+if (in_array('mysqli', @get_loaded_extensions()) && !function_exists('mysqli_set_charset')) {
+ function mysqli_set_charset($link, $charset)
+ {
+ return mysqli_query($link, "SET NAMES '$charset'");
+ }
+}
+
+/**
+ * parse_ini_file() replacement.
+ * Behaves like parse_ini_file($filename, $process_sections);
+ *
+ * @author Andrew Sohn <asohn (at) aircanopy (dot) net>
+ * @author anthon (dot) pang (at) gmail (dot) com
+ *
+ * @param string $filename
+ * @param bool $process_sections (defaults to false)
+ * @return array
+ */
+if(function_exists('parse_ini_file')) {
+ function _parse_ini_file($filename, $process_sections = false) {
+ return parse_ini_file($filename, $process_sections);
+ }
+} else {
+ function _parse_ini_file($filename, $process_sections = false)
+ {
+ if(function_exists('file_get_contents')) {
+ $ini = file_get_contents($filename);
+ } else if(function_exists('file') && version_compare(phpversion(), '6') >= 0) {
+ $ini = implode(file($filename), FILE_TEXT);
+ } else if(function_exists('fopen') && function_exists('fread')) {
+ $handle = fopen($filename, 'r');
+ $ini = fread($handle, filesize($filename));
+ fclose($handle);
+ } else {
+ return false;
+ }
+
+ if(is_string($ini)) { $ini = explode("\n", str_replace("\r", "\n", $ini)); }
+ if (count($ini) == 0) { return array(); }
+
+ $sections = array();
+ $values = array();
+ $result = array();
+ $globals = array();
+ $i = 0;
+ foreach ($ini as $line) {
+ $line = trim($line);
+ $line = str_replace("\t", " ", $line);
+
+ // Comments
+ if (!preg_match('/^[a-zA-Z0-9[]/', $line)) {continue;}
+
+ // Sections
+ if ($line{0} == '[') {
+ $tmp = explode(']', $line);
+ $sections[] = trim(substr($tmp[0], 1));
+ $i++;
+ continue;
+ }
+
+ // Key-value pair
+ list($key, $value) = explode('=', $line, 2);
+ $key = trim($key);
+ $value = trim($value);
+ if (strstr($value, ";")) {
+ $tmp = explode(';', $value);
+ if (count($tmp) == 2) {
+ if ((($value{0} != '"') && ($value{0} != "'")) ||
+ preg_match('/^".*"\s*;/', $value) || preg_match('/^".*;[^"]*$/', $value) ||
+ preg_match("/^'.*'\s*;/", $value) || preg_match("/^'.*;[^']*$/", $value) ){
+ $value = $tmp[0];
+ }
+ } else {
+ if ($value{0} == '"') {
+ $value = preg_replace('/^"(.*)".*/', '$1', $value);
+ } elseif ($value{0} == "'") {
+ $value = preg_replace("/^'(.*)'.*/", '$1', $value);
+ } else {
+ $value = $tmp[0];
+ }
+ }
+ }
+
+ $value = trim($value);
+ $value = trim($value, "'\"");
+
+ if ($i == 0) {
+ if (substr($key, -2) == '[]') {
+ $globals[substr($key, 0, -2)][] = $value;
+ } else {
+ $globals[$key] = $value;
+ }
+ } else {
+ if (substr($key, -2) == '[]') {
+ $values[$i-1][substr($key, 0, -2)][] = $value;
+ } else {
+ $values[$i-1][$key] = $value;
+ }
+ }
+ }
+
+ for($j = 0; $j < $i; $j++) {
+ if ($process_sections === true) {
+ $result[$sections[$j]] = $values[$j];
+ } else {
+ $result[] = $values[$j];
+ }
+ }
+
+ return $result + $globals;
+ }
+}