NextGEN Gallery – WordPress Gallery Plugin - Version 3.3.16

Version Description

  • 08.18.2020 =
  • Fixed: Override Thumbnail Settings not configurable
  • Fixed: Broken gallery displays in WP 5.5 with Classic Editor
  • Fixed: HTML in Gallery & Image fields
  • Fixed: Inability to save Gallery Settings or Other Options
Download this release

Release Info

Developer photocrati
Plugin Icon 128x128 NextGEN Gallery – WordPress Gallery Plugin
Version 3.3.16
Comparing to
See all releases

Code changes from version 3.3.11 to 3.3.16

Files changed (355) hide show
  1. changelog.txt +6 -0
  2. composer.json +2 -1
  3. composer.lock +59 -2
  4. nggallery.php +2 -2
  5. products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post.js +1 -1
  6. products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post.min.js +1 -1
  7. products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.js +1 -1
  8. products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.min.js +1 -1
  9. products/photocrati_nextgen/modules/attach_to_post/static/ngg_tabs.js +1 -1
  10. products/photocrati_nextgen/modules/attach_to_post/static/ngg_tabs.min.js +1 -1
  11. products/photocrati_nextgen/modules/frame_communication/static/frame_event_publisher.js +1 -1
  12. products/photocrati_nextgen/modules/frame_communication/static/frame_event_publisher.min.js +1 -1
  13. products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js +1 -1
  14. products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.min.js +1 -1
  15. products/photocrati_nextgen/modules/lightbox/static/shutter_reloaded/nextgen_shutter_reloaded.js +1 -1
  16. products/photocrati_nextgen/modules/lightbox/static/shutter_reloaded/nextgen_shutter_reloaded.min.js +1 -1
  17. products/photocrati_nextgen/modules/lightbox/static/simplelightbox/nextgen_simple_lightbox_init.js +1 -1
  18. products/photocrati_nextgen/modules/lightbox/static/simplelightbox/nextgen_simple_lightbox_init.min.js +1 -1
  19. products/photocrati_nextgen/modules/marketing/package.module.marketing.php +6 -3
  20. products/photocrati_nextgen/modules/marketing/static/{pro-mosiac-preview.jpg → pro-mosaic-preview.jpg} +0 -0
  21. products/photocrati_nextgen/modules/nextgen_addgallery_page/package.module.nextgen_addgallery_page.php +1 -0
  22. products/photocrati_nextgen/modules/nextgen_admin/static/jquery.nextgen_radio_toggle.js +1 -1
  23. products/photocrati_nextgen/modules/nextgen_admin/static/jquery.nextgen_radio_toggle.min.js +1 -1
  24. products/photocrati_nextgen/modules/nextgen_admin/static/nextgen_wizards.js +5 -5
  25. products/photocrati_nextgen/modules/nextgen_admin/static/nextgen_wizards.min.js +1 -1
  26. products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.js +1 -1
  27. products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.min.js +1 -1
  28. products/photocrati_nextgen/modules/nextgen_block/static/build/post-thumbnail.min.js +1 -1
  29. products/photocrati_nextgen/modules/nextgen_block/static/build/post-thumbnail.min.js.map +1 -1
  30. products/photocrati_nextgen/modules/nextgen_block/static/src/post-thumbnail.jsx +2 -2
  31. products/photocrati_nextgen/modules/nextgen_block/static/src/post-thumbnail.min.js +2 -2
  32. products/photocrati_nextgen/modules/nextgen_data/module.nextgen_data.php +34 -95
  33. products/photocrati_nextgen/modules/nextgen_gallery_display/package.module.nextgen_gallery_display.php +5 -1
  34. products/photocrati_nextgen/modules/nextgen_other_options/static/nextgen_settings_page.js +1 -1
  35. products/photocrati_nextgen/modules/nextgen_other_options/static/nextgen_settings_page.min.js +1 -1
  36. products/photocrati_nextgen/modules/ngglegacy/admin/tags.php +1 -1
  37. readme.txt +7 -1
  38. vendor/composer/autoload_files.php +1 -0
  39. vendor/composer/autoload_namespaces.php +1 -0
  40. vendor/composer/autoload_static.php +12 -0
  41. vendor/composer/installed.json +58 -0
  42. vendor/ezyang/htmlpurifier/CREDITS +9 -0
  43. vendor/ezyang/htmlpurifier/LICENSE +504 -0
  44. vendor/ezyang/htmlpurifier/README.md +29 -0
  45. vendor/ezyang/htmlpurifier/VERSION +1 -0
  46. vendor/ezyang/htmlpurifier/composer.json +28 -0
  47. vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php +11 -0
  48. vendor/ezyang/htmlpurifier/library/HTMLPurifier.autoload-legacy.php +15 -0
  49. vendor/ezyang/htmlpurifier/library/HTMLPurifier.autoload.php +24 -0
  50. vendor/ezyang/htmlpurifier/library/HTMLPurifier.composer.php +4 -0
  51. vendor/ezyang/htmlpurifier/library/HTMLPurifier.func.php +25 -0
  52. vendor/ezyang/htmlpurifier/library/HTMLPurifier.includes.php +234 -0
  53. vendor/ezyang/htmlpurifier/library/HTMLPurifier.kses.php +30 -0
  54. vendor/ezyang/htmlpurifier/library/HTMLPurifier.path.php +11 -0
  55. vendor/ezyang/htmlpurifier/library/HTMLPurifier.php +297 -0
  56. vendor/ezyang/htmlpurifier/library/HTMLPurifier.safe-includes.php +228 -0
  57. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Arborize.php +71 -0
  58. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrCollections.php +148 -0
  59. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef.php +144 -0
  60. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php +136 -0
  61. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php +34 -0
  62. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php +111 -0
  63. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php +157 -0
  64. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php +56 -0
  65. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php +161 -0
  66. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Composite.php +48 -0
  67. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php +44 -0
  68. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php +77 -0
  69. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Font.php +176 -0
  70. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php +219 -0
  71. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Ident.php +32 -0
  72. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php +56 -0
  73. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Length.php +77 -0
  74. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ListStyle.php +112 -0
  75. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Multiple.php +71 -0
  76. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Number.php +90 -0
  77. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Percentage.php +54 -0
  78. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php +46 -0
  79. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/URI.php +77 -0
  80. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Clone.php +44 -0
  81. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Enum.php +73 -0
  82. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php +48 -0
  83. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Class.php +48 -0
  84. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Color.php +51 -0
  85. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php +38 -0
  86. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/ID.php +113 -0
  87. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Length.php +56 -0
  88. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php +72 -0
  89. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/MultiLength.php +60 -0
  90. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php +70 -0
  91. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Pixels.php +76 -0
  92. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Integer.php +91 -0
  93. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Lang.php +86 -0
  94. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Switch.php +53 -0
  95. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Text.php +21 -0
  96. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI.php +111 -0
  97. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email.php +20 -0
  98. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php +29 -0
  99. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php +142 -0
  100. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv4.php +45 -0
  101. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv6.php +89 -0
  102. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform.php +60 -0
  103. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Background.php +28 -0
  104. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/BdoDir.php +27 -0
  105. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/BgColor.php +28 -0
  106. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/BoolToCSS.php +47 -0
  107. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Border.php +26 -0
  108. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/EnumToCSS.php +68 -0
  109. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/ImgRequired.php +47 -0
  110. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/ImgSpace.php +61 -0
  111. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Input.php +56 -0
  112. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Lang.php +31 -0
  113. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Length.php +45 -0
  114. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Name.php +33 -0
  115. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/NameSync.php +41 -0
  116. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Nofollow.php +52 -0
  117. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/SafeEmbed.php +25 -0
  118. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/SafeObject.php +28 -0
  119. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/SafeParam.php +79 -0
  120. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/ScriptRequired.php +23 -0
  121. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/TargetBlank.php +45 -0
  122. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/TargetNoopener.php +37 -0
  123. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/TargetNoreferrer.php +37 -0
  124. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Textarea.php +27 -0
  125. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTypes.php +96 -0
  126. vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrValidator.php +178 -0
  127. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Bootstrap.php +124 -0
  128. vendor/ezyang/htmlpurifier/library/HTMLPurifier/CSSDefinition.php +533 -0
  129. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef.php +52 -0
  130. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Chameleon.php +67 -0
  131. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Custom.php +102 -0
  132. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Empty.php +38 -0
  133. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/List.php +92 -0
  134. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Optional.php +45 -0
  135. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Required.php +118 -0
  136. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/StrictBlockquote.php +110 -0
  137. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Table.php +224 -0
  138. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Config.php +920 -0
  139. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema.php +176 -0
  140. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php +48 -0
  141. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Builder/Xml.php +144 -0
  142. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Exception.php +11 -0
  143. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Interchange.php +47 -0
  144. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Interchange/Directive.php +89 -0
  145. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Interchange/Id.php +58 -0
  146. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php +226 -0
  147. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Validator.php +248 -0
  148. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/ValidatorAtom.php +130 -0
  149. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema.ser +1 -0
  150. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedClasses.txt +8 -0
  151. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedFrameTargets.txt +12 -0
  152. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRel.txt +9 -0
  153. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRev.txt +9 -0
  154. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.ClassUseCDATA.txt +19 -0
  155. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultImageAlt.txt +11 -0
  156. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImage.txt +9 -0
  157. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImageAlt.txt +8 -0
  158. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultTextDir.txt +10 -0
  159. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.EnableID.txt +16 -0
  160. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.ForbiddenClasses.txt +8 -0
  161. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.ID.HTML5.txt +10 -0
  162. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklist.txt +5 -0
  163. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklistRegexp.txt +9 -0
  164. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefix.txt +12 -0
  165. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefixLocal.txt +14 -0
  166. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.AutoParagraph.txt +31 -0
  167. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Custom.txt +12 -0
  168. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.DisplayLinkURI.txt +11 -0
  169. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Linkify.txt +12 -0
  170. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.DocURL.txt +12 -0
  171. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.txt +12 -0
  172. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt +14 -0
  173. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt +11 -0
  174. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt +15 -0
  175. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.txt +46 -0
  176. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveSpansWithoutAttributes.txt +11 -0
  177. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowDuplicates.txt +11 -0
  178. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowImportant.txt +8 -0
  179. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowTricky.txt +11 -0
  180. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedFonts.txt +12 -0
  181. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedProperties.txt +18 -0
  182. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.DefinitionRev.txt +11 -0
  183. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.ForbiddenProperties.txt +13 -0
  184. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.MaxImgLength.txt +16 -0
  185. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.Proprietary.txt +10 -0
  186. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/CSS.Trusted.txt +9 -0
  187. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Cache.DefinitionImpl.txt +14 -0
  188. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPath.txt +13 -0
  189. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPermissions.txt +16 -0
  190. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyFixLt.txt +18 -0
  191. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyRemoveScript.txt +16 -0
  192. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.AllowHostnameUnderscore.txt +16 -0
  193. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.AllowParseManyTags.txt +12 -0
  194. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.CollectErrors.txt +12 -0
  195. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt +160 -0
  196. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.ConvertDocumentToFragment.txt +14 -0
  197. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.DirectLexLineNumberSyncInterval.txt +17 -0
  198. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.DisableExcludes.txt +14 -0
  199. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.EnableIDNA.txt +9 -0
  200. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.Encoding.txt +15 -0
  201. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidChildren.txt +12 -0
  202. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidTags.txt +7 -0
  203. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeNonASCIICharacters.txt +13 -0
  204. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.HiddenElements.txt +19 -0
  205. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.Language.txt +10 -0
  206. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.LegacyEntityDecoder.txt +36 -0
  207. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.LexerImpl.txt +34 -0
  208. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.MaintainLineNumbers.txt +16 -0
  209. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.NormalizeNewlines.txt +11 -0
  210. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveInvalidImg.txt +12 -0
  211. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveProcessingInstructions.txt +11 -0
  212. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveScriptContents.txt +12 -0
  213. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt +11 -0
  214. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Escaping.txt +14 -0
  215. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Scope.txt +29 -0
  216. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.TidyImpl.txt +16 -0
  217. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt +74 -0
  218. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt +16 -0
  219. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Allowed.txt +25 -0
  220. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedAttributes.txt +19 -0
  221. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedComments.txt +10 -0
  222. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedCommentsRegexp.txt +15 -0
  223. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedElements.txt +23 -0
  224. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedModules.txt +20 -0
  225. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Attr.Name.UseCDATA.txt +11 -0
  226. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.BlockWrapper.txt +18 -0
  227. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.CoreModules.txt +23 -0
  228. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt +9 -0
  229. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionID.txt +33 -0
  230. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionRev.txt +16 -0
  231. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Doctype.txt +11 -0
  232. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.FlashAllowFullScreen.txt +11 -0
  233. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenAttributes.txt +21 -0
  234. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenElements.txt +20 -0
  235. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Forms.txt +11 -0
  236. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.MaxImgLength.txt +14 -0
  237. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Nofollow.txt +7 -0
  238. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Parent.txt +12 -0
  239. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Proprietary.txt +12 -0
  240. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeEmbed.txt +13 -0
  241. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeIframe.txt +13 -0
  242. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeObject.txt +13 -0
  243. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeScripting.txt +10 -0
  244. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Strict.txt +9 -0
  245. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetBlank.txt +8 -0
  246. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoopener.txt +10 -0
  247. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoreferrer.txt +9 -0
  248. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyAdd.txt +8 -0
  249. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyLevel.txt +24 -0
  250. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyRemove.txt +8 -0
  251. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.Trusted.txt +9 -0
  252. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/HTML.XHTML.txt +11 -0
  253. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Output.CommentScriptContents.txt +10 -0
  254. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Output.FixInnerHTML.txt +15 -0
  255. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Output.FlashCompat.txt +11 -0
  256. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Output.Newline.txt +13 -0
  257. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Output.SortAttr.txt +14 -0
  258. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Output.TidyFormat.txt +25 -0
  259. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Test.ForceNoIconv.txt +7 -0
  260. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.AllowedSchemes.txt +18 -0
  261. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.Base.txt +17 -0
  262. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt +15 -0
  263. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionID.txt +11 -0
  264. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionRev.txt +11 -0
  265. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.Disable.txt +14 -0
  266. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternal.txt +11 -0
  267. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternalResources.txt +13 -0
  268. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.DisableResources.txt +15 -0
  269. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.Host.txt +19 -0
  270. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.HostBlacklist.txt +9 -0
  271. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.MakeAbsolute.txt +13 -0
  272. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.Munge.txt +83 -0
  273. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.MungeResources.txt +17 -0
  274. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt +30 -0
  275. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.OverrideAllowedSchemes.txt +9 -0
  276. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/URI.SafeIframeRegexp.txt +22 -0
  277. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/info.ini +3 -0
  278. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ContentSets.php +170 -0
  279. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Context.php +95 -0
  280. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Definition.php +55 -0
  281. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache.php +129 -0
  282. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Decorator.php +112 -0
  283. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php +78 -0
  284. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Decorator/Memory.php +85 -0
  285. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Decorator/Template.php.in +82 -0
  286. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Null.php +76 -0
  287. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer.php +311 -0
  288. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/README +3 -0
  289. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCacheFactory.php +106 -0
  290. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Doctype.php +73 -0
  291. vendor/ezyang/htmlpurifier/library/HTMLPurifier/DoctypeRegistry.php +142 -0
  292. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ElementDef.php +216 -0
  293. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Encoder.php +617 -0
  294. vendor/ezyang/htmlpurifier/library/HTMLPurifier/EntityLookup.php +48 -0
  295. vendor/ezyang/htmlpurifier/library/HTMLPurifier/EntityLookup/entities.ser +1 -0
  296. vendor/ezyang/htmlpurifier/library/HTMLPurifier/EntityParser.php +285 -0
  297. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ErrorCollector.php +244 -0
  298. vendor/ezyang/htmlpurifier/library/HTMLPurifier/ErrorStruct.php +74 -0
  299. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Exception.php +12 -0
  300. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Filter.php +56 -0
  301. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Filter/ExtractStyleBlocks.php +341 -0
  302. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Filter/YouTube.php +65 -0
  303. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Generator.php +286 -0
  304. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLDefinition.php +493 -0
  305. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule.php +284 -0
  306. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Bdo.php +44 -0
  307. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/CommonAttributes.php +31 -0
  308. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Edit.php +55 -0
  309. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Forms.php +194 -0
  310. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Hypertext.php +40 -0
  311. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Iframe.php +51 -0
  312. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Image.php +49 -0
  313. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Legacy.php +186 -0
  314. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/List.php +51 -0
  315. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Name.php +26 -0
  316. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Nofollow.php +25 -0
  317. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php +20 -0
  318. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Object.php +62 -0
  319. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Presentation.php +42 -0
  320. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Proprietary.php +40 -0
  321. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Ruby.php +36 -0
  322. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/SafeEmbed.php +40 -0
  323. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/SafeObject.php +62 -0
  324. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/SafeScripting.php +40 -0
  325. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Scripting.php +73 -0
  326. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/StyleAttribute.php +33 -0
  327. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php +75 -0
  328. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Target.php +28 -0
  329. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/TargetBlank.php +24 -0
  330. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/TargetNoopener.php +21 -0
  331. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/TargetNoreferrer.php +21 -0
  332. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Text.php +87 -0
  333. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy.php +230 -0
  334. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy/Name.php +33 -0
  335. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php +34 -0
  336. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy/Strict.php +43 -0
  337. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy/Transitional.php +16 -0
  338. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy/XHTML.php +26 -0
  339. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php +180 -0
  340. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/XMLCommonAttributes.php +20 -0
  341. vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModuleManager.php +467 -0
  342. vendor/ezyang/htmlpurifier/library/HTMLPurifier/IDAccumulator.php +57 -0
  343. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector.php +283 -0
  344. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/AutoParagraph.php +356 -0
  345. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/DisplayLinkURI.php +40 -0
  346. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/Linkify.php +64 -0
  347. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/PurifierLinkify.php +71 -0
  348. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/RemoveEmpty.php +112 -0
  349. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php +84 -0
  350. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/SafeObject.php +124 -0
  351. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language.php +204 -0
  352. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en.php +55 -0
  353. vendor/ezyang/htmlpurifier/library/HTMLPurifier/LanguageFactory.php +209 -0
  354. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Length.php +162 -0
  355. vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer.php +370 -0
changelog.txt CHANGED
@@ -1,6 +1,12 @@
1
  NextGEN Gallery
2
  by Imagely
3
 
 
 
 
 
 
 
4
  = V3.3.11 - 08.14.2020 =
5
  * Fixed: Fancybox lightbox not working with WordPress 5.5
6
  * Fixed: Inability to upload images or create galleries in WordPress 5.5
1
  NextGEN Gallery
2
  by Imagely
3
 
4
+ = V3.3.16 - 08.18.2020 =
5
+ * Fixed: Override Thumbnail Settings not configurable
6
+ * Fixed: Broken gallery displays in WP 5.5 with Classic Editor
7
+ * Fixed: HTML in Gallery & Image fields
8
+ * Fixed: Inability to save Gallery Settings or Other Options
9
+
10
  = V3.3.11 - 08.14.2020 =
11
  * Fixed: Fancybox lightbox not working with WordPress 5.5
12
  * Fixed: Inability to upload images or create galleries in WordPress 5.5
composer.json CHANGED
@@ -11,7 +11,8 @@
11
  {"packagist.org": false}
12
  ],
13
  "require": {
14
- "imagely/pope-framework": "v0.16"
 
15
  },
16
  "require-dev": {
17
  "nikic/php-parser": "^4.3"
11
  {"packagist.org": false}
12
  ],
13
  "require": {
14
+ "imagely/pope-framework": "v0.16",
15
+ "ezyang/htmlpurifier": "^4.13"
16
  },
17
  "require-dev": {
18
  "nikic/php-parser": "^4.3"
composer.lock CHANGED
@@ -4,8 +4,64 @@
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
- "content-hash": "82ce22d8971d1f742e7c2238cf7840d8",
8
  "packages": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  {
10
  "name": "imagely/pope-framework",
11
  "version": "v0.16",
@@ -116,5 +172,6 @@
116
  "prefer-stable": false,
117
  "prefer-lowest": false,
118
  "platform": [],
119
- "platform-dev": []
 
120
  }
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
+ "content-hash": "08767df545d4de682892862eee42f18f",
8
  "packages": [
9
+ {
10
+ "name": "ezyang/htmlpurifier",
11
+ "version": "v4.13.0",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/ezyang/htmlpurifier.git",
15
+ "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
20
+ "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
21
+ "shasum": "",
22
+ "mirrors": [
23
+ {
24
+ "url": "https://repo.packagist.com/imagely/dists/%package%/%version%/%reference%.%type%",
25
+ "preferred": true
26
+ }
27
+ ]
28
+ },
29
+ "require": {
30
+ "php": ">=5.2"
31
+ },
32
+ "require-dev": {
33
+ "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
34
+ },
35
+ "type": "library",
36
+ "autoload": {
37
+ "psr-0": {
38
+ "HTMLPurifier": "library/"
39
+ },
40
+ "files": [
41
+ "library/HTMLPurifier.composer.php"
42
+ ],
43
+ "exclude-from-classmap": [
44
+ "/library/HTMLPurifier/Language/"
45
+ ]
46
+ },
47
+ "notification-url": "https://repo.packagist.com/imagely/downloads/",
48
+ "license": [
49
+ "LGPL-2.1-or-later"
50
+ ],
51
+ "authors": [
52
+ {
53
+ "name": "Edward Z. Yang",
54
+ "email": "admin@htmlpurifier.org",
55
+ "homepage": "http://ezyang.com"
56
+ }
57
+ ],
58
+ "description": "Standards compliant HTML filter written in PHP",
59
+ "homepage": "http://htmlpurifier.org/",
60
+ "keywords": [
61
+ "html"
62
+ ],
63
+ "time": "2020-06-29T00:56:53+00:00"
64
+ },
65
  {
66
  "name": "imagely/pope-framework",
67
  "version": "v0.16",
172
  "prefer-stable": false,
173
  "prefer-lowest": false,
174
  "platform": [],
175
+ "platform-dev": [],
176
+ "plugin-api-version": "1.1.0"
177
  }
nggallery.php CHANGED
@@ -4,7 +4,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
4
  /**
5
  * Plugin Name: NextGEN Gallery
6
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 28 million downloads.
7
- * Version: 3.3.11
8
  * Author: Imagely
9
  * Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
10
  * Author URI: https://www.imagely.com
@@ -680,7 +680,7 @@ class C_NextGEN_Bootstrap
680
  define('NGG_PRODUCT_URL', path_join(str_replace("\\" , '/', NGG_PLUGIN_URL), 'products'));
681
  define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
682
  define('NGG_PLUGIN_STARTED_AT', microtime());
683
- define('NGG_PLUGIN_VERSION', '3.3.11');
684
 
685
  define(
686
  'NGG_SCRIPT_VERSION',
4
  /**
5
  * Plugin Name: NextGEN Gallery
6
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 28 million downloads.
7
+ * Version: 3.3.16
8
  * Author: Imagely
9
  * Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
10
  * Author URI: https://www.imagely.com
680
  define('NGG_PRODUCT_URL', path_join(str_replace("\\" , '/', NGG_PLUGIN_URL), 'products'));
681
  define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
682
  define('NGG_PLUGIN_STARTED_AT', microtime());
683
+ define('NGG_PLUGIN_VERSION', '3.3.16');
684
 
685
  define(
686
  'NGG_SCRIPT_VERSION',
products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post.js CHANGED
@@ -109,7 +109,7 @@ jQuery(function($) {
109
  });
110
 
111
  // If the preview area is being displayed, emit an event for that
112
- $('.ngg_page_content_menu a').bind('click', function(){
113
  if ($(this).attr('data-id') === 'preview_tab') {
114
  $('#preview_area').trigger('opened');
115
  }
109
  });
110
 
111
  // If the preview area is being displayed, emit an event for that
112
+ $('.ngg_page_content_menu a').on('click', function(){
113
  if ($(this).attr('data-id') === 'preview_tab') {
114
  $('#preview_area').trigger('opened');
115
  }
products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post.min.js CHANGED
@@ -1 +1 @@
1
- function close_attach_to_post_window(){var e=jQuery(top.document).find("#TB_window iframe").attr("src");e&&e.match("attach_to_post")?top.tb_remove():top.tinyMCE.activeEditor.windowManager.close(window)}function adjust_height_for_frame(e,t,i){if(!/crios|iP(hone|od|ad)/i.test(navigator.userAgent))return void 0===i||i(e,t);var a=jQuery(t.frameElement),o=a.contents().height()/3,n=a.contents().find("#wpbody").height(),s=jQuery(e.document).height(),d=a.height();if(0===n&&(n=a.contents().height()),o<n&&(o=n),o<s&&(o=s),d<o){var c=a.attr("id");if(c&&0===c.indexOf("ngg-iframe-")){var r=c.substr(11);r&&jQuery("#"+r).height(o)}}return void 0===i||i(e,t,o)}function ngg_get_measures_for_frame(e){var t=jQuery(e),i=t.attr("id"),a={};if(i&&0===i.indexOf("ngg-iframe-")){if(i.substr(11)){var o=jQuery(document);a.scrollTop=o.scrollTop()-40,window.parent?a.scrollHeight=jQuery(window.parent.document).find(".ngg_attach_to_post_window").height()-40:a.scrollHeight=o.height(),void 0!==window.console&&console.log(a)}}return a}function is_visual_editor(){return 0===jQuery(top.document).find(".html-active:visible").length}function insert_into_editor(e,t){if(is_visual_editor()){var i=top.tinyMCE.activeEditor;i.selection.getNode().outerHTML.indexOf(t)>=0?jQuery(i.selection.getNode()).attr("data-shortcode",e.substring(1,e.length-1)):i.execCommand("mceInsertContent",!1,e),i.selection.collapse(!1)}else if(myField=top.document.getElementById("content"),myValue=e,document.selection)myField.focus(),sel=document.selection.createRange(),sel.text=myValue;else if(myField.selectionStart||"0"===myField.selectionStart){var a=myField.selectionStart,o=myField.selectionEnd;myField.value=myField.value.substring(0,a)+myValue+myField.value.substring(o,myField.value.length)}else myField.value+=myValue}this.id="ngg-attach_to_post",jQuery(function(e){/crios|iP(hone|od|ad)/i.test(navigator.userAgent)&&e("#attach_to_post_tabs").addClass("ngg_atp_ios_detected"),e("#attach_to_post_tabs").ngg_tabs({onShowTab:function(t){navigator.appVersion.match(/Chrome\/(69|7)/)&&("displayed_tab"!=t.attr("id")?e("#attach_to_post_tabs").addClass("chrome_70_hack_frames").removeClass("chrome_70_hack_noframes"):e("#attach_to_post_tabs").removeClass("chrome_70_hack_frames").addClass("chrome_70_hack_noframes"))}}),e(".ngg_page_content_menu a").bind("click",function(){"preview_tab"===e(this).attr("data-id")&&e("#preview_area").trigger("opened")}),e(".accordion").accordion({clearStyle:!0,autoHeight:!1,heightStyle:"content"}),e(".ui-tabs-nav li:first-of-type a").addClass("active_tab"),e(".ui-tabs-nav a").click(function(t){e(".ui-tabs-nav a").removeClass("active_tab"),e(this).addClass("active_tab");var i=t.target?t.target:t.srcElement;if(e(i).parent().hasClass("ui-state-active")){var a=e(i.hash+" iframe");a.length>0&&a[0].contentDocument.location!=a.attr("src")&&(a[0].contentDocument.location=a.attr("src"))}}),e(this).keydown(function(e){27===e.keyCode&&close_attach_to_post_window()}),e("body").css({position:"static",visibility:"visible"}).animate({opacity:1})}),jQuery(function(e){e("#displayed_tab .ngg_igw_video_open").click(function(t){e("#displayed_tab .ngg_igw_video_inner").append('<iframe class="ngg_igw_video_iframe" width="1050" height="590" src="https://www.youtube.com/embed/mNEnY23i9DE?rel=0" frameborder="0" allowfullscreen></iframe>'),e("#displayed_tab .ngg_igw_video_inner").css("display","block"),e("#displayed_tab .ngg_igw_video_open").css("display","none")}),e("#displayed_tab .ngg_igw_video_close").click(function(t){e("#displayed_tab .ngg_igw_video_iframe").remove(),e("#displayed_tab .ngg_igw_video_inner").css("display","none"),e("#displayed_tab .ngg_igw_video_open").css("display","block")})}),jQuery(function(e){e(".ngg_page_content_menu a").click(function(t){"choose_display"==e(this).attr("data-id")?e("#displayed_tab .ngg_igw_video_open").css("display","block"):(e("#displayed_tab .ngg_igw_video_open").css("display","none"),e("#displayed_tab .ngg_igw_video_inner").css("display","none"))})});
1
+ function close_attach_to_post_window(){var e=jQuery(top.document).find("#TB_window iframe").attr("src");e&&e.match("attach_to_post")?top.tb_remove():top.tinyMCE.activeEditor.windowManager.close(window)}function adjust_height_for_frame(e,t,i){if(!/crios|iP(hone|od|ad)/i.test(navigator.userAgent))return void 0===i||i(e,t);var a=jQuery(t.frameElement),o=a.contents().height()/3,n=a.contents().find("#wpbody").height(),s=jQuery(e.document).height(),d=a.height();if(0===n&&(n=a.contents().height()),o<n&&(o=n),o<s&&(o=s),d<o){var c=a.attr("id");if(c&&0===c.indexOf("ngg-iframe-")){var r=c.substr(11);r&&jQuery("#"+r).height(o)}}return void 0===i||i(e,t,o)}function ngg_get_measures_for_frame(e){var t=jQuery(e),i=t.attr("id"),a={};if(i&&0===i.indexOf("ngg-iframe-")){if(i.substr(11)){var o=jQuery(document);a.scrollTop=o.scrollTop()-40,window.parent?a.scrollHeight=jQuery(window.parent.document).find(".ngg_attach_to_post_window").height()-40:a.scrollHeight=o.height(),void 0!==window.console&&console.log(a)}}return a}function is_visual_editor(){return 0===jQuery(top.document).find(".html-active:visible").length}function insert_into_editor(e,t){if(is_visual_editor()){var i=top.tinyMCE.activeEditor;i.selection.getNode().outerHTML.indexOf(t)>=0?jQuery(i.selection.getNode()).attr("data-shortcode",e.substring(1,e.length-1)):i.execCommand("mceInsertContent",!1,e),i.selection.collapse(!1)}else if(myField=top.document.getElementById("content"),myValue=e,document.selection)myField.focus(),sel=document.selection.createRange(),sel.text=myValue;else if(myField.selectionStart||"0"===myField.selectionStart){var a=myField.selectionStart,o=myField.selectionEnd;myField.value=myField.value.substring(0,a)+myValue+myField.value.substring(o,myField.value.length)}else myField.value+=myValue}this.id="ngg-attach_to_post",jQuery(function(e){/crios|iP(hone|od|ad)/i.test(navigator.userAgent)&&e("#attach_to_post_tabs").addClass("ngg_atp_ios_detected"),e("#attach_to_post_tabs").ngg_tabs({onShowTab:function(t){navigator.appVersion.match(/Chrome\/(69|7)/)&&("displayed_tab"!=t.attr("id")?e("#attach_to_post_tabs").addClass("chrome_70_hack_frames").removeClass("chrome_70_hack_noframes"):e("#attach_to_post_tabs").removeClass("chrome_70_hack_frames").addClass("chrome_70_hack_noframes"))}}),e(".ngg_page_content_menu a").on("click",function(){"preview_tab"===e(this).attr("data-id")&&e("#preview_area").trigger("opened")}),e(".accordion").accordion({clearStyle:!0,autoHeight:!1,heightStyle:"content"}),e(".ui-tabs-nav li:first-of-type a").addClass("active_tab"),e(".ui-tabs-nav a").click(function(t){e(".ui-tabs-nav a").removeClass("active_tab"),e(this).addClass("active_tab");var i=t.target?t.target:t.srcElement;if(e(i).parent().hasClass("ui-state-active")){var a=e(i.hash+" iframe");a.length>0&&a[0].contentDocument.location!=a.attr("src")&&(a[0].contentDocument.location=a.attr("src"))}}),e(this).keydown(function(e){27===e.keyCode&&close_attach_to_post_window()}),e("body").css({position:"static",visibility:"visible"}).animate({opacity:1})}),jQuery(function(e){e("#displayed_tab .ngg_igw_video_open").click(function(t){e("#displayed_tab .ngg_igw_video_inner").append('<iframe class="ngg_igw_video_iframe" width="1050" height="590" src="https://www.youtube.com/embed/mNEnY23i9DE?rel=0" frameborder="0" allowfullscreen></iframe>'),e("#displayed_tab .ngg_igw_video_inner").css("display","block"),e("#displayed_tab .ngg_igw_video_open").css("display","none")}),e("#displayed_tab .ngg_igw_video_close").click(function(t){e("#displayed_tab .ngg_igw_video_iframe").remove(),e("#displayed_tab .ngg_igw_video_inner").css("display","none"),e("#displayed_tab .ngg_igw_video_open").css("display","block")})}),jQuery(function(e){e(".ngg_page_content_menu a").click(function(t){"choose_display"==e(this).attr("data-id")?e("#displayed_tab .ngg_igw_video_open").css("display","block"):(e("#displayed_tab .ngg_igw_video_open").css("display","none"),e("#displayed_tab .ngg_igw_video_inner").css("display","none"))})});
products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.js CHANGED
@@ -55,7 +55,7 @@
55
  });
56
 
57
  editor.on('SaveContent', function(event) {
58
- if (wp.blocks) {
59
  handle_shortcode(event, '[ngg_images ');
60
  handle_shortcode(event, '[ngg ');
61
  }
55
  });
56
 
57
  editor.on('SaveContent', function(event) {
58
+ if ($('body').hasClass('block-editor-page')) {
59
  handle_shortcode(event, '[ngg_images ');
60
  handle_shortcode(event, '[ngg ');
61
  }
products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){window.id="wordpress-post-page",tinyMCE.addI18n("en.ngg_attach_to_post",{title:"Attach NextGEN Gallery to Post"}),tinymce.create("tinymce.plugins.NextGEN_AttachToPost",{siteurl:t,getInfo:function(){return{longname:"NextGEN Gallery",author:"Imagely",authorurl:"https://www.imagely.com",infourl:"https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/",version:"0.1"}},init:function(t,n){function o(t,n){for(;t.content.indexOf(n)>=0;){for(var o=t.content.indexOf(n),a=o+n.length,r=!1,i=null,c=!1,g=t.content.length;;){var l=t.content[a];if('"'==l||"'"==l&&"="==c)r&&i==l?(r=!1,i=null):(r=!0,i=l);else if("]"==l&&!r)break;if(c=l,a==g)break;a++}var s=t.content.substring(o,++a),d=s.substring(1,s.length-1);d=d.replace("[","&#91;"),d=d.replace("]","&#93;");var h=_.template(e("#ngg-igw-placeholder").html());t.content=t.content.replace(s,h(e.extend(ngg_igw_i18n,{shortcode:d,ref:_.now()})))}}var a=this;t.windowManager.nggOldOpen=t.windowManager.open,t.windowManager.open=function(e,n){var o=t.windowManager.nggOldOpen(e,n);return o.on("close",a.wm_close_event),o},t.addCommand("ngg_attach_to_post",this.render_attach_to_post_interface,{editor:t,plugin:t.plugins.NextGEN_AttachToPost}),t.addButton("NextGEN_AttachToPost",{title:"ngg_attach_to_post.title",cmd:"ngg_attach_to_post",image:n+"/igw_button.png"}),t.on("SaveContent",function(t){wp.blocks&&(o(t,"[ngg_images "),o(t,"[ngg "))}),t.on("mouseup touchend",function(n){if(tinymce.extend(a,{editor:t,plugin:t.plugins.NextGEN_AttachToPost}),"IMG"==n.target.tagName){if(a.get_class_name(n.target).indexOf("ngg_displayed_gallery")>=0){t.dom.events.cancel(n);var o=n.target.src.match(/\d+$/);o&&(o=o.pop()),a.render_attach_to_post_interface({key:"id",val:o})}}else{var r=e(n.target);if(r.hasClass("nggPlaceholderButton"))if(r.hasClass("nggIgwRemove")){var i=r.parents(".nggPlaceholder"),c=i[0].getAttribute("data-shortcode");t.fire("ngg-removed",{shortcode:c}),i.remove()}else window.igw_shortcode=e(n.target).parents(".nggPlaceholder")[0].getAttribute("data-shortcode"),a.render_attach_to_post_interface({key:"shortcode",val:Base64.encode(window.igw_shortcode),ref:e(n.target).parents(".nggPlaceholder").attr("id")})}}),t.on("BeforeSetContent",function(t){o(t,"[ngg_images "),o(t,"[ngg ")}),t.on("PostProcess",function(t){var n=e("<div/>").append(t.content);n.find(".nggPlaceholder").toArray().forEach(function(t){var n=e(t),o=n.data("shortcode");o="["+_.unescape(o)+"]",n.replaceWith(o)}),t.content=n[0].innerHTML})},get_class_name:function(t){var e=t.getAttribute("class")?t.getAttribute("class"):t.className;return e||""},wm_close_event:function(t){t&&t.target&&t.target._id&&"ngg_attach_to_post_dialog"==t.target._id&&(e("html,body").css("overflow","auto"),tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.dom.select("p")[0]),tinyMCE.activeEditor.selection.collapse(0))},render_attach_to_post_interface:function(t){var n=nextgen_gallery_attach_to_post_url;void 0!==t&&(n+="&"+t.key+"="+encodeURIComponent(t.val),void 0!==t.ref&&(n+="&ref="+encodeURIComponent(t.ref))),n+="&editor="+this.editor.id;for(var o=window;null!=o.parent&&o.parent!=o;)o=o.parent;o=e(o);var a=o.width(),r=o.height(),i=1600,c=1200,g=a-.05*a,l=r-.1*r;g<800&&(g=a-20),l<600&&(l=r-40),i>g&&(i=g),c>l&&(c=l),document.activeElement.blur(),Array.prototype.forEach.call(document.querySelectorAll("input, textarea"),function(t){t.blur()}),this.editor.windowManager.open({url:n,id:"ngg_attach_to_post_dialog",width:i,height:c,title:"NextGEN Gallery - Attach To Post"}),e("html,body").css("overflow","hidden"),e("#ngg_attach_to_post_dialog_ifr").css("overflow-y","auto"),e("#ngg_attach_to_post_dialog_ifr").css("overflow-x","hidden")}}),tinymce.PluginManager.add("NextGEN_AttachToPost",tinymce.plugins.NextGEN_AttachToPost)}(photocrati_ajax.wp_site_url,jQuery);
1
+ !function(t,e){window.id="wordpress-post-page",tinyMCE.addI18n("en.ngg_attach_to_post",{title:"Attach NextGEN Gallery to Post"}),tinymce.create("tinymce.plugins.NextGEN_AttachToPost",{siteurl:t,getInfo:function(){return{longname:"NextGEN Gallery",author:"Imagely",authorurl:"https://www.imagely.com",infourl:"https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/",version:"0.1"}},init:function(t,n){function o(t,n){for(;t.content.indexOf(n)>=0;){for(var o=t.content.indexOf(n),a=o+n.length,r=!1,i=null,c=!1,g=t.content.length;;){var l=t.content[a];if('"'==l||"'"==l&&"="==c)r&&i==l?(r=!1,i=null):(r=!0,i=l);else if("]"==l&&!r)break;if(c=l,a==g)break;a++}var s=t.content.substring(o,++a),d=s.substring(1,s.length-1);d=d.replace("[","&#91;"),d=d.replace("]","&#93;");var h=_.template(e("#ngg-igw-placeholder").html());t.content=t.content.replace(s,h(e.extend(ngg_igw_i18n,{shortcode:d,ref:_.now()})))}}var a=this;t.windowManager.nggOldOpen=t.windowManager.open,t.windowManager.open=function(e,n){var o=t.windowManager.nggOldOpen(e,n);return o.on("close",a.wm_close_event),o},t.addCommand("ngg_attach_to_post",this.render_attach_to_post_interface,{editor:t,plugin:t.plugins.NextGEN_AttachToPost}),t.addButton("NextGEN_AttachToPost",{title:"ngg_attach_to_post.title",cmd:"ngg_attach_to_post",image:n+"/igw_button.png"}),t.on("SaveContent",function(t){e("body").hasClass("block-editor-page")&&(o(t,"[ngg_images "),o(t,"[ngg "))}),t.on("mouseup touchend",function(n){if(tinymce.extend(a,{editor:t,plugin:t.plugins.NextGEN_AttachToPost}),"IMG"==n.target.tagName){if(a.get_class_name(n.target).indexOf("ngg_displayed_gallery")>=0){t.dom.events.cancel(n);var o=n.target.src.match(/\d+$/);o&&(o=o.pop()),a.render_attach_to_post_interface({key:"id",val:o})}}else{var r=e(n.target);if(r.hasClass("nggPlaceholderButton"))if(r.hasClass("nggIgwRemove")){var i=r.parents(".nggPlaceholder"),c=i[0].getAttribute("data-shortcode");t.fire("ngg-removed",{shortcode:c}),i.remove()}else window.igw_shortcode=e(n.target).parents(".nggPlaceholder")[0].getAttribute("data-shortcode"),a.render_attach_to_post_interface({key:"shortcode",val:Base64.encode(window.igw_shortcode),ref:e(n.target).parents(".nggPlaceholder").attr("id")})}}),t.on("BeforeSetContent",function(t){o(t,"[ngg_images "),o(t,"[ngg ")}),t.on("PostProcess",function(t){var n=e("<div/>").append(t.content);n.find(".nggPlaceholder").toArray().forEach(function(t){var n=e(t),o=n.data("shortcode");o="["+_.unescape(o)+"]",n.replaceWith(o)}),t.content=n[0].innerHTML})},get_class_name:function(t){var e=t.getAttribute("class")?t.getAttribute("class"):t.className;return e||""},wm_close_event:function(t){t&&t.target&&t.target._id&&"ngg_attach_to_post_dialog"==t.target._id&&(e("html,body").css("overflow","auto"),tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.dom.select("p")[0]),tinyMCE.activeEditor.selection.collapse(0))},render_attach_to_post_interface:function(t){var n=nextgen_gallery_attach_to_post_url;void 0!==t&&(n+="&"+t.key+"="+encodeURIComponent(t.val),void 0!==t.ref&&(n+="&ref="+encodeURIComponent(t.ref))),n+="&editor="+this.editor.id;for(var o=window;null!=o.parent&&o.parent!=o;)o=o.parent;o=e(o);var a=o.width(),r=o.height(),i=1600,c=1200,g=a-.05*a,l=r-.1*r;g<800&&(g=a-20),l<600&&(l=r-40),i>g&&(i=g),c>l&&(c=l),document.activeElement.blur(),Array.prototype.forEach.call(document.querySelectorAll("input, textarea"),function(t){t.blur()}),this.editor.windowManager.open({url:n,id:"ngg_attach_to_post_dialog",width:i,height:c,title:"NextGEN Gallery - Attach To Post"}),e("html,body").css("overflow","hidden"),e("#ngg_attach_to_post_dialog_ifr").css("overflow-y","auto"),e("#ngg_attach_to_post_dialog_ifr").css("overflow-x","hidden")}}),tinymce.PluginManager.add("NextGEN_AttachToPost",tinymce.plugins.NextGEN_AttachToPost)}(photocrati_ajax.wp_site_url,jQuery);
products/photocrati_nextgen/modules/attach_to_post/static/ngg_tabs.js CHANGED
@@ -32,7 +32,7 @@ jQuery(function($) {
32
  });
33
 
34
  // When the selected tab changes, then we need to re-adjust
35
- this.bind('tabsactivate', function(event, ui) {
36
  // Ensure that all tabs are still displayed, but hidden ;)
37
  $.fn.ngg_tabs.hide_tab($.fn.ngg_tabs.get_tab_by_li(ui.oldTab), options.onHideTab);
38
  $.fn.ngg_tabs.show_tab($.fn.ngg_tabs.get_tab_by_li(ui.newTab), options.onShowTab);
32
  });
33
 
34
  // When the selected tab changes, then we need to re-adjust
35
+ this.on('tabsactivate', function(event, ui) {
36
  // Ensure that all tabs are still displayed, but hidden ;)
37
  $.fn.ngg_tabs.hide_tab($.fn.ngg_tabs.get_tab_by_li(ui.oldTab), options.onHideTab);
38
  $.fn.ngg_tabs.show_tab($.fn.ngg_tabs.get_tab_by_li(ui.newTab), options.onShowTab);
products/photocrati_nextgen/modules/attach_to_post/static/ngg_tabs.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(t){t.fn.ngg_tabs=function(i){/crios|iP(hone|od|ad)/i.test(navigator.userAgent)&&(this.find(".main_menu_tab").each(function(){"create_tab"===this.id&&t(this).remove()}),this.find("ul li a").each(function(){-1!==this.href.indexOf("#create_tab")&&t(this).parent("li").remove()})),this.tabs(i);var n=0;this.find(".main_menu_tab").each(function(){0===n?t.fn.ngg_tabs.show_tab(this,i.onShowTab):t.fn.ngg_tabs.hide_tab(this,i.onHideTab),n++}),this.bind("tabsactivate",function(n,a){t.fn.ngg_tabs.hide_tab(t.fn.ngg_tabs.get_tab_by_li(a.oldTab),i.onHideTab),t.fn.ngg_tabs.show_tab(t.fn.ngg_tabs.get_tab_by_li(a.newTab),i.onShowTab)})},t.fn.ngg_tabs.hide_tab=function(i,n){setTimeout(function(){t(i).css({display:"block","z-index":-10,visibility:"hidden",opacity:0}).addClass("ngg-tab-inactive").removeClass("ngg-tab-active").trigger("tab-hidden"),n&&n(i)},0)},t.fn.ngg_tabs.show_tab=function(i,n){i=t(i),setTimeout(function(){var t=i.find("iframe")[0];void 0!==t&&void 0!==t.contentWindow&&adjust_height_for_frame(top,t.contentWindow)},50),setTimeout(function(){i.css({"z-index":1,visibility:"visible",opacity:1}).addClass("ngg-tab-active").removeClass("ngg-tab-inactive").trigger("tab-visible"),n&&n(i)},50),n&&n(i)},t.fn.ngg_tabs.get_tab_by_li=function(t){return t.parents("div").find('.main_menu_tab[aria-labelledby="'+t.attr("aria-labelledby")+'"]')}});
1
+ jQuery(function(t){t.fn.ngg_tabs=function(i){/crios|iP(hone|od|ad)/i.test(navigator.userAgent)&&(this.find(".main_menu_tab").each(function(){"create_tab"===this.id&&t(this).remove()}),this.find("ul li a").each(function(){-1!==this.href.indexOf("#create_tab")&&t(this).parent("li").remove()})),this.tabs(i);var n=0;this.find(".main_menu_tab").each(function(){0===n?t.fn.ngg_tabs.show_tab(this,i.onShowTab):t.fn.ngg_tabs.hide_tab(this,i.onHideTab),n++}),this.on("tabsactivate",function(n,a){t.fn.ngg_tabs.hide_tab(t.fn.ngg_tabs.get_tab_by_li(a.oldTab),i.onHideTab),t.fn.ngg_tabs.show_tab(t.fn.ngg_tabs.get_tab_by_li(a.newTab),i.onShowTab)})},t.fn.ngg_tabs.hide_tab=function(i,n){setTimeout(function(){t(i).css({display:"block","z-index":-10,visibility:"hidden",opacity:0}).addClass("ngg-tab-inactive").removeClass("ngg-tab-active").trigger("tab-hidden"),n&&n(i)},0)},t.fn.ngg_tabs.show_tab=function(i,n){i=t(i),setTimeout(function(){var t=i.find("iframe")[0];void 0!==t&&void 0!==t.contentWindow&&adjust_height_for_frame(top,t.contentWindow)},50),setTimeout(function(){i.css({"z-index":1,visibility:"visible",opacity:1}).addClass("ngg-tab-active").removeClass("ngg-tab-inactive").trigger("tab-visible"),n&&n(i)},50),n&&n(i)},t.fn.ngg_tabs.get_tab_by_li=function(t){return t.parents("div").find('.main_menu_tab[aria-labelledby="'+t.attr("aria-labelledby")+'"]')}});
products/photocrati_nextgen/modules/frame_communication/static/frame_event_publisher.js CHANGED
@@ -175,7 +175,7 @@ window.Frame_Event_Publisher = {
175
 
176
  listen_for: function(signal, callback){
177
  var publisher = this;
178
- jQuery(window).bind(signal, function(e, event){
179
  var context = event.context;
180
  var event_id = event.id;
181
  if (!publisher.has_received_event(event_id)) {
175
 
176
  listen_for: function(signal, callback){
177
  var publisher = this;
178
+ jQuery(window).on(signal, function(e, event){
179
  var context = event.context;
180
  var event_id = event.id;
181
  if (!publisher.has_received_event(event_id)) {
products/photocrati_nextgen/modules/frame_communication/static/frame_event_publisher.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"use strict";var i=function(e){if("object"!=typeof e.document)throw Error("Cookies.js requires a `window` with a `document` object");var i=function(e,t,n){return 1===arguments.length?i.get(e):i.set(e,t,n)};return i._document=e.document,i._cacheKeyPrefix="cookey.",i._maxExpireDate=new Date("Fri, 31 Dec 9999 23:59:59 UTC"),i.defaults={path:"/",secure:!1},i.get=function(e){return i._cachedDocumentCookie!==i._document.cookie&&i._renewCache(),e=i._cache[i._cacheKeyPrefix+e],e===t?t:decodeURIComponent(e)},i.set=function(e,n,o){return o=i._getExtendedOptions(o),o.expires=i._getExpiresDate(n===t?-1:o.expires),i._document.cookie=i._generateCookieString(e,n,o),i},i.expire=function(e,n){return i.set(e,t,n)},i._getExtendedOptions=function(e){return{path:e&&e.path||i.defaults.path,domain:e&&e.domain||i.defaults.domain,expires:e&&e.expires||i.defaults.expires,secure:e&&e.secure!==t?e.secure:i.defaults.secure}},i._isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},i._getExpiresDate=function(e,t){if(t=t||new Date,"number"==typeof e?e=1/0===e?i._maxExpireDate:new Date(t.getTime()+1e3*e):"string"==typeof e&&(e=new Date(e)),e&&!i._isValidDate(e))throw Error("`expires` parameter cannot be converted to a valid Date instance");return e},i._generateCookieString=function(e,t,i){return e=e.replace(/[^#$&+\^`|]/g,encodeURIComponent),e=e.replace(/\(/g,"%28").replace(/\)/g,"%29"),t=(t+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent),i=i||{},e=e+"="+t+(i.path?";path="+i.path:""),e+=i.domain?";domain="+i.domain:"",e+=i.expires?";expires="+i.expires.toUTCString():"",e+=i.secure?";secure":""},i._getCacheFromString=function(e){var n={};e=e?e.split("; "):[];for(var o=0;o<e.length;o++){var r=i._getKeyValuePairFromCookieString(e[o]);n[i._cacheKeyPrefix+r.key]===t&&(n[i._cacheKeyPrefix+r.key]=r.value)}return n},i._getKeyValuePairFromCookieString=function(e){var t,i=e.indexOf("="),i=0>i?e.length:i,n=e.substr(0,i);try{t=decodeURIComponent(n)}catch(e){console&&"function"==typeof console.error&&console.error('Could not decode cookie with key "'+n+'"',e)}return{key:t,value:e.substr(i+1)}},i._renewCache=function(){i._cache=i._getCacheFromString(i._document.cookie),i._cachedDocumentCookie=i._document.cookie},i._areEnabled=function(){var e="1"===i.set("cookies.js",1).get("cookies.js");return i.expire("cookies.js"),e},i.enabled=i._areEnabled(),i},n="object"==typeof e.document?i(e):i;"function"==typeof define&&define.amd?define(function(){return n}):"object"==typeof exports?("object"==typeof module&&"object"==typeof module.exports&&(exports=module.exports=n),exports.Cookies=n):e.Cookies=n}("undefined"==typeof window?this:window),window.Frame_Event_Publisher={id:window.name,cookie_name:"X-Frame-Events",received:[],initialized:!1,children:{},window:!1,ajax_handlers_setup:!1,is_parent:function(){return window.parent.document===window.document},is_child:function(){return!this.is_parent()},setup_ajax_handlers:function(){if(!this.ajax_handlers_setup){var e=this;jQuery(document).ajaxComplete(function(t,i,n){setTimeout(function(){e.ajax_handler()},0)})}},ajax_handler:function(){this.broadcast(this.get_events(document.cookie))},initialize:function(){return this.setup_ajax_handlers(),void 0!==window.frame_event_publisher_domain&&(Cookies.defaults.domain=window.frame_event_publisher_domain),this.window=window,void 0!==this.window.id&&null!=this.window.id.length&&this.window.id.length>0?this.id=this.window.id:this.id,this.received=this.get_events(document.cookie),this.initialized=!0,this.is_parent()&&this.emit(this.received,!0),this.received},register_child:function(e){this.children[e.id]=e},broadcast:function(e,t){this.initialized||(e=this.initialize()),"Unknown"==this.id?(this.initialized=!1,setTimeout(function(){this.broadcast(e,t)},100)):this.is_child()?(arguments.length<=1&&(t=window),this.find_parent(t).register_child(t.Frame_Event_Publisher),this.notify_parent(e,t)):(0==arguments.length&&(e=this.received),this.notify_children(e))},notify_parent:function(e,t){this.find_parent(t).broadcast(e,t)},notify_children:function(e){this.emit(e);for(var t in this.children){var i=this.children[t];try{i.emit(e)}catch(e){"undefined"!=typeof console&&console.log(e),delete this.children.index}}},find_parent:function(e){var t=e;try{for(;t.document!==t.parent.document;)t=t.parent}catch(e){"undefined"!=typeof console&&console.log(e)}return t.Frame_Event_Publisher},emit:function(e,t){void 0===t&&(t=!1);for(var i in e){var n=e[i];t||this.has_received_event(i)||("undefined"!=typeof console&&console.log("Emitting "+i+":"+n.event+" to "+this.id),this.trigger_event(i,e[i]))}},has_received_event:function(e){return void 0!=this.received[e]},trigger_event:function(e,t){var i=t.context+":"+t.event;t.id=e,"undefined"!=typeof window&&jQuery(window).trigger(i,t),this.received[e]=t},get_events:function(e){for(var t={},i=unescape(e).split(" "),n=0;n<i.length;n++){var o=i[n],r=o.match(/X-Frame-Events_([^=]+)=(.*)/);if(r){var c=r[1],a=r[2].replace(/;$/,"");try{t[c]=JSON.parse(a)}catch(e){}var s="X-Frame-Events_"+c;this.delete_cookie(s)}}return t},delete_cookie:function(e){Cookies.expire(e)},listen_for:function(e,t){var i=this;jQuery(window).bind(e,function(e,n){var o=(n.context,n.id);i.has_received_event(o)||(t.call(i,n),i.received[o]=n)})}},jQuery(function(e){Frame_Event_Publisher.broadcast()});
1
+ !function(e,t){"use strict";var i=function(e){if("object"!=typeof e.document)throw Error("Cookies.js requires a `window` with a `document` object");var i=function(e,t,n){return 1===arguments.length?i.get(e):i.set(e,t,n)};return i._document=e.document,i._cacheKeyPrefix="cookey.",i._maxExpireDate=new Date("Fri, 31 Dec 9999 23:59:59 UTC"),i.defaults={path:"/",secure:!1},i.get=function(e){return i._cachedDocumentCookie!==i._document.cookie&&i._renewCache(),e=i._cache[i._cacheKeyPrefix+e],e===t?t:decodeURIComponent(e)},i.set=function(e,n,o){return o=i._getExtendedOptions(o),o.expires=i._getExpiresDate(n===t?-1:o.expires),i._document.cookie=i._generateCookieString(e,n,o),i},i.expire=function(e,n){return i.set(e,t,n)},i._getExtendedOptions=function(e){return{path:e&&e.path||i.defaults.path,domain:e&&e.domain||i.defaults.domain,expires:e&&e.expires||i.defaults.expires,secure:e&&e.secure!==t?e.secure:i.defaults.secure}},i._isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},i._getExpiresDate=function(e,t){if(t=t||new Date,"number"==typeof e?e=1/0===e?i._maxExpireDate:new Date(t.getTime()+1e3*e):"string"==typeof e&&(e=new Date(e)),e&&!i._isValidDate(e))throw Error("`expires` parameter cannot be converted to a valid Date instance");return e},i._generateCookieString=function(e,t,i){return e=e.replace(/[^#$&+\^`|]/g,encodeURIComponent),e=e.replace(/\(/g,"%28").replace(/\)/g,"%29"),t=(t+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent),i=i||{},e=e+"="+t+(i.path?";path="+i.path:""),e+=i.domain?";domain="+i.domain:"",e+=i.expires?";expires="+i.expires.toUTCString():"",e+=i.secure?";secure":""},i._getCacheFromString=function(e){var n={};e=e?e.split("; "):[];for(var o=0;o<e.length;o++){var r=i._getKeyValuePairFromCookieString(e[o]);n[i._cacheKeyPrefix+r.key]===t&&(n[i._cacheKeyPrefix+r.key]=r.value)}return n},i._getKeyValuePairFromCookieString=function(e){var t,i=e.indexOf("="),i=0>i?e.length:i,n=e.substr(0,i);try{t=decodeURIComponent(n)}catch(e){console&&"function"==typeof console.error&&console.error('Could not decode cookie with key "'+n+'"',e)}return{key:t,value:e.substr(i+1)}},i._renewCache=function(){i._cache=i._getCacheFromString(i._document.cookie),i._cachedDocumentCookie=i._document.cookie},i._areEnabled=function(){var e="1"===i.set("cookies.js",1).get("cookies.js");return i.expire("cookies.js"),e},i.enabled=i._areEnabled(),i},n="object"==typeof e.document?i(e):i;"function"==typeof define&&define.amd?define(function(){return n}):"object"==typeof exports?("object"==typeof module&&"object"==typeof module.exports&&(exports=module.exports=n),exports.Cookies=n):e.Cookies=n}("undefined"==typeof window?this:window),window.Frame_Event_Publisher={id:window.name,cookie_name:"X-Frame-Events",received:[],initialized:!1,children:{},window:!1,ajax_handlers_setup:!1,is_parent:function(){return window.parent.document===window.document},is_child:function(){return!this.is_parent()},setup_ajax_handlers:function(){if(!this.ajax_handlers_setup){var e=this;jQuery(document).ajaxComplete(function(t,i,n){setTimeout(function(){e.ajax_handler()},0)})}},ajax_handler:function(){this.broadcast(this.get_events(document.cookie))},initialize:function(){return this.setup_ajax_handlers(),void 0!==window.frame_event_publisher_domain&&(Cookies.defaults.domain=window.frame_event_publisher_domain),this.window=window,void 0!==this.window.id&&null!=this.window.id.length&&this.window.id.length>0?this.id=this.window.id:this.id,this.received=this.get_events(document.cookie),this.initialized=!0,this.is_parent()&&this.emit(this.received,!0),this.received},register_child:function(e){this.children[e.id]=e},broadcast:function(e,t){this.initialized||(e=this.initialize()),"Unknown"==this.id?(this.initialized=!1,setTimeout(function(){this.broadcast(e,t)},100)):this.is_child()?(arguments.length<=1&&(t=window),this.find_parent(t).register_child(t.Frame_Event_Publisher),this.notify_parent(e,t)):(0==arguments.length&&(e=this.received),this.notify_children(e))},notify_parent:function(e,t){this.find_parent(t).broadcast(e,t)},notify_children:function(e){this.emit(e);for(var t in this.children){var i=this.children[t];try{i.emit(e)}catch(e){"undefined"!=typeof console&&console.log(e),delete this.children.index}}},find_parent:function(e){var t=e;try{for(;t.document!==t.parent.document;)t=t.parent}catch(e){"undefined"!=typeof console&&console.log(e)}return t.Frame_Event_Publisher},emit:function(e,t){void 0===t&&(t=!1);for(var i in e){var n=e[i];t||this.has_received_event(i)||("undefined"!=typeof console&&console.log("Emitting "+i+":"+n.event+" to "+this.id),this.trigger_event(i,e[i]))}},has_received_event:function(e){return void 0!=this.received[e]},trigger_event:function(e,t){var i=t.context+":"+t.event;t.id=e,"undefined"!=typeof window&&jQuery(window).trigger(i,t),this.received[e]=t},get_events:function(e){for(var t={},i=unescape(e).split(" "),n=0;n<i.length;n++){var o=i[n],r=o.match(/X-Frame-Events_([^=]+)=(.*)/);if(r){var c=r[1],a=r[2].replace(/;$/,"");try{t[c]=JSON.parse(a)}catch(e){}var s="X-Frame-Events_"+c;this.delete_cookie(s)}}return t},delete_cookie:function(e){Cookies.expire(e)},listen_for:function(e,t){var i=this;jQuery(window).on(e,function(e,n){var o=(n.context,n.id);i.has_received_event(o)||(t.call(i,n),i.received[o]=n)})}},jQuery(function(e){Frame_Event_Publisher.broadcast()});
products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js CHANGED
@@ -10,6 +10,6 @@ jQuery(function($) {
10
  }
11
  });
12
  };
13
- $(window).bind('refreshed', nextgen_fancybox_init);
14
  nextgen_fancybox_init();
15
  });
10
  }
11
  });
12
  };
13
+ $(window).on('refreshed', nextgen_fancybox_init);
14
  nextgen_fancybox_init();
15
  });
products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(n){var e=function(){nextgen_lightbox_filter_selector(n,n(".ngg-fancybox")).fancybox({titlePosition:"inside",onComplete:function(){n("#fancybox-wrap").css("z-index",1e4)}})};n(window).bind("refreshed",e),e()});
1
+ jQuery(function(n){var e=function(){nextgen_lightbox_filter_selector(n,n(".ngg-fancybox")).fancybox({titlePosition:"inside",onComplete:function(){n("#fancybox-wrap").css("z-index",1e4)}})};n(window).on("refreshed",e),e()});
products/photocrati_nextgen/modules/lightbox/static/shutter_reloaded/nextgen_shutter_reloaded.js CHANGED
@@ -7,7 +7,7 @@ jQuery(function($){
7
  }
8
  shutterReloaded.Init();
9
  };
10
- $(this).bind('refreshed', callback);
11
 
12
  var flag = 'shutterReloaded';
13
  if (typeof($(window).data(flag)) == 'undefined')
7
  }
8
  shutterReloaded.Init();
9
  };
10
+ $(this).on('refreshed', callback);
11
 
12
  var flag = 'shutterReloaded';
13
  if (typeof($(window).data(flag)) == 'undefined')
products/photocrati_nextgen/modules/lightbox/static/shutter_reloaded/nextgen_shutter_reloaded.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){var t=function(){nextgen_lightbox_filter_selector(e,e([])).addClass("shutterset"),"undefined"!=typeof nextgen_shutter2_i18n&&(shutterReloaded.L10n=nextgen_shutter2_i18n),shutterReloaded.Init()};e(this).bind("refreshed",t);var n="shutterReloaded";void 0===e(window).data(n)&&(e(window).data(n,!0),t())});
1
+ jQuery(function(e){var t=function(){nextgen_lightbox_filter_selector(e,e([])).addClass("shutterset"),"undefined"!=typeof nextgen_shutter2_i18n&&(shutterReloaded.L10n=nextgen_shutter2_i18n),shutterReloaded.Init()};e(this).on("refreshed",t);var n="shutterReloaded";void 0===e(window).data(n)&&(e(window).data(n,!0),t())});
products/photocrati_nextgen/modules/lightbox/static/simplelightbox/nextgen_simple_lightbox_init.js CHANGED
@@ -19,7 +19,7 @@ jQuery(function($) {
19
 
20
  nextgen_simplelightbox_init();
21
 
22
- $(window).bind('refreshed', function() {
23
  if (typeof lightbox !== 'undefined') {
24
  lightbox.destroy();
25
  }
19
 
20
  nextgen_simplelightbox_init();
21
 
22
+ $(window).on('refreshed', function() {
23
  if (typeof lightbox !== 'undefined') {
24
  lightbox.destroy();
25
  }
products/photocrati_nextgen/modules/lightbox/static/simplelightbox/nextgen_simple_lightbox_init.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){var i=null,n=null,t={history:!1,animationSlide:!1,animationSpeed:100,captionSelector:"self"};!function(){i=nextgen_lightbox_filter_selector(e,e(".ngg-simplelightbox")),i.length>0&&(n=i.simpleLightbox(t))}(),e(window).bind("refreshed",function(){void 0!==n&&n.destroy(),i=nextgen_lightbox_filter_selector(e,e(".ngg-simplelightbox")),i.length>0&&(n=i.simpleLightbox(t))})});
1
+ jQuery(function(e){var i=null,n=null,t={history:!1,animationSlide:!1,animationSpeed:100,captionSelector:"self"};!function(){i=nextgen_lightbox_filter_selector(e,e(".ngg-simplelightbox")),i.length>0&&(n=i.simpleLightbox(t))}(),e(window).on("refreshed",function(){void 0!==n&&n.destroy(),i=nextgen_lightbox_filter_selector(e,e(".ngg-simplelightbox")),i.length>0&&(n=i.simpleLightbox(t))})});
products/photocrati_nextgen/modules/marketing/package.module.marketing.php CHANGED
@@ -87,6 +87,7 @@ class A_Marketing_Display_Settings_Form extends Mixin_Display_Type_Form
87
  function enqueue_static_resources()
88
  {
89
  M_Marketing::enqueue_blocks_style();
 
90
  }
91
  }
92
  /**
@@ -124,6 +125,7 @@ class A_Marketing_Display_Type_Settings_Form extends Mixin
124
  wp_enqueue_style('jquery-modal');
125
  wp_enqueue_script('ngg_display_type_settings_marketing', M_Static_Assets::get_static_url('photocrati-marketing#display_type_settings.min.js'), ['jquery-modal'], NGG_SCRIPT_VERSION, TRUE);
126
  wp_localize_script('ngg_display_type_settings_marketing', 'ngg_display_type_settings_marketing', ['upsells' => $this->get_upsell_popups(), 'i18n' => (array) $this->get_i18n()]);
 
127
  }
128
  function _render_marketing_ecommerce_block_field($display_type)
129
  {
@@ -142,14 +144,14 @@ class A_Marketing_IGW_Display_Type_Upsells extends Mixin
142
  }
143
  function get_pro_display_types()
144
  {
145
- return [$this->new_pro_display_type_upsell(-1, 'pro-tile', __("Pro Tile", 'nggallery'), 'photocrati-marketing#pro-tile-preview.jpg'), $this->new_pro_display_type_upsell(-2, 'pro-mosiac', __("Pro Mosiac", 'nggallery'), 'photocrati-marketing#pro-mosiac-preview.jpg'), $this->new_pro_display_type_upsell(-3, 'pro-masonry', __("Pro Masonry", 'nggallery'), 'photocrati-marketing#pro-masonry-preview.jpg'), $this->new_pro_display_type_upsell(-4, 'igw-promo')];
146
  }
147
  function get_marketing_cards()
148
  {
149
  $pro_tile = new C_Marketing_Block_Popup(__('Pro Tiled Gallery', 'nggallery'), M_Marketing::get_i18n_fragment('feature_not_available', __('the Pro Tiled Gallery', 'nggallery')), M_Marketing::get_i18n_fragment('lite_coupon'), $this->get_static_url('photocrati-marketing#pro-tile-preview.jpg'), 'igw', 'tiledgallery');
150
  $pro_masonry = new C_Marketing_Block_Popup(__('Pro Masonry Gallery', 'nggallery'), M_Marketing::get_i18n_fragment('feature_not_available', __('the Pro Masonry Gallery', 'nggallery')), M_Marketing::get_i18n_fragment('lite_coupon'), $this->get_static_url('photocrati-marketing#pro-masonry-preview.jpg'), 'igw', 'masonrygallery');
151
- $pro_mosiac = new C_Marketing_Block_Popup(__('Pro Mosiac Gallery', 'nggallery'), M_Marketing::get_i18n_fragment('feature_not_available', __('the Pro Mosiac Gallery', 'nggallery')), M_Marketing::get_i18n_fragment('lite_coupon'), $this->get_static_url('photocrati-marketing#pro-mosiac-preview.jpg'), 'igw', 'mosaicgallery');
152
- return ['pro-tile' => '<div>' . $pro_tile->render() . '</div>', 'pro-masonry' => '<div>' . $pro_masonry->render() . '</div>', 'pro-mosiac' => '<div>' . $pro_mosiac->render() . '</div>'];
153
  }
154
  function enqueue_display_tab_js()
155
  {
@@ -194,6 +196,7 @@ class A_Marketing_Other_Options_Form extends Mixin
194
  function enqueue_static_resources()
195
  {
196
  M_Marketing::enqueue_blocks_style();
 
197
  }
198
  }
199
  abstract class C_Marketing_Block_Base
87
  function enqueue_static_resources()
88
  {
89
  M_Marketing::enqueue_blocks_style();
90
+ return $this->call_parent('enqueue_static_resources');
91
  }
92
  }
93
  /**
125
  wp_enqueue_style('jquery-modal');
126
  wp_enqueue_script('ngg_display_type_settings_marketing', M_Static_Assets::get_static_url('photocrati-marketing#display_type_settings.min.js'), ['jquery-modal'], NGG_SCRIPT_VERSION, TRUE);
127
  wp_localize_script('ngg_display_type_settings_marketing', 'ngg_display_type_settings_marketing', ['upsells' => $this->get_upsell_popups(), 'i18n' => (array) $this->get_i18n()]);
128
+ return $this->call_parent('enqueue_static_resources');
129
  }
130
  function _render_marketing_ecommerce_block_field($display_type)
131
  {
144
  }
145
  function get_pro_display_types()
146
  {
147
+ return [$this->new_pro_display_type_upsell(-1, 'pro-tile', __("Pro Tile", 'nggallery'), 'photocrati-marketing#pro-tile-preview.jpg'), $this->new_pro_display_type_upsell(-2, 'pro-mosaic', __("Pro Mosaic", 'nggallery'), 'photocrati-marketing#pro-mosaic-preview.jpg'), $this->new_pro_display_type_upsell(-3, 'pro-masonry', __("Pro Masonry", 'nggallery'), 'photocrati-marketing#pro-masonry-preview.jpg'), $this->new_pro_display_type_upsell(-4, 'igw-promo')];
148
  }
149
  function get_marketing_cards()
150
  {
151
  $pro_tile = new C_Marketing_Block_Popup(__('Pro Tiled Gallery', 'nggallery'), M_Marketing::get_i18n_fragment('feature_not_available', __('the Pro Tiled Gallery', 'nggallery')), M_Marketing::get_i18n_fragment('lite_coupon'), $this->get_static_url('photocrati-marketing#pro-tile-preview.jpg'), 'igw', 'tiledgallery');
152
  $pro_masonry = new C_Marketing_Block_Popup(__('Pro Masonry Gallery', 'nggallery'), M_Marketing::get_i18n_fragment('feature_not_available', __('the Pro Masonry Gallery', 'nggallery')), M_Marketing::get_i18n_fragment('lite_coupon'), $this->get_static_url('photocrati-marketing#pro-masonry-preview.jpg'), 'igw', 'masonrygallery');
153
+ $pro_mosaic = new C_Marketing_Block_Popup(__('Pro Mosaic Gallery', 'nggallery'), M_Marketing::get_i18n_fragment('feature_not_available', __('the Pro Mosaic Gallery', 'nggallery')), M_Marketing::get_i18n_fragment('lite_coupon'), $this->get_static_url('photocrati-marketing#pro-mosaic-preview.jpg'), 'igw', 'mosaicgallery');
154
+ return ['pro-tile' => '<div>' . $pro_tile->render() . '</div>', 'pro-masonry' => '<div>' . $pro_masonry->render() . '</div>', 'pro-mosaic' => '<div>' . $pro_mosaic->render() . '</div>'];
155
  }
156
  function enqueue_display_tab_js()
157
  {
196
  function enqueue_static_resources()
197
  {
198
  M_Marketing::enqueue_blocks_style();
199
+ return $this->call_parent('enqueue_static_resources');
200
  }
201
  }
202
  abstract class C_Marketing_Block_Base
products/photocrati_nextgen/modules/marketing/static/{pro-mosiac-preview.jpg → pro-mosaic-preview.jpg} RENAMED
File without changes
products/photocrati_nextgen/modules/nextgen_addgallery_page/package.module.nextgen_addgallery_page.php CHANGED
@@ -16,6 +16,7 @@ class A_Import_Folder_Form extends Mixin
16
  wp_enqueue_style('ngg_progressbar');
17
  wp_enqueue_script('jquery.filetree');
18
  wp_enqueue_script('ngg_progressbar');
 
19
  }
20
  function render()
21
  {
16
  wp_enqueue_style('ngg_progressbar');
17
  wp_enqueue_script('jquery.filetree');
18
  wp_enqueue_script('ngg_progressbar');
19
+ return $this->call_parent('enqueue_static_resources');
20
  }
21
  function render()
22
  {
products/photocrati_nextgen/modules/nextgen_admin/static/jquery.nextgen_radio_toggle.js CHANGED
@@ -5,7 +5,7 @@
5
  $.fn.nextgen_radio_toggle_tr = function(val, target) {
6
  return this.each(function() {
7
  var $this = $(this);
8
- $this.bind('change', function() {
9
  if ($this.val() == val) {
10
  target.show('slow');
11
  } else {
5
  $.fn.nextgen_radio_toggle_tr = function(val, target) {
6
  return this.each(function() {
7
  var $this = $(this);
8
+ $this.on('change', function() {
9
  if ($this.val() == val) {
10
  target.show('slow');
11
  } else {
products/photocrati_nextgen/modules/nextgen_admin/static/jquery.nextgen_radio_toggle.min.js CHANGED
@@ -1 +1 @@
1
- !function(n){n.fn.nextgen_radio_toggle_tr=function(t,i){return this.each(function(){var o=n(this);o.bind("change",function(){o.val()==t?i.show("slow"):i.hide("slow")})})}}(jQuery);
1
+ !function(n){n.fn.nextgen_radio_toggle_tr=function(o,t){return this.each(function(){var e=n(this);e.on("change",function(){e.val()==o?t.show("slow"):t.hide("slow")})})}}(jQuery);
products/photocrati_nextgen/modules/nextgen_admin/static/nextgen_wizards.js CHANGED
@@ -698,7 +698,7 @@ if (typeof(NextGEN_Wizard_Manager) === 'undefined') {
698
  if (doBind) {
699
  this.condition_setup = true;
700
  var tourStep = this;
701
- $ob.bind(condValue, function () {
702
  tourStep.condition_met = true;
703
  });
704
  }
@@ -711,7 +711,7 @@ if (typeof(NextGEN_Wizard_Manager) === 'undefined') {
711
  this.condition_met = true;
712
  else {
713
  var tourStep = this;
714
- jQuery(window.top.document).find('body').bind('nextgen_event', function (e, type) {
715
  if (type == condValue)
716
  tourStep.condition_met = true;
717
  });
@@ -776,7 +776,7 @@ if (typeof(NextGEN_Wizard_Manager) === 'undefined') {
776
  view.currentWizard = tour.ngg_wizard_id;
777
  view.currentStep = this.ngg_step_id;
778
  view.setup();
779
- view.bind('done', this.onDone);
780
  view.enable();
781
  }
782
  };
@@ -789,7 +789,7 @@ if (typeof(NextGEN_Wizard_Manager) === 'undefined') {
789
 
790
  if (view != null) {
791
  view.disable();
792
- view.unbind('done', this.onDone);
793
  view.reset();
794
  }
795
  };
@@ -912,7 +912,7 @@ if (typeof(NextGEN_Wizard_Manager) === 'undefined') {
912
 
913
  jQuery(function($){
914
  if (typeof(NextGEN_Wizard_Manager) !== 'undefined') {
915
- NextGEN_Wizard_Manager.bind('ready', function () {
916
  NextGEN_Wizard_Manager.start();
917
  });
918
 
698
  if (doBind) {
699
  this.condition_setup = true;
700
  var tourStep = this;
701
+ $ob.on(condValue, function () {
702
  tourStep.condition_met = true;
703
  });
704
  }
711
  this.condition_met = true;
712
  else {
713
  var tourStep = this;
714
+ jQuery(window.top.document).find('body').on('nextgen_event', function (e, type) {
715
  if (type == condValue)
716
  tourStep.condition_met = true;
717
  });
776
  view.currentWizard = tour.ngg_wizard_id;
777
  view.currentStep = this.ngg_step_id;
778
  view.setup();
779
+ view.on('done', this.onDone);
780
  view.enable();
781
  }
782
  };
789
 
790
  if (view != null) {
791
  view.disable();
792
+ view.off('done', this.onDone);
793
  view.reset();
794
  }
795
  };
912
 
913
  jQuery(function($){
914
  if (typeof(NextGEN_Wizard_Manager) !== 'undefined') {
915
+ NextGEN_Wizard_Manager.on('ready', function () {
916
  NextGEN_Wizard_Manager.start();
917
  });
918
 
products/photocrati_nextgen/modules/nextgen_admin/static/nextgen_wizards.min.js CHANGED
@@ -1 +1 @@
1
- function NextGEN_Wizard(t,e){this.id=t,this.manager=e,this.data={},this.steps=[],this.status=null,this.tour=null,this.created=Math.floor(Date.now()/1e3)}if("undefined"==typeof NextGEN_Wizard_Manager){NextGEN_Wizard.prototype.start=function(){null!=this.tour&&this.tour.start()},NextGEN_Wizard.prototype.getNextStep=function(t){for(var e=0;e<this.steps.length;e++){if(this.steps[e].id==t)break}return e++,e<this.steps.length?this.steps[e]:null},NextGEN_Wizard.prototype.setState=function(t){};var manager={state:[],wizards:[],runningWizard:null,views:[],starter:null,anchor:null,events:{},targetWatchers:{},refreshTimer:null,nggEvents:[],init:function(){function t(t){this.itemSelector=".view-item",this.currentWizard=null,this.currentStep=null,this.doneFlag=!1,this.init=function(){},this.disable=function(){t.addClass("ngg-wizard-disabled")},this.enable=function(){t.removeClass("ngg-wizard-disabled")},this.setup=function(){},this.reset=function(){t.removeClass("ngg-wizard-has-selection"),t.find(this.itemSelector).removeClass("ngg-wizard-selected")},this.done=function(t){this.doneFlag||(this.doneFlag=!0,this.trigger("done",this,t))}}function e(e){t.call(this,e);var n=this;jQuery(e.get(0).ownerDocument).on("click",e.selector,function(t){n.done(e)})}function n(e){t.call(this,e);var n=this;e.click(function(t){(!e.is("a,button.ngg_save_settings_button,input.ngg_save_gallery_changes")||e.attr("href").startsWith("#")||e.attr("href").startsWith("javascript:")||e.hasClass("thickbox"))&&n.done(e)}),this.setup=function(){if(e.is("a,button.ngg_save_settings_button,button.ngg_save_pricelist_button,input.ngg_save_gallery_changes")){if(e.is("a")){var t=e.attr("href");this.originalHref=t}if(e.is("button.ngg_save_settings_button,button.ngg_save_pricelist_button,input.ngg_save_gallery_changes")){var t=e.parents("form").attr("action");t.indexOf("&ngg_wizard")>-1&&(hrefSplit=t.split("&ngg_wizard"),t=hrefSplit[0])}t.startsWith("#")||(-1==t.indexOf("?")?t+="?":t+="&",t=t+"ngg_wizard="+this.currentWizard+"&ngg_wizard_step="+this.currentStep,e.is("a")&&e.attr("href",t),e.is("button.ngg_save_settings_button,button.ngg_save_pricelist_button,input.ngg_save_gallery_changes")&&e.parents("form").attr("action",t))}},this.reset=function(){this.originalHref&&e.is("a")&&e.attr("href",this.originalHref)}}function i(e){t.call(this,e);var n=this;e.on("input",function(t){jQuery(this).val().length>=3&&n.done(e)}),this.setup=function(){}}function r(e){t.call(this,e);var n=this;jQuery(e.get(0).ownerDocument).on("change",e.selector,function(t){jQuery(this).is(":checked")&&n.done(e)}),this.setup=function(){}}function a(e){t.call(this,e);var n=this;e.on("change",function(t){n.done(e)})}"undefined"!=typeof NextGEN_Wizard_Manager_State&&(this.state=NextGEN_Wizard_Manager_State);var o=this;jQuery(window.top.document).find("body").on("nextgen_event",function(t,e){o.nggEvents.push({type:e})}),_.extend(t.prototype,Backbone.Events),_.extend(e.prototype,t.prototype),_.extend(n.prototype,t.prototype),_.extend(i.prototype,t.prototype),_.extend(r.prototype,t.prototype),_.extend(a.prototype,t.prototype);var s=null;s={handler:a,name:"SelectView",selector:"select"},this.views.push(s),s={handler:r,name:"RadioView",selector:"input[type='radio']"},this.views.push(s),s={handler:i,name:"TextView",selector:"input[type='text'], input[type='search'], input[type='email'], input[type='tel'], input[type='number'], input[type='username'], input[type='password'], textarea"},this.views.push(s),s={handler:n,name:"ButtonView",selector:"a, input[type='button'], input[type='submit'], button"},this.views.push(s),s={handler:e,name:"GenericView",selector:"*"},this.views.push(s),Tourist.Tip.Base.prototype.nextButtonTemplate='<a class="button-primary pull-right tour-next">Next step →</a>',Tourist.Tip.Base.prototype.finalButtonTemplate='<button class="button-primary pull-right tour-next">Finish up</button>',Tourist.Tip.Base.prototype.closeButtonTemplate='<a class="btn btn-close tour-close" href="#"><i class="icon icon-remove far fa-window-close"></i></a>',Tourist.Tip.BootstrapTip.prototype._getTargetBounds=function(t){var e,n;e=t[0],n="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{width:e.offsetWidth,height:e.offsetHeight};var i=t.offset();if(t.ownerDocument!=document)for(var r=function(t,e){for(var n=t.find("iframe"),i=[],a=0;a<n.length;a++){var o=jQuery(n.get(a));try{if(o.prop("contentWindow").document==e)return[o]}catch(t){continue}var s=r(o.contents(),e);if(s.length>0){i.push(o);for(var u=0;u<s.length;u++)i.push(s[u]);break}}return i},a=r(jQuery(document),t.get(0).ownerDocument),o=0;o<a.length;o++){var s=a[o],u=s.offset();i.left+=u.left,i.top+=u.top}return jQuery.extend({},n,i)},jQuery(".ngg-wizard-invoker").on("click",function(t){t.preventDefault();for(var e=NextGEN_Wizard_Manager,n=jQuery(this).data("ngg-wizard"),i=null,r=0;r<e.wizards.length;r++){var a=e.wizards[r];if(a.id==n){i=a;break}}return null!=i&&null==this.runningWizard&&i.start(),!1})},bind:function(t,e){t in this.events||(this.events[t]=[]);var n={handler:e};this.events[t].push(n)},trigger:function(t,e){if(void 0===e&&(e={}),t in this.events)for(var n=this.events[t],i=0;i<n.length;i++){var r=n[i];r.handler&&r.handler(this,e)}},didNextgenEventFire:function(t){for(var e=0;e<this.nggEvents.length;e++){if(this.nggEvents[e].type==t)return!0}return!1},getViewForSelector:function(t,e){var n=null;void 0===e&&(e=!0);for(var i=0;i<this.views.length;i++){var r=this.views[i];if(t.is(r.selector)){n=r.handler;break}}if(null!=n){var r=new n(t);return e&&r.init(),r}return null},getViewFor:function(t,e,n){var i=this.getViewForSelector(t,!1);return null!=i&&(i.currentWizard=e,i.currentStep=n,i.init()),i},generateQueue:function(t){var e=this,n=this.state,i=n.wizard_list.length,r=n.starter,a=n.running_wizard;if(i>0){var o=t('<div id="ngg-wizard-starter" class="ngg-wizard-starter"></div>');o.append('<div class="starter-wrap-top"><div class="starter-wrap-icon"><img class="starter-icon" src="'+r.image+'" /></div></div>'),o.append('<div class="starter-wrap-bottom"><div class="starter-wrap-text">'+r.text+"</div></div>"),o.on("click",".starter-wrap-icon, starter-wrap-bottom",function(){e.startQueue()}),o.hide(),o.appendTo("body"),this.starter=o;var s=t('<div id="ngg-wizard-anchor" class="ngg-wizard-anchor"></div>');s.appendTo("body"),this.anchor=s;for(var u=0,l=0;l<i;l++){var d=n.wizard_list[l],h=new NextGEN_Wizard(d.id,this);h.data=d,h.steps=d.steps;var g=this.generateTour(h);"ok"==g.result?(h.status="ready",h.tour=g.tour):"wait_element"==g.result&&(h.status="wait",u++),h.id==a?(this.wizards.unshift(h),this.runningWizard=h):this.wizards.push(h)}u>0?this.enqueueRefreshOperation():this.trigger("ready")}},getContextObject:function(t){var e=null;if(null!=t){"object"!=typeof t&&(t=[t]);for(var n=0;n<t.length;n++){var i=t[n];if(e=null==e?jQuery(i):e.find(i),e.is("iframe")){var r=e.prop("contentWindow");if("interactive"!=r.document.readyState&&"complete"!=r.document.readyState){e=jQuery([]);break}e=r.jQuery?r.jQuery("body"):e.contents().find("body")}}0==e.length&&(e=jQuery([]))}else e=jQuery(document);return e},computeStepTarget:function(t,e,n){var i=e.target_wait,r=e.target,a=e.view,o=null,s=null,u=null,l=this.getContextObject(e.context),d=!1;if(null!=r){if(o=l.find(r),o.length>0?d=!0:o=this.anchor,!d&&null!=i&&Math.floor(Date.now()/1e3)-t.created<=i)return!1}else o=this.anchor;return null!=a&&(s=l.find(a),s.length>0&&(u=this.getViewFor(s,t.id,e.id))),n.highlightTarget=d,n.nextButton=!d||e.optional,n.target=o,n.ngg_view=u,!0},scrollIntoView:function(t){},generateTour:function(t){if(null==t.tour){var e=t.data,n=e.steps,i=e.current_step,r=0,a=[],o=null;if(null!=e.view&&null==(o=this.getViewFor(jQuery(e.view),t.id)))return{result:"wait_element",element:e.view};for(var s=0;s<n.length;s++){var u=n[s];null!=i&&i==u.id&&(r=s);var l={ngg_step_id:u.id,ngg_step_data:u,viewport:jQuery(window),closeButton:!0,content:'<div class="ngg-wizard-text">'+u.text+"</div>",my:u.popup_anchor,at:u.target_anchor,bind:["onDone"],onDone:function(t,e,n,i){var r=t.ngg_wizard,a=this.ngg_step_data,o=!0;if(null!=a.condition&&(this.condition_met||(o=!1,this.condition_setup||this.setupCondition(t,e))),o&&null!=r){var s=r.getNextStep(this.ngg_step_id);if(null!=s&&s.lazy){o=!1;for(var u=null,l=0;l<t.options.steps.length;l++){var d=t.options.steps[l];if(d.ngg_step_id==s.id){u=d;break}}null!=u&&(null==u.target||0==u.target.length||"ngg-wizard-anchor"==u.target.attr("id")?!(o=r.manager.computeStepTarget(r,s,u))||null!=u.target&&0!=u.target.length&&"ngg-wizard-anchor"!=u.target.attr("id")||(o=!1):o=!0)}}if(o)t.next();else{null!=this.lazyTimeout&&(clearTimeout(this.lazyTimeout),this.lazyTimeout=null);var h=this;this.lazyTimeout=setTimeout(function(){h.lazyTimeout=null,h.onDone(t,e,n,i)},500)}}};if(!this.computeStepTarget(t,u,l))return{result:"wait_element",element:u.target};l.setupCondition=function(t,e){var n=t.ngg_wizard,i=this.ngg_step_data;if(!this.condition_setup&&null!=i.condition){var r=i.condition,a=r.type,o=r.value,s=r.context,u=r.timeout;this.condition_met=!1,this.condition_setup=!1,s&&"object"!=typeof s&&(s=[s]);var l=jQuery([]);if(s){s=s.slice(0);var d=s.pop();l=n.manager.getContextObject(s).find(d)}if(l.length>0){var h=l.get(0).ownerDocument;h.defaultView||h.parentWindow}switch(a){case"frame_event":if(window.Frame_Event_Publisher){this.condition_setup=!0;var g=this;Frame_Event_Publisher.listen_for(o,function(){g.condition_met=!0})}break;case"event_bind":case"plupload_bind":var c=l.length>0;if("plupload_bind"==a&&(void 0!==l.pluploadQueue?l=l.pluploadQueue():c=!1),c){this.condition_setup=!0;var g=this;l.bind(o,function(){g.condition_met=!0})}break;case"nextgen_event":if(this.condition_setup=!0,n.manager.didNextgenEventFire(o))this.condition_met=!0;else{var g=this;jQuery(window.top.document).find("body").bind("nextgen_event",function(t,e){e==o&&(g.condition_met=!0)})}break;case"wait":this.condition_setup=!0;var g=this;setTimeout(function(){g.condition_met=!0},o)}}var p=jQuery(".tourist-popover .ngg-wizard-text"),f=p.find(".ngg-wizard-loading");if(f.hide(),this.condition_setup&&!this.condition_met&&u>0){this.condition_timeout=0,0==f.length&&(f=jQuery('<div class="ngg-wizard-loading"></div>'),p.append(f)),f.html("Loading... ("+Math.ceil(u/1e3).toString()+")"),f.show();var g=this;g.condition_timer=setInterval(function(){g.condition_timeout+=1e3,g.condition_timeout>=u&&(g.condition_met=!0);var t=(Math.floor(g.condition_timeout/1e3),Math.ceil(u/1e3),Math.floor((u-g.condition_timeout)/1e3));f.html("Loading... ("+t.toString()+")"),g.condition_met&&(f.hide(),clearInterval(g.condition_timer),g.condition_timer=null)},1e3)}return this.condition_setup},l.setup=function(t,e){var n=e.view;null!=this.ngg_view&&(n=this.ngg_view),null!=n&&(n.currentWizard=t.ngg_wizard_id,n.currentStep=this.ngg_step_id,n.setup(),n.bind("done",this.onDone),n.enable())},l.teardown=function(t,e){var n=e.view;null!=this.ngg_view&&(n=this.ngg_view),null!=n&&(n.disable(),n.unbind("done",this.onDone),n.reset())},a.push(l)}var d={steps:a,tipClass:"Bootstrap",tipOptions:{showEffect:"slidein"},stepOptions:{}};null!=o&&(d.stepOptions.view=o);var h=new Tourist.Tour(d);for(h.ngg_wizard_id=t.id,h.ngg_wizard=t;r>0;)h.next(),r--;return{result:"ok",tour:h}}},enqueueRefreshOperation:function(){null!=this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.refreshTimer=setTimeout(function(t){NextGEN_Wizard_Manager.refreshQueue()},500)},refreshQueue:function(){this.refreshTimer=null;for(var t=0,e=0;e<this.wizards.length;e++){var n=this.wizards[e];if("wait"==n.status){var i=this.generateTour(n);"ok"==i.result?(n.status="ready",n.tour=i.tour):"wait_element"==i.result&&(n.status="wait",t++)}}t>0?this.enqueueRefreshOperation():this.trigger("ready")},start:function(){null!=this.runningWizard?this.runningWizard.start():this.showStarter()},showStarter:function(){},startQueue:function(){if(null!=this.starter){var t=this;this.starter.fadeOut(function(){t.nextTour()})}else this.nextTour()},nextTour:function(){for(var t=0,e=0;e<this.wizards.length;e++){var n=this.wizards[e];if("ready"==n.status&&null!=n.tour){t=e;break}}if(t<this.wizards.length){var n=this.wizards[t];n.tour.start()}},updateWizardState:function(t){}};manager.init(),window.NextGEN_Wizard_Manager=manager}jQuery(function(t){"undefined"!=typeof NextGEN_Wizard_Manager&&(NextGEN_Wizard_Manager.bind("ready",function(){NextGEN_Wizard_Manager.start()}),NextGEN_Wizard_Manager.generateQueue(t))});
1
+ function NextGEN_Wizard(t,e){this.id=t,this.manager=e,this.data={},this.steps=[],this.status=null,this.tour=null,this.created=Math.floor(Date.now()/1e3)}if("undefined"==typeof NextGEN_Wizard_Manager){NextGEN_Wizard.prototype.start=function(){null!=this.tour&&this.tour.start()},NextGEN_Wizard.prototype.getNextStep=function(t){for(var e=0;e<this.steps.length;e++){if(this.steps[e].id==t)break}return e++,e<this.steps.length?this.steps[e]:null},NextGEN_Wizard.prototype.setState=function(t){};var manager={state:[],wizards:[],runningWizard:null,views:[],starter:null,anchor:null,events:{},targetWatchers:{},refreshTimer:null,nggEvents:[],init:function(){function t(t){this.itemSelector=".view-item",this.currentWizard=null,this.currentStep=null,this.doneFlag=!1,this.init=function(){},this.disable=function(){t.addClass("ngg-wizard-disabled")},this.enable=function(){t.removeClass("ngg-wizard-disabled")},this.setup=function(){},this.reset=function(){t.removeClass("ngg-wizard-has-selection"),t.find(this.itemSelector).removeClass("ngg-wizard-selected")},this.done=function(t){this.doneFlag||(this.doneFlag=!0,this.trigger("done",this,t))}}function e(e){t.call(this,e);var n=this;jQuery(e.get(0).ownerDocument).on("click",e.selector,function(t){n.done(e)})}function n(e){t.call(this,e);var n=this;e.click(function(t){(!e.is("a,button.ngg_save_settings_button,input.ngg_save_gallery_changes")||e.attr("href").startsWith("#")||e.attr("href").startsWith("javascript:")||e.hasClass("thickbox"))&&n.done(e)}),this.setup=function(){if(e.is("a,button.ngg_save_settings_button,button.ngg_save_pricelist_button,input.ngg_save_gallery_changes")){if(e.is("a")){var t=e.attr("href");this.originalHref=t}if(e.is("button.ngg_save_settings_button,button.ngg_save_pricelist_button,input.ngg_save_gallery_changes")){var t=e.parents("form").attr("action");t.indexOf("&ngg_wizard")>-1&&(hrefSplit=t.split("&ngg_wizard"),t=hrefSplit[0])}t.startsWith("#")||(-1==t.indexOf("?")?t+="?":t+="&",t=t+"ngg_wizard="+this.currentWizard+"&ngg_wizard_step="+this.currentStep,e.is("a")&&e.attr("href",t),e.is("button.ngg_save_settings_button,button.ngg_save_pricelist_button,input.ngg_save_gallery_changes")&&e.parents("form").attr("action",t))}},this.reset=function(){this.originalHref&&e.is("a")&&e.attr("href",this.originalHref)}}function i(e){t.call(this,e);var n=this;e.on("input",function(t){jQuery(this).val().length>=3&&n.done(e)}),this.setup=function(){}}function r(e){t.call(this,e);var n=this;jQuery(e.get(0).ownerDocument).on("change",e.selector,function(t){jQuery(this).is(":checked")&&n.done(e)}),this.setup=function(){}}function a(e){t.call(this,e);var n=this;e.on("change",function(t){n.done(e)})}"undefined"!=typeof NextGEN_Wizard_Manager_State&&(this.state=NextGEN_Wizard_Manager_State);var o=this;jQuery(window.top.document).find("body").on("nextgen_event",function(t,e){o.nggEvents.push({type:e})}),_.extend(t.prototype,Backbone.Events),_.extend(e.prototype,t.prototype),_.extend(n.prototype,t.prototype),_.extend(i.prototype,t.prototype),_.extend(r.prototype,t.prototype),_.extend(a.prototype,t.prototype);var s=null;s={handler:a,name:"SelectView",selector:"select"},this.views.push(s),s={handler:r,name:"RadioView",selector:"input[type='radio']"},this.views.push(s),s={handler:i,name:"TextView",selector:"input[type='text'], input[type='search'], input[type='email'], input[type='tel'], input[type='number'], input[type='username'], input[type='password'], textarea"},this.views.push(s),s={handler:n,name:"ButtonView",selector:"a, input[type='button'], input[type='submit'], button"},this.views.push(s),s={handler:e,name:"GenericView",selector:"*"},this.views.push(s),Tourist.Tip.Base.prototype.nextButtonTemplate='<a class="button-primary pull-right tour-next">Next step →</a>',Tourist.Tip.Base.prototype.finalButtonTemplate='<button class="button-primary pull-right tour-next">Finish up</button>',Tourist.Tip.Base.prototype.closeButtonTemplate='<a class="btn btn-close tour-close" href="#"><i class="icon icon-remove far fa-window-close"></i></a>',Tourist.Tip.BootstrapTip.prototype._getTargetBounds=function(t){var e,n;e=t[0],n="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{width:e.offsetWidth,height:e.offsetHeight};var i=t.offset();if(t.ownerDocument!=document)for(var r=function(t,e){for(var n=t.find("iframe"),i=[],a=0;a<n.length;a++){var o=jQuery(n.get(a));try{if(o.prop("contentWindow").document==e)return[o]}catch(t){continue}var s=r(o.contents(),e);if(s.length>0){i.push(o);for(var u=0;u<s.length;u++)i.push(s[u]);break}}return i},a=r(jQuery(document),t.get(0).ownerDocument),o=0;o<a.length;o++){var s=a[o],u=s.offset();i.left+=u.left,i.top+=u.top}return jQuery.extend({},n,i)},jQuery(".ngg-wizard-invoker").on("click",function(t){t.preventDefault();for(var e=NextGEN_Wizard_Manager,n=jQuery(this).data("ngg-wizard"),i=null,r=0;r<e.wizards.length;r++){var a=e.wizards[r];if(a.id==n){i=a;break}}return null!=i&&null==this.runningWizard&&i.start(),!1})},bind:function(t,e){t in this.events||(this.events[t]=[]);var n={handler:e};this.events[t].push(n)},trigger:function(t,e){if(void 0===e&&(e={}),t in this.events)for(var n=this.events[t],i=0;i<n.length;i++){var r=n[i];r.handler&&r.handler(this,e)}},didNextgenEventFire:function(t){for(var e=0;e<this.nggEvents.length;e++){if(this.nggEvents[e].type==t)return!0}return!1},getViewForSelector:function(t,e){var n=null;void 0===e&&(e=!0);for(var i=0;i<this.views.length;i++){var r=this.views[i];if(t.is(r.selector)){n=r.handler;break}}if(null!=n){var r=new n(t);return e&&r.init(),r}return null},getViewFor:function(t,e,n){var i=this.getViewForSelector(t,!1);return null!=i&&(i.currentWizard=e,i.currentStep=n,i.init()),i},generateQueue:function(t){var e=this,n=this.state,i=n.wizard_list.length,r=n.starter,a=n.running_wizard;if(i>0){var o=t('<div id="ngg-wizard-starter" class="ngg-wizard-starter"></div>');o.append('<div class="starter-wrap-top"><div class="starter-wrap-icon"><img class="starter-icon" src="'+r.image+'" /></div></div>'),o.append('<div class="starter-wrap-bottom"><div class="starter-wrap-text">'+r.text+"</div></div>"),o.on("click",".starter-wrap-icon, starter-wrap-bottom",function(){e.startQueue()}),o.hide(),o.appendTo("body"),this.starter=o;var s=t('<div id="ngg-wizard-anchor" class="ngg-wizard-anchor"></div>');s.appendTo("body"),this.anchor=s;for(var u=0,l=0;l<i;l++){var d=n.wizard_list[l],h=new NextGEN_Wizard(d.id,this);h.data=d,h.steps=d.steps;var g=this.generateTour(h);"ok"==g.result?(h.status="ready",h.tour=g.tour):"wait_element"==g.result&&(h.status="wait",u++),h.id==a?(this.wizards.unshift(h),this.runningWizard=h):this.wizards.push(h)}u>0?this.enqueueRefreshOperation():this.trigger("ready")}},getContextObject:function(t){var e=null;if(null!=t){"object"!=typeof t&&(t=[t]);for(var n=0;n<t.length;n++){var i=t[n];if(e=null==e?jQuery(i):e.find(i),e.is("iframe")){var r=e.prop("contentWindow");if("interactive"!=r.document.readyState&&"complete"!=r.document.readyState){e=jQuery([]);break}e=r.jQuery?r.jQuery("body"):e.contents().find("body")}}0==e.length&&(e=jQuery([]))}else e=jQuery(document);return e},computeStepTarget:function(t,e,n){var i=e.target_wait,r=e.target,a=e.view,o=null,s=null,u=null,l=this.getContextObject(e.context),d=!1;if(null!=r){if(o=l.find(r),o.length>0?d=!0:o=this.anchor,!d&&null!=i&&Math.floor(Date.now()/1e3)-t.created<=i)return!1}else o=this.anchor;return null!=a&&(s=l.find(a),s.length>0&&(u=this.getViewFor(s,t.id,e.id))),n.highlightTarget=d,n.nextButton=!d||e.optional,n.target=o,n.ngg_view=u,!0},scrollIntoView:function(t){},generateTour:function(t){if(null==t.tour){var e=t.data,n=e.steps,i=e.current_step,r=0,a=[],o=null;if(null!=e.view&&null==(o=this.getViewFor(jQuery(e.view),t.id)))return{result:"wait_element",element:e.view};for(var s=0;s<n.length;s++){var u=n[s];null!=i&&i==u.id&&(r=s);var l={ngg_step_id:u.id,ngg_step_data:u,viewport:jQuery(window),closeButton:!0,content:'<div class="ngg-wizard-text">'+u.text+"</div>",my:u.popup_anchor,at:u.target_anchor,bind:["onDone"],onDone:function(t,e,n,i){var r=t.ngg_wizard,a=this.ngg_step_data,o=!0;if(null!=a.condition&&(this.condition_met||(o=!1,this.condition_setup||this.setupCondition(t,e))),o&&null!=r){var s=r.getNextStep(this.ngg_step_id);if(null!=s&&s.lazy){o=!1;for(var u=null,l=0;l<t.options.steps.length;l++){var d=t.options.steps[l];if(d.ngg_step_id==s.id){u=d;break}}null!=u&&(null==u.target||0==u.target.length||"ngg-wizard-anchor"==u.target.attr("id")?!(o=r.manager.computeStepTarget(r,s,u))||null!=u.target&&0!=u.target.length&&"ngg-wizard-anchor"!=u.target.attr("id")||(o=!1):o=!0)}}if(o)t.next();else{null!=this.lazyTimeout&&(clearTimeout(this.lazyTimeout),this.lazyTimeout=null);var h=this;this.lazyTimeout=setTimeout(function(){h.lazyTimeout=null,h.onDone(t,e,n,i)},500)}}};if(!this.computeStepTarget(t,u,l))return{result:"wait_element",element:u.target};l.setupCondition=function(t,e){var n=t.ngg_wizard,i=this.ngg_step_data;if(!this.condition_setup&&null!=i.condition){var r=i.condition,a=r.type,o=r.value,s=r.context,u=r.timeout;this.condition_met=!1,this.condition_setup=!1,s&&"object"!=typeof s&&(s=[s]);var l=jQuery([]);if(s){s=s.slice(0);var d=s.pop();l=n.manager.getContextObject(s).find(d)}if(l.length>0){var h=l.get(0).ownerDocument;h.defaultView||h.parentWindow}switch(a){case"frame_event":if(window.Frame_Event_Publisher){this.condition_setup=!0;var g=this;Frame_Event_Publisher.listen_for(o,function(){g.condition_met=!0})}break;case"event_bind":case"plupload_bind":var c=l.length>0;if("plupload_bind"==a&&(void 0!==l.pluploadQueue?l=l.pluploadQueue():c=!1),c){this.condition_setup=!0;var g=this;l.on(o,function(){g.condition_met=!0})}break;case"nextgen_event":if(this.condition_setup=!0,n.manager.didNextgenEventFire(o))this.condition_met=!0;else{var g=this;jQuery(window.top.document).find("body").on("nextgen_event",function(t,e){e==o&&(g.condition_met=!0)})}break;case"wait":this.condition_setup=!0;var g=this;setTimeout(function(){g.condition_met=!0},o)}}var p=jQuery(".tourist-popover .ngg-wizard-text"),f=p.find(".ngg-wizard-loading");if(f.hide(),this.condition_setup&&!this.condition_met&&u>0){this.condition_timeout=0,0==f.length&&(f=jQuery('<div class="ngg-wizard-loading"></div>'),p.append(f)),f.html("Loading... ("+Math.ceil(u/1e3).toString()+")"),f.show();var g=this;g.condition_timer=setInterval(function(){g.condition_timeout+=1e3,g.condition_timeout>=u&&(g.condition_met=!0);var t=(Math.floor(g.condition_timeout/1e3),Math.ceil(u/1e3),Math.floor((u-g.condition_timeout)/1e3));f.html("Loading... ("+t.toString()+")"),g.condition_met&&(f.hide(),clearInterval(g.condition_timer),g.condition_timer=null)},1e3)}return this.condition_setup},l.setup=function(t,e){var n=e.view;null!=this.ngg_view&&(n=this.ngg_view),null!=n&&(n.currentWizard=t.ngg_wizard_id,n.currentStep=this.ngg_step_id,n.setup(),n.on("done",this.onDone),n.enable())},l.teardown=function(t,e){var n=e.view;null!=this.ngg_view&&(n=this.ngg_view),null!=n&&(n.disable(),n.off("done",this.onDone),n.reset())},a.push(l)}var d={steps:a,tipClass:"Bootstrap",tipOptions:{showEffect:"slidein"},stepOptions:{}};null!=o&&(d.stepOptions.view=o);var h=new Tourist.Tour(d);for(h.ngg_wizard_id=t.id,h.ngg_wizard=t;r>0;)h.next(),r--;return{result:"ok",tour:h}}},enqueueRefreshOperation:function(){null!=this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.refreshTimer=setTimeout(function(t){NextGEN_Wizard_Manager.refreshQueue()},500)},refreshQueue:function(){this.refreshTimer=null;for(var t=0,e=0;e<this.wizards.length;e++){var n=this.wizards[e];if("wait"==n.status){var i=this.generateTour(n);"ok"==i.result?(n.status="ready",n.tour=i.tour):"wait_element"==i.result&&(n.status="wait",t++)}}t>0?this.enqueueRefreshOperation():this.trigger("ready")},start:function(){null!=this.runningWizard?this.runningWizard.start():this.showStarter()},showStarter:function(){},startQueue:function(){if(null!=this.starter){var t=this;this.starter.fadeOut(function(){t.nextTour()})}else this.nextTour()},nextTour:function(){for(var t=0,e=0;e<this.wizards.length;e++){var n=this.wizards[e];if("ready"==n.status&&null!=n.tour){t=e;break}}if(t<this.wizards.length){var n=this.wizards[t];n.tour.start()}},updateWizardState:function(t){}};manager.init(),window.NextGEN_Wizard_Manager=manager}jQuery(function(t){"undefined"!=typeof NextGEN_Wizard_Manager&&(NextGEN_Wizard_Manager.on("ready",function(){NextGEN_Wizard_Manager.start()}),NextGEN_Wizard_Manager.generateQueue(t))});
products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.js CHANGED
@@ -51,6 +51,6 @@ jQuery(function($) {
51
  }
52
  };
53
 
54
- $(this).bind('refreshed', ngg_imagebrowser_init);
55
  ngg_imagebrowser_init();
56
  });
51
  }
52
  };
53
 
54
+ $(this).on('refreshed', ngg_imagebrowser_init);
55
  ngg_imagebrowser_init();
56
  });
products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(t){var a=function(){var a=t("a.use_imagebrowser_effect");a.click(function(a){a.preventDefault();var i=!0,n=t(this),e=n.attr("data-image-id"),r=n.attr("data-image-slug"),o=n.attr("data-imagebrowser-url"),c=window.location.toString();c=c.split("/"+photocrati_ajax.ngg_param_slug+"/").shift(),"/"===c.substr(-1)&&(c=c.substr(0,c.length-1)),e=r||e;try{e||(e=parseInt(n.parents(".ngg-gallery-thumbnail-box").attr("id").match(/\d+/).join("")))}catch(t){i=!1}i&&(c=o.replace("%STUB%",e),window.location=c)}),a.length>0&&setTimeout(function(){a.each(function(){this.onclick=null})},200)};t(this).bind("refreshed",a),a()});
1
+ jQuery(function(t){var a=function(){var a=t("a.use_imagebrowser_effect");a.click(function(a){a.preventDefault();var i=!0,n=t(this),e=n.attr("data-image-id"),r=n.attr("data-image-slug"),o=n.attr("data-imagebrowser-url"),c=window.location.toString();c=c.split("/"+photocrati_ajax.ngg_param_slug+"/").shift(),"/"===c.substr(-1)&&(c=c.substr(0,c.length-1)),e=r||e;try{e||(e=parseInt(n.parents(".ngg-gallery-thumbnail-box").attr("id").match(/\d+/).join("")))}catch(t){i=!1}i&&(c=o.replace("%STUB%",e),window.location=c)}),a.length>0&&setTimeout(function(){a.each(function(){this.onclick=null})},200)};t(this).on("refreshed",a),a()});
products/photocrati_nextgen/modules/nextgen_block/static/build/post-thumbnail.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e,r){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=function(t){function e(){this.fetch=!1}return e.prototype=t,new e}("undefined"!=typeof self?self:this);(function(t){!function(t){if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=function(t){return t&&DataView.prototype.isPrototypeOf(t)},o=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};f.prototype.append=function(t,e){t=s(t),e=u(e);var r=this.map[t];this.map[t]=r?r+","+e:e},f.prototype.delete=function(t){delete this.map[s(t)]},f.prototype.get=function(t){return t=s(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(s(t))},f.prototype.set=function(t,e){this.map[s(t)]=u(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),c(t)},f.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),c(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),c(t)},e.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var a=[301,302,303,307,308];g.redirect=function(t,e){if(-1===a.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},t.Headers=f,t.Request=m,t.Response=g,t.fetch=function(t,r){return new Promise(function(n,o){var i=new m(t,r),a=new XMLHttpRequest;a.onload=function(){var t={status:a.status,statusText:a.statusText,headers:function(t){var e=new f;return t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}(a.getAllResponseHeaders()||"")};t.url="responseURL"in a?a.responseURL:t.headers.get("X-Request-URL");var e="response"in a?a.response:a.responseText;n(new g(e,t))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials?a.withCredentials=!0:"omit"===i.credentials&&(a.withCredentials=!1),"responseType"in a&&e.blob&&(a.responseType="blob"),i.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),a.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}function s(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function f(t){this.map={},t instanceof f?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function d(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&n(t))this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!o(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,r=p(e);return e.readAsText(t),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}function m(t,e){var r=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=function(t){var e=t.toUpperCase();return i.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function b(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function g(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}}(void 0!==t?t:this)}).call(r,void 0);var n=r.fetch;n.Response=r.Response,n.Request=r.Request,n.Headers=r.Headers;"object"===e(t)&&t.exports&&(t.exports=n,t.exports.default=n)}).call(this,r(2)(t))},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports="object"==("undefined"==typeof self?"undefined":r(self))?self.FormData:window.FormData},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n),i=r(1),a=r.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){g(t,e,r[e])})}return t}function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function p(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),t}function d(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?b(t):e}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function y(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&m(t,e)}function m(t,e){return(m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function b(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var w=wp.element,v=w.Fragment,_=w.Component,P=wp.data,O=P.withSelect,E=P.withDispatch,x=wp.compose.compose,T=wp.components.Button,S=wp.i18n.__,j=lodash.property,A=function(t){function e(){var t,r;f(this,e);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return g(b(b(r=d(this,(t=h(e)).call.apply(t,[this].concat(i))))),"state",{image_url:null,msg:S("Loading...")}),g(b(b(r)),"updateImageUrl",function(){r.getImageUrl(r.props.image_id).then(function(t){return r.setState({image_url:t})}).catch(function(t){return console.log(t)&&r.setState({msg:S("Could not load image")})})}),g(b(b(r)),"getImageUrl",function(t){var e=new a.a;return e.append("action","get_image"),e.append("image_id",t),o()(photocrati_ajax.url,{method:"POST",body:e,headers:{Accept:"application/json"}}).then(function(t){return t.json()}).then(j("image.image_url"))}),r}return y(e,_),p(e,[{key:"componentDidUpdate",value:function(t){this.props.image_id!=t.image_id&&this.updateImageUrl()}},{key:"componentDidMount",value:function(){this.updateImageUrl()}},{key:"render",value:function(){var t=this.state.msg,e=this.state.image_url?React.createElement("img",{src:this.state.image_url}):React.createElement("span",null,t);return React.createElement("div",{style:{paddingTop:"5px",paddingBottom:"5px"}},e)}}]),e}(),B=function(t){function e(){var t,r;f(this,e);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return g(b(b(r=d(this,(t=h(e)).call.apply(t,[this].concat(o))))),"handleOpenClick",function(t){var e=r.props.currentPostId;top.set_ngg_post_thumbnail=r.onUpdatePostThumbnail,tb_show("Set NextGEN Featured Image",ngg_featured_image.modal_url.replace(/%post_id%/,e))}),g(b(b(r)),"handleRemoveClick",function(t){r.props.onRemoveNggPostThumbnail()}),g(b(b(r)),"onUpdatePostThumbnail",function(t){tb_remove(),r.props.onSetNggPostThumbnail(parseInt(t))}),r}return y(e,_),p(e,[{key:"render",value:function(){var t=this.props,e=t.PostFeaturedImage,r=t.nggPostThumbnailId;return React.createElement(v,null,!r&&React.createElement(e,this.props),React.createElement(T,{style:{marginTop:"10px"},onClick:this.handleOpenClick,className:"editor-post-featured-image__toggle"},S("Set NextGEN Featured Image")),r>0&&React.createElement("div",null,React.createElement(A,{image_id:r}),React.createElement(T,{onClick:this.handleRemoveClick,className:"is-link is-destructive"},S("Remove featured image"))))}}]),e}(),R=O(function(t){var e=t("core/editor"),r=e.getCurrentPostId,n=e.getEditedPostAttribute,o=n("featured_media"),i=n("meta"),a=void 0!==i&&i.ngg_post_thumbnail?i.ngg_post_thumbnail:null;return{currentPostId:r(),featuredImageId:o,nggPostThumbnailId:a}}),I=E(function(t){var e=t("core/editor").editPost;return{onSetNggPostThumbnail:function(t){var r=wp.data.select("core/editor").getEditedPostAttribute("meta");void 0===r&&(r={}),r.ngg_post_thumbnail=t,e(u({},r,{meta:r}))},onRemoveNggPostThumbnail:function(){var t=wp.data.select("core/editor").getEditedPostAttribute("meta");t.ngg_post_thumbnail=0,t.featured_media=0,e(u({},t,{meta:t}))}}}),U=function(t){return x(R,I)(function(t){return function(e){return React.createElement(B,c({PostFeaturedImage:t},e))}}(t))},D=lodash.memoize,F={get:function(t,e){return"isProxy"==e||("PostFeaturedImage"==e?U(function(t){return D(function(e){return t[e]})}(t)(e)):t[e])}},k={get:function(t,e){return"editor"==e&&t[e]&&!t[e].isProxy&&(t[e]=new Proxy(t[e],F)),t[e]},set:function(t,e,r){return"editor"!=e||r.isProxy||(r=new Proxy(r,F)),t[e]=r,r}};window.wp=new Proxy(wp,k)}]);
2
  //# sourceMappingURL=post-thumbnail.min.js.map
1
+ !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e,r){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=function(t){function e(){this.fetch=!1}return e.prototype=t,new e}("undefined"!=typeof self?self:this);(function(t){!function(t){if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=function(t){return t&&DataView.prototype.isPrototypeOf(t)},o=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};f.prototype.append=function(t,e){t=s(t),e=u(e);var r=this.map[t];this.map[t]=r?r+","+e:e},f.prototype.delete=function(t){delete this.map[s(t)]},f.prototype.get=function(t){return t=s(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(s(t))},f.prototype.set=function(t,e){this.map[s(t)]=u(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),c(t)},f.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),c(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),c(t)},e.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var a=[301,302,303,307,308];g.redirect=function(t,e){if(-1===a.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},t.Headers=f,t.Request=m,t.Response=g,t.fetch=function(t,r){return new Promise(function(n,o){var i=new m(t,r),a=new XMLHttpRequest;a.onload=function(){var t={status:a.status,statusText:a.statusText,headers:function(t){var e=new f;return t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}(a.getAllResponseHeaders()||"")};t.url="responseURL"in a?a.responseURL:t.headers.get("X-Request-URL");var e="response"in a?a.response:a.responseText;n(new g(e,t))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials?a.withCredentials=!0:"omit"===i.credentials&&(a.withCredentials=!1),"responseType"in a&&e.blob&&(a.responseType="blob"),i.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),a.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}function s(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function f(t){this.map={},t instanceof f?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function d(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&n(t))this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!o(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,r=p(e);return e.readAsText(t),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}function m(t,e){var r=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=function(t){var e=t.toUpperCase();return i.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function b(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function g(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}}(void 0!==t?t:this)}).call(r,void 0);var n=r.fetch;n.Response=r.Response,n.Request=r.Request,n.Headers=r.Headers;"object"===e(t)&&t.exports&&(t.exports=n,t.exports.default=n)}).call(this,r(2)(t))},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports="object"==("undefined"==typeof self?"undefined":r(self))?self.FormData:window.FormData},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n),i=r(1),a=r.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){g(t,e,r[e])})}return t}function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function p(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),t}function d(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?b(t):e}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function y(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&m(t,e)}function m(t,e){return(m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function b(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var w=wp.element,v=w.Fragment,_=w.Component,P=wp.data,O=P.withSelect,E=P.withDispatch,x=wp.compose.compose,T=wp.components.Button,S=wp.i18n.__,j=lodash.property,A=function(t){function e(){var t,r;f(this,e);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return g(b(b(r=d(this,(t=h(e)).call.apply(t,[this].concat(i))))),"state",{image_url:null,msg:S("Loading...")}),g(b(b(r)),"updateImageUrl",function(){r.getImageUrl(r.props.image_id).then(function(t){return r.setState({image_url:t})}).catch(function(t){return console.log(t)&&r.setState({msg:S("Could not load image")})})}),g(b(b(r)),"getImageUrl",function(t){var e=new a.a;return e.append("action","get_image"),e.append("image_id",t),o()(photocrati_ajax.url,{method:"POST",body:e,headers:{Accept:"application/json"}}).then(function(t){return t.json()}).then(j("image.image_url"))}),r}return y(e,_),p(e,[{key:"componentDidUpdate",value:function(t){this.props.image_id!=t.image_id&&this.updateImageUrl()}},{key:"componentDidMount",value:function(){this.updateImageUrl()}},{key:"render",value:function(){var t=this.state.msg,e=this.state.image_url?React.createElement("img",{src:this.state.image_url}):React.createElement("span",null,t);return React.createElement("div",{style:{paddingTop:"5px",paddingBottom:"5px"}},e)}}]),e}(),B=function(t){function e(){var t,r;f(this,e);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return g(b(b(r=d(this,(t=h(e)).call.apply(t,[this].concat(o))))),"handleOpenClick",function(t){var e=r.props.currentPostId;top.set_ngg_post_thumbnail=r.onUpdatePostThumbnail,tb_show("Set NextGEN Featured Image",ngg_featured_image.modal_url.replace(/%post_id%/,e))}),g(b(b(r)),"handleRemoveClick",function(t){r.props.onRemoveNggPostThumbnail()}),g(b(b(r)),"onUpdatePostThumbnail",function(t){tb_remove(),r.props.onSetNggPostThumbnail(parseInt(t))}),r}return y(e,_),p(e,[{key:"render",value:function(){var t=this.props,e=t.PostFeaturedImage,r=t.nggPostThumbnailId;return React.createElement(v,null,!r&&React.createElement(e,this.props),React.createElement(T,{style:{marginTop:"10px"},onClick:this.handleOpenClick,className:"editor-post-featured-image__toggle"},S("Set NextGEN Featured Image")),r>0&&React.createElement("div",null,React.createElement(A,{image_id:r}),React.createElement(T,{onClick:this.handleRemoveClick,className:"is-link is-destructive"},S("Remove featured image"))))}}]),e}(),R=O(function(t){var e=t("core/editor"),r=e.getCurrentPostId,n=e.getEditedPostAttribute,o=n("featured_media"),i=n("meta"),a=void 0!==i&&i.ngg_post_thumbnail?i.ngg_post_thumbnail:null;return{currentPostId:r(),featuredImageId:o,nggPostThumbnailId:a}}),I=E(function(t){var e=t("core/editor").editPost;return{onSetNggPostThumbnail:function(t){var r=wp.data.select("core/editor").getEditedPostAttribute("meta");void 0===r&&(r={}),r.ngg_post_thumbnail=t,e(u({},r,{meta:r}))},onRemoveNggPostThumbnail:function(){var t=wp.data.select("core/editor").getEditedPostAttribute("meta");t.ngg_post_thumbnail=0,t.featured_media=0,e(u({},t,{meta:t}))}}}),U=function(t){return x(R,I)(function(t){return function(e){return React.createElement(B,c({PostFeaturedImage:t},e))}}(t))},D=lodash.memoize,F={get:function(t,e){return"isProxy"==e||("PostFeaturedImage"==e?U(function(t){return D(function(e){return t[e]})}(t)(e)):t[e])}},k={get:function(t,e){return"editor"==e&&t[e]&&!t[e].isProxy&&(t[e]=new Proxy(t[e],F)),t[e]},set:function(t,e,r){return"editor"!=e||r.isProxy||(r=new Proxy(r,F)),t[e]=r,r}};window.wp.originalEditor=window.wp.editor,window.wp=new Proxy(wp,k)}]);
2
  //# sourceMappingURL=post-thumbnail.min.js.map
products/photocrati_nextgen/modules/nextgen_block/static/build/post-thumbnail.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./node_modules/cross-fetch/dist/browser-ponyfill.js","webpack:///./node_modules/form-data/lib/browser.js","webpack:///(webpack)/buildin/module.js","webpack:///./build/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_block/static/src/components/ngg-post-thumbnail.min.js","webpack:///./build/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_block/static/src/post-thumbnail.min.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","__root__","root","F","this","fetch","self","support","searchParams","iterable","blob","Blob","e","formData","arrayBuffer","viewClasses","isDataView","obj","DataView","isPrototypeOf","isArrayBufferView","ArrayBuffer","isView","indexOf","toString","Headers","append","normalizeName","normalizeValue","oldValue","map","has","set","forEach","callback","thisArg","keys","items","push","iteratorFor","values","entries","iterator","methods","Request","clone","body","_bodyInit","Body","Response","status","statusText","headers","url","error","response","type","redirectStatuses","redirect","RangeError","location","input","init","Promise","resolve","reject","request","xhr","XMLHttpRequest","onload","options","rawHeaders","replace","split","line","parts","shift","trim","join","parseHeaders","getAllResponseHeaders","responseURL","responseText","onerror","TypeError","ontimeout","open","method","credentials","withCredentials","responseType","setRequestHeader","send","polyfill","String","test","toLowerCase","next","done","undefined","Array","isArray","header","getOwnPropertyNames","consumed","bodyUsed","fileReaderReady","reader","result","readBlobAsArrayBuffer","FileReader","promise","readAsArrayBuffer","bufferClone","buf","slice","view","Uint8Array","byteLength","buffer","_initBody","_bodyText","_bodyBlob","FormData","_bodyFormData","URLSearchParams","_bodyArrayBuffer","Error","rejected","then","text","readAsText","readBlobAsText","chars","length","fromCharCode","readArrayBufferAsText","decode","json","JSON","parse","upcased","toUpperCase","normalizeMethod","referrer","form","bytes","decodeURIComponent","bodyInit","ok","_typeof","default","window","webpackPolyfill","deprecate","paths","children","wp","element","Fragment","Component","data","withSelect","withDispatch","compose","Button","components","__","i18n","lodash","NggThumbnail","_Component","_getPrototypeOf2","_this","_classCallCheck","_len","arguments","args","_key","_defineProperty","_assertThisInitialized","_possibleConstructorReturn","_getPrototypeOf","apply","concat","image_url","msg","getImageUrl","props","image_id","setState","catch","err","console","log","photocrati_ajax","Accept","res","_inherits","_createClass","prevProps","updateImageUrl","state","el","React","createElement","src","style","paddingTop","paddingBottom","PostThumbnail","currentPostId","_this2","top","set_ngg_post_thumbnail","onUpdatePostThumbnail","tb_show","ngg_featured_image","modal_url","onRemoveNggPostThumbnail","ngg_image_id","tb_remove","onSetNggPostThumbnail","parseInt","_this$props","PostFeaturedImage","nggPostThumbnailId","marginTop","onClick","handleOpenClick","className","ngg_post_thumbnail_min_NggThumbnail","handleRemoveClick","applyWithSelect","select","_select","getCurrentPostId","getEditedPostAttribute","featuredImageId","meta","ngg_post_thumbnail","applyWithDispatch","dispatch","editPost","_objectSpread","featured_media","ngg_post_thumbnail_min","_extends","nggPostThumbnail","memoize","wpEditorProxy","prop","NggPostThumbnail","getOriginalComponent","wpProxy","isProxy","Proxy"],"mappings":"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","file":"post-thumbnail.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","var __root__ = (function (root) {\nfunction F() { this.fetch = false; }\nF.prototype = root;\nreturn new F();\n})(typeof self !== 'undefined' ? self : this);\n(function(self) {\n\n(function(self) {\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob();\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n };\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue+','+value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) { items.push(name); });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) { items.push(value); });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) { items.push([name, value]); });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'omit';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n };\n\n function decode(body) {\n var form = new FormData();\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n var xhr = new XMLHttpRequest();\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n };\n self.fetch.polyfill = true;\n})(typeof self !== 'undefined' ? self : this);\n}).call(__root__, void(0));\nvar fetch = __root__.fetch;\nvar Response = fetch.Response = __root__.Response;\nvar Request = fetch.Request = __root__.Request;\nvar Headers = fetch.Headers = __root__.Headers;\nif (typeof module === 'object' && module.exports) {\nmodule.exports = fetch;\n// Needed for TypeScript consumers without esModuleInterop.\nmodule.exports.default = fetch;\n}\n","/* eslint-env browser */\nmodule.exports = typeof self == 'object' ? self.FormData : window.FormData;\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","import fetch from 'cross-fetch'\nimport FormData from 'form-data'\n\nconst {Fragment, Component} = wp.element\nconst {withSelect, withDispatch} = wp.data\nconst {compose} = wp.compose\nconst {Button}\t\t\t\t\t\t= wp.components\nconst {__}\t\t\t\t\t\t\t= wp.i18n\nconst {property}\t\t\t\t\t= lodash\n\n/**\n * Renders a NGG thumbnail\n */\nexport class NggThumbnail extends Component {\n\tstate = {\n\t\timage_url: null,\n\t\tmsg: __('Loading...')\n\t}\n\n\tcomponentDidUpdate(prevProps) {\n\t\tif (this.props.image_id != prevProps.image_id) {\n\t\t\tthis.updateImageUrl()\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.updateImageUrl()\n\t}\n\n\tupdateImageUrl = () => {\n\t\tthis.getImageUrl(this.props.image_id)\n\t\t\t.then(image_url => this.setState({image_url}))\n\t\t\t.catch((err) => console.log(err) && this.setState({msg: __(\"Could not load image\")}))\t\t\n\t}\n\n\tgetImageUrl = image_id => {\n\t\tconst data = new FormData()\n\n\t\tdata.append('action', 'get_image')\n\t\tdata.append('image_id', image_id)\t\n\n\t\treturn fetch(photocrati_ajax.url, {method: 'POST', body: data, headers: {'Accept': 'application/json'}})\n\t\t\t.then(res => res.json())\n\t\t\t.then(property('image.image_url'))\n\t}\n\n\trender() {\n\t\tconst {msg} \t\t= this.state\n\n\t\tconst style = {\n\t\t\tpaddingTop: '5px',\n\t\t\tpaddingBottom: '5px'\n\t\t}\n\n\t\tconst el = this.state.image_url\n\t\t\t? <img src={this.state.image_url}/>\n\t\t\t: <span>{msg}</span>\n\t\t\n\t\treturn (\n\t\t\t<div style={style}>{el}</div>\n\t\t)\n\t}\n}\n\n/**\n * Displays the NGG Post Thumbnail component, which is a wrapper\n * around the PostFeaturedImage component.\n * \n * This exponent expects the following props:\n * \n * @param PostFeaturedImage PostFeaturedImage\n * @param Function onUpdatePostThumbnail\n * @param Integer nggPostThumbnailId\n */\nclass PostThumbnail extends Component {\n\n\t// Open the modal window to select a Featured Image\n\thandleOpenClick = e => {\n\t\tconst {currentPostId} = this.props\n\t\ttop.set_ngg_post_thumbnail = this.onUpdatePostThumbnail\n\t\ttb_show(\"Set NextGEN Featured Image\", ngg_featured_image.modal_url.replace(/%post_id%/, currentPostId))\n\t}\n\n\t// Remove the post thumbnail\n\thandleRemoveClick = e => {\n\t\tthis.props.onRemoveNggPostThumbnail()\n\t}\n\n\t// Close the modal window and set the ngg_post_thumbnail post meta field\n\tonUpdatePostThumbnail = ngg_image_id => {\n\t\ttb_remove()\n\t\tthis.props.onSetNggPostThumbnail(parseInt(ngg_image_id))\n\t}\n\n\trender() {\n\t\tconst {PostFeaturedImage, nggPostThumbnailId} = this.props\n\t\tconst buttonStyle = {marginTop: '10px'}\n\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{! nggPostThumbnailId && <PostFeaturedImage {...this.props}/>}\n\n\t\t\t\t<Button style={buttonStyle} onClick={this.handleOpenClick} className=\"editor-post-featured-image__toggle\">\n\t\t\t\t\t{__('Set NextGEN Featured Image')}\n\t\t\t\t</Button>\n\n\t\t\t\t{nggPostThumbnailId > 0 && \n\t\t\t\t\t<div>\n\t\t\t\t\t\t<NggThumbnail image_id={nggPostThumbnailId}/>\n\t\t\t\t\t\t<Button onClick={this.handleRemoveClick} className=\"is-link is-destructive\">\n\t\t\t\t\t\t\t{__('Remove featured image')}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t</Fragment>\n\t\t)\n\t\t\n\t}\n}\n\n/**\n * A higher-order component used to provide the PostFeaturedImage prop\n * to the PostThumbnail component\n * @param PostFeaturedImage PostFeaturedImage \n */\nconst nggPostThumbnail = PostFeaturedImage => props => (\n\t<PostThumbnail PostFeaturedImage={PostFeaturedImage} {...props}/>\n)\n\n/**\n * A higher-order component using the core/editor store which provides the following props\n * to the PostThumbnail component:\n * \n * @param integer currentPostId\t\t\tthe id of the current post\n * @param integer nggPostThumbnailId\tthe NGG image id used as a post thumbnail for the post/page\n * @param integer featuredImageId\t\tthe media library image id used as a post thumbnail for the post/page \t\n */\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( 'core/editor' );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\tconst meta = getEditedPostAttribute('meta')\n\tconst nggPostThumbnailId = (typeof meta !== 'undefined' && meta.ngg_post_thumbnail) ? meta.ngg_post_thumbnail : null;\n\n\treturn {\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tfeaturedImageId,\n\t\tnggPostThumbnailId\n\t};\n} );\n\n\n/**\n * A higher-order component using the core/editor store which provides the following props\n * to the PostThumbnail component:\n * \n * @param function onSetPostThumbnail\n */\nconst applyWithDispatch = withDispatch( ( dispatch ) => {\n\tconst { editPost } = dispatch( 'core/editor' );\n\treturn {\n\t\tonSetNggPostThumbnail(image_id) {\n\t\t\tvar meta = wp.data.select('core/editor').getEditedPostAttribute('meta')\n\t\t\tif (typeof meta === 'undefined') {\n\t\t\t\tmeta = {}\n\t\t\t}\n\t\t\tmeta.ngg_post_thumbnail = image_id\n\t\t\teditPost({\n\t\t\t\t...meta,\n\t\t\t\tmeta\t\n\t\t\t})\n\t\t},\n\t\t\n\t\tonRemoveNggPostThumbnail() {\n\t\t\tconst meta = wp.data.select('core/editor').getEditedPostAttribute('meta')\n\t\t\tmeta.ngg_post_thumbnail = 0\n\t\t\tmeta.featured_media = 0\n\t\t\teditPost({\n\t\t\t\t...meta,\n\t\t\t\tmeta\n\t\t\t})\n\t\t},\n\t};\t\n} );\n\n/** Export a composed component **/\nexport default PostFeaturedImage => compose(\n\tapplyWithSelect,\n\tapplyWithDispatch\n)(nggPostThumbnail(PostFeaturedImage))\n","import NggPostThumbnail from './components/ngg-post-thumbnail.min'\nconst {memoize} = lodash\n\n// Gets the original component which we will wrap\nconst getOriginalComponent = obj => memoize(prop => {\n return obj[prop]\n})\n\n// Wrap wp && wp.editor in a Proxy. We can then override the wp.editor.PostFeaturedImage component\n// TODO: All of this logic should be encapsulated into a utility of some kind.\nconst wpEditorProxy = {\n get(obj, prop) {\n if (prop == 'isProxy') return true\n else if (prop == 'PostFeaturedImage') {\n return NggPostThumbnail(getOriginalComponent(obj)(prop))\n }\n return obj[prop]\n }\n }\nconst wpProxy = {\n get(obj, prop) {\n if (prop == 'editor') {\n if (obj[prop] && !obj[prop].isProxy) {\n obj[prop] = new Proxy(obj[prop], wpEditorProxy) \n }\n }\n return obj[prop]\n },\n\n set(obj, prop, value) {\n if (prop == 'editor' && !value.isProxy) {\n value = new Proxy(value, wpEditorProxy)\n }\n obj[prop] = value\n return value\n }\n}\n\nwindow.wp = new Proxy(wp, wpProxy)\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./node_modules/cross-fetch/dist/browser-ponyfill.js","webpack:///./node_modules/form-data/lib/browser.js","webpack:///(webpack)/buildin/module.js","webpack:///./build/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_block/static/src/components/ngg-post-thumbnail.min.js","webpack:///./build/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_block/static/src/post-thumbnail.min.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","__root__","root","F","this","fetch","self","support","searchParams","iterable","blob","Blob","e","formData","arrayBuffer","viewClasses","isDataView","obj","DataView","isPrototypeOf","isArrayBufferView","ArrayBuffer","isView","indexOf","toString","Headers","append","normalizeName","normalizeValue","oldValue","map","has","set","forEach","callback","thisArg","keys","items","push","iteratorFor","values","entries","iterator","methods","Request","clone","body","_bodyInit","Body","Response","status","statusText","headers","url","error","response","type","redirectStatuses","redirect","RangeError","location","input","init","Promise","resolve","reject","request","xhr","XMLHttpRequest","onload","options","rawHeaders","replace","split","line","parts","shift","trim","join","parseHeaders","getAllResponseHeaders","responseURL","responseText","onerror","TypeError","ontimeout","open","method","credentials","withCredentials","responseType","setRequestHeader","send","polyfill","String","test","toLowerCase","next","done","undefined","Array","isArray","header","getOwnPropertyNames","consumed","bodyUsed","fileReaderReady","reader","result","readBlobAsArrayBuffer","FileReader","promise","readAsArrayBuffer","bufferClone","buf","slice","view","Uint8Array","byteLength","buffer","_initBody","_bodyText","_bodyBlob","FormData","_bodyFormData","URLSearchParams","_bodyArrayBuffer","Error","rejected","then","text","readAsText","readBlobAsText","chars","length","fromCharCode","readArrayBufferAsText","decode","json","JSON","parse","upcased","toUpperCase","normalizeMethod","referrer","form","bytes","decodeURIComponent","bodyInit","ok","_typeof","default","window","webpackPolyfill","deprecate","paths","children","wp","element","Fragment","Component","data","withSelect","withDispatch","compose","Button","components","__","i18n","lodash","NggThumbnail","_Component","_getPrototypeOf2","_this","_classCallCheck","_len","arguments","args","_key","_defineProperty","_assertThisInitialized","_possibleConstructorReturn","_getPrototypeOf","apply","concat","image_url","msg","getImageUrl","props","image_id","setState","catch","err","console","log","photocrati_ajax","Accept","res","_inherits","_createClass","prevProps","updateImageUrl","state","el","React","createElement","src","style","paddingTop","paddingBottom","PostThumbnail","currentPostId","_this2","top","set_ngg_post_thumbnail","onUpdatePostThumbnail","tb_show","ngg_featured_image","modal_url","onRemoveNggPostThumbnail","ngg_image_id","tb_remove","onSetNggPostThumbnail","parseInt","_this$props","PostFeaturedImage","nggPostThumbnailId","marginTop","onClick","handleOpenClick","className","ngg_post_thumbnail_min_NggThumbnail","handleRemoveClick","applyWithSelect","select","_select","getCurrentPostId","getEditedPostAttribute","featuredImageId","meta","ngg_post_thumbnail","applyWithDispatch","dispatch","editPost","_objectSpread","featured_media","ngg_post_thumbnail_min","_extends","nggPostThumbnail","memoize","wpEditorProxy","prop","NggPostThumbnail","getOriginalComponent","wpProxy","isProxy","Proxy","originalEditor","editor"],"mappings":"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","file":"post-thumbnail.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","var __root__ = (function (root) {\nfunction F() { this.fetch = false; }\nF.prototype = root;\nreturn new F();\n})(typeof self !== 'undefined' ? self : this);\n(function(self) {\n\n(function(self) {\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob();\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n };\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue+','+value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) { items.push(name); });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) { items.push(value); });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) { items.push([name, value]); });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'omit';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n };\n\n function decode(body) {\n var form = new FormData();\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n var xhr = new XMLHttpRequest();\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n };\n self.fetch.polyfill = true;\n})(typeof self !== 'undefined' ? self : this);\n}).call(__root__, void(0));\nvar fetch = __root__.fetch;\nvar Response = fetch.Response = __root__.Response;\nvar Request = fetch.Request = __root__.Request;\nvar Headers = fetch.Headers = __root__.Headers;\nif (typeof module === 'object' && module.exports) {\nmodule.exports = fetch;\n// Needed for TypeScript consumers without esModuleInterop.\nmodule.exports.default = fetch;\n}\n","/* eslint-env browser */\nmodule.exports = typeof self == 'object' ? self.FormData : window.FormData;\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","import fetch from 'cross-fetch'\nimport FormData from 'form-data'\n\nconst {Fragment, Component} = wp.element\nconst {withSelect, withDispatch} = wp.data\nconst {compose} = wp.compose\nconst {Button}\t\t\t\t\t\t= wp.components\nconst {__}\t\t\t\t\t\t\t= wp.i18n\nconst {property}\t\t\t\t\t= lodash\n\n/**\n * Renders a NGG thumbnail\n */\nexport class NggThumbnail extends Component {\n\tstate = {\n\t\timage_url: null,\n\t\tmsg: __('Loading...')\n\t}\n\n\tcomponentDidUpdate(prevProps) {\n\t\tif (this.props.image_id != prevProps.image_id) {\n\t\t\tthis.updateImageUrl()\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.updateImageUrl()\n\t}\n\n\tupdateImageUrl = () => {\n\t\tthis.getImageUrl(this.props.image_id)\n\t\t\t.then(image_url => this.setState({image_url}))\n\t\t\t.catch((err) => console.log(err) && this.setState({msg: __(\"Could not load image\")}))\t\t\n\t}\n\n\tgetImageUrl = image_id => {\n\t\tconst data = new FormData()\n\n\t\tdata.append('action', 'get_image')\n\t\tdata.append('image_id', image_id)\t\n\n\t\treturn fetch(photocrati_ajax.url, {method: 'POST', body: data, headers: {'Accept': 'application/json'}})\n\t\t\t.then(res => res.json())\n\t\t\t.then(property('image.image_url'))\n\t}\n\n\trender() {\n\t\tconst {msg} \t\t= this.state\n\n\t\tconst style = {\n\t\t\tpaddingTop: '5px',\n\t\t\tpaddingBottom: '5px'\n\t\t}\n\n\t\tconst el = this.state.image_url\n\t\t\t? <img src={this.state.image_url}/>\n\t\t\t: <span>{msg}</span>\n\t\t\n\t\treturn (\n\t\t\t<div style={style}>{el}</div>\n\t\t)\n\t}\n}\n\n/**\n * Displays the NGG Post Thumbnail component, which is a wrapper\n * around the PostFeaturedImage component.\n * \n * This exponent expects the following props:\n * \n * @param PostFeaturedImage PostFeaturedImage\n * @param Function onUpdatePostThumbnail\n * @param Integer nggPostThumbnailId\n */\nclass PostThumbnail extends Component {\n\n\t// Open the modal window to select a Featured Image\n\thandleOpenClick = e => {\n\t\tconst {currentPostId} = this.props\n\t\ttop.set_ngg_post_thumbnail = this.onUpdatePostThumbnail\n\t\ttb_show(\"Set NextGEN Featured Image\", ngg_featured_image.modal_url.replace(/%post_id%/, currentPostId))\n\t}\n\n\t// Remove the post thumbnail\n\thandleRemoveClick = e => {\n\t\tthis.props.onRemoveNggPostThumbnail()\n\t}\n\n\t// Close the modal window and set the ngg_post_thumbnail post meta field\n\tonUpdatePostThumbnail = ngg_image_id => {\n\t\ttb_remove()\n\t\tthis.props.onSetNggPostThumbnail(parseInt(ngg_image_id))\n\t}\n\n\trender() {\n\t\tconst {PostFeaturedImage, nggPostThumbnailId} = this.props\n\t\tconst buttonStyle = {marginTop: '10px'}\n\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{! nggPostThumbnailId && <PostFeaturedImage {...this.props}/>}\n\n\t\t\t\t<Button style={buttonStyle} onClick={this.handleOpenClick} className=\"editor-post-featured-image__toggle\">\n\t\t\t\t\t{__('Set NextGEN Featured Image')}\n\t\t\t\t</Button>\n\n\t\t\t\t{nggPostThumbnailId > 0 && \n\t\t\t\t\t<div>\n\t\t\t\t\t\t<NggThumbnail image_id={nggPostThumbnailId}/>\n\t\t\t\t\t\t<Button onClick={this.handleRemoveClick} className=\"is-link is-destructive\">\n\t\t\t\t\t\t\t{__('Remove featured image')}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t</Fragment>\n\t\t)\n\t\t\n\t}\n}\n\n/**\n * A higher-order component used to provide the PostFeaturedImage prop\n * to the PostThumbnail component\n * @param PostFeaturedImage PostFeaturedImage \n */\nconst nggPostThumbnail = PostFeaturedImage => props => (\n\t<PostThumbnail PostFeaturedImage={PostFeaturedImage} {...props}/>\n)\n\n/**\n * A higher-order component using the core/editor store which provides the following props\n * to the PostThumbnail component:\n * \n * @param integer currentPostId\t\t\tthe id of the current post\n * @param integer nggPostThumbnailId\tthe NGG image id used as a post thumbnail for the post/page\n * @param integer featuredImageId\t\tthe media library image id used as a post thumbnail for the post/page \t\n */\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( 'core/editor' );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\tconst meta = getEditedPostAttribute('meta')\n\tconst nggPostThumbnailId = (typeof meta !== 'undefined' && meta.ngg_post_thumbnail) ? meta.ngg_post_thumbnail : null;\n\n\treturn {\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tfeaturedImageId,\n\t\tnggPostThumbnailId\n\t};\n} );\n\n\n/**\n * A higher-order component using the core/editor store which provides the following props\n * to the PostThumbnail component:\n * \n * @param function onSetPostThumbnail\n */\nconst applyWithDispatch = withDispatch( ( dispatch ) => {\n\tconst { editPost } = dispatch( 'core/editor' );\n\treturn {\n\t\tonSetNggPostThumbnail(image_id) {\n\t\t\tvar meta = wp.data.select('core/editor').getEditedPostAttribute('meta')\n\t\t\tif (typeof meta === 'undefined') {\n\t\t\t\tmeta = {}\n\t\t\t}\n\t\t\tmeta.ngg_post_thumbnail = image_id\n\t\t\teditPost({\n\t\t\t\t...meta,\n\t\t\t\tmeta\t\n\t\t\t})\n\t\t},\n\t\t\n\t\tonRemoveNggPostThumbnail() {\n\t\t\tconst meta = wp.data.select('core/editor').getEditedPostAttribute('meta')\n\t\t\tmeta.ngg_post_thumbnail = 0\n\t\t\tmeta.featured_media = 0\n\t\t\teditPost({\n\t\t\t\t...meta,\n\t\t\t\tmeta\n\t\t\t})\n\t\t},\n\t};\t\n} );\n\n/** Export a composed component **/\nexport default PostFeaturedImage => compose(\n\tapplyWithSelect,\n\tapplyWithDispatch\n)(nggPostThumbnail(PostFeaturedImage))\n","import NggPostThumbnail from './components/ngg-post-thumbnail.min'\nconst {memoize} = lodash\n\n// Gets the original component which we will wrap\nconst getOriginalComponent = obj => memoize(prop => {\n return obj[prop]\n})\n\n// Wrap wp && wp.editor in a Proxy. We can then override the wp.editor.PostFeaturedImage component\n// TODO: All of this logic should be encapsulated into a utility of some kind.\nconst wpEditorProxy = {\n get(obj, prop) {\n if (prop == 'isProxy') return true\n else if (prop == 'PostFeaturedImage') {\n return NggPostThumbnail(getOriginalComponent(obj)(prop))\n }\n return obj[prop]\n }\n }\nconst wpProxy = {\n get(obj, prop) {\n if (prop == 'editor') {\n if (obj[prop] && !obj[prop].isProxy) {\n obj[prop] = new Proxy(obj[prop], wpEditorProxy) \n }\n }\n return obj[prop]\n },\n\n set(obj, prop, value) {\n if (prop == 'editor' && !value.isProxy) {\n value = new Proxy(value, wpEditorProxy)\n }\n obj[prop] = value\n return value\n }\n}\nwindow.wp.originalEditor = window.wp.editor;\nwindow.wp = new Proxy(wp, wpProxy);\n"],"sourceRoot":""}
products/photocrati_nextgen/modules/nextgen_block/static/src/post-thumbnail.jsx CHANGED
@@ -35,5 +35,5 @@ const wpProxy = {
35
  return value
36
  }
37
  }
38
-
39
- window.wp = new Proxy(wp, wpProxy)
35
  return value
36
  }
37
  }
38
+ window.wp.originalEditor = window.wp.editor;
39
+ window.wp = new Proxy(wp, wpProxy);
products/photocrati_nextgen/modules/nextgen_block/static/src/post-thumbnail.min.js CHANGED
@@ -35,5 +35,5 @@ const wpProxy = {
35
  return value
36
  }
37
  }
38
-
39
- window.wp = new Proxy(wp, wpProxy)
35
  return value
36
  }
37
  }
38
+ window.wp.originalEditor = window.wp.editor;
39
+ window.wp = new Proxy(wp, wpProxy);
products/photocrati_nextgen/modules/nextgen_data/module.nextgen_data.php CHANGED
@@ -22,7 +22,7 @@ class M_NextGen_Data extends C_Base_Module
22
  'photocrati-nextgen-data',
23
  'NextGEN Data Tier',
24
  "Provides a data tier for NextGEN gallery based on the DataMapper module",
25
- '3.3.7',
26
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
27
  'Imagely',
28
  'https://www.imagely.com'
@@ -130,109 +130,48 @@ class M_NextGen_Data extends C_Base_Module
130
 
131
  static function strip_html($data, $just_scripts=FALSE)
132
  {
133
- $retval = $data;
134
-
135
- if (!$just_scripts)
136
- {
137
- // Remove *ALL* HTML and tag contents
138
- $retval = wp_strip_all_tags($retval, TRUE);
 
 
 
 
 
 
 
 
 
 
139
  }
140
- else if (class_exists('DOMDocument')) {
141
 
142
- // Allows HTML to remain but we strip nearly all attributes, strip all
143
- // <script> tags, and sanitize hrefs to prevent javascript.
144
- //
 
 
145
  // This can generate a *lot* of warnings when given improper texts
146
  libxml_use_internal_errors(true);
147
  libxml_clear_errors();
148
 
149
- $allowed_attributes = array(
150
- '*' => array('id', 'class', 'href', 'name', 'title', 'rel', 'style'),
151
- 'a' => array('target', 'rel'),
152
- 'img' => array('src', 'alt', 'title')
153
- );
154
-
155
- if (is_object($data))
156
- {
157
- // First... recurse to the deepest elements and work back & upwards
158
- if ($data->hasChildNodes())
159
- {
160
- foreach (range($data->childNodes->length - 1, 0) as $i) {
161
- self::strip_html($data->childNodes->item($i), TRUE);
162
- }
163
- }
164
-
165
- // Remove disallowed elements and content
166
- if ($data instanceof DOMElement) {
167
- foreach ($data->getElementsByTagName('script') as $deleteme) {
168
- /**
169
- * @var DOMNode $deleteme
170
- */
171
- $data->removeChild($deleteme);
172
- }
173
- }
174
-
175
- // Strip (nearly) all attributes
176
- if (!empty($data->attributes))
177
- {
178
- // DOMDocument reindexes as soon as any changes are made so we
179
- // must loop through attributes backwards
180
- for ($i = $data->attributes->length - 1; $i >= 0; --$i) {
181
- $item = $data->attributes->item($i);
182
- $name = $item->nodeName;
183
-
184
- $allowed = FALSE;
185
- foreach ($allowed_attributes as $element_type => $attributes) {
186
- if (($data->tagName == $element_type || $element_type == '*')
187
- && in_array($name, $attributes)) {
188
- $allowed = TRUE;
189
- }
190
- }
191
-
192
- if (!$allowed)
193
- $data->removeAttribute($name);
194
-
195
- // DO NOT EVER allow href="javascript:...."
196
- if (strpos($item->nodeValue, 'javascript:') === 0)
197
- $item->nodeValue = '#';
198
- }
199
- }
200
- }
201
- else {
202
- $dom = new DOMDocument('1.0', 'UTF-8');
203
-
204
- if (!empty($data))
205
- {
206
- // Because DOMDocument wraps saveHTML() with HTML headers & tags we use
207
- // this placeholder to retrieve *just* the original given text
208
- $id = 'ngg_data_strip_html_placeholder';
209
- $start = "<div id=\"{$id}\">";
210
- $end = '</div>';
211
-
212
- // Prevent attempted work-arounds using &lt; and &gt; or other html entities
213
- $data = html_entity_decode($data);
214
-
215
- // This forces DOMDocument to treat the HTML as UTF-8
216
- $meta = '<meta http-equiv="Content-Type" content="charset=utf-8"/>';
217
- $data = $meta . $start . $data . $end;
218
-
219
- $dom->loadHTML($data);
220
-
221
- // Invoke the actual work
222
- self::strip_html($dom->documentElement, TRUE);
223
-
224
- $el = $dom->getElementById($id);
225
- $retval = $el
226
- ? implode(array_map([$dom, 'saveHTML'], iterator_to_array($el->childNodes)))
227
- : $dom->saveHTML();
228
- }
229
- else {
230
- $retval = '';
231
- }
232
  }
 
 
 
 
 
 
 
 
 
233
  }
234
 
235
- return $retval;
236
  }
237
 
238
  function get_type_list()
22
  'photocrati-nextgen-data',
23
  'NextGEN Data Tier',
24
  "Provides a data tier for NextGEN gallery based on the DataMapper module",
25
+ '3.3.14',
26
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
27
  'Imagely',
28
  'https://www.imagely.com'
130
 
131
  static function strip_html($data, $just_scripts=FALSE)
132
  {
133
+ // NGG 3.3.11 fix. Some of the data persisted with 3.3.11 didn't strip out all HTML
134
+ if (strpos($data, 'ngg_data_strip_html_placeholder') !== FALSE) {
135
+ if (class_exists('DomDocument')) {
136
+ $dom = new DOMDocument('1.0', 'UTF-8');
137
+ $dom->loadHTML($data);
138
+ $el = $dom->getElementById('ngg_data_strip_html_placeholder');
139
+ $parts = array_map(
140
+ function($el) use ($dom) {
141
+ $part = $dom->saveHTML($el);
142
+ return $part instanceof DOMText ? $part->data : (string) $part;
143
+ },
144
+ $el->childNodes ? iterator_to_array($el->childNodes) : []
145
+ );
146
+ return self::strip_html(implode(" ", $parts), $just_scripts);
147
+ }
148
+ else return strip_tags($data);
149
  }
 
150
 
151
+ // Remove all HTML elements
152
+ if (!$just_scripts) return strip_tags($data);
153
+
154
+ // Remove unsafe HTML
155
+ else if (class_exists('DOMDocument')) {
156
  // This can generate a *lot* of warnings when given improper texts
157
  libxml_use_internal_errors(true);
158
  libxml_clear_errors();
159
 
160
+ if (!class_exists("HTMLPurifier_Config")) {
161
+ require_once(NGG_PLUGIN_DIR."vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
163
+ $config = HTMLPurifier_Config::createDefault();
164
+ $config->set('Cache', 'DefinitionImpl', NULL);
165
+ $purifier = new HTMLPurifier($config);
166
+ return $purifier->purify($data);
167
+ }
168
+ else {
169
+ // wp_strip_all_tags() is misleading in a way - it only removes <script> and <style>
170
+ // tags, nothing
171
+ return wp_strip_all_tags($data, TRUE);
172
  }
173
 
174
+ return $data;
175
  }
176
 
177
  function get_type_list()
products/photocrati_nextgen/modules/nextgen_gallery_display/package.module.nextgen_gallery_display.php CHANGED
@@ -2535,7 +2535,11 @@ class Mixin_Display_Type_Form extends Mixin
2535
  */
2536
  function save_action($attributes = array())
2537
  {
2538
- return $this->object->get_model()->save(array('settings' => $attributes));
 
 
 
 
2539
  }
2540
  /**
2541
  * Renders the AJAX pagination settings field
2535
  */
2536
  function save_action($attributes = array())
2537
  {
2538
+ $model = $this->object->get_model();
2539
+ if ($model) {
2540
+ return $model->save(['settings' => $attributes]);
2541
+ }
2542
+ return FALSE;
2543
  }
2544
  /**
2545
  * Renders the AJAX pagination settings field
products/photocrati_nextgen/modules/nextgen_other_options/static/nextgen_settings_page.js CHANGED
@@ -84,7 +84,7 @@ jQuery(function($){
84
  $('input[name="style_settings[activateCSS]"]')
85
  .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_styles_activated_stylesheet'))
86
  .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_styles_show_more'))
87
- .bind('change', function() {
88
  var $this = $(this);
89
  if ($this.val() == '0') {
90
  $('#cssfile_contents').prop('disabled', true);
84
  $('input[name="style_settings[activateCSS]"]')
85
  .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_styles_activated_stylesheet'))
86
  .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_styles_show_more'))
87
+ .on('change', function() {
88
  var $this = $(this);
89
  if ($this.val() == '0') {
90
  $('#cssfile_contents').prop('disabled', true);
products/photocrati_nextgen/modules/nextgen_other_options/static/nextgen_settings_page.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(t){t("select.select2").select2(),t("label.tooltip, span.tooltip").tooltip(),t("#lightbox_library").change(function(){var e=t(this).find(":selected").val(),a="lightbox_library_"+e;t(".lightbox_library_settings").each(function(){t(this).attr("id")!=a&&t(this).fadeOut("fast")}),t("#"+a).fadeIn()}).change(),t("#watermark_customization").attr("rel","watermark_"+t("#watermark_source").val()+"_source"),t("#watermark_source").change(function(){t("#"+t("#watermark_customization").attr("rel")).css("display","").addClass("hidden"),t("#"+t(this).val()).hasClass("hidden")||t("#"+t(this).val()).removeClass("hidden"),t("#watermark_customization").attr("rel","watermark_"+t("#watermark_source").val()+"_source").click()}),t("#watermark_source").change(function(){var e=t(this).val();t(".watermark_field").each(function(){0==e?t(this).fadeOut().addClass("hidden"):t(this).fadeIn().removeClass("hidden")})}).change(),t("#nextgen_settings_preview_refresh").click(function(e){e.preventDefault();var a=t(this).parents("form:first"),r=t(this),s=t(r).html();return t(r).attr("disabled","disabled").html("Processing..."),t("body").css("cursor","wait"),t.ajax({type:a.attr("method"),url:t(this).data("refresh-url"),data:a.serialize()+"&action=get_watermark_preview_url",dataType:"json",success:function(e){var a=r.prev(),i=e.thumbnail_url;queryPos=i.indexOf("?"),-1!=queryPos&&(i=i.substring(0,queryPos)),a.attr("src",i+"?"+(new Date).getTime()),t(r).removeAttr("disabled").html(s),t("body").css("cursor","default")},error:function(e,a,i){t(r).removeAttr("disabled").html(s),t("body").css("cursor","default")}}),!1}),t('input[name="style_settings[activateCSS]"]').nextgen_radio_toggle_tr("1",t("#tr_photocrati-nextgen_styles_activated_stylesheet")).nextgen_radio_toggle_tr("1",t("#tr_photocrati-nextgen_styles_show_more")).bind("change",function(){"0"==t(this).val()?(t("#cssfile_contents").prop("disabled",!0),t("#advanced_stylesheet_form").hide("slow")):t("#cssfile_contents").prop("disabled",!1)}),t("#activated_stylesheet").change(function(){var e=t(this).find(":selected"),a={action:"get_stylesheet_contents",cssfile:e.val()};t.post(photocrati_ajax.url,a,function(e){"object"!=typeof e&&(e=JSON.parse(e)),t("#cssfile_contents").val(e.error?e.error:e.contents);var a=t("#writable_identicator");e.writable?a.text(a.attr("writable_label")+" "+e.writepath):a.text(a.attr("readonly_label"))})}).change()});
1
+ jQuery(function(t){t("select.select2").select2(),t("label.tooltip, span.tooltip").tooltip(),t("#lightbox_library").change(function(){var e=t(this).find(":selected").val(),a="lightbox_library_"+e;t(".lightbox_library_settings").each(function(){t(this).attr("id")!=a&&t(this).fadeOut("fast")}),t("#"+a).fadeIn()}).change(),t("#watermark_customization").attr("rel","watermark_"+t("#watermark_source").val()+"_source"),t("#watermark_source").change(function(){t("#"+t("#watermark_customization").attr("rel")).css("display","").addClass("hidden"),t("#"+t(this).val()).hasClass("hidden")||t("#"+t(this).val()).removeClass("hidden"),t("#watermark_customization").attr("rel","watermark_"+t("#watermark_source").val()+"_source").click()}),t("#watermark_source").change(function(){var e=t(this).val();t(".watermark_field").each(function(){0==e?t(this).fadeOut().addClass("hidden"):t(this).fadeIn().removeClass("hidden")})}).change(),t("#nextgen_settings_preview_refresh").click(function(e){e.preventDefault();var a=t(this).parents("form:first"),r=t(this),s=t(r).html();return t(r).attr("disabled","disabled").html("Processing..."),t("body").css("cursor","wait"),t.ajax({type:a.attr("method"),url:t(this).data("refresh-url"),data:a.serialize()+"&action=get_watermark_preview_url",dataType:"json",success:function(e){var a=r.prev(),i=e.thumbnail_url;queryPos=i.indexOf("?"),-1!=queryPos&&(i=i.substring(0,queryPos)),a.attr("src",i+"?"+(new Date).getTime()),t(r).removeAttr("disabled").html(s),t("body").css("cursor","default")},error:function(e,a,i){t(r).removeAttr("disabled").html(s),t("body").css("cursor","default")}}),!1}),t('input[name="style_settings[activateCSS]"]').nextgen_radio_toggle_tr("1",t("#tr_photocrati-nextgen_styles_activated_stylesheet")).nextgen_radio_toggle_tr("1",t("#tr_photocrati-nextgen_styles_show_more")).on("change",function(){"0"==t(this).val()?(t("#cssfile_contents").prop("disabled",!0),t("#advanced_stylesheet_form").hide("slow")):t("#cssfile_contents").prop("disabled",!1)}),t("#activated_stylesheet").change(function(){var e=t(this).find(":selected"),a={action:"get_stylesheet_contents",cssfile:e.val()};t.post(photocrati_ajax.url,a,function(e){"object"!=typeof e&&(e=JSON.parse(e)),t("#cssfile_contents").val(e.error?e.error:e.contents);var a=t("#writable_identicator");e.writable?a.text(a.attr("writable_label")+" "+e.writepath):a.text(a.attr("readonly_label"))})}).change()});
products/photocrati_nextgen/modules/ngglegacy/admin/tags.php CHANGED
@@ -258,7 +258,7 @@ if ($nb_tags < $tag_count && $offset>0) {
258
  // <![CDATA[
259
  // Register onclick event
260
  function registerClick() {
261
- jQuery('#taglist ul li span').bind("click", function(){
262
  addTag(this.innerHTML, "renametag_old");
263
  addTag(this.innerHTML, "deletetag_name");
264
  addTag(this.innerHTML, "tagname_match");
258
  // <![CDATA[
259
  // Register onclick event
260
  function registerClick() {
261
+ jQuery('#taglist ul li span').on("click", function(){
262
  addTag(this.innerHTML, "renametag_old");
263
  addTag(this.innerHTML, "deletetag_name");
264
  addTag(this.innerHTML, "tagname_match");
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: photocrati, imagely
3
  Tags: wordpress gallery plugin, gallery, nextgen, nextgen gallery, photo gallery, image gallery, photography, slideshow, images, photo, photo album, watermark
4
  Requires at least: 4.0.0
5
- Stable tag: 3.3.11
6
  Tested up to: 5.5.0
7
  License: GPLv2
8
  Requires PHP: 5.4
@@ -180,6 +180,12 @@ For more information, feel free to visit the official website for the NextGEN Ga
180
 
181
  == Changelog ==
182
 
 
 
 
 
 
 
183
  = V3.3.11 - 08.14.2020 =
184
  * Fixed: Fancybox lightbox not working with WordPress 5.5
185
  * Fixed: Inability to upload images or create galleries in WordPress 5.5
2
  Contributors: photocrati, imagely
3
  Tags: wordpress gallery plugin, gallery, nextgen, nextgen gallery, photo gallery, image gallery, photography, slideshow, images, photo, photo album, watermark
4
  Requires at least: 4.0.0
5
+ Stable tag: 3.3.16
6
  Tested up to: 5.5.0
7
  License: GPLv2
8
  Requires PHP: 5.4
180
 
181
  == Changelog ==
182
 
183
+ = V3.3.16 - 08.18.2020 =
184
+ * Fixed: Override Thumbnail Settings not configurable
185
+ * Fixed: Broken gallery displays in WP 5.5 with Classic Editor
186
+ * Fixed: HTML in Gallery & Image fields
187
+ * Fixed: Inability to save Gallery Settings or Other Options
188
+
189
  = V3.3.11 - 08.14.2020 =
190
  * Fixed: Fancybox lightbox not working with WordPress 5.5
191
  * Fixed: Inability to upload images or create galleries in WordPress 5.5
vendor/composer/autoload_files.php CHANGED
@@ -6,5 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  'a5dbe7df96665c0b6c16ae8d91231502' => $vendorDir . '/imagely/pope-framework/lib/autoload.php',
10
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
10
  'a5dbe7df96665c0b6c16ae8d91231502' => $vendorDir . '/imagely/pope-framework/lib/autoload.php',
11
  );
vendor/composer/autoload_namespaces.php CHANGED
@@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
10
  );
vendor/composer/autoload_static.php CHANGED
@@ -7,6 +7,7 @@ namespace Composer\Autoload;
7
  class ComposerStaticInitd944cb3ad10f834222db970b76dd976d
8
  {
9
  public static $files = array (
 
10
  'a5dbe7df96665c0b6c16ae8d91231502' => __DIR__ . '/..' . '/imagely/pope-framework/lib/autoload.php',
11
  );
12
 
@@ -24,11 +25,22 @@ class ComposerStaticInitd944cb3ad10f834222db970b76dd976d
24
  ),
25
  );
26
 
 
 
 
 
 
 
 
 
 
 
27
  public static function getInitializer(ClassLoader $loader)
28
  {
29
  return \Closure::bind(function () use ($loader) {
30
  $loader->prefixLengthsPsr4 = ComposerStaticInitd944cb3ad10f834222db970b76dd976d::$prefixLengthsPsr4;
31
  $loader->prefixDirsPsr4 = ComposerStaticInitd944cb3ad10f834222db970b76dd976d::$prefixDirsPsr4;
 
32
 
33
  }, null, ClassLoader::class);
34
  }
7
  class ComposerStaticInitd944cb3ad10f834222db970b76dd976d
8
  {
9
  public static $files = array (
10
+ '2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
11
  'a5dbe7df96665c0b6c16ae8d91231502' => __DIR__ . '/..' . '/imagely/pope-framework/lib/autoload.php',
12
  );
13
 
25
  ),
26
  );
27
 
28
+ public static $prefixesPsr0 = array (
29
+ 'H' =>
30
+ array (
31
+ 'HTMLPurifier' =>
32
+ array (
33
+ 0 => __DIR__ . '/..' . '/ezyang/htmlpurifier/library',
34
+ ),
35
+ ),
36
+ );
37
+
38
  public static function getInitializer(ClassLoader $loader)
39
  {
40
  return \Closure::bind(function () use ($loader) {
41
  $loader->prefixLengthsPsr4 = ComposerStaticInitd944cb3ad10f834222db970b76dd976d::$prefixLengthsPsr4;
42
  $loader->prefixDirsPsr4 = ComposerStaticInitd944cb3ad10f834222db970b76dd976d::$prefixDirsPsr4;
43
+ $loader->prefixesPsr0 = ComposerStaticInitd944cb3ad10f834222db970b76dd976d::$prefixesPsr0;
44
 
45
  }, null, ClassLoader::class);
46
  }
vendor/composer/installed.json CHANGED
@@ -1,4 +1,62 @@
1
  [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  {
3
  "name": "imagely/pope-framework",
4
  "version": "v0.16",
1
  [
2
+ {
3
+ "name": "ezyang/htmlpurifier",
4
+ "version": "v4.13.0",
5
+ "version_normalized": "4.13.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/ezyang/htmlpurifier.git",
9
+ "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
14
+ "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
15
+ "shasum": "",
16
+ "mirrors": [
17
+ {
18
+ "url": "https://repo.packagist.com/imagely/dists/%package%/%version%/%reference%.%type%",
19
+ "preferred": true
20
+ }
21
+ ]
22
+ },
23
+ "require": {
24
+ "php": ">=5.2"
25
+ },
26
+ "require-dev": {
27
+ "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
28
+ },
29
+ "time": "2020-06-29T00:56:53+00:00",
30
+ "type": "library",
31
+ "installation-source": "dist",
32
+ "autoload": {
33
+ "psr-0": {
34
+ "HTMLPurifier": "library/"
35
+ },
36
+ "files": [
37
+ "library/HTMLPurifier.composer.php"
38
+ ],
39
+ "exclude-from-classmap": [
40
+ "/library/HTMLPurifier/Language/"
41
+ ]
42
+ },
43
+ "notification-url": "https://repo.packagist.com/imagely/downloads/",
44
+ "license": [
45
+ "LGPL-2.1-or-later"
46
+ ],
47
+ "authors": [
48
+ {
49
+ "name": "Edward Z. Yang",
50
+ "email": "admin@htmlpurifier.org",
51
+ "homepage": "http://ezyang.com"
52
+ }
53
+ ],
54
+ "description": "Standards compliant HTML filter written in PHP",
55
+ "homepage": "http://htmlpurifier.org/",
56
+ "keywords": [
57
+ "html"
58
+ ]
59
+ },
60
  {
61
  "name": "imagely/pope-framework",
62
  "version": "v0.16",
vendor/ezyang/htmlpurifier/CREDITS ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ CREDITS
3
+
4
+ Almost everything written by Edward Z. Yang (Ambush Commander). Lots of thanks
5
+ to the DevNetwork Community for their help (see docs/ref-devnetwork.html for
6
+ more details), Feyd especially (namely IPv6 and optimization). Thanks to RSnake
7
+ for letting me package his fantastic XSS cheatsheet for a smoketest.
8
+
9
+ vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/LICENSE ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 2.1, February 1999
3
+
4
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ [This is the first released version of the Lesser GPL. It also counts
10
+ as the successor of the GNU Library Public License, version 2, hence
11
+ the version number 2.1.]
12
+
13
+ Preamble
14
+
15
+ The licenses for most software are designed to take away your
16
+ freedom to share and change it. By contrast, the GNU General Public
17
+ Licenses are intended to guarantee your freedom to share and change
18
+ free software--to make sure the software is free for all its users.
19
+
20
+ This license, the Lesser General Public License, applies to some
21
+ specially designated software packages--typically libraries--of the
22
+ Free Software Foundation and other authors who decide to use it. You
23
+ can use it too, but we suggest you first think carefully about whether
24
+ this license or the ordinary General Public License is the better
25
+ strategy to use in any particular case, based on the explanations below.
26
+
27
+ When we speak of free software, we are referring to freedom of use,
28
+ not price. Our General Public Licenses are designed to make sure that
29
+ you have the freedom to distribute copies of free software (and charge
30
+ for this service if you wish); that you receive source code or can get
31
+ it if you want it; that you can change the software and use pieces of
32
+ it in new free programs; and that you are informed that you can do
33
+ these things.
34
+
35
+ To protect your rights, we need to make restrictions that forbid
36
+ distributors to deny you these rights or to ask you to surrender these
37
+ rights. These restrictions translate to certain responsibilities for
38
+ you if you distribute copies of the library or if you modify it.
39
+
40
+ For example, if you distribute copies of the library, whether gratis
41
+ or for a fee, you must give the recipients all the rights that we gave
42
+ you. You must make sure that they, too, receive or can get the source
43
+ code. If you link other code with the library, you must provide
44
+ complete object files to the recipients, so that they can relink them
45
+ with the library after making changes to the library and recompiling
46
+ it. And you must show them these terms so they know their rights.
47
+
48
+ We protect your rights with a two-step method: (1) we copyright the
49
+ library, and (2) we offer you this license, which gives you legal
50
+ permission to copy, distribute and/or modify the library.
51
+
52
+ To protect each distributor, we want to make it very clear that
53
+ there is no warranty for the free library. Also, if the library is
54
+ modified by someone else and passed on, the recipients should know
55
+ that what they have is not the original version, so that the original
56
+ author's reputation will not be affected by problems that might be
57
+ introduced by others.
58
+
59
+ Finally, software patents pose a constant threat to the existence of
60
+ any free program. We wish to make sure that a company cannot
61
+ effectively restrict the users of a free program by obtaining a
62
+ restrictive license from a patent holder. Therefore, we insist that
63
+ any patent license obtained for a version of the library must be
64
+ consistent with the full freedom of use specified in this license.
65
+
66
+ Most GNU software, including some libraries, is covered by the
67
+ ordinary GNU General Public License. This license, the GNU Lesser
68
+ General Public License, applies to certain designated libraries, and
69
+ is quite different from the ordinary General Public License. We use
70
+ this license for certain libraries in order to permit linking those
71
+ libraries into non-free programs.
72
+
73
+ When a program is linked with a library, whether statically or using
74
+ a shared library, the combination of the two is legally speaking a
75
+ combined work, a derivative of the original library. The ordinary
76
+ General Public License therefore permits such linking only if the
77
+ entire combination fits its criteria of freedom. The Lesser General
78
+ Public License permits more lax criteria for linking other code with
79
+ the library.
80
+
81
+ We call this license the "Lesser" General Public License because it
82
+ does Less to protect the user's freedom than the ordinary General
83
+ Public License. It also provides other free software developers Less
84
+ of an advantage over competing non-free programs. These disadvantages
85
+ are the reason we use the ordinary General Public License for many
86
+ libraries. However, the Lesser license provides advantages in certain
87
+ special circumstances.
88
+
89
+ For example, on rare occasions, there may be a special need to
90
+ encourage the widest possible use of a certain library, so that it becomes
91
+ a de-facto standard. To achieve this, non-free programs must be
92
+ allowed to use the library. A more frequent case is that a free
93
+ library does the same job as widely used non-free libraries. In this
94
+ case, there is little to gain by limiting the free library to free
95
+ software only, so we use the Lesser General Public License.
96
+
97
+ In other cases, permission to use a particular library in non-free
98
+ programs enables a greater number of people to use a large body of
99
+ free software. For example, permission to use the GNU C Library in
100
+ non-free programs enables many more people to use the whole GNU
101
+ operating system, as well as its variant, the GNU/Linux operating
102
+ system.
103
+
104
+ Although the Lesser General Public License is Less protective of the
105
+ users' freedom, it does ensure that the user of a program that is
106
+ linked with the Library has the freedom and the wherewithal to run
107
+ that program using a modified version of the Library.
108
+
109
+ The precise terms and conditions for copying, distribution and
110
+ modification follow. Pay close attention to the difference between a
111
+ "work based on the library" and a "work that uses the library". The
112
+ former contains code derived from the library, whereas the latter must
113
+ be combined with the library in order to run.
114
+
115
+ GNU LESSER GENERAL PUBLIC LICENSE
116
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
+
118
+ 0. This License Agreement applies to any software library or other
119
+ program which contains a notice placed by the copyright holder or
120
+ other authorized party saying it may be distributed under the terms of
121
+ this Lesser General Public License (also called "this License").
122
+ Each licensee is addressed as "you".
123
+
124
+ A "library" means a collection of software functions and/or data
125
+ prepared so as to be conveniently linked with application programs
126
+ (which use some of those functions and data) to form executables.
127
+
128
+ The "Library", below, refers to any such software library or work
129
+ which has been distributed under these terms. A "work based on the
130
+ Library" means either the Library or any derivative work under
131
+ copyright law: that is to say, a work containing the Library or a
132
+ portion of it, either verbatim or with modifications and/or translated
133
+ straightforwardly into another language. (Hereinafter, translation is
134
+ included without limitation in the term "modification".)
135
+
136
+ "Source code" for a work means the preferred form of the work for
137
+ making modifications to it. For a library, complete source code means
138
+ all the source code for all modules it contains, plus any associated
139
+ interface definition files, plus the scripts used to control compilation
140
+ and installation of the library.
141
+
142
+ Activities other than copying, distribution and modification are not
143
+ covered by this License; they are outside its scope. The act of
144
+ running a program using the Library is not restricted, and output from
145
+ such a program is covered only if its contents constitute a work based
146
+ on the Library (independent of the use of the Library in a tool for
147
+ writing it). Whether that is true depends on what the Library does
148
+ and what the program that uses the Library does.
149
+
150
+ 1. You may copy and distribute verbatim copies of the Library's
151
+ complete source code as you receive it, in any medium, provided that
152
+ you conspicuously and appropriately publish on each copy an
153
+ appropriate copyright notice and disclaimer of warranty; keep intact
154
+ all the notices that refer to this License and to the absence of any
155
+ warranty; and distribute a copy of this License along with the
156
+ Library.
157
+
158
+ You may charge a fee for the physical act of transferring a copy,
159
+ and you may at your option offer warranty protection in exchange for a
160
+ fee.
161
+
162
+ 2. You may modify your copy or copies of the Library or any portion
163
+ of it, thus forming a work based on the Library, and copy and
164
+ distribute such modifications or work under the terms of Section 1
165
+ above, provided that you also meet all of these conditions:
166
+
167
+ a) The modified work must itself be a software library.
168
+
169
+ b) You must cause the files modified to carry prominent notices
170
+ stating that you changed the files and the date of any change.
171
+
172
+ c) You must cause the whole of the work to be licensed at no
173
+ charge to all third parties under the terms of this License.
174
+
175
+ d) If a facility in the modified Library refers to a function or a
176
+ table of data to be supplied by an application program that uses
177
+ the facility, other than as an argument passed when the facility
178
+ is invoked, then you must make a good faith effort to ensure that,
179
+ in the event an application does not supply such function or
180
+ table, the facility still operates, and performs whatever part of
181
+ its purpose remains meaningful.
182
+
183
+ (For example, a function in a library to compute square roots has
184
+ a purpose that is entirely well-defined independent of the
185
+ application. Therefore, Subsection 2d requires that any
186
+ application-supplied function or table used by this function must
187
+ be optional: if the application does not supply it, the square
188
+ root function must still compute square roots.)
189
+
190
+ These requirements apply to the modified work as a whole. If
191
+ identifiable sections of that work are not derived from the Library,
192
+ and can be reasonably considered independent and separate works in
193
+ themselves, then this License, and its terms, do not apply to those
194
+ sections when you distribute them as separate works. But when you
195
+ distribute the same sections as part of a whole which is a work based
196
+ on the Library, the distribution of the whole must be on the terms of
197
+ this License, whose permissions for other licensees extend to the
198
+ entire whole, and thus to each and every part regardless of who wrote
199
+ it.
200
+
201
+ Thus, it is not the intent of this section to claim rights or contest
202
+ your rights to work written entirely by you; rather, the intent is to
203
+ exercise the right to control the distribution of derivative or
204
+ collective works based on the Library.
205
+
206
+ In addition, mere aggregation of another work not based on the Library
207
+ with the Library (or with a work based on the Library) on a volume of
208
+ a storage or distribution medium does not bring the other work under
209
+ the scope of this License.
210
+
211
+ 3. You may opt to apply the terms of the ordinary GNU General Public
212
+ License instead of this License to a given copy of the Library. To do
213
+ this, you must alter all the notices that refer to this License, so
214
+ that they refer to the ordinary GNU General Public License, version 2,
215
+ instead of to this License. (If a newer version than version 2 of the
216
+ ordinary GNU General Public License has appeared, then you can specify
217
+ that version instead if you wish.) Do not make any other change in
218
+ these notices.
219
+
220
+ Once this change is made in a given copy, it is irreversible for
221
+ that copy, so the ordinary GNU General Public License applies to all
222
+ subsequent copies and derivative works made from that copy.
223
+
224
+ This option is useful when you wish to copy part of the code of
225
+ the Library into a program that is not a library.
226
+
227
+ 4. You may copy and distribute the Library (or a portion or
228
+ derivative of it, under Section 2) in object code or executable form
229
+ under the terms of Sections 1 and 2 above provided that you accompany
230
+ it with the complete corresponding machine-readable source code, which
231
+ must be distributed under the terms of Sections 1 and 2 above on a
232
+ medium customarily used for software interchange.
233
+
234
+ If distribution of object code is made by offering access to copy
235
+ from a designated place, then offering equivalent access to copy the
236
+ source code from the same place satisfies the requirement to
237
+ distribute the source code, even though third parties are not
238
+ compelled to copy the source along with the object code.
239
+
240
+ 5. A program that contains no derivative of any portion of the
241
+ Library, but is designed to work with the Library by being compiled or
242
+ linked with it, is called a "work that uses the Library". Such a
243
+ work, in isolation, is not a derivative work of the Library, and
244
+ therefore falls outside the scope of this License.
245
+
246
+ However, linking a "work that uses the Library" with the Library
247
+ creates an executable that is a derivative of the Library (because it
248
+ contains portions of the Library), rather than a "work that uses the
249
+ library". The executable is therefore covered by this License.
250
+ Section 6 states terms for distribution of such executables.
251
+
252
+ When a "work that uses the Library" uses material from a header file
253
+ that is part of the Library, the object code for the work may be a
254
+ derivative work of the Library even though the source code is not.
255
+ Whether this is true is especially significant if the work can be
256
+ linked without the Library, or if the work is itself a library. The
257
+ threshold for this to be true is not precisely defined by law.
258
+
259
+ If such an object file uses only numerical parameters, data
260
+ structure layouts and accessors, and small macros and small inline
261
+ functions (ten lines or less in length), then the use of the object
262
+ file is unrestricted, regardless of whether it is legally a derivative
263
+ work. (Executables containing this object code plus portions of the
264
+ Library will still fall under Section 6.)
265
+
266
+ Otherwise, if the work is a derivative of the Library, you may
267
+ distribute the object code for the work under the terms of Section 6.
268
+ Any executables containing that work also fall under Section 6,
269
+ whether or not they are linked directly with the Library itself.
270
+
271
+ 6. As an exception to the Sections above, you may also combine or
272
+ link a "work that uses the Library" with the Library to produce a
273
+ work containing portions of the Library, and distribute that work
274
+ under terms of your choice, provided that the terms permit
275
+ modification of the work for the customer's own use and reverse
276
+ engineering for debugging such modifications.
277
+
278
+ You must give prominent notice with each copy of the work that the
279
+ Library is used in it and that the Library and its use are covered by
280
+ this License. You must supply a copy of this License. If the work
281
+ during execution displays copyright notices, you must include the
282
+ copyright notice for the Library among them, as well as a reference
283
+ directing the user to the copy of this License. Also, you must do one
284
+ of these things:
285
+
286
+ a) Accompany the work with the complete corresponding
287
+ machine-readable source code for the Library including whatever
288
+ changes were used in the work (which must be distributed under
289
+ Sections 1 and 2 above); and, if the work is an executable linked
290
+ with the Library, with the complete machine-readable "work that
291
+ uses the Library", as object code and/or source code, so that the
292
+ user can modify the Library and then relink to produce a modified
293
+ executable containing the modified Library. (It is understood
294
+ that the user who changes the contents of definitions files in the
295
+ Library will not necessarily be able to recompile the application
296
+ to use the modified definitions.)
297
+
298
+ b) Use a suitable shared library mechanism for linking with the
299
+ Library. A suitable mechanism is one that (1) uses at run time a
300
+ copy of the library already present on the user's computer system,
301
+ rather than copying library functions into the executable, and (2)
302
+ will operate properly with a modified version of the library, if
303
+ the user installs one, as long as the modified version is
304
+ interface-compatible with the version that the work was made with.
305
+
306
+ c) Accompany the work with a written offer, valid for at
307
+ least three years, to give the same user the materials
308
+ specified in Subsection 6a, above, for a charge no more
309
+ than the cost of performing this distribution.
310
+
311
+ d) If distribution of the work is made by offering access to copy
312
+ from a designated place, offer equivalent access to copy the above
313
+ specified materials from the same place.
314
+
315
+ e) Verify that the user has already received a copy of these
316
+ materials or that you have already sent this user a copy.
317
+
318
+ For an executable, the required form of the "work that uses the
319
+ Library" must include any data and utility programs needed for
320
+ reproducing the executable from it. However, as a special exception,
321
+ the materials to be distributed need not include anything that is
322
+ normally distributed (in either source or binary form) with the major
323
+ components (compiler, kernel, and so on) of the operating system on
324
+ which the executable runs, unless that component itself accompanies
325
+ the executable.
326
+
327
+ It may happen that this requirement contradicts the license
328
+ restrictions of other proprietary libraries that do not normally
329
+ accompany the operating system. Such a contradiction means you cannot
330
+ use both them and the Library together in an executable that you
331
+ distribute.
332
+
333
+ 7. You may place library facilities that are a work based on the
334
+ Library side-by-side in a single library together with other library
335
+ facilities not covered by this License, and distribute such a combined
336
+ library, provided that the separate distribution of the work based on
337
+ the Library and of the other library facilities is otherwise
338
+ permitted, and provided that you do these two things:
339
+
340
+ a) Accompany the combined library with a copy of the same work
341
+ based on the Library, uncombined with any other library
342
+ facilities. This must be distributed under the terms of the
343
+ Sections above.
344
+
345
+ b) Give prominent notice with the combined library of the fact
346
+ that part of it is a work based on the Library, and explaining
347
+ where to find the accompanying uncombined form of the same work.
348
+
349
+ 8. You may not copy, modify, sublicense, link with, or distribute
350
+ the Library except as expressly provided under this License. Any
351
+ attempt otherwise to copy, modify, sublicense, link with, or
352
+ distribute the Library is void, and will automatically terminate your
353
+ rights under this License. However, parties who have received copies,
354
+ or rights, from you under this License will not have their licenses
355
+ terminated so long as such parties remain in full compliance.
356
+
357
+ 9. You are not required to accept this License, since you have not
358
+ signed it. However, nothing else grants you permission to modify or
359
+ distribute the Library or its derivative works. These actions are
360
+ prohibited by law if you do not accept this License. Therefore, by
361
+ modifying or distributing the Library (or any work based on the
362
+ Library), you indicate your acceptance of this License to do so, and
363
+ all its terms and conditions for copying, distributing or modifying
364
+ the Library or works based on it.
365
+
366
+ 10. Each time you redistribute the Library (or any work based on the
367
+ Library), the recipient automatically receives a license from the
368
+ original licensor to copy, distribute, link with or modify the Library
369
+ subject to these terms and conditions. You may not impose any further
370
+ restrictions on the recipients' exercise of the rights granted herein.
371
+ You are not responsible for enforcing compliance by third parties with
372
+ this License.
373
+
374
+ 11. If, as a consequence of a court judgment or allegation of patent
375
+ infringement or for any other reason (not limited to patent issues),
376
+ conditions are imposed on you (whether by court order, agreement or
377
+ otherwise) that contradict the conditions of this License, they do not
378
+ excuse you from the conditions of this License. If you cannot
379
+ distribute so as to satisfy simultaneously your obligations under this
380
+ License and any other pertinent obligations, then as a consequence you
381
+ may not distribute the Library at all. For example, if a patent
382
+ license would not permit royalty-free redistribution of the Library by
383
+ all those who receive copies directly or indirectly through you, then
384
+ the only way you could satisfy both it and this License would be to
385
+ refrain entirely from distribution of the Library.
386
+
387
+ If any portion of this section is held invalid or unenforceable under any
388
+ particular circumstance, the balance of the section is intended to apply,
389
+ and the section as a whole is intended to apply in other circumstances.
390
+
391
+ It is not the purpose of this section to induce you to infringe any
392
+ patents or other property right claims or to contest validity of any
393
+ such claims; this section has the sole purpose of protecting the
394
+ integrity of the free software distribution system which is
395
+ implemented by public license practices. Many people have made
396
+ generous contributions to the wide range of software distributed
397
+ through that system in reliance on consistent application of that
398
+ system; it is up to the author/donor to decide if he or she is willing
399
+ to distribute software through any other system and a licensee cannot
400
+ impose that choice.
401
+
402
+ This section is intended to make thoroughly clear what is believed to
403
+ be a consequence of the rest of this License.
404
+
405
+ 12. If the distribution and/or use of the Library is restricted in
406
+ certain countries either by patents or by copyrighted interfaces, the
407
+ original copyright holder who places the Library under this License may add
408
+ an explicit geographical distribution limitation excluding those countries,
409
+ so that distribution is permitted only in or among countries not thus
410
+ excluded. In such case, this License incorporates the limitation as if
411
+ written in the body of this License.
412
+
413
+ 13. The Free Software Foundation may publish revised and/or new
414
+ versions of the Lesser General Public License from time to time.
415
+ Such new versions will be similar in spirit to the present version,
416
+ but may differ in detail to address new problems or concerns.
417
+
418
+ Each version is given a distinguishing version number. If the Library
419
+ specifies a version number of this License which applies to it and
420
+ "any later version", you have the option of following the terms and
421
+ conditions either of that version or of any later version published by
422
+ the Free Software Foundation. If the Library does not specify a
423
+ license version number, you may choose any version ever published by
424
+ the Free Software Foundation.
425
+
426
+ 14. If you wish to incorporate parts of the Library into other free
427
+ programs whose distribution conditions are incompatible with these,
428
+ write to the author to ask for permission. For software which is
429
+ copyrighted by the Free Software Foundation, write to the Free
430
+ Software Foundation; we sometimes make exceptions for this. Our
431
+ decision will be guided by the two goals of preserving the free status
432
+ of all derivatives of our free software and of promoting the sharing
433
+ and reuse of software generally.
434
+
435
+ NO WARRANTY
436
+
437
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438
+ WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440
+ OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444
+ LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445
+ THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
+
447
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448
+ WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449
+ AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450
+ FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451
+ CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452
+ LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453
+ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454
+ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455
+ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456
+ DAMAGES.
457
+
458
+ END OF TERMS AND CONDITIONS
459
+
460
+ How to Apply These Terms to Your New Libraries
461
+
462
+ If you develop a new library, and you want it to be of the greatest
463
+ possible use to the public, we recommend making it free software that
464
+ everyone can redistribute and change. You can do so by permitting
465
+ redistribution under these terms (or, alternatively, under the terms of the
466
+ ordinary General Public License).
467
+
468
+ To apply these terms, attach the following notices to the library. It is
469
+ safest to attach them to the start of each source file to most effectively
470
+ convey the exclusion of warranty; and each file should have at least the
471
+ "copyright" line and a pointer to where the full notice is found.
472
+
473
+ <one line to give the library's name and a brief idea of what it does.>
474
+ Copyright (C) <year> <name of author>
475
+
476
+ This library is free software; you can redistribute it and/or
477
+ modify it under the terms of the GNU Lesser General Public
478
+ License as published by the Free Software Foundation; either
479
+ version 2.1 of the License, or (at your option) any later version.
480
+
481
+ This library is distributed in the hope that it will be useful,
482
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
483
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484
+ Lesser General Public License for more details.
485
+
486
+ You should have received a copy of the GNU Lesser General Public
487
+ License along with this library; if not, write to the Free Software
488
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
489
+
490
+ Also add information on how to contact you by electronic and paper mail.
491
+
492
+ You should also get your employer (if you work as a programmer) or your
493
+ school, if any, to sign a "copyright disclaimer" for the library, if
494
+ necessary. Here is a sample; alter the names:
495
+
496
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
497
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498
+
499
+ <signature of Ty Coon>, 1 April 1990
500
+ Ty Coon, President of Vice
501
+
502
+ That's all there is to it!
503
+
504
+ vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/README.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ HTML Purifier [![Build Status](https://secure.travis-ci.org/ezyang/htmlpurifier.svg?branch=master)](http://travis-ci.org/ezyang/htmlpurifier)
2
+ =============
3
+
4
+ HTML Purifier is an HTML filtering solution that uses a unique combination
5
+ of robust whitelists and aggressive parsing to ensure that not only are
6
+ XSS attacks thwarted, but the resulting HTML is standards compliant.
7
+
8
+ HTML Purifier is oriented towards richly formatted documents from
9
+ untrusted sources that require CSS and a full tag-set. This library can
10
+ be configured to accept a more restrictive set of tags, but it won't be
11
+ as efficient as more bare-bones parsers. It will, however, do the job
12
+ right, which may be more important.
13
+
14
+ Places to go:
15
+
16
+ * See INSTALL for a quick installation guide
17
+ * See docs/ for developer-oriented documentation, code examples and
18
+ an in-depth installation guide.
19
+ * See WYSIWYG for information on editors like TinyMCE and FCKeditor
20
+
21
+ HTML Purifier can be found on the web at: [http://htmlpurifier.org/](http://htmlpurifier.org/)
22
+
23
+ ## Installation
24
+
25
+ Package available on [Composer](https://packagist.org/packages/ezyang/htmlpurifier).
26
+
27
+ If you're using Composer to manage dependencies, you can use
28
+
29
+ $ composer require ezyang/htmlpurifier
vendor/ezyang/htmlpurifier/VERSION ADDED
@@ -0,0 +1 @@
 
1
+ 4.13.0
vendor/ezyang/htmlpurifier/composer.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "ezyang/htmlpurifier",
3
+ "description": "Standards compliant HTML filter written in PHP",
4
+ "type": "library",
5
+ "keywords": ["html"],
6
+ "homepage": "http://htmlpurifier.org/",
7
+ "license": "LGPL-2.1-or-later",
8
+ "authors": [
9
+ {
10
+ "name": "Edward Z. Yang",
11
+ "email": "admin@htmlpurifier.org",
12
+ "homepage": "http://ezyang.com"
13
+ }
14
+ ],
15
+ "require": {
16
+ "php": ">=5.2"
17
+ },
18
+ "require-dev": {
19
+ "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
20
+ },
21
+ "autoload": {
22
+ "psr-0": { "HTMLPurifier": "library/" },
23
+ "files": ["library/HTMLPurifier.composer.php"],
24
+ "exclude-from-classmap": [
25
+ "/library/HTMLPurifier/Language/"
26
+ ]
27
+ }
28
+ }
vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * This is a stub include that automatically configures the include path.
5
+ */
6
+
7
+ set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
8
+ require_once 'HTMLPurifier/Bootstrap.php';
9
+ require_once 'HTMLPurifier.autoload.php';
10
+
11
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier.autoload-legacy.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @file
5
+ * Legacy autoloader for systems lacking spl_autoload_register
6
+ *
7
+ * Must be separate to prevent deprecation warning on PHP 7.2
8
+ */
9
+
10
+ function __autoload($class)
11
+ {
12
+ return HTMLPurifier_Bootstrap::autoload($class);
13
+ }
14
+
15
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier.autoload.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @file
5
+ * Convenience file that registers autoload handler for HTML Purifier.
6
+ * It also does some sanity checks.
7
+ */
8
+
9
+ if (function_exists('spl_autoload_register') && function_exists('spl_autoload_unregister')) {
10
+ // We need unregister for our pre-registering functionality
11
+ HTMLPurifier_Bootstrap::registerAutoload();
12
+ if (function_exists('__autoload')) {
13
+ // Be polite and ensure that userland autoload gets retained
14
+ spl_autoload_register('__autoload');
15
+ }
16
+ } elseif (!function_exists('__autoload')) {
17
+ require dirname(__FILE__) . '/HTMLPurifier.autoload-legacy.php';
18
+ }
19
+
20
+ if (ini_get('zend.ze1_compatibility_mode')) {
21
+ trigger_error("HTML Purifier is not compatible with zend.ze1_compatibility_mode; please turn it off", E_USER_ERROR);
22
+ }
23
+
24
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier.composer.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ if (!defined('HTMLPURIFIER_PREFIX')) {
3
+ define('HTMLPURIFIER_PREFIX', dirname(__FILE__));
4
+ }
vendor/ezyang/htmlpurifier/library/HTMLPurifier.func.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @file
5
+ * Defines a function wrapper for HTML Purifier for quick use.
6
+ * @note ''HTMLPurifier()'' is NOT the same as ''new HTMLPurifier()''
7
+ */
8
+
9
+ /**
10
+ * Purify HTML.
11
+ * @param string $html String HTML to purify
12
+ * @param mixed $config Configuration to use, can be any value accepted by
13
+ * HTMLPurifier_Config::create()
14
+ * @return string
15
+ */
16
+ function HTMLPurifier($html, $config = null)
17
+ {
18
+ static $purifier = false;
19
+ if (!$purifier) {
20
+ $purifier = new HTMLPurifier();
21
+ }
22
+ return $purifier->purify($html, $config);
23
+ }
24
+
25
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier.includes.php ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @file
5
+ * This file was auto-generated by generate-includes.php and includes all of
6
+ * the core files required by HTML Purifier. Use this if performance is a
7
+ * primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
8
+ * FILE, changes will be overwritten the next time the script is run.
9
+ *
10
+ * @version 4.13.0
11
+ *
12
+ * @warning
13
+ * You must *not* include any other HTML Purifier files before this file,
14
+ * because 'require' not 'require_once' is used.
15
+ *
16
+ * @warning
17
+ * This file requires that the include path contains the HTML Purifier
18
+ * library directory; this is not auto-set.
19
+ */
20
+
21
+ require 'HTMLPurifier.php';
22
+ require 'HTMLPurifier/Arborize.php';
23
+ require 'HTMLPurifier/AttrCollections.php';
24
+ require 'HTMLPurifier/AttrDef.php';
25
+ require 'HTMLPurifier/AttrTransform.php';
26
+ require 'HTMLPurifier/AttrTypes.php';
27
+ require 'HTMLPurifier/AttrValidator.php';
28
+ require 'HTMLPurifier/Bootstrap.php';
29
+ require 'HTMLPurifier/Definition.php';
30
+ require 'HTMLPurifier/CSSDefinition.php';
31
+ require 'HTMLPurifier/ChildDef.php';
32
+ require 'HTMLPurifier/Config.php';
33
+ require 'HTMLPurifier/ConfigSchema.php';
34
+ require 'HTMLPurifier/ContentSets.php';
35
+ require 'HTMLPurifier/Context.php';
36
+ require 'HTMLPurifier/DefinitionCache.php';
37
+ require 'HTMLPurifier/DefinitionCacheFactory.php';
38
+ require 'HTMLPurifier/Doctype.php';
39
+ require 'HTMLPurifier/DoctypeRegistry.php';
40
+ require 'HTMLPurifier/ElementDef.php';
41
+ require 'HTMLPurifier/Encoder.php';
42
+ require 'HTMLPurifier/EntityLookup.php';
43
+ require 'HTMLPurifier/EntityParser.php';
44
+ require 'HTMLPurifier/ErrorCollector.php';
45
+ require 'HTMLPurifier/ErrorStruct.php';
46
+ require 'HTMLPurifier/Exception.php';
47
+ require 'HTMLPurifier/Filter.php';
48
+ require 'HTMLPurifier/Generator.php';
49
+ require 'HTMLPurifier/HTMLDefinition.php';
50
+ require 'HTMLPurifier/HTMLModule.php';
51
+ require 'HTMLPurifier/HTMLModuleManager.php';
52
+ require 'HTMLPurifier/IDAccumulator.php';
53
+ require 'HTMLPurifier/Injector.php';
54
+ require 'HTMLPurifier/Language.php';
55
+ require 'HTMLPurifier/LanguageFactory.php';
56
+ require 'HTMLPurifier/Length.php';
57
+ require 'HTMLPurifier/Lexer.php';
58
+ require 'HTMLPurifier/Node.php';
59
+ require 'HTMLPurifier/PercentEncoder.php';
60
+ require 'HTMLPurifier/PropertyList.php';
61
+ require 'HTMLPurifier/PropertyListIterator.php';
62
+ require 'HTMLPurifier/Queue.php';
63
+ require 'HTMLPurifier/Strategy.php';
64
+ require 'HTMLPurifier/StringHash.php';
65
+ require 'HTMLPurifier/StringHashParser.php';
66
+ require 'HTMLPurifier/TagTransform.php';
67
+ require 'HTMLPurifier/Token.php';
68
+ require 'HTMLPurifier/TokenFactory.php';
69
+ require 'HTMLPurifier/URI.php';
70
+ require 'HTMLPurifier/URIDefinition.php';
71
+ require 'HTMLPurifier/URIFilter.php';
72
+ require 'HTMLPurifier/URIParser.php';
73
+ require 'HTMLPurifier/URIScheme.php';
74
+ require 'HTMLPurifier/URISchemeRegistry.php';
75
+ require 'HTMLPurifier/UnitConverter.php';
76
+ require 'HTMLPurifier/VarParser.php';
77
+ require 'HTMLPurifier/VarParserException.php';
78
+ require 'HTMLPurifier/Zipper.php';
79
+ require 'HTMLPurifier/AttrDef/CSS.php';
80
+ require 'HTMLPurifier/AttrDef/Clone.php';
81
+ require 'HTMLPurifier/AttrDef/Enum.php';
82
+ require 'HTMLPurifier/AttrDef/Integer.php';
83
+ require 'HTMLPurifier/AttrDef/Lang.php';
84
+ require 'HTMLPurifier/AttrDef/Switch.php';
85
+ require 'HTMLPurifier/AttrDef/Text.php';
86
+ require 'HTMLPurifier/AttrDef/URI.php';
87
+ require 'HTMLPurifier/AttrDef/CSS/Number.php';
88
+ require 'HTMLPurifier/AttrDef/CSS/AlphaValue.php';
89
+ require 'HTMLPurifier/AttrDef/CSS/Background.php';
90
+ require 'HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
91
+ require 'HTMLPurifier/AttrDef/CSS/Border.php';
92
+ require 'HTMLPurifier/AttrDef/CSS/Color.php';
93
+ require 'HTMLPurifier/AttrDef/CSS/Composite.php';
94
+ require 'HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
95
+ require 'HTMLPurifier/AttrDef/CSS/Filter.php';
96
+ require 'HTMLPurifier/AttrDef/CSS/Font.php';
97
+ require 'HTMLPurifier/AttrDef/CSS/FontFamily.php';
98
+ require 'HTMLPurifier/AttrDef/CSS/Ident.php';
99
+ require 'HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
100
+ require 'HTMLPurifier/AttrDef/CSS/Length.php';
101
+ require 'HTMLPurifier/AttrDef/CSS/ListStyle.php';
102
+ require 'HTMLPurifier/AttrDef/CSS/Multiple.php';
103
+ require 'HTMLPurifier/AttrDef/CSS/Percentage.php';
104
+ require 'HTMLPurifier/AttrDef/CSS/TextDecoration.php';
105
+ require 'HTMLPurifier/AttrDef/CSS/URI.php';
106
+ require 'HTMLPurifier/AttrDef/HTML/Bool.php';
107
+ require 'HTMLPurifier/AttrDef/HTML/Nmtokens.php';
108
+ require 'HTMLPurifier/AttrDef/HTML/Class.php';
109
+ require 'HTMLPurifier/AttrDef/HTML/Color.php';
110
+ require 'HTMLPurifier/AttrDef/HTML/FrameTarget.php';
111
+ require 'HTMLPurifier/AttrDef/HTML/ID.php';
112
+ require 'HTMLPurifier/AttrDef/HTML/Pixels.php';
113
+ require 'HTMLPurifier/AttrDef/HTML/Length.php';
114
+ require 'HTMLPurifier/AttrDef/HTML/LinkTypes.php';
115
+ require 'HTMLPurifier/AttrDef/HTML/MultiLength.php';
116
+ require 'HTMLPurifier/AttrDef/URI/Email.php';
117
+ require 'HTMLPurifier/AttrDef/URI/Host.php';
118
+ require 'HTMLPurifier/AttrDef/URI/IPv4.php';
119
+ require 'HTMLPurifier/AttrDef/URI/IPv6.php';
120
+ require 'HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
121
+ require 'HTMLPurifier/AttrTransform/Background.php';
122
+ require 'HTMLPurifier/AttrTransform/BdoDir.php';
123
+ require 'HTMLPurifier/AttrTransform/BgColor.php';
124
+ require 'HTMLPurifier/AttrTransform/BoolToCSS.php';
125
+ require 'HTMLPurifier/AttrTransform/Border.php';
126
+ require 'HTMLPurifier/AttrTransform/EnumToCSS.php';
127
+ require 'HTMLPurifier/AttrTransform/ImgRequired.php';
128
+ require 'HTMLPurifier/AttrTransform/ImgSpace.php';
129
+ require 'HTMLPurifier/AttrTransform/Input.php';
130
+ require 'HTMLPurifier/AttrTransform/Lang.php';
131
+ require 'HTMLPurifier/AttrTransform/Length.php';
132
+ require 'HTMLPurifier/AttrTransform/Name.php';
133
+ require 'HTMLPurifier/AttrTransform/NameSync.php';
134
+ require 'HTMLPurifier/AttrTransform/Nofollow.php';
135
+ require 'HTMLPurifier/AttrTransform/SafeEmbed.php';
136
+ require 'HTMLPurifier/AttrTransform/SafeObject.php';
137
+ require 'HTMLPurifier/AttrTransform/SafeParam.php';
138
+ require 'HTMLPurifier/AttrTransform/ScriptRequired.php';
139
+ require 'HTMLPurifier/AttrTransform/TargetBlank.php';
140
+ require 'HTMLPurifier/AttrTransform/TargetNoopener.php';
141
+ require 'HTMLPurifier/AttrTransform/TargetNoreferrer.php';
142
+ require 'HTMLPurifier/AttrTransform/Textarea.php';
143
+ require 'HTMLPurifier/ChildDef/Chameleon.php';
144
+ require 'HTMLPurifier/ChildDef/Custom.php';
145
+ require 'HTMLPurifier/ChildDef/Empty.php';
146
+ require 'HTMLPurifier/ChildDef/List.php';
147
+ require 'HTMLPurifier/ChildDef/Required.php';
148
+ require 'HTMLPurifier/ChildDef/Optional.php';
149
+ require 'HTMLPurifier/ChildDef/StrictBlockquote.php';
150
+ require 'HTMLPurifier/ChildDef/Table.php';
151
+ require 'HTMLPurifier/DefinitionCache/Decorator.php';
152
+ require 'HTMLPurifier/DefinitionCache/Null.php';
153
+ require 'HTMLPurifier/DefinitionCache/Serializer.php';
154
+ require 'HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
155
+ require 'HTMLPurifier/DefinitionCache/Decorator/Memory.php';
156
+ require 'HTMLPurifier/HTMLModule/Bdo.php';
157
+ require 'HTMLPurifier/HTMLModule/CommonAttributes.php';
158
+ require 'HTMLPurifier/HTMLModule/Edit.php';
159
+ require 'HTMLPurifier/HTMLModule/Forms.php';
160
+ require 'HTMLPurifier/HTMLModule/Hypertext.php';
161
+ require 'HTMLPurifier/HTMLModule/Iframe.php';
162
+ require 'HTMLPurifier/HTMLModule/Image.php';
163
+ require 'HTMLPurifier/HTMLModule/Legacy.php';
164
+ require 'HTMLPurifier/HTMLModule/List.php';
165
+ require 'HTMLPurifier/HTMLModule/Name.php';
166
+ require 'HTMLPurifier/HTMLModule/Nofollow.php';
167
+ require 'HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
168
+ require 'HTMLPurifier/HTMLModule/Object.php';
169
+ require 'HTMLPurifier/HTMLModule/Presentation.php';
170
+ require 'HTMLPurifier/HTMLModule/Proprietary.php';
171
+ require 'HTMLPurifier/HTMLModule/Ruby.php';
172
+ require 'HTMLPurifier/HTMLModule/SafeEmbed.php';
173
+ require 'HTMLPurifier/HTMLModule/SafeObject.php';
174
+ require 'HTMLPurifier/HTMLModule/SafeScripting.php';
175
+ require 'HTMLPurifier/HTMLModule/Scripting.php';
176
+ require 'HTMLPurifier/HTMLModule/StyleAttribute.php';
177
+ require 'HTMLPurifier/HTMLModule/Tables.php';
178
+ require 'HTMLPurifier/HTMLModule/Target.php';
179
+ require 'HTMLPurifier/HTMLModule/TargetBlank.php';
180
+ require 'HTMLPurifier/HTMLModule/TargetNoopener.php';
181
+ require 'HTMLPurifier/HTMLModule/TargetNoreferrer.php';
182
+ require 'HTMLPurifier/HTMLModule/Text.php';
183
+ require 'HTMLPurifier/HTMLModule/Tidy.php';
184
+ require 'HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
185
+ require 'HTMLPurifier/HTMLModule/Tidy/Name.php';
186
+ require 'HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
187
+ require 'HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
188
+ require 'HTMLPurifier/HTMLModule/Tidy/Strict.php';
189
+ require 'HTMLPurifier/HTMLModule/Tidy/Transitional.php';
190
+ require 'HTMLPurifier/HTMLModule/Tidy/XHTML.php';
191
+ require 'HTMLPurifier/Injector/AutoParagraph.php';
192
+ require 'HTMLPurifier/Injector/DisplayLinkURI.php';
193
+ require 'HTMLPurifier/Injector/Linkify.php';
194
+ require 'HTMLPurifier/Injector/PurifierLinkify.php';
195
+ require 'HTMLPurifier/Injector/RemoveEmpty.php';
196
+ require 'HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
197
+ require 'HTMLPurifier/Injector/SafeObject.php';
198
+ require 'HTMLPurifier/Lexer/DOMLex.php';
199
+ require 'HTMLPurifier/Lexer/DirectLex.php';
200
+ require 'HTMLPurifier/Node/Comment.php';
201
+ require 'HTMLPurifier/Node/Element.php';
202
+ require 'HTMLPurifier/Node/Text.php';
203
+ require 'HTMLPurifier/Strategy/Composite.php';
204
+ require 'HTMLPurifier/Strategy/Core.php';
205
+ require 'HTMLPurifier/Strategy/FixNesting.php';
206
+ require 'HTMLPurifier/Strategy/MakeWellFormed.php';
207
+ require 'HTMLPurifier/Strategy/RemoveForeignElements.php';
208
+ require 'HTMLPurifier/Strategy/ValidateAttributes.php';
209
+ require 'HTMLPurifier/TagTransform/Font.php';
210
+ require 'HTMLPurifier/TagTransform/Simple.php';
211
+ require 'HTMLPurifier/Token/Comment.php';
212
+ require 'HTMLPurifier/Token/Tag.php';
213
+ require 'HTMLPurifier/Token/Empty.php';
214
+ require 'HTMLPurifier/Token/End.php';
215
+ require 'HTMLPurifier/Token/Start.php';
216
+ require 'HTMLPurifier/Token/Text.php';
217
+ require 'HTMLPurifier/URIFilter/DisableExternal.php';
218
+ require 'HTMLPurifier/URIFilter/DisableExternalResources.php';
219
+ require 'HTMLPurifier/URIFilter/DisableResources.php';
220
+ require 'HTMLPurifier/URIFilter/HostBlacklist.php';
221
+ require 'HTMLPurifier/URIFilter/MakeAbsolute.php';
222
+ require 'HTMLPurifier/URIFilter/Munge.php';
223
+ require 'HTMLPurifier/URIFilter/SafeIframe.php';
224
+ require 'HTMLPurifier/URIScheme/data.php';
225
+ require 'HTMLPurifier/URIScheme/file.php';
226
+ require 'HTMLPurifier/URIScheme/ftp.php';
227
+ require 'HTMLPurifier/URIScheme/http.php';
228
+ require 'HTMLPurifier/URIScheme/https.php';
229
+ require 'HTMLPurifier/URIScheme/mailto.php';
230
+ require 'HTMLPurifier/URIScheme/news.php';
231
+ require 'HTMLPurifier/URIScheme/nntp.php';
232
+ require 'HTMLPurifier/URIScheme/tel.php';
233
+ require 'HTMLPurifier/VarParser/Flexible.php';
234
+ require 'HTMLPurifier/VarParser/Native.php';
vendor/ezyang/htmlpurifier/library/HTMLPurifier.kses.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @file
5
+ * Emulation layer for code that used kses(), substituting in HTML Purifier.
6
+ */
7
+
8
+ require_once dirname(__FILE__) . '/HTMLPurifier.auto.php';
9
+
10
+ function kses($string, $allowed_html, $allowed_protocols = null)
11
+ {
12
+ $config = HTMLPurifier_Config::createDefault();
13
+ $allowed_elements = array();
14
+ $allowed_attributes = array();
15
+ foreach ($allowed_html as $element => $attributes) {
16
+ $allowed_elements[$element] = true;
17
+ foreach ($attributes as $attribute => $x) {
18
+ $allowed_attributes["$element.$attribute"] = true;
19
+ }
20
+ }
21
+ $config->set('HTML.AllowedElements', $allowed_elements);
22
+ $config->set('HTML.AllowedAttributes', $allowed_attributes);
23
+ if ($allowed_protocols !== null) {
24
+ $config->set('URI.AllowedSchemes', $allowed_protocols);
25
+ }
26
+ $purifier = new HTMLPurifier($config);
27
+ return $purifier->purify($string);
28
+ }
29
+
30
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier.path.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @file
5
+ * Convenience stub file that adds HTML Purifier's library file to the path
6
+ * without any other side-effects.
7
+ */
8
+
9
+ set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
10
+
11
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier.php ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*! @mainpage
4
+ *
5
+ * HTML Purifier is an HTML filter that will take an arbitrary snippet of
6
+ * HTML and rigorously test, validate and filter it into a version that
7
+ * is safe for output onto webpages. It achieves this by:
8
+ *
9
+ * -# Lexing (parsing into tokens) the document,
10
+ * -# Executing various strategies on the tokens:
11
+ * -# Removing all elements not in the whitelist,
12
+ * -# Making the tokens well-formed,
13
+ * -# Fixing the nesting of the nodes, and
14
+ * -# Validating attributes of the nodes; and
15
+ * -# Generating HTML from the purified tokens.
16
+ *
17
+ * However, most users will only need to interface with the HTMLPurifier
18
+ * and HTMLPurifier_Config.
19
+ */
20
+
21
+ /*
22
+ HTML Purifier 4.13.0 - Standards Compliant HTML Filtering
23
+ Copyright (C) 2006-2008 Edward Z. Yang
24
+
25
+ This library is free software; you can redistribute it and/or
26
+ modify it under the terms of the GNU Lesser General Public
27
+ License as published by the Free Software Foundation; either
28
+ version 2.1 of the License, or (at your option) any later version.
29
+
30
+ This library is distributed in the hope that it will be useful,
31
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
32
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33
+ Lesser General Public License for more details.
34
+
35
+ You should have received a copy of the GNU Lesser General Public
36
+ License along with this library; if not, write to the Free Software
37
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
38
+ */
39
+
40
+ /**
41
+ * Facade that coordinates HTML Purifier's subsystems in order to purify HTML.
42
+ *
43
+ * @note There are several points in which configuration can be specified
44
+ * for HTML Purifier. The precedence of these (from lowest to
45
+ * highest) is as follows:
46
+ * -# Instance: new HTMLPurifier($config)
47
+ * -# Invocation: purify($html, $config)
48
+ * These configurations are entirely independent of each other and
49
+ * are *not* merged (this behavior may change in the future).
50
+ *
51
+ * @todo We need an easier way to inject strategies using the configuration
52
+ * object.
53
+ */
54
+ class HTMLPurifier
55
+ {
56
+
57
+ /**
58
+ * Version of HTML Purifier.
59
+ * @type string
60
+ */
61
+ public $version = '4.13.0';
62
+
63
+ /**
64
+ * Constant with version of HTML Purifier.
65
+ */
66
+ const VERSION = '4.13.0';
67
+
68
+ /**
69
+ * Global configuration object.
70
+ * @type HTMLPurifier_Config
71
+ */
72
+ public $config;
73
+
74
+ /**
75
+ * Array of extra filter objects to run on HTML,
76
+ * for backwards compatibility.
77
+ * @type HTMLPurifier_Filter[]
78
+ */
79
+ private $filters = array();
80
+
81
+ /**
82
+ * Single instance of HTML Purifier.
83
+ * @type HTMLPurifier
84
+ */
85
+ private static $instance;
86
+
87
+ /**
88
+ * @type HTMLPurifier_Strategy_Core
89
+ */
90
+ protected $strategy;
91
+
92
+ /**
93
+ * @type HTMLPurifier_Generator
94
+ */
95
+ protected $generator;
96
+
97
+ /**
98
+ * Resultant context of last run purification.
99
+ * Is an array of contexts if the last called method was purifyArray().
100
+ * @type HTMLPurifier_Context
101
+ */
102
+ public $context;
103
+
104
+ /**
105
+ * Initializes the purifier.
106
+ *
107
+ * @param HTMLPurifier_Config|mixed $config Optional HTMLPurifier_Config object
108
+ * for all instances of the purifier, if omitted, a default
109
+ * configuration is supplied (which can be overridden on a
110
+ * per-use basis).
111
+ * The parameter can also be any type that
112
+ * HTMLPurifier_Config::create() supports.
113
+ */
114
+ public function __construct($config = null)
115
+ {
116
+ $this->config = HTMLPurifier_Config::create($config);
117
+ $this->strategy = new HTMLPurifier_Strategy_Core();
118
+ }
119
+
120
+ /**
121
+ * Adds a filter to process the output. First come first serve
122
+ *
123
+ * @param HTMLPurifier_Filter $filter HTMLPurifier_Filter object
124
+ */
125
+ public function addFilter($filter)
126
+ {
127
+ trigger_error(
128
+ 'HTMLPurifier->addFilter() is deprecated, use configuration directives' .
129
+ ' in the Filter namespace or Filter.Custom',
130
+ E_USER_WARNING
131
+ );
132
+ $this->filters[] = $filter;
133
+ }
134
+
135
+ /**
136
+ * Filters an HTML snippet/document to be XSS-free and standards-compliant.
137
+ *
138
+ * @param string $html String of HTML to purify
139
+ * @param HTMLPurifier_Config $config Config object for this operation,
140
+ * if omitted, defaults to the config object specified during this
141
+ * object's construction. The parameter can also be any type
142
+ * that HTMLPurifier_Config::create() supports.
143
+ *
144
+ * @return string Purified HTML
145
+ */
146
+ public function purify($html, $config = null)
147
+ {
148
+ // :TODO: make the config merge in, instead of replace
149
+ $config = $config ? HTMLPurifier_Config::create($config) : $this->config;
150
+
151
+ // implementation is partially environment dependant, partially
152
+ // configuration dependant
153
+ $lexer = HTMLPurifier_Lexer::create($config);
154
+
155
+ $context = new HTMLPurifier_Context();
156
+
157
+ // setup HTML generator
158
+ $this->generator = new HTMLPurifier_Generator($config, $context);
159
+ $context->register('Generator', $this->generator);
160
+
161
+ // set up global context variables
162
+ if ($config->get('Core.CollectErrors')) {
163
+ // may get moved out if other facilities use it
164
+ $language_factory = HTMLPurifier_LanguageFactory::instance();
165
+ $language = $language_factory->create($config, $context);
166
+ $context->register('Locale', $language);
167
+
168
+ $error_collector = new HTMLPurifier_ErrorCollector($context);
169
+ $context->register('ErrorCollector', $error_collector);
170
+ }
171
+
172
+ // setup id_accumulator context, necessary due to the fact that
173
+ // AttrValidator can be called from many places
174
+ $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
175
+ $context->register('IDAccumulator', $id_accumulator);
176
+
177
+ $html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context);
178
+
179
+ // setup filters
180
+ $filter_flags = $config->getBatch('Filter');
181
+ $custom_filters = $filter_flags['Custom'];
182
+ unset($filter_flags['Custom']);
183
+ $filters = array();
184
+ foreach ($filter_flags as $filter => $flag) {
185
+ if (!$flag) {
186
+ continue;
187
+ }
188
+ if (strpos($filter, '.') !== false) {
189
+ continue;
190
+ }
191
+ $class = "HTMLPurifier_Filter_$filter";
192
+ $filters[] = new $class;
193
+ }
194
+ foreach ($custom_filters as $filter) {
195
+ // maybe "HTMLPurifier_Filter_$filter", but be consistent with AutoFormat
196
+ $filters[] = $filter;
197
+ }
198
+ $filters = array_merge($filters, $this->filters);
199
+ // maybe prepare(), but later
200
+
201
+ for ($i = 0, $filter_size = count($filters); $i < $filter_size; $i++) {
202
+ $html = $filters[$i]->preFilter($html, $config, $context);
203
+ }
204
+
205
+ // purified HTML
206
+ $html =
207
+ $this->generator->generateFromTokens(
208
+ // list of tokens
209
+ $this->strategy->execute(
210
+ // list of un-purified tokens
211
+ $lexer->tokenizeHTML(
212
+ // un-purified HTML
213
+ $html,
214
+ $config,
215
+ $context
216
+ ),
217
+ $config,
218
+ $context
219
+ )
220
+ );
221
+
222
+ for ($i = $filter_size - 1; $i >= 0; $i--) {
223
+ $html = $filters[$i]->postFilter($html, $config, $context);
224
+ }
225
+
226
+ $html = HTMLPurifier_Encoder::convertFromUTF8($html, $config, $context);
227
+ $this->context =& $context;
228
+ return $html;
229
+ }
230
+
231
+ /**
232
+ * Filters an array of HTML snippets
233
+ *
234
+ * @param string[] $array_of_html Array of html snippets
235
+ * @param HTMLPurifier_Config $config Optional config object for this operation.
236
+ * See HTMLPurifier::purify() for more details.
237
+ *
238
+ * @return string[] Array of purified HTML
239
+ */
240
+ public function purifyArray($array_of_html, $config = null)
241
+ {
242
+ $context_array = array();
243
+ $array = array();
244
+ foreach($array_of_html as $key=>$value){
245
+ if (is_array($value)) {
246
+ $array[$key] = $this->purifyArray($value, $config);
247
+ } else {
248
+ $array[$key] = $this->purify($value, $config);
249
+ }
250
+ $context_array[$key] = $this->context;
251
+ }
252
+ $this->context = $context_array;
253
+ return $array;
254
+ }
255
+
256
+ /**
257
+ * Singleton for enforcing just one HTML Purifier in your system
258
+ *
259
+ * @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
260
+ * HTMLPurifier instance to overload singleton with,
261
+ * or HTMLPurifier_Config instance to configure the
262
+ * generated version with.
263
+ *
264
+ * @return HTMLPurifier
265
+ */
266
+ public static function instance($prototype = null)
267
+ {
268
+ if (!self::$instance || $prototype) {
269
+ if ($prototype instanceof HTMLPurifier) {
270
+ self::$instance = $prototype;
271
+ } elseif ($prototype) {
272
+ self::$instance = new HTMLPurifier($prototype);
273
+ } else {
274
+ self::$instance = new HTMLPurifier();
275
+ }
276
+ }
277
+ return self::$instance;
278
+ }
279
+
280
+ /**
281
+ * Singleton for enforcing just one HTML Purifier in your system
282
+ *
283
+ * @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
284
+ * HTMLPurifier instance to overload singleton with,
285
+ * or HTMLPurifier_Config instance to configure the
286
+ * generated version with.
287
+ *
288
+ * @return HTMLPurifier
289
+ * @note Backwards compatibility, see instance()
290
+ */
291
+ public static function getInstance($prototype = null)
292
+ {
293
+ return HTMLPurifier::instance($prototype);
294
+ }
295
+ }
296
+
297
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier.safe-includes.php ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @file
5
+ * This file was auto-generated by generate-includes.php and includes all of
6
+ * the core files required by HTML Purifier. This is a convenience stub that
7
+ * includes all files using dirname(__FILE__) and require_once. PLEASE DO NOT
8
+ * EDIT THIS FILE, changes will be overwritten the next time the script is run.
9
+ *
10
+ * Changes to include_path are not necessary.
11
+ */
12
+
13
+ $__dir = dirname(__FILE__);
14
+
15
+ require_once $__dir . '/HTMLPurifier.php';
16
+ require_once $__dir . '/HTMLPurifier/Arborize.php';
17
+ require_once $__dir . '/HTMLPurifier/AttrCollections.php';
18
+ require_once $__dir . '/HTMLPurifier/AttrDef.php';
19
+ require_once $__dir . '/HTMLPurifier/AttrTransform.php';
20
+ require_once $__dir . '/HTMLPurifier/AttrTypes.php';
21
+ require_once $__dir . '/HTMLPurifier/AttrValidator.php';
22
+ require_once $__dir . '/HTMLPurifier/Bootstrap.php';
23
+ require_once $__dir . '/HTMLPurifier/Definition.php';
24
+ require_once $__dir . '/HTMLPurifier/CSSDefinition.php';
25
+ require_once $__dir . '/HTMLPurifier/ChildDef.php';
26
+ require_once $__dir . '/HTMLPurifier/Config.php';
27
+ require_once $__dir . '/HTMLPurifier/ConfigSchema.php';
28
+ require_once $__dir . '/HTMLPurifier/ContentSets.php';
29
+ require_once $__dir . '/HTMLPurifier/Context.php';
30
+ require_once $__dir . '/HTMLPurifier/DefinitionCache.php';
31
+ require_once $__dir . '/HTMLPurifier/DefinitionCacheFactory.php';
32
+ require_once $__dir . '/HTMLPurifier/Doctype.php';
33
+ require_once $__dir . '/HTMLPurifier/DoctypeRegistry.php';
34
+ require_once $__dir . '/HTMLPurifier/ElementDef.php';
35
+ require_once $__dir . '/HTMLPurifier/Encoder.php';
36
+ require_once $__dir . '/HTMLPurifier/EntityLookup.php';
37
+ require_once $__dir . '/HTMLPurifier/EntityParser.php';
38
+ require_once $__dir . '/HTMLPurifier/ErrorCollector.php';
39
+ require_once $__dir . '/HTMLPurifier/ErrorStruct.php';
40
+ require_once $__dir . '/HTMLPurifier/Exception.php';
41
+ require_once $__dir . '/HTMLPurifier/Filter.php';
42
+ require_once $__dir . '/HTMLPurifier/Generator.php';
43
+ require_once $__dir . '/HTMLPurifier/HTMLDefinition.php';
44
+ require_once $__dir . '/HTMLPurifier/HTMLModule.php';
45
+ require_once $__dir . '/HTMLPurifier/HTMLModuleManager.php';
46
+ require_once $__dir . '/HTMLPurifier/IDAccumulator.php';
47
+ require_once $__dir . '/HTMLPurifier/Injector.php';
48
+ require_once $__dir . '/HTMLPurifier/Language.php';
49
+ require_once $__dir . '/HTMLPurifier/LanguageFactory.php';
50
+ require_once $__dir . '/HTMLPurifier/Length.php';
51
+ require_once $__dir . '/HTMLPurifier/Lexer.php';
52
+ require_once $__dir . '/HTMLPurifier/Node.php';
53
+ require_once $__dir . '/HTMLPurifier/PercentEncoder.php';
54
+ require_once $__dir . '/HTMLPurifier/PropertyList.php';
55
+ require_once $__dir . '/HTMLPurifier/PropertyListIterator.php';
56
+ require_once $__dir . '/HTMLPurifier/Queue.php';
57
+ require_once $__dir . '/HTMLPurifier/Strategy.php';
58
+ require_once $__dir . '/HTMLPurifier/StringHash.php';
59
+ require_once $__dir . '/HTMLPurifier/StringHashParser.php';
60
+ require_once $__dir . '/HTMLPurifier/TagTransform.php';
61
+ require_once $__dir . '/HTMLPurifier/Token.php';
62
+ require_once $__dir . '/HTMLPurifier/TokenFactory.php';
63
+ require_once $__dir . '/HTMLPurifier/URI.php';
64
+ require_once $__dir . '/HTMLPurifier/URIDefinition.php';
65
+ require_once $__dir . '/HTMLPurifier/URIFilter.php';
66
+ require_once $__dir . '/HTMLPurifier/URIParser.php';
67
+ require_once $__dir . '/HTMLPurifier/URIScheme.php';
68
+ require_once $__dir . '/HTMLPurifier/URISchemeRegistry.php';
69
+ require_once $__dir . '/HTMLPurifier/UnitConverter.php';
70
+ require_once $__dir . '/HTMLPurifier/VarParser.php';
71
+ require_once $__dir . '/HTMLPurifier/VarParserException.php';
72
+ require_once $__dir . '/HTMLPurifier/Zipper.php';
73
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS.php';
74
+ require_once $__dir . '/HTMLPurifier/AttrDef/Clone.php';
75
+ require_once $__dir . '/HTMLPurifier/AttrDef/Enum.php';
76
+ require_once $__dir . '/HTMLPurifier/AttrDef/Integer.php';
77
+ require_once $__dir . '/HTMLPurifier/AttrDef/Lang.php';
78
+ require_once $__dir . '/HTMLPurifier/AttrDef/Switch.php';
79
+ require_once $__dir . '/HTMLPurifier/AttrDef/Text.php';
80
+ require_once $__dir . '/HTMLPurifier/AttrDef/URI.php';
81
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Number.php';
82
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/AlphaValue.php';
83
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Background.php';
84
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
85
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Border.php';
86
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Color.php';
87
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Composite.php';
88
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
89
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Filter.php';
90
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Font.php';
91
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/FontFamily.php';
92
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Ident.php';
93
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
94
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Length.php';
95
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ListStyle.php';
96
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Multiple.php';
97
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Percentage.php';
98
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/TextDecoration.php';
99
+ require_once $__dir . '/HTMLPurifier/AttrDef/CSS/URI.php';
100
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Bool.php';
101
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Nmtokens.php';
102
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Class.php';
103
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Color.php';
104
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/FrameTarget.php';
105
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/ID.php';
106
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Pixels.php';
107
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Length.php';
108
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/LinkTypes.php';
109
+ require_once $__dir . '/HTMLPurifier/AttrDef/HTML/MultiLength.php';
110
+ require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email.php';
111
+ require_once $__dir . '/HTMLPurifier/AttrDef/URI/Host.php';
112
+ require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv4.php';
113
+ require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv6.php';
114
+ require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
115
+ require_once $__dir . '/HTMLPurifier/AttrTransform/Background.php';
116
+ require_once $__dir . '/HTMLPurifier/AttrTransform/BdoDir.php';
117
+ require_once $__dir . '/HTMLPurifier/AttrTransform/BgColor.php';
118
+ require_once $__dir . '/HTMLPurifier/AttrTransform/BoolToCSS.php';
119
+ require_once $__dir . '/HTMLPurifier/AttrTransform/Border.php';
120
+ require_once $__dir . '/HTMLPurifier/AttrTransform/EnumToCSS.php';
121
+ require_once $__dir . '/HTMLPurifier/AttrTransform/ImgRequired.php';
122
+ require_once $__dir . '/HTMLPurifier/AttrTransform/ImgSpace.php';
123
+ require_once $__dir . '/HTMLPurifier/AttrTransform/Input.php';
124
+ require_once $__dir . '/HTMLPurifier/AttrTransform/Lang.php';
125
+ require_once $__dir . '/HTMLPurifier/AttrTransform/Length.php';
126
+ require_once $__dir . '/HTMLPurifier/AttrTransform/Name.php';
127
+ require_once $__dir . '/HTMLPurifier/AttrTransform/NameSync.php';
128
+ require_once $__dir . '/HTMLPurifier/AttrTransform/Nofollow.php';
129
+ require_once $__dir . '/HTMLPurifier/AttrTransform/SafeEmbed.php';
130
+ require_once $__dir . '/HTMLPurifier/AttrTransform/SafeObject.php';
131
+ require_once $__dir . '/HTMLPurifier/AttrTransform/SafeParam.php';
132
+ require_once $__dir . '/HTMLPurifier/AttrTransform/ScriptRequired.php';
133
+ require_once $__dir . '/HTMLPurifier/AttrTransform/TargetBlank.php';
134
+ require_once $__dir . '/HTMLPurifier/AttrTransform/TargetNoopener.php';
135
+ require_once $__dir . '/HTMLPurifier/AttrTransform/TargetNoreferrer.php';
136
+ require_once $__dir . '/HTMLPurifier/AttrTransform/Textarea.php';
137
+ require_once $__dir . '/HTMLPurifier/ChildDef/Chameleon.php';
138
+ require_once $__dir . '/HTMLPurifier/ChildDef/Custom.php';
139
+ require_once $__dir . '/HTMLPurifier/ChildDef/Empty.php';
140
+ require_once $__dir . '/HTMLPurifier/ChildDef/List.php';
141
+ require_once $__dir . '/HTMLPurifier/ChildDef/Required.php';
142
+ require_once $__dir . '/HTMLPurifier/ChildDef/Optional.php';
143
+ require_once $__dir . '/HTMLPurifier/ChildDef/StrictBlockquote.php';
144
+ require_once $__dir . '/HTMLPurifier/ChildDef/Table.php';
145
+ require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator.php';
146
+ require_once $__dir . '/HTMLPurifier/DefinitionCache/Null.php';
147
+ require_once $__dir . '/HTMLPurifier/DefinitionCache/Serializer.php';
148
+ require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
149
+ require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Memory.php';
150
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Bdo.php';
151
+ require_once $__dir . '/HTMLPurifier/HTMLModule/CommonAttributes.php';
152
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Edit.php';
153
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Forms.php';
154
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Hypertext.php';
155
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Iframe.php';
156
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Image.php';
157
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Legacy.php';
158
+ require_once $__dir . '/HTMLPurifier/HTMLModule/List.php';
159
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Name.php';
160
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Nofollow.php';
161
+ require_once $__dir . '/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
162
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Object.php';
163
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Presentation.php';
164
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Proprietary.php';
165
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Ruby.php';
166
+ require_once $__dir . '/HTMLPurifier/HTMLModule/SafeEmbed.php';
167
+ require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php';
168
+ require_once $__dir . '/HTMLPurifier/HTMLModule/SafeScripting.php';
169
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Scripting.php';
170
+ require_once $__dir . '/HTMLPurifier/HTMLModule/StyleAttribute.php';
171
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Tables.php';
172
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Target.php';
173
+ require_once $__dir . '/HTMLPurifier/HTMLModule/TargetBlank.php';
174
+ require_once $__dir . '/HTMLPurifier/HTMLModule/TargetNoopener.php';
175
+ require_once $__dir . '/HTMLPurifier/HTMLModule/TargetNoreferrer.php';
176
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Text.php';
177
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy.php';
178
+ require_once $__dir . '/HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
179
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Name.php';
180
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
181
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
182
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Strict.php';
183
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Transitional.php';
184
+ require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTML.php';
185
+ require_once $__dir . '/HTMLPurifier/Injector/AutoParagraph.php';
186
+ require_once $__dir . '/HTMLPurifier/Injector/DisplayLinkURI.php';
187
+ require_once $__dir . '/HTMLPurifier/Injector/Linkify.php';
188
+ require_once $__dir . '/HTMLPurifier/Injector/PurifierLinkify.php';
189
+ require_once $__dir . '/HTMLPurifier/Injector/RemoveEmpty.php';
190
+ require_once $__dir . '/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
191
+ require_once $__dir . '/HTMLPurifier/Injector/SafeObject.php';
192
+ require_once $__dir . '/HTMLPurifier/Lexer/DOMLex.php';
193
+ require_once $__dir . '/HTMLPurifier/Lexer/DirectLex.php';
194
+ require_once $__dir . '/HTMLPurifier/Node/Comment.php';
195
+ require_once $__dir . '/HTMLPurifier/Node/Element.php';
196
+ require_once $__dir . '/HTMLPurifier/Node/Text.php';
197
+ require_once $__dir . '/HTMLPurifier/Strategy/Composite.php';
198
+ require_once $__dir . '/HTMLPurifier/Strategy/Core.php';
199
+ require_once $__dir . '/HTMLPurifier/Strategy/FixNesting.php';
200
+ require_once $__dir . '/HTMLPurifier/Strategy/MakeWellFormed.php';
201
+ require_once $__dir . '/HTMLPurifier/Strategy/RemoveForeignElements.php';
202
+ require_once $__dir . '/HTMLPurifier/Strategy/ValidateAttributes.php';
203
+ require_once $__dir . '/HTMLPurifier/TagTransform/Font.php';
204
+ require_once $__dir . '/HTMLPurifier/TagTransform/Simple.php';
205
+ require_once $__dir . '/HTMLPurifier/Token/Comment.php';
206
+ require_once $__dir . '/HTMLPurifier/Token/Tag.php';
207
+ require_once $__dir . '/HTMLPurifier/Token/Empty.php';
208
+ require_once $__dir . '/HTMLPurifier/Token/End.php';
209
+ require_once $__dir . '/HTMLPurifier/Token/Start.php';
210
+ require_once $__dir . '/HTMLPurifier/Token/Text.php';
211
+ require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternal.php';
212
+ require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternalResources.php';
213
+ require_once $__dir . '/HTMLPurifier/URIFilter/DisableResources.php';
214
+ require_once $__dir . '/HTMLPurifier/URIFilter/HostBlacklist.php';
215
+ require_once $__dir . '/HTMLPurifier/URIFilter/MakeAbsolute.php';
216
+ require_once $__dir . '/HTMLPurifier/URIFilter/Munge.php';
217
+ require_once $__dir . '/HTMLPurifier/URIFilter/SafeIframe.php';
218
+ require_once $__dir . '/HTMLPurifier/URIScheme/data.php';
219
+ require_once $__dir . '/HTMLPurifier/URIScheme/file.php';
220
+ require_once $__dir . '/HTMLPurifier/URIScheme/ftp.php';
221
+ require_once $__dir . '/HTMLPurifier/URIScheme/http.php';
222
+ require_once $__dir . '/HTMLPurifier/URIScheme/https.php';
223
+ require_once $__dir . '/HTMLPurifier/URIScheme/mailto.php';
224
+ require_once $__dir . '/HTMLPurifier/URIScheme/news.php';
225
+ require_once $__dir . '/HTMLPurifier/URIScheme/nntp.php';
226
+ require_once $__dir . '/HTMLPurifier/URIScheme/tel.php';
227
+ require_once $__dir . '/HTMLPurifier/VarParser/Flexible.php';
228
+ require_once $__dir . '/HTMLPurifier/VarParser/Native.php';
vendor/ezyang/htmlpurifier/library/HTMLPurifier/Arborize.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Converts a stream of HTMLPurifier_Token into an HTMLPurifier_Node,
5
+ * and back again.
6
+ *
7
+ * @note This transformation is not an equivalence. We mutate the input
8
+ * token stream to make it so; see all [MUT] markers in code.
9
+ */
10
+ class HTMLPurifier_Arborize
11
+ {
12
+ public static function arborize($tokens, $config, $context) {
13
+ $definition = $config->getHTMLDefinition();
14
+ $parent = new HTMLPurifier_Token_Start($definition->info_parent);
15
+ $stack = array($parent->toNode());
16
+ foreach ($tokens as $token) {
17
+ $token->skip = null; // [MUT]
18
+ $token->carryover = null; // [MUT]
19
+ if ($token instanceof HTMLPurifier_Token_End) {
20
+ $token->start = null; // [MUT]
21
+ $r = array_pop($stack);
22
+ //assert($r->name === $token->name);
23
+ //assert(empty($token->attr));
24
+ $r->endCol = $token->col;
25
+ $r->endLine = $token->line;
26
+ $r->endArmor = $token->armor;
27
+ continue;
28
+ }
29
+ $node = $token->toNode();
30
+ $stack[count($stack)-1]->children[] = $node;
31
+ if ($token instanceof HTMLPurifier_Token_Start) {
32
+ $stack[] = $node;
33
+ }
34
+ }
35
+ //assert(count($stack) == 1);
36
+ return $stack[0];
37
+ }
38
+
39
+ public static function flatten($node, $config, $context) {
40
+ $level = 0;
41
+ $nodes = array($level => new HTMLPurifier_Queue(array($node)));
42
+ $closingTokens = array();
43
+ $tokens = array();
44
+ do {
45
+ while (!$nodes[$level]->isEmpty()) {
46
+ $node = $nodes[$level]->shift(); // FIFO
47
+ list($start, $end) = $node->toTokenPair();
48
+ if ($level > 0) {
49
+ $tokens[] = $start;
50
+ }
51
+ if ($end !== NULL) {
52
+ $closingTokens[$level][] = $end;
53
+ }
54
+ if ($node instanceof HTMLPurifier_Node_Element) {
55
+ $level++;
56
+ $nodes[$level] = new HTMLPurifier_Queue();
57
+ foreach ($node->children as $childNode) {
58
+ $nodes[$level]->push($childNode);
59
+ }
60
+ }
61
+ }
62
+ $level--;
63
+ if ($level && isset($closingTokens[$level])) {
64
+ while ($token = array_pop($closingTokens[$level])) {
65
+ $tokens[] = $token;
66
+ }
67
+ }
68
+ } while ($level > 0);
69
+ return $tokens;
70
+ }
71
+ }
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrCollections.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Defines common attribute collections that modules reference
5
+ */
6
+
7
+ class HTMLPurifier_AttrCollections
8
+ {
9
+
10
+ /**
11
+ * Associative array of attribute collections, indexed by name.
12
+ * @type array
13
+ */
14
+ public $info = array();
15
+
16
+ /**
17
+ * Performs all expansions on internal data for use by other inclusions
18
+ * It also collects all attribute collection extensions from
19
+ * modules
20
+ * @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
21
+ * @param HTMLPurifier_HTMLModule[] $modules Hash array of HTMLPurifier_HTMLModule members
22
+ */
23
+ public function __construct($attr_types, $modules)
24
+ {
25
+ $this->doConstruct($attr_types, $modules);
26
+ }
27
+
28
+ public function doConstruct($attr_types, $modules)
29
+ {
30
+ // load extensions from the modules
31
+ foreach ($modules as $module) {
32
+ foreach ($module->attr_collections as $coll_i => $coll) {
33
+ if (!isset($this->info[$coll_i])) {
34
+ $this->info[$coll_i] = array();
35
+ }
36
+ foreach ($coll as $attr_i => $attr) {
37
+ if ($attr_i === 0 && isset($this->info[$coll_i][$attr_i])) {
38
+ // merge in includes
39
+ $this->info[$coll_i][$attr_i] = array_merge(
40
+ $this->info[$coll_i][$attr_i],
41
+ $attr
42
+ );
43
+ continue;
44
+ }
45
+ $this->info[$coll_i][$attr_i] = $attr;
46
+ }
47
+ }
48
+ }
49
+ // perform internal expansions and inclusions
50
+ foreach ($this->info as $name => $attr) {
51
+ // merge attribute collections that include others
52
+ $this->performInclusions($this->info[$name]);
53
+ // replace string identifiers with actual attribute objects
54
+ $this->expandIdentifiers($this->info[$name], $attr_types);
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Takes a reference to an attribute associative array and performs
60
+ * all inclusions specified by the zero index.
61
+ * @param array &$attr Reference to attribute array
62
+ */
63
+ public function performInclusions(&$attr)
64
+ {
65
+ if (!isset($attr[0])) {
66
+ return;
67
+ }
68
+ $merge = $attr[0];
69
+ $seen = array(); // recursion guard
70
+ // loop through all the inclusions
71
+ for ($i = 0; isset($merge[$i]); $i++) {
72
+ if (isset($seen[$merge[$i]])) {
73
+ continue;
74
+ }
75
+ $seen[$merge[$i]] = true;
76
+ // foreach attribute of the inclusion, copy it over
77
+ if (!isset($this->info[$merge[$i]])) {
78
+ continue;
79
+ }
80
+ foreach ($this->info[$merge[$i]] as $key => $value) {
81
+ if (isset($attr[$key])) {
82
+ continue;
83
+ } // also catches more inclusions
84
+ $attr[$key] = $value;
85
+ }
86
+ if (isset($this->info[$merge[$i]][0])) {
87
+ // recursion
88
+ $merge = array_merge($merge, $this->info[$merge[$i]][0]);
89
+ }
90
+ }
91
+ unset($attr[0]);
92
+ }
93
+
94
+ /**
95
+ * Expands all string identifiers in an attribute array by replacing
96
+ * them with the appropriate values inside HTMLPurifier_AttrTypes
97
+ * @param array &$attr Reference to attribute array
98
+ * @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
99
+ */
100
+ public function expandIdentifiers(&$attr, $attr_types)
101
+ {
102
+ // because foreach will process new elements we add, make sure we
103
+ // skip duplicates
104
+ $processed = array();
105
+
106
+ foreach ($attr as $def_i => $def) {
107
+ // skip inclusions
108
+ if ($def_i === 0) {
109
+ continue;
110
+ }
111
+
112
+ if (isset($processed[$def_i])) {
113
+ continue;
114
+ }
115
+
116
+ // determine whether or not attribute is required
117
+ if ($required = (strpos($def_i, '*') !== false)) {
118
+ // rename the definition
119
+ unset($attr[$def_i]);
120
+ $def_i = trim($def_i, '*');
121
+ $attr[$def_i] = $def;
122
+ }
123
+
124
+ $processed[$def_i] = true;
125
+
126
+ // if we've already got a literal object, move on
127
+ if (is_object($def)) {
128
+ // preserve previous required
129
+ $attr[$def_i]->required = ($required || $attr[$def_i]->required);
130
+ continue;
131
+ }
132
+
133
+ if ($def === false) {
134
+ unset($attr[$def_i]);
135
+ continue;
136
+ }
137
+
138
+ if ($t = $attr_types->get($def)) {
139
+ $attr[$def_i] = $t;
140
+ $attr[$def_i]->required = $required;
141
+ } else {
142
+ unset($attr[$def_i]);
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Base class for all validating attribute definitions.
5
+ *
6
+ * This family of classes forms the core for not only HTML attribute validation,
7
+ * but also any sort of string that needs to be validated or cleaned (which
8
+ * means CSS properties and composite definitions are defined here too).
9
+ * Besides defining (through code) what precisely makes the string valid,
10
+ * subclasses are also responsible for cleaning the code if possible.
11
+ */
12
+
13
+ abstract class HTMLPurifier_AttrDef
14
+ {
15
+
16
+ /**
17
+ * Tells us whether or not an HTML attribute is minimized.
18
+ * Has no meaning in other contexts.
19
+ * @type bool
20
+ */
21
+ public $minimized = false;
22
+
23
+ /**
24
+ * Tells us whether or not an HTML attribute is required.
25
+ * Has no meaning in other contexts
26
+ * @type bool
27
+ */
28
+ public $required = false;
29
+
30
+ /**
31
+ * Validates and cleans passed string according to a definition.
32
+ *
33
+ * @param string $string String to be validated and cleaned.
34
+ * @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object.
35
+ * @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object.
36
+ */
37
+ abstract public function validate($string, $config, $context);
38
+
39
+ /**
40
+ * Convenience method that parses a string as if it were CDATA.
41
+ *
42
+ * This method process a string in the manner specified at
43
+ * <http://www.w3.org/TR/html4/types.html#h-6.2> by removing
44
+ * leading and trailing whitespace, ignoring line feeds, and replacing
45
+ * carriage returns and tabs with spaces. While most useful for HTML
46
+ * attributes specified as CDATA, it can also be applied to most CSS
47
+ * values.
48
+ *
49
+ * @note This method is not entirely standards compliant, as trim() removes
50
+ * more types of whitespace than specified in the spec. In practice,
51
+ * this is rarely a problem, as those extra characters usually have
52
+ * already been removed by HTMLPurifier_Encoder.
53
+ *
54
+ * @warning This processing is inconsistent with XML's whitespace handling
55
+ * as specified by section 3.3.3 and referenced XHTML 1.0 section
56
+ * 4.7. However, note that we are NOT necessarily
57
+ * parsing XML, thus, this behavior may still be correct. We
58
+ * assume that newlines have been normalized.
59
+ */
60
+ public function parseCDATA($string)
61
+ {
62
+ $string = trim($string);
63
+ $string = str_replace(array("\n", "\t", "\r"), ' ', $string);
64
+ return $string;
65
+ }
66
+
67
+ /**
68
+ * Factory method for creating this class from a string.
69
+ * @param string $string String construction info
70
+ * @return HTMLPurifier_AttrDef Created AttrDef object corresponding to $string
71
+ */
72
+ public function make($string)
73
+ {
74
+ // default implementation, return a flyweight of this object.
75
+ // If $string has an effect on the returned object (i.e. you
76
+ // need to overload this method), it is best
77
+ // to clone or instantiate new copies. (Instantiation is safer.)
78
+ return $this;
79
+ }
80
+
81
+ /**
82
+ * Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work
83
+ * properly. THIS IS A HACK!
84
+ * @param string $string a CSS colour definition
85
+ * @return string
86
+ */
87
+ protected function mungeRgb($string)
88
+ {
89
+ $p = '\s*(\d+(\.\d+)?([%]?))\s*';
90
+
91
+ if (preg_match('/(rgba|hsla)\(/', $string)) {
92
+ return preg_replace('/(rgba|hsla)\('.$p.','.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8,\11)', $string);
93
+ }
94
+
95
+ return preg_replace('/(rgb|hsl)\('.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8)', $string);
96
+ }
97
+
98
+ /**
99
+ * Parses a possibly escaped CSS string and returns the "pure"
100
+ * version of it.
101
+ */
102
+ protected function expandCSSEscape($string)
103
+ {
104
+ // flexibly parse it
105
+ $ret = '';
106
+ for ($i = 0, $c = strlen($string); $i < $c; $i++) {
107
+ if ($string[$i] === '\\') {
108
+ $i++;
109
+ if ($i >= $c) {
110
+ $ret .= '\\';
111
+ break;
112
+ }
113
+ if (ctype_xdigit($string[$i])) {
114
+ $code = $string[$i];
115
+ for ($a = 1, $i++; $i < $c && $a < 6; $i++, $a++) {
116
+ if (!ctype_xdigit($string[$i])) {
117
+ break;
118
+ }
119
+ $code .= $string[$i];
120
+ }
121
+ // We have to be extremely careful when adding
122
+ // new characters, to make sure we're not breaking
123
+ // the encoding.
124
+ $char = HTMLPurifier_Encoder::unichr(hexdec($code));
125
+ if (HTMLPurifier_Encoder::cleanUTF8($char) === '') {
126
+ continue;
127
+ }
128
+ $ret .= $char;
129
+ if ($i < $c && trim($string[$i]) !== '') {
130
+ $i--;
131
+ }
132
+ continue;
133
+ }
134
+ if ($string[$i] === "\n") {
135
+ continue;
136
+ }
137
+ }
138
+ $ret .= $string[$i];
139
+ }
140
+ return $ret;
141
+ }
142
+ }
143
+
144
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates the HTML attribute style, otherwise known as CSS.
5
+ * @note We don't implement the whole CSS specification, so it might be
6
+ * difficult to reuse this component in the context of validating
7
+ * actual stylesheet declarations.
8
+ * @note If we were really serious about validating the CSS, we would
9
+ * tokenize the styles and then parse the tokens. Obviously, we
10
+ * are not doing that. Doing that could seriously harm performance,
11
+ * but would make these components a lot more viable for a CSS
12
+ * filtering solution.
13
+ */
14
+ class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
15
+ {
16
+
17
+ /**
18
+ * @param string $css
19
+ * @param HTMLPurifier_Config $config
20
+ * @param HTMLPurifier_Context $context
21
+ * @return bool|string
22
+ */
23
+ public function validate($css, $config, $context)
24
+ {
25
+ $css = $this->parseCDATA($css);
26
+
27
+ $definition = $config->getCSSDefinition();
28
+ $allow_duplicates = $config->get("CSS.AllowDuplicates");
29
+
30
+
31
+ // According to the CSS2.1 spec, the places where a
32
+ // non-delimiting semicolon can appear are in strings
33
+ // escape sequences. So here is some dumb hack to
34
+ // handle quotes.
35
+ $len = strlen($css);
36
+ $accum = "";
37
+ $declarations = array();
38
+ $quoted = false;
39
+ for ($i = 0; $i < $len; $i++) {
40
+ $c = strcspn($css, ";'\"", $i);
41
+ $accum .= substr($css, $i, $c);
42
+ $i += $c;
43
+ if ($i == $len) break;
44
+ $d = $css[$i];
45
+ if ($quoted) {
46
+ $accum .= $d;
47
+ if ($d == $quoted) {
48
+ $quoted = false;
49
+ }
50
+ } else {
51
+ if ($d == ";") {
52
+ $declarations[] = $accum;
53
+ $accum = "";
54
+ } else {
55
+ $accum .= $d;
56
+ $quoted = $d;
57
+ }
58
+ }
59
+ }
60
+ if ($accum != "") $declarations[] = $accum;
61
+
62
+ $propvalues = array();
63
+ $new_declarations = '';
64
+
65
+ /**
66
+ * Name of the current CSS property being validated.
67
+ */
68
+ $property = false;
69
+ $context->register('CurrentCSSProperty', $property);
70
+
71
+ foreach ($declarations as $declaration) {
72
+ if (!$declaration) {
73
+ continue;
74
+ }
75
+ if (!strpos($declaration, ':')) {
76
+ continue;
77
+ }
78
+ list($property, $value) = explode(':', $declaration, 2);
79
+ $property = trim($property);
80
+ $value = trim($value);
81
+ $ok = false;
82
+ do {
83
+ if (isset($definition->info[$property])) {
84
+ $ok = true;
85
+ break;
86
+ }
87
+ if (ctype_lower($property)) {
88
+ break;
89
+ }
90
+ $property = strtolower($property);
91
+ if (isset($definition->info[$property])) {
92
+ $ok = true;
93
+ break;
94
+ }
95
+ } while (0);
96
+ if (!$ok) {
97
+ continue;
98
+ }
99
+ // inefficient call, since the validator will do this again
100
+ if (strtolower(trim($value)) !== 'inherit') {
101
+ // inherit works for everything (but only on the base property)
102
+ $result = $definition->info[$property]->validate(
103
+ $value,
104
+ $config,
105
+ $context
106
+ );
107
+ } else {
108
+ $result = 'inherit';
109
+ }
110
+ if ($result === false) {
111
+ continue;
112
+ }
113
+ if ($allow_duplicates) {
114
+ $new_declarations .= "$property:$result;";
115
+ } else {
116
+ $propvalues[$property] = $result;
117
+ }
118
+ }
119
+
120
+ $context->destroy('CurrentCSSProperty');
121
+
122
+ // procedure does not write the new CSS simultaneously, so it's
123
+ // slightly inefficient, but it's the only way of getting rid of
124
+ // duplicates. Perhaps config to optimize it, but not now.
125
+
126
+ foreach ($propvalues as $prop => $value) {
127
+ $new_declarations .= "$prop:$value;";
128
+ }
129
+
130
+ return $new_declarations ? $new_declarations : false;
131
+
132
+ }
133
+
134
+ }
135
+
136
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct(false); // opacity is non-negative, but we will clamp it
9
+ }
10
+
11
+ /**
12
+ * @param string $number
13
+ * @param HTMLPurifier_Config $config
14
+ * @param HTMLPurifier_Context $context
15
+ * @return string
16
+ */
17
+ public function validate($number, $config, $context)
18
+ {
19
+ $result = parent::validate($number, $config, $context);
20
+ if ($result === false) {
21
+ return $result;
22
+ }
23
+ $float = (float)$result;
24
+ if ($float < 0.0) {
25
+ $result = '0';
26
+ }
27
+ if ($float > 1.0) {
28
+ $result = '1';
29
+ }
30
+ return $result;
31
+ }
32
+ }
33
+
34
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates shorthand CSS property background.
5
+ * @warning Does not support url tokens that have internal spaces.
6
+ */
7
+ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
8
+ {
9
+
10
+ /**
11
+ * Local copy of component validators.
12
+ * @type HTMLPurifier_AttrDef[]
13
+ * @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
14
+ */
15
+ protected $info;
16
+
17
+ /**
18
+ * @param HTMLPurifier_Config $config
19
+ */
20
+ public function __construct($config)
21
+ {
22
+ $def = $config->getCSSDefinition();
23
+ $this->info['background-color'] = $def->info['background-color'];
24
+ $this->info['background-image'] = $def->info['background-image'];
25
+ $this->info['background-repeat'] = $def->info['background-repeat'];
26
+ $this->info['background-attachment'] = $def->info['background-attachment'];
27
+ $this->info['background-position'] = $def->info['background-position'];
28
+ }
29
+
30
+ /**
31
+ * @param string $string
32
+ * @param HTMLPurifier_Config $config
33
+ * @param HTMLPurifier_Context $context
34
+ * @return bool|string
35
+ */
36
+ public function validate($string, $config, $context)
37
+ {
38
+ // regular pre-processing
39
+ $string = $this->parseCDATA($string);
40
+ if ($string === '') {
41
+ return false;
42
+ }
43
+
44
+ // munge rgb() decl if necessary
45
+ $string = $this->mungeRgb($string);
46
+
47
+ // assumes URI doesn't have spaces in it
48
+ $bits = explode(' ', $string); // bits to process
49
+
50
+ $caught = array();
51
+ $caught['color'] = false;
52
+ $caught['image'] = false;
53
+ $caught['repeat'] = false;
54
+ $caught['attachment'] = false;
55
+ $caught['position'] = false;
56
+
57
+ $i = 0; // number of catches
58
+
59
+ foreach ($bits as $bit) {
60
+ if ($bit === '') {
61
+ continue;
62
+ }
63
+ foreach ($caught as $key => $status) {
64
+ if ($key != 'position') {
65
+ if ($status !== false) {
66
+ continue;
67
+ }
68
+ $r = $this->info['background-' . $key]->validate($bit, $config, $context);
69
+ } else {
70
+ $r = $bit;
71
+ }
72
+ if ($r === false) {
73
+ continue;
74
+ }
75
+ if ($key == 'position') {
76
+ if ($caught[$key] === false) {
77
+ $caught[$key] = '';
78
+ }
79
+ $caught[$key] .= $r . ' ';
80
+ } else {
81
+ $caught[$key] = $r;
82
+ }
83
+ $i++;
84
+ break;
85
+ }
86
+ }
87
+
88
+ if (!$i) {
89
+ return false;
90
+ }
91
+ if ($caught['position'] !== false) {
92
+ $caught['position'] = $this->info['background-position']->
93
+ validate($caught['position'], $config, $context);
94
+ }
95
+
96
+ $ret = array();
97
+ foreach ($caught as $value) {
98
+ if ($value === false) {
99
+ continue;
100
+ }
101
+ $ret[] = $value;
102
+ }
103
+
104
+ if (empty($ret)) {
105
+ return false;
106
+ }
107
+ return implode(' ', $ret);
108
+ }
109
+ }
110
+
111
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* W3C says:
4
+ [ // adjective and number must be in correct order, even if
5
+ // you could switch them without introducing ambiguity.
6
+ // some browsers support that syntax
7
+ [
8
+ <percentage> | <length> | left | center | right
9
+ ]
10
+ [
11
+ <percentage> | <length> | top | center | bottom
12
+ ]?
13
+ ] |
14
+ [ // this signifies that the vertical and horizontal adjectives
15
+ // can be arbitrarily ordered, however, there can only be two,
16
+ // one of each, or none at all
17
+ [
18
+ left | center | right
19
+ ] ||
20
+ [
21
+ top | center | bottom
22
+ ]
23
+ ]
24
+ top, left = 0%
25
+ center, (none) = 50%
26
+ bottom, right = 100%
27
+ */
28
+
29
+ /* QuirksMode says:
30
+ keyword + length/percentage must be ordered correctly, as per W3C
31
+
32
+ Internet Explorer and Opera, however, support arbitrary ordering. We
33
+ should fix it up.
34
+
35
+ Minor issue though, not strictly necessary.
36
+ */
37
+
38
+ // control freaks may appreciate the ability to convert these to
39
+ // percentages or something, but it's not necessary
40
+
41
+ /**
42
+ * Validates the value of background-position.
43
+ */
44
+ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
45
+ {
46
+
47
+ /**
48
+ * @type HTMLPurifier_AttrDef_CSS_Length
49
+ */
50
+ protected $length;
51
+
52
+ /**
53
+ * @type HTMLPurifier_AttrDef_CSS_Percentage
54
+ */
55
+ protected $percentage;
56
+
57
+ public function __construct()
58
+ {
59
+ $this->length = new HTMLPurifier_AttrDef_CSS_Length();
60
+ $this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
61
+ }
62
+
63
+ /**
64
+ * @param string $string
65
+ * @param HTMLPurifier_Config $config
66
+ * @param HTMLPurifier_Context $context
67
+ * @return bool|string
68
+ */
69
+ public function validate($string, $config, $context)
70
+ {
71
+ $string = $this->parseCDATA($string);
72
+ $bits = explode(' ', $string);
73
+
74
+ $keywords = array();
75
+ $keywords['h'] = false; // left, right
76
+ $keywords['v'] = false; // top, bottom
77
+ $keywords['ch'] = false; // center (first word)
78
+ $keywords['cv'] = false; // center (second word)
79
+ $measures = array();
80
+
81
+ $i = 0;
82
+
83
+ $lookup = array(
84
+ 'top' => 'v',
85
+ 'bottom' => 'v',
86
+ 'left' => 'h',
87
+ 'right' => 'h',
88
+ 'center' => 'c'
89
+ );
90
+
91
+ foreach ($bits as $bit) {
92
+ if ($bit === '') {
93
+ continue;
94
+ }
95
+
96
+ // test for keyword
97
+ $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
98
+ if (isset($lookup[$lbit])) {
99
+ $status = $lookup[$lbit];
100
+ if ($status == 'c') {
101
+ if ($i == 0) {
102
+ $status = 'ch';
103
+ } else {
104
+ $status = 'cv';
105
+ }
106
+ }
107
+ $keywords[$status] = $lbit;
108
+ $i++;
109
+ }
110
+
111
+ // test for length
112
+ $r = $this->length->validate($bit, $config, $context);
113
+ if ($r !== false) {
114
+ $measures[] = $r;
115
+ $i++;
116
+ }
117
+
118
+ // test for percentage
119
+ $r = $this->percentage->validate($bit, $config, $context);
120
+ if ($r !== false) {
121
+ $measures[] = $r;
122
+ $i++;
123
+ }
124
+ }
125
+
126
+ if (!$i) {
127
+ return false;
128
+ } // no valid values were caught
129
+
130
+ $ret = array();
131
+
132
+ // first keyword
133
+ if ($keywords['h']) {
134
+ $ret[] = $keywords['h'];
135
+ } elseif ($keywords['ch']) {
136
+ $ret[] = $keywords['ch'];
137
+ $keywords['cv'] = false; // prevent re-use: center = center center
138
+ } elseif (count($measures)) {
139
+ $ret[] = array_shift($measures);
140
+ }
141
+
142
+ if ($keywords['v']) {
143
+ $ret[] = $keywords['v'];
144
+ } elseif ($keywords['cv']) {
145
+ $ret[] = $keywords['cv'];
146
+ } elseif (count($measures)) {
147
+ $ret[] = array_shift($measures);
148
+ }
149
+
150
+ if (empty($ret)) {
151
+ return false;
152
+ }
153
+ return implode(' ', $ret);
154
+ }
155
+ }
156
+
157
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates the border property as defined by CSS.
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * Local copy of properties this property is shorthand for.
11
+ * @type HTMLPurifier_AttrDef[]
12
+ */
13
+ protected $info = array();
14
+
15
+ /**
16
+ * @param HTMLPurifier_Config $config
17
+ */
18
+ public function __construct($config)
19
+ {
20
+ $def = $config->getCSSDefinition();
21
+ $this->info['border-width'] = $def->info['border-width'];
22
+ $this->info['border-style'] = $def->info['border-style'];
23
+ $this->info['border-top-color'] = $def->info['border-top-color'];
24
+ }
25
+
26
+ /**
27
+ * @param string $string
28
+ * @param HTMLPurifier_Config $config
29
+ * @param HTMLPurifier_Context $context
30
+ * @return bool|string
31
+ */
32
+ public function validate($string, $config, $context)
33
+ {
34
+ $string = $this->parseCDATA($string);
35
+ $string = $this->mungeRgb($string);
36
+ $bits = explode(' ', $string);
37
+ $done = array(); // segments we've finished
38
+ $ret = ''; // return value
39
+ foreach ($bits as $bit) {
40
+ foreach ($this->info as $propname => $validator) {
41
+ if (isset($done[$propname])) {
42
+ continue;
43
+ }
44
+ $r = $validator->validate($bit, $config, $context);
45
+ if ($r !== false) {
46
+ $ret .= $r . ' ';
47
+ $done[$propname] = true;
48
+ break;
49
+ }
50
+ }
51
+ }
52
+ return rtrim($ret);
53
+ }
54
+ }
55
+
56
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates Color as defined by CSS.
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * @type HTMLPurifier_AttrDef_CSS_AlphaValue
11
+ */
12
+ protected $alpha;
13
+
14
+ public function __construct()
15
+ {
16
+ $this->alpha = new HTMLPurifier_AttrDef_CSS_AlphaValue();
17
+ }
18
+
19
+ /**
20
+ * @param string $color
21
+ * @param HTMLPurifier_Config $config
22
+ * @param HTMLPurifier_Context $context
23
+ * @return bool|string
24
+ */
25
+ public function validate($color, $config, $context)
26
+ {
27
+ static $colors = null;
28
+ if ($colors === null) {
29
+ $colors = $config->get('Core.ColorKeywords');
30
+ }
31
+
32
+ $color = trim($color);
33
+ if ($color === '') {
34
+ return false;
35
+ }
36
+
37
+ $lower = strtolower($color);
38
+ if (isset($colors[$lower])) {
39
+ return $colors[$lower];
40
+ }
41
+
42
+ if (preg_match('#(rgb|rgba|hsl|hsla)\(#', $color, $matches) === 1) {
43
+ $length = strlen($color);
44
+ if (strpos($color, ')') !== $length - 1) {
45
+ return false;
46
+ }
47
+
48
+ // get used function : rgb, rgba, hsl or hsla
49
+ $function = $matches[1];
50
+
51
+ $parameters_size = 3;
52
+ $alpha_channel = false;
53
+ if (substr($function, -1) === 'a') {
54
+ $parameters_size = 4;
55
+ $alpha_channel = true;
56
+ }
57
+
58
+ /*
59
+ * Allowed types for values :
60
+ * parameter_position => [type => max_value]
61
+ */
62
+ $allowed_types = array(
63
+ 1 => array('percentage' => 100, 'integer' => 255),
64
+ 2 => array('percentage' => 100, 'integer' => 255),
65
+ 3 => array('percentage' => 100, 'integer' => 255),
66
+ );
67
+ $allow_different_types = false;
68
+
69
+ if (strpos($function, 'hsl') !== false) {
70
+ $allowed_types = array(
71
+ 1 => array('integer' => 360),
72
+ 2 => array('percentage' => 100),
73
+ 3 => array('percentage' => 100),
74
+ );
75
+ $allow_different_types = true;
76
+ }
77
+
78
+ $values = trim(str_replace($function, '', $color), ' ()');
79
+
80
+ $parts = explode(',', $values);
81
+ if (count($parts) !== $parameters_size) {
82
+ return false;
83
+ }
84
+
85
+ $type = false;
86
+ $new_parts = array();
87
+ $i = 0;
88
+
89
+ foreach ($parts as $part) {
90
+ $i++;
91
+ $part = trim($part);
92
+
93
+ if ($part === '') {
94
+ return false;
95
+ }
96
+
97
+ // different check for alpha channel
98
+ if ($alpha_channel === true && $i === count($parts)) {
99
+ $result = $this->alpha->validate($part, $config, $context);
100
+
101
+ if ($result === false) {
102
+ return false;
103
+ }
104
+
105
+ $new_parts[] = (string)$result;
106
+ continue;
107
+ }
108
+
109
+ if (substr($part, -1) === '%') {
110
+ $current_type = 'percentage';
111
+ } else {
112
+ $current_type = 'integer';
113
+ }
114
+
115
+ if (!array_key_exists($current_type, $allowed_types[$i])) {
116
+ return false;
117
+ }
118
+
119
+ if (!$type) {
120
+ $type = $current_type;
121
+ }
122
+
123
+ if ($allow_different_types === false && $type != $current_type) {
124
+ return false;
125
+ }
126
+
127
+ $max_value = $allowed_types[$i][$current_type];
128
+
129
+ if ($current_type == 'integer') {
130
+ // Return value between range 0 -> $max_value
131
+ $new_parts[] = (int)max(min($part, $max_value), 0);
132
+ } elseif ($current_type == 'percentage') {
133
+ $new_parts[] = (float)max(min(rtrim($part, '%'), $max_value), 0) . '%';
134
+ }
135
+ }
136
+
137
+ $new_values = implode(',', $new_parts);
138
+
139
+ $color = $function . '(' . $new_values . ')';
140
+ } else {
141
+ // hexadecimal handling
142
+ if ($color[0] === '#') {
143
+ $hex = substr($color, 1);
144
+ } else {
145
+ $hex = $color;
146
+ $color = '#' . $color;
147
+ }
148
+ $length = strlen($hex);
149
+ if ($length !== 3 && $length !== 6) {
150
+ return false;
151
+ }
152
+ if (!ctype_xdigit($hex)) {
153
+ return false;
154
+ }
155
+ }
156
+ return $color;
157
+ }
158
+
159
+ }
160
+
161
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Composite.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Allows multiple validators to attempt to validate attribute.
5
+ *
6
+ * Composite is just what it sounds like: a composite of many validators.
7
+ * This means that multiple HTMLPurifier_AttrDef objects will have a whack
8
+ * at the string. If one of them passes, that's what is returned. This is
9
+ * especially useful for CSS values, which often are a choice between
10
+ * an enumerated set of predefined values or a flexible data type.
11
+ */
12
+ class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
13
+ {
14
+
15
+ /**
16
+ * List of objects that may process strings.
17
+ * @type HTMLPurifier_AttrDef[]
18
+ * @todo Make protected
19
+ */
20
+ public $defs;
21
+
22
+ /**
23
+ * @param HTMLPurifier_AttrDef[] $defs List of HTMLPurifier_AttrDef objects
24
+ */
25
+ public function __construct($defs)
26
+ {
27
+ $this->defs = $defs;
28
+ }
29
+
30
+ /**
31
+ * @param string $string
32
+ * @param HTMLPurifier_Config $config
33
+ * @param HTMLPurifier_Context $context
34
+ * @return bool|string
35
+ */
36
+ public function validate($string, $config, $context)
37
+ {
38
+ foreach ($this->defs as $i => $def) {
39
+ $result = $this->defs[$i]->validate($string, $config, $context);
40
+ if ($result !== false) {
41
+ return $result;
42
+ }
43
+ }
44
+ return false;
45
+ }
46
+ }
47
+
48
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Decorator which enables CSS properties to be disabled for specific elements.
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef
7
+ {
8
+ /**
9
+ * @type HTMLPurifier_AttrDef
10
+ */
11
+ public $def;
12
+ /**
13
+ * @type string
14
+ */
15
+ public $element;
16
+
17
+ /**
18
+ * @param HTMLPurifier_AttrDef $def Definition to wrap
19
+ * @param string $element Element to deny
20
+ */
21
+ public function __construct($def, $element)
22
+ {
23
+ $this->def = $def;
24
+ $this->element = $element;
25
+ }
26
+
27
+ /**
28
+ * Checks if CurrentToken is set and equal to $this->element
29
+ * @param string $string
30
+ * @param HTMLPurifier_Config $config
31
+ * @param HTMLPurifier_Context $context
32
+ * @return bool|string
33
+ */
34
+ public function validate($string, $config, $context)
35
+ {
36
+ $token = $context->get('CurrentToken', true);
37
+ if ($token && $token->name == $this->element) {
38
+ return false;
39
+ }
40
+ return $this->def->validate($string, $config, $context);
41
+ }
42
+ }
43
+
44
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Microsoft's proprietary filter: CSS property
5
+ * @note Currently supports the alpha filter. In the future, this will
6
+ * probably need an extensible framework
7
+ */
8
+ class HTMLPurifier_AttrDef_CSS_Filter extends HTMLPurifier_AttrDef
9
+ {
10
+ /**
11
+ * @type HTMLPurifier_AttrDef_Integer
12
+ */
13
+ protected $intValidator;
14
+
15
+ public function __construct()
16
+ {
17
+ $this->intValidator = new HTMLPurifier_AttrDef_Integer();
18
+ }
19
+
20
+ /**
21
+ * @param string $value
22
+ * @param HTMLPurifier_Config $config
23
+ * @param HTMLPurifier_Context $context
24
+ * @return bool|string
25
+ */
26
+ public function validate($value, $config, $context)
27
+ {
28
+ $value = $this->parseCDATA($value);
29
+ if ($value === 'none') {
30
+ return $value;
31
+ }
32
+ // if we looped this we could support multiple filters
33
+ $function_length = strcspn($value, '(');
34
+ $function = trim(substr($value, 0, $function_length));
35
+ if ($function !== 'alpha' &&
36
+ $function !== 'Alpha' &&
37
+ $function !== 'progid:DXImageTransform.Microsoft.Alpha'
38
+ ) {
39
+ return false;
40
+ }
41
+ $cursor = $function_length + 1;
42
+ $parameters_length = strcspn($value, ')', $cursor);
43
+ $parameters = substr($value, $cursor, $parameters_length);
44
+ $params = explode(',', $parameters);
45
+ $ret_params = array();
46
+ $lookup = array();
47
+ foreach ($params as $param) {
48
+ list($key, $value) = explode('=', $param);
49
+ $key = trim($key);
50
+ $value = trim($value);
51
+ if (isset($lookup[$key])) {
52
+ continue;
53
+ }
54
+ if ($key !== 'opacity') {
55
+ continue;
56
+ }
57
+ $value = $this->intValidator->validate($value, $config, $context);
58
+ if ($value === false) {
59
+ continue;
60
+ }
61
+ $int = (int)$value;
62
+ if ($int > 100) {
63
+ $value = '100';
64
+ }
65
+ if ($int < 0) {
66
+ $value = '0';
67
+ }
68
+ $ret_params[] = "$key=$value";
69
+ $lookup[$key] = true;
70
+ }
71
+ $ret_parameters = implode(',', $ret_params);
72
+ $ret_function = "$function($ret_parameters)";
73
+ return $ret_function;
74
+ }
75
+ }
76
+
77
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Font.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates shorthand CSS property font.
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * Local copy of validators
11
+ * @type HTMLPurifier_AttrDef[]
12
+ * @note If we moved specific CSS property definitions to their own
13
+ * classes instead of having them be assembled at run time by
14
+ * CSSDefinition, this wouldn't be necessary. We'd instantiate
15
+ * our own copies.
16
+ */
17
+ protected $info = array();
18
+
19
+ /**
20
+ * @param HTMLPurifier_Config $config
21
+ */
22
+ public function __construct($config)
23
+ {
24
+ $def = $config->getCSSDefinition();
25
+ $this->info['font-style'] = $def->info['font-style'];
26
+ $this->info['font-variant'] = $def->info['font-variant'];
27
+ $this->info['font-weight'] = $def->info['font-weight'];
28
+ $this->info['font-size'] = $def->info['font-size'];
29
+ $this->info['line-height'] = $def->info['line-height'];
30
+ $this->info['font-family'] = $def->info['font-family'];
31
+ }
32
+
33
+ /**
34
+ * @param string $string
35
+ * @param HTMLPurifier_Config $config
36
+ * @param HTMLPurifier_Context $context
37
+ * @return bool|string
38
+ */
39
+ public function validate($string, $config, $context)
40
+ {
41
+ static $system_fonts = array(
42
+ 'caption' => true,
43
+ 'icon' => true,
44
+ 'menu' => true,
45
+ 'message-box' => true,
46
+ 'small-caption' => true,
47
+ 'status-bar' => true
48
+ );
49
+
50
+ // regular pre-processing
51
+ $string = $this->parseCDATA($string);
52
+ if ($string === '') {
53
+ return false;
54
+ }
55
+
56
+ // check if it's one of the keywords
57
+ $lowercase_string = strtolower($string);
58
+ if (isset($system_fonts[$lowercase_string])) {
59
+ return $lowercase_string;
60
+ }
61
+
62
+ $bits = explode(' ', $string); // bits to process
63
+ $stage = 0; // this indicates what we're looking for
64
+ $caught = array(); // which stage 0 properties have we caught?
65
+ $stage_1 = array('font-style', 'font-variant', 'font-weight');
66
+ $final = ''; // output
67
+
68
+ for ($i = 0, $size = count($bits); $i < $size; $i++) {
69
+ if ($bits[$i] === '') {
70
+ continue;
71
+ }
72
+ switch ($stage) {
73
+ case 0: // attempting to catch font-style, font-variant or font-weight
74
+ foreach ($stage_1 as $validator_name) {
75
+ if (isset($caught[$validator_name])) {
76
+ continue;
77
+ }
78
+ $r = $this->info[$validator_name]->validate(
79
+ $bits[$i],
80
+ $config,
81
+ $context
82
+ );
83
+ if ($r !== false) {
84
+ $final .= $r . ' ';
85
+ $caught[$validator_name] = true;
86
+ break;
87
+ }
88
+ }
89
+ // all three caught, continue on
90
+ if (count($caught) >= 3) {
91
+ $stage = 1;
92
+ }
93
+ if ($r !== false) {
94
+ break;
95
+ }
96
+ case 1: // attempting to catch font-size and perhaps line-height
97
+ $found_slash = false;
98
+ if (strpos($bits[$i], '/') !== false) {
99
+ list($font_size, $line_height) =
100
+ explode('/', $bits[$i]);
101
+ if ($line_height === '') {
102
+ // ooh, there's a space after the slash!
103
+ $line_height = false;
104
+ $found_slash = true;
105
+ }
106
+ } else {
107
+ $font_size = $bits[$i];
108
+ $line_height = false;
109
+ }
110
+ $r = $this->info['font-size']->validate(
111
+ $font_size,
112
+ $config,
113
+ $context
114
+ );
115
+ if ($r !== false) {
116
+ $final .= $r;
117
+ // attempt to catch line-height
118
+ if ($line_height === false) {
119
+ // we need to scroll forward
120
+ for ($j = $i + 1; $j < $size; $j++) {
121
+ if ($bits[$j] === '') {
122
+ continue;
123
+ }
124
+ if ($bits[$j] === '/') {
125
+ if ($found_slash) {
126
+ return false;
127
+ } else {
128
+ $found_slash = true;
129
+ continue;
130
+ }
131
+ }
132
+ $line_height = $bits[$j];
133
+ break;
134
+ }
135
+ } else {
136
+ // slash already found
137
+ $found_slash = true;
138
+ $j = $i;
139
+ }
140
+ if ($found_slash) {
141
+ $i = $j;
142
+ $r = $this->info['line-height']->validate(
143
+ $line_height,
144
+ $config,
145
+ $context
146
+ );
147
+ if ($r !== false) {
148
+ $final .= '/' . $r;
149
+ }
150
+ }
151
+ $final .= ' ';
152
+ $stage = 2;
153
+ break;
154
+ }
155
+ return false;
156
+ case 2: // attempting to catch font-family
157
+ $font_family =
158
+ implode(' ', array_slice($bits, $i, $size - $i));
159
+ $r = $this->info['font-family']->validate(
160
+ $font_family,
161
+ $config,
162
+ $context
163
+ );
164
+ if ($r !== false) {
165
+ $final .= $r . ' ';
166
+ // processing completed successfully
167
+ return rtrim($final);
168
+ }
169
+ return false;
170
+ }
171
+ }
172
+ return false;
173
+ }
174
+ }
175
+
176
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a font family list according to CSS spec
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ protected $mask = null;
10
+
11
+ public function __construct()
12
+ {
13
+ $this->mask = '_- ';
14
+ for ($c = 'a'; $c <= 'z'; $c++) {
15
+ $this->mask .= $c;
16
+ }
17
+ for ($c = 'A'; $c <= 'Z'; $c++) {
18
+ $this->mask .= $c;
19
+ }
20
+ for ($c = '0'; $c <= '9'; $c++) {
21
+ $this->mask .= $c;
22
+ } // cast-y, but should be fine
23
+ // special bytes used by UTF-8
24
+ for ($i = 0x80; $i <= 0xFF; $i++) {
25
+ // We don't bother excluding invalid bytes in this range,
26
+ // because the our restriction of well-formed UTF-8 will
27
+ // prevent these from ever occurring.
28
+ $this->mask .= chr($i);
29
+ }
30
+
31
+ /*
32
+ PHP's internal strcspn implementation is
33
+ O(length of string * length of mask), making it inefficient
34
+ for large masks. However, it's still faster than
35
+ preg_match 8)
36
+ for (p = s1;;) {
37
+ spanp = s2;
38
+ do {
39
+ if (*spanp == c || p == s1_end) {
40
+ return p - s1;
41
+ }
42
+ } while (spanp++ < (s2_end - 1));
43
+ c = *++p;
44
+ }
45
+ */
46
+ // possible optimization: invert the mask.
47
+ }
48
+
49
+ /**
50
+ * @param string $string
51
+ * @param HTMLPurifier_Config $config
52
+ * @param HTMLPurifier_Context $context
53
+ * @return bool|string
54
+ */
55
+ public function validate($string, $config, $context)
56
+ {
57
+ static $generic_names = array(
58
+ 'serif' => true,
59
+ 'sans-serif' => true,
60
+ 'monospace' => true,
61
+ 'fantasy' => true,
62
+ 'cursive' => true
63
+ );
64
+ $allowed_fonts = $config->get('CSS.AllowedFonts');
65
+
66
+ // assume that no font names contain commas in them
67
+ $fonts = explode(',', $string);
68
+ $final = '';
69
+ foreach ($fonts as $font) {
70
+ $font = trim($font);
71
+ if ($font === '') {
72
+ continue;
73
+ }
74
+ // match a generic name
75
+ if (isset($generic_names[$font])) {
76
+ if ($allowed_fonts === null || isset($allowed_fonts[$font])) {
77
+ $final .= $font . ', ';
78
+ }
79
+ continue;
80
+ }
81
+ // match a quoted name
82
+ if ($font[0] === '"' || $font[0] === "'") {
83
+ $length = strlen($font);
84
+ if ($length <= 2) {
85
+ continue;
86
+ }
87
+ $quote = $font[0];
88
+ if ($font[$length - 1] !== $quote) {
89
+ continue;
90
+ }
91
+ $font = substr($font, 1, $length - 2);
92
+ }
93
+
94
+ $font = $this->expandCSSEscape($font);
95
+
96
+ // $font is a pure representation of the font name
97
+
98
+ if ($allowed_fonts !== null && !isset($allowed_fonts[$font])) {
99
+ continue;
100
+ }
101
+
102
+ if (ctype_alnum($font) && $font !== '') {
103
+ // very simple font, allow it in unharmed
104
+ $final .= $font . ', ';
105
+ continue;
106
+ }
107
+
108
+ // bugger out on whitespace. form feed (0C) really
109
+ // shouldn't show up regardless
110
+ $font = str_replace(array("\n", "\t", "\r", "\x0C"), ' ', $font);
111
+
112
+ // Here, there are various classes of characters which need
113
+ // to be treated differently:
114
+ // - Alphanumeric characters are essentially safe. We
115
+ // handled these above.
116
+ // - Spaces require quoting, though most parsers will do
117
+ // the right thing if there aren't any characters that
118
+ // can be misinterpreted
119
+ // - Dashes rarely occur, but they fairly unproblematic
120
+ // for parsing/rendering purposes.
121
+ // The above characters cover the majority of Western font
122
+ // names.
123
+ // - Arbitrary Unicode characters not in ASCII. Because
124
+ // most parsers give little thought to Unicode, treatment
125
+ // of these codepoints is basically uniform, even for
126
+ // punctuation-like codepoints. These characters can
127
+ // show up in non-Western pages and are supported by most
128
+ // major browsers, for example: "MS 明朝" is a
129
+ // legitimate font-name
130
+ // <http://ja.wikipedia.org/wiki/MS_明朝>. See
131
+ // the CSS3 spec for more examples:
132
+ // <http://www.w3.org/TR/2011/WD-css3-fonts-20110324/localizedfamilynames.png>
133
+ // You can see live samples of these on the Internet:
134
+ // <http://www.google.co.jp/search?q=font-family+MS+明朝|ゴシック>
135
+ // However, most of these fonts have ASCII equivalents:
136
+ // for example, 'MS Mincho', and it's considered
137
+ // professional to use ASCII font names instead of
138
+ // Unicode font names. Thanks Takeshi Terada for
139
+ // providing this information.
140
+ // The following characters, to my knowledge, have not been
141
+ // used to name font names.
142
+ // - Single quote. While theoretically you might find a
143
+ // font name that has a single quote in its name (serving
144
+ // as an apostrophe, e.g. Dave's Scribble), I haven't
145
+ // been able to find any actual examples of this.
146
+ // Internet Explorer's cssText translation (which I
147
+ // believe is invoked by innerHTML) normalizes any
148
+ // quoting to single quotes, and fails to escape single
149
+ // quotes. (Note that this is not IE's behavior for all
150
+ // CSS properties, just some sort of special casing for
151
+ // font-family). So a single quote *cannot* be used
152
+ // safely in the font-family context if there will be an
153
+ // innerHTML/cssText translation. Note that Firefox 3.x
154
+ // does this too.
155
+ // - Double quote. In IE, these get normalized to
156
+ // single-quotes, no matter what the encoding. (Fun
157
+ // fact, in IE8, the 'content' CSS property gained
158
+ // support, where they special cased to preserve encoded
159
+ // double quotes, but still translate unadorned double
160
+ // quotes into single quotes.) So, because their
161
+ // fixpoint behavior is identical to single quotes, they
162
+ // cannot be allowed either. Firefox 3.x displays
163
+ // single-quote style behavior.
164
+ // - Backslashes are reduced by one (so \\ -> \) every
165
+ // iteration, so they cannot be used safely. This shows
166
+ // up in IE7, IE8 and FF3
167
+ // - Semicolons, commas and backticks are handled properly.
168
+ // - The rest of the ASCII punctuation is handled properly.
169
+ // We haven't checked what browsers do to unadorned
170
+ // versions, but this is not important as long as the
171
+ // browser doesn't /remove/ surrounding quotes (as IE does
172
+ // for HTML).
173
+ //
174
+ // With these results in hand, we conclude that there are
175
+ // various levels of safety:
176
+ // - Paranoid: alphanumeric, spaces and dashes(?)
177
+ // - International: Paranoid + non-ASCII Unicode
178
+ // - Edgy: Everything except quotes, backslashes
179
+ // - NoJS: Standards compliance, e.g. sod IE. Note that
180
+ // with some judicious character escaping (since certain
181
+ // types of escaping doesn't work) this is theoretically
182
+ // OK as long as innerHTML/cssText is not called.
183
+ // We believe that international is a reasonable default
184
+ // (that we will implement now), and once we do more
185
+ // extensive research, we may feel comfortable with dropping
186
+ // it down to edgy.
187
+
188
+ // Edgy: alphanumeric, spaces, dashes, underscores and Unicode. Use of
189
+ // str(c)spn assumes that the string was already well formed
190
+ // Unicode (which of course it is).
191
+ if (strspn($font, $this->mask) !== strlen($font)) {
192
+ continue;
193
+ }
194
+
195
+ // Historical:
196
+ // In the absence of innerHTML/cssText, these ugly
197
+ // transforms don't pose a security risk (as \\ and \"
198
+ // might--these escapes are not supported by most browsers).
199
+ // We could try to be clever and use single-quote wrapping
200
+ // when there is a double quote present, but I have choosen
201
+ // not to implement that. (NOTE: you can reduce the amount
202
+ // of escapes by one depending on what quoting style you use)
203
+ // $font = str_replace('\\', '\\5C ', $font);
204
+ // $font = str_replace('"', '\\22 ', $font);
205
+ // $font = str_replace("'", '\\27 ', $font);
206
+
207
+ // font possibly with spaces, requires quoting
208
+ $final .= "'$font', ";
209
+ }
210
+ $final = rtrim($final, ', ');
211
+ if ($final === '') {
212
+ return false;
213
+ }
214
+ return $final;
215
+ }
216
+
217
+ }
218
+
219
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Ident.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates based on {ident} CSS grammar production
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_Ident extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * @param string $string
11
+ * @param HTMLPurifier_Config $config
12
+ * @param HTMLPurifier_Context $context
13
+ * @return bool|string
14
+ */
15
+ public function validate($string, $config, $context)
16
+ {
17
+ $string = trim($string);
18
+
19
+ // early abort: '' and '0' (strings that convert to false) are invalid
20
+ if (!$string) {
21
+ return false;
22
+ }
23
+
24
+ $pattern = '/^(-?[A-Za-z_][A-Za-z_\-0-9]*)$/';
25
+ if (!preg_match($pattern, $string)) {
26
+ return false;
27
+ }
28
+ return $string;
29
+ }
30
+ }
31
+
32
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Decorator which enables !important to be used in CSS values.
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_ImportantDecorator extends HTMLPurifier_AttrDef
7
+ {
8
+ /**
9
+ * @type HTMLPurifier_AttrDef
10
+ */
11
+ public $def;
12
+ /**
13
+ * @type bool
14
+ */
15
+ public $allow;
16
+
17
+ /**
18
+ * @param HTMLPurifier_AttrDef $def Definition to wrap
19
+ * @param bool $allow Whether or not to allow !important
20
+ */
21
+ public function __construct($def, $allow = false)
22
+ {
23
+ $this->def = $def;
24
+ $this->allow = $allow;
25
+ }
26
+
27
+ /**
28
+ * Intercepts and removes !important if necessary
29
+ * @param string $string
30
+ * @param HTMLPurifier_Config $config
31
+ * @param HTMLPurifier_Context $context
32
+ * @return bool|string
33
+ */
34
+ public function validate($string, $config, $context)
35
+ {
36
+ // test for ! and important tokens
37
+ $string = trim($string);
38
+ $is_important = false;
39
+ // :TODO: optimization: test directly for !important and ! important
40
+ if (strlen($string) >= 9 && substr($string, -9) === 'important') {
41
+ $temp = rtrim(substr($string, 0, -9));
42
+ // use a temp, because we might want to restore important
43
+ if (strlen($temp) >= 1 && substr($temp, -1) === '!') {
44
+ $string = rtrim(substr($temp, 0, -1));
45
+ $is_important = true;
46
+ }
47
+ }
48
+ $string = $this->def->validate($string, $config, $context);
49
+ if ($this->allow && $is_important) {
50
+ $string .= ' !important';
51
+ }
52
+ return $string;
53
+ }
54
+ }
55
+
56
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Length.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Represents a Length as defined by CSS.
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * @type HTMLPurifier_Length|string
11
+ */
12
+ protected $min;
13
+
14
+ /**
15
+ * @type HTMLPurifier_Length|string
16
+ */
17
+ protected $max;
18
+
19
+ /**
20
+ * @param HTMLPurifier_Length|string $min Minimum length, or null for no bound. String is also acceptable.
21
+ * @param HTMLPurifier_Length|string $max Maximum length, or null for no bound. String is also acceptable.
22
+ */
23
+ public function __construct($min = null, $max = null)
24
+ {
25
+ $this->min = $min !== null ? HTMLPurifier_Length::make($min) : null;
26
+ $this->max = $max !== null ? HTMLPurifier_Length::make($max) : null;
27
+ }
28
+
29
+ /**
30
+ * @param string $string
31
+ * @param HTMLPurifier_Config $config
32
+ * @param HTMLPurifier_Context $context
33
+ * @return bool|string
34
+ */
35
+ public function validate($string, $config, $context)
36
+ {
37
+ $string = $this->parseCDATA($string);
38
+
39
+ // Optimizations
40
+ if ($string === '') {
41
+ return false;
42
+ }
43
+ if ($string === '0') {
44
+ return '0';
45
+ }
46
+ if (strlen($string) === 1) {
47
+ return false;
48
+ }
49
+
50
+ $length = HTMLPurifier_Length::make($string);
51
+ if (!$length->isValid()) {
52
+ return false;
53
+ }
54
+
55
+ if ($this->min) {
56
+ $c = $length->compareTo($this->min);
57
+ if ($c === false) {
58
+ return false;
59
+ }
60
+ if ($c < 0) {
61
+ return false;
62
+ }
63
+ }
64
+ if ($this->max) {
65
+ $c = $length->compareTo($this->max);
66
+ if ($c === false) {
67
+ return false;
68
+ }
69
+ if ($c > 0) {
70
+ return false;
71
+ }
72
+ }
73
+ return $length->toString();
74
+ }
75
+ }
76
+
77
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ListStyle.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates shorthand CSS property list-style.
5
+ * @warning Does not support url tokens that have internal spaces.
6
+ */
7
+ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
8
+ {
9
+
10
+ /**
11
+ * Local copy of validators.
12
+ * @type HTMLPurifier_AttrDef[]
13
+ * @note See HTMLPurifier_AttrDef_CSS_Font::$info for a similar impl.
14
+ */
15
+ protected $info;
16
+
17
+ /**
18
+ * @param HTMLPurifier_Config $config
19
+ */
20
+ public function __construct($config)
21
+ {
22
+ $def = $config->getCSSDefinition();
23
+ $this->info['list-style-type'] = $def->info['list-style-type'];
24
+ $this->info['list-style-position'] = $def->info['list-style-position'];
25
+ $this->info['list-style-image'] = $def->info['list-style-image'];
26
+ }
27
+
28
+ /**
29
+ * @param string $string
30
+ * @param HTMLPurifier_Config $config
31
+ * @param HTMLPurifier_Context $context
32
+ * @return bool|string
33
+ */
34
+ public function validate($string, $config, $context)
35
+ {
36
+ // regular pre-processing
37
+ $string = $this->parseCDATA($string);
38
+ if ($string === '') {
39
+ return false;
40
+ }
41
+
42
+ // assumes URI doesn't have spaces in it
43
+ $bits = explode(' ', strtolower($string)); // bits to process
44
+
45
+ $caught = array();
46
+ $caught['type'] = false;
47
+ $caught['position'] = false;
48
+ $caught['image'] = false;
49
+
50
+ $i = 0; // number of catches
51
+ $none = false;
52
+
53
+ foreach ($bits as $bit) {
54
+ if ($i >= 3) {
55
+ return;
56
+ } // optimization bit
57
+ if ($bit === '') {
58
+ continue;
59
+ }
60
+ foreach ($caught as $key => $status) {
61
+ if ($status !== false) {
62
+ continue;
63
+ }
64
+ $r = $this->info['list-style-' . $key]->validate($bit, $config, $context);
65
+ if ($r === false) {
66
+ continue;
67
+ }
68
+ if ($r === 'none') {
69
+ if ($none) {
70
+ continue;
71
+ } else {
72
+ $none = true;
73
+ }
74
+ if ($key == 'image') {
75
+ continue;
76
+ }
77
+ }
78
+ $caught[$key] = $r;
79
+ $i++;
80
+ break;
81
+ }
82
+ }
83
+
84
+ if (!$i) {
85
+ return false;
86
+ }
87
+
88
+ $ret = array();
89
+
90
+ // construct type
91
+ if ($caught['type']) {
92
+ $ret[] = $caught['type'];
93
+ }
94
+
95
+ // construct image
96
+ if ($caught['image']) {
97
+ $ret[] = $caught['image'];
98
+ }
99
+
100
+ // construct position
101
+ if ($caught['position']) {
102
+ $ret[] = $caught['position'];
103
+ }
104
+
105
+ if (empty($ret)) {
106
+ return false;
107
+ }
108
+ return implode(' ', $ret);
109
+ }
110
+ }
111
+
112
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Multiple.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Framework class for strings that involve multiple values.
5
+ *
6
+ * Certain CSS properties such as border-width and margin allow multiple
7
+ * lengths to be specified. This class can take a vanilla border-width
8
+ * definition and multiply it, usually into a max of four.
9
+ *
10
+ * @note Even though the CSS specification isn't clear about it, inherit
11
+ * can only be used alone: it will never manifest as part of a multi
12
+ * shorthand declaration. Thus, this class does not allow inherit.
13
+ */
14
+ class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
15
+ {
16
+ /**
17
+ * Instance of component definition to defer validation to.
18
+ * @type HTMLPurifier_AttrDef
19
+ * @todo Make protected
20
+ */
21
+ public $single;
22
+
23
+ /**
24
+ * Max number of values allowed.
25
+ * @todo Make protected
26
+ */
27
+ public $max;
28
+
29
+ /**
30
+ * @param HTMLPurifier_AttrDef $single HTMLPurifier_AttrDef to multiply
31
+ * @param int $max Max number of values allowed (usually four)
32
+ */
33
+ public function __construct($single, $max = 4)
34
+ {
35
+ $this->single = $single;
36
+ $this->max = $max;
37
+ }
38
+
39
+ /**
40
+ * @param string $string
41
+ * @param HTMLPurifier_Config $config
42
+ * @param HTMLPurifier_Context $context
43
+ * @return bool|string
44
+ */
45
+ public function validate($string, $config, $context)
46
+ {
47
+ $string = $this->mungeRgb($this->parseCDATA($string));
48
+ if ($string === '') {
49
+ return false;
50
+ }
51
+ $parts = explode(' ', $string); // parseCDATA replaced \r, \t and \n
52
+ $length = count($parts);
53
+ $final = '';
54
+ for ($i = 0, $num = 0; $i < $length && $num < $this->max; $i++) {
55
+ if (ctype_space($parts[$i])) {
56
+ continue;
57
+ }
58
+ $result = $this->single->validate($parts[$i], $config, $context);
59
+ if ($result !== false) {
60
+ $final .= $result . ' ';
61
+ $num++;
62
+ }
63
+ }
64
+ if ($final === '') {
65
+ return false;
66
+ }
67
+ return rtrim($final);
68
+ }
69
+ }
70
+
71
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Number.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a number as defined by the CSS spec.
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * Indicates whether or not only positive values are allowed.
11
+ * @type bool
12
+ */
13
+ protected $non_negative = false;
14
+
15
+ /**
16
+ * @param bool $non_negative indicates whether negatives are forbidden
17
+ */
18
+ public function __construct($non_negative = false)
19
+ {
20
+ $this->non_negative = $non_negative;
21
+ }
22
+
23
+ /**
24
+ * @param string $number
25
+ * @param HTMLPurifier_Config $config
26
+ * @param HTMLPurifier_Context $context
27
+ * @return string|bool
28
+ * @warning Some contexts do not pass $config, $context. These
29
+ * variables should not be used without checking HTMLPurifier_Length
30
+ */
31
+ public function validate($number, $config, $context)
32
+ {
33
+ $number = $this->parseCDATA($number);
34
+
35
+ if ($number === '') {
36
+ return false;
37
+ }
38
+ if ($number === '0') {
39
+ return '0';
40
+ }
41
+
42
+ $sign = '';
43
+ switch ($number[0]) {
44
+ case '-':
45
+ if ($this->non_negative) {
46
+ return false;
47
+ }
48
+ $sign = '-';
49
+ case '+':
50
+ $number = substr($number, 1);
51
+ }
52
+
53
+ if (ctype_digit($number)) {
54
+ $number = ltrim($number, '0');
55
+ return $number ? $sign . $number : '0';
56
+ }
57
+
58
+ // Period is the only non-numeric character allowed
59
+ if (strpos($number, '.') === false) {
60
+ return false;
61
+ }
62
+
63
+ list($left, $right) = explode('.', $number, 2);
64
+
65
+ if ($left === '' && $right === '') {
66
+ return false;
67
+ }
68
+ if ($left !== '' && !ctype_digit($left)) {
69
+ return false;
70
+ }
71
+
72
+ // Remove leading zeros until positive number or a zero stays left
73
+ if (ltrim($left, '0') != '') {
74
+ $left = ltrim($left, '0');
75
+ } else {
76
+ $left = '0';
77
+ }
78
+
79
+ $right = rtrim($right, '0');
80
+
81
+ if ($right === '') {
82
+ return $left ? $sign . $left : '0';
83
+ } elseif (!ctype_digit($right)) {
84
+ return false;
85
+ }
86
+ return $sign . $left . '.' . $right;
87
+ }
88
+ }
89
+
90
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Percentage.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a Percentage as defined by the CSS spec.
5
+ */
6
+ class HTMLPurifier_AttrDef_CSS_Percentage extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * Instance to defer number validation to.
11
+ * @type HTMLPurifier_AttrDef_CSS_Number
12
+ */
13
+ protected $number_def;
14
+
15
+ /**
16
+ * @param bool $non_negative Whether to forbid negative values
17
+ */
18
+ public function __construct($non_negative = false)
19
+ {
20
+ $this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative);
21
+ }
22
+
23
+ /**
24
+ * @param string $string
25
+ * @param HTMLPurifier_Config $config
26
+ * @param HTMLPurifier_Context $context
27
+ * @return bool|string
28
+ */
29
+ public function validate($string, $config, $context)
30
+ {
31
+ $string = $this->parseCDATA($string);
32
+
33
+ if ($string === '') {
34
+ return false;
35
+ }
36
+ $length = strlen($string);
37
+ if ($length === 1) {
38
+ return false;
39
+ }
40
+ if ($string[$length - 1] !== '%') {
41
+ return false;
42
+ }
43
+
44
+ $number = substr($string, 0, $length - 1);
45
+ $number = $this->number_def->validate($number, $config, $context);
46
+
47
+ if ($number === false) {
48
+ return false;
49
+ }
50
+ return "$number%";
51
+ }
52
+ }
53
+
54
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates the value for the CSS property text-decoration
5
+ * @note This class could be generalized into a version that acts sort of
6
+ * like Enum except you can compound the allowed values.
7
+ */
8
+ class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
9
+ {
10
+
11
+ /**
12
+ * @param string $string
13
+ * @param HTMLPurifier_Config $config
14
+ * @param HTMLPurifier_Context $context
15
+ * @return bool|string
16
+ */
17
+ public function validate($string, $config, $context)
18
+ {
19
+ static $allowed_values = array(
20
+ 'line-through' => true,
21
+ 'overline' => true,
22
+ 'underline' => true,
23
+ );
24
+
25
+ $string = strtolower($this->parseCDATA($string));
26
+
27
+ if ($string === 'none') {
28
+ return $string;
29
+ }
30
+
31
+ $parts = explode(' ', $string);
32
+ $final = '';
33
+ foreach ($parts as $part) {
34
+ if (isset($allowed_values[$part])) {
35
+ $final .= $part . ' ';
36
+ }
37
+ }
38
+ $final = rtrim($final);
39
+ if ($final === '') {
40
+ return false;
41
+ }
42
+ return $final;
43
+ }
44
+ }
45
+
46
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/URI.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a URI in CSS syntax, which uses url('http://example.com')
5
+ * @note While theoretically speaking a URI in a CSS document could
6
+ * be non-embedded, as of CSS2 there is no such usage so we're
7
+ * generalizing it. This may need to be changed in the future.
8
+ * @warning Since HTMLPurifier_AttrDef_CSS blindly uses semicolons as
9
+ * the separator, you cannot put a literal semicolon in
10
+ * in the URI. Try percent encoding it, in that case.
11
+ */
12
+ class HTMLPurifier_AttrDef_CSS_URI extends HTMLPurifier_AttrDef_URI
13
+ {
14
+
15
+ public function __construct()
16
+ {
17
+ parent::__construct(true); // always embedded
18
+ }
19
+
20
+ /**
21
+ * @param string $uri_string
22
+ * @param HTMLPurifier_Config $config
23
+ * @param HTMLPurifier_Context $context
24
+ * @return bool|string
25
+ */
26
+ public function validate($uri_string, $config, $context)
27
+ {
28
+ // parse the URI out of the string and then pass it onto
29
+ // the parent object
30
+
31
+ $uri_string = $this->parseCDATA($uri_string);
32
+ if (strpos($uri_string, 'url(') !== 0) {
33
+ return false;
34
+ }
35
+ $uri_string = substr($uri_string, 4);
36
+ if (strlen($uri_string) == 0) {
37
+ return false;
38
+ }
39
+ $new_length = strlen($uri_string) - 1;
40
+ if ($uri_string[$new_length] != ')') {
41
+ return false;
42
+ }
43
+ $uri = trim(substr($uri_string, 0, $new_length));
44
+
45
+ if (!empty($uri) && ($uri[0] == "'" || $uri[0] == '"')) {
46
+ $quote = $uri[0];
47
+ $new_length = strlen($uri) - 1;
48
+ if ($uri[$new_length] !== $quote) {
49
+ return false;
50
+ }
51
+ $uri = substr($uri, 1, $new_length - 1);
52
+ }
53
+
54
+ $uri = $this->expandCSSEscape($uri);
55
+
56
+ $result = parent::validate($uri, $config, $context);
57
+
58
+ if ($result === false) {
59
+ return false;
60
+ }
61
+
62
+ // extra sanity check; should have been done by URI
63
+ $result = str_replace(array('"', "\\", "\n", "\x0c", "\r"), "", $result);
64
+
65
+ // suspicious characters are ()'; we're going to percent encode
66
+ // them for safety.
67
+ $result = str_replace(array('(', ')', "'"), array('%28', '%29', '%27'), $result);
68
+
69
+ // there's an extra bug where ampersands lose their escaping on
70
+ // an innerHTML cycle, so a very unlucky query parameter could
71
+ // then change the meaning of the URL. Unfortunately, there's
72
+ // not much we can do about that...
73
+ return "url(\"$result\")";
74
+ }
75
+ }
76
+
77
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Clone.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dummy AttrDef that mimics another AttrDef, BUT it generates clones
5
+ * with make.
6
+ */
7
+ class HTMLPurifier_AttrDef_Clone extends HTMLPurifier_AttrDef
8
+ {
9
+ /**
10
+ * What we're cloning.
11
+ * @type HTMLPurifier_AttrDef
12
+ */
13
+ protected $clone;
14
+
15
+ /**
16
+ * @param HTMLPurifier_AttrDef $clone
17
+ */
18
+ public function __construct($clone)
19
+ {
20
+ $this->clone = $clone;
21
+ }
22
+
23
+ /**
24
+ * @param string $v
25
+ * @param HTMLPurifier_Config $config
26
+ * @param HTMLPurifier_Context $context
27
+ * @return bool|string
28
+ */
29
+ public function validate($v, $config, $context)
30
+ {
31
+ return $this->clone->validate($v, $config, $context);
32
+ }
33
+
34
+ /**
35
+ * @param string $string
36
+ * @return HTMLPurifier_AttrDef
37
+ */
38
+ public function make($string)
39
+ {
40
+ return clone $this->clone;
41
+ }
42
+ }
43
+
44
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Enum.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Enum = Enumerated
4
+ /**
5
+ * Validates a keyword against a list of valid values.
6
+ * @warning The case-insensitive compare of this function uses PHP's
7
+ * built-in strtolower and ctype_lower functions, which may
8
+ * cause problems with international comparisons
9
+ */
10
+ class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
11
+ {
12
+
13
+ /**
14
+ * Lookup table of valid values.
15
+ * @type array
16
+ * @todo Make protected
17
+ */
18
+ public $valid_values = array();
19
+
20
+ /**
21
+ * Bool indicating whether or not enumeration is case sensitive.
22
+ * @note In general this is always case insensitive.
23
+ */
24
+ protected $case_sensitive = false; // values according to W3C spec
25
+
26
+ /**
27
+ * @param array $valid_values List of valid values
28
+ * @param bool $case_sensitive Whether or not case sensitive
29
+ */
30
+ public function __construct($valid_values = array(), $case_sensitive = false)
31
+ {
32
+ $this->valid_values = array_flip($valid_values);
33
+ $this->case_sensitive = $case_sensitive;
34
+ }
35
+
36
+ /**
37
+ * @param string $string
38
+ * @param HTMLPurifier_Config $config
39
+ * @param HTMLPurifier_Context $context
40
+ * @return bool|string
41
+ */
42
+ public function validate($string, $config, $context)
43
+ {
44
+ $string = trim($string);
45
+ if (!$this->case_sensitive) {
46
+ // we may want to do full case-insensitive libraries
47
+ $string = ctype_lower($string) ? $string : strtolower($string);
48
+ }
49
+ $result = isset($this->valid_values[$string]);
50
+
51
+ return $result ? $string : false;
52
+ }
53
+
54
+ /**
55
+ * @param string $string In form of comma-delimited list of case-insensitive
56
+ * valid values. Example: "foo,bar,baz". Prepend "s:" to make
57
+ * case sensitive
58
+ * @return HTMLPurifier_AttrDef_Enum
59
+ */
60
+ public function make($string)
61
+ {
62
+ if (strlen($string) > 2 && $string[0] == 's' && $string[1] == ':') {
63
+ $string = substr($string, 2);
64
+ $sensitive = true;
65
+ } else {
66
+ $sensitive = false;
67
+ }
68
+ $values = explode(',', $string);
69
+ return new HTMLPurifier_AttrDef_Enum($values, $sensitive);
70
+ }
71
+ }
72
+
73
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a boolean attribute
5
+ */
6
+ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * @type string
11
+ */
12
+ protected $name;
13
+
14
+ /**
15
+ * @type bool
16
+ */
17
+ public $minimized = true;
18
+
19
+ /**
20
+ * @param bool|string $name
21
+ */
22
+ public function __construct($name = false)
23
+ {
24
+ $this->name = $name;
25
+ }
26
+
27
+ /**
28
+ * @param string $string
29
+ * @param HTMLPurifier_Config $config
30
+ * @param HTMLPurifier_Context $context
31
+ * @return bool|string
32
+ */
33
+ public function validate($string, $config, $context)
34
+ {
35
+ return $this->name;
36
+ }
37
+
38
+ /**
39
+ * @param string $string Name of attribute
40
+ * @return HTMLPurifier_AttrDef_HTML_Bool
41
+ */
42
+ public function make($string)
43
+ {
44
+ return new HTMLPurifier_AttrDef_HTML_Bool($string);
45
+ }
46
+ }
47
+
48
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Class.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Implements special behavior for class attribute (normally NMTOKENS)
5
+ */
6
+ class HTMLPurifier_AttrDef_HTML_Class extends HTMLPurifier_AttrDef_HTML_Nmtokens
7
+ {
8
+ /**
9
+ * @param string $string
10
+ * @param HTMLPurifier_Config $config
11
+ * @param HTMLPurifier_Context $context
12
+ * @return bool|string
13
+ */
14
+ protected function split($string, $config, $context)
15
+ {
16
+ // really, this twiddle should be lazy loaded
17
+ $name = $config->getDefinition('HTML')->doctype->name;
18
+ if ($name == "XHTML 1.1" || $name == "XHTML 2.0") {
19
+ return parent::split($string, $config, $context);
20
+ } else {
21
+ return preg_split('/\s+/', $string);
22
+ }
23
+ }
24
+
25
+ /**
26
+ * @param array $tokens
27
+ * @param HTMLPurifier_Config $config
28
+ * @param HTMLPurifier_Context $context
29
+ * @return array
30
+ */
31
+ protected function filter($tokens, $config, $context)
32
+ {
33
+ $allowed = $config->get('Attr.AllowedClasses');
34
+ $forbidden = $config->get('Attr.ForbiddenClasses');
35
+ $ret = array();
36
+ foreach ($tokens as $token) {
37
+ if (($allowed === null || isset($allowed[$token])) &&
38
+ !isset($forbidden[$token]) &&
39
+ // We need this O(n) check because of PHP's array
40
+ // implementation that casts -0 to 0.
41
+ !in_array($token, $ret, true)
42
+ ) {
43
+ $ret[] = $token;
44
+ }
45
+ }
46
+ return $ret;
47
+ }
48
+ }
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Color.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a color according to the HTML spec.
5
+ */
6
+ class HTMLPurifier_AttrDef_HTML_Color extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * @param string $string
11
+ * @param HTMLPurifier_Config $config
12
+ * @param HTMLPurifier_Context $context
13
+ * @return bool|string
14
+ */
15
+ public function validate($string, $config, $context)
16
+ {
17
+ static $colors = null;
18
+ if ($colors === null) {
19
+ $colors = $config->get('Core.ColorKeywords');
20
+ }
21
+
22
+ $string = trim($string);
23
+
24
+ if (empty($string)) {
25
+ return false;
26
+ }
27
+ $lower = strtolower($string);
28
+ if (isset($colors[$lower])) {
29
+ return $colors[$lower];
30
+ }
31
+ if ($string[0] === '#') {
32
+ $hex = substr($string, 1);
33
+ } else {
34
+ $hex = $string;
35
+ }
36
+
37
+ $length = strlen($hex);
38
+ if ($length !== 3 && $length !== 6) {
39
+ return false;
40
+ }
41
+ if (!ctype_xdigit($hex)) {
42
+ return false;
43
+ }
44
+ if ($length === 3) {
45
+ $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
46
+ }
47
+ return "#$hex";
48
+ }
49
+ }
50
+
51
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Special-case enum attribute definition that lazy loads allowed frame targets
5
+ */
6
+ class HTMLPurifier_AttrDef_HTML_FrameTarget extends HTMLPurifier_AttrDef_Enum
7
+ {
8
+
9
+ /**
10
+ * @type array
11
+ */
12
+ public $valid_values = false; // uninitialized value
13
+
14
+ /**
15
+ * @type bool
16
+ */
17
+ protected $case_sensitive = false;
18
+
19
+ public function __construct()
20
+ {
21
+ }
22
+
23
+ /**
24
+ * @param string $string
25
+ * @param HTMLPurifier_Config $config
26
+ * @param HTMLPurifier_Context $context
27
+ * @return bool|string
28
+ */
29
+ public function validate($string, $config, $context)
30
+ {
31
+ if ($this->valid_values === false) {
32
+ $this->valid_values = $config->get('Attr.AllowedFrameTargets');
33
+ }
34
+ return parent::validate($string, $config, $context);
35
+ }
36
+ }
37
+
38
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/ID.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates the HTML attribute ID.
5
+ * @warning Even though this is the id processor, it
6
+ * will ignore the directive Attr:IDBlacklist, since it will only
7
+ * go according to the ID accumulator. Since the accumulator is
8
+ * automatically generated, it will have already absorbed the
9
+ * blacklist. If you're hacking around, make sure you use load()!
10
+ */
11
+
12
+ class HTMLPurifier_AttrDef_HTML_ID extends HTMLPurifier_AttrDef
13
+ {
14
+
15
+ // selector is NOT a valid thing to use for IDREFs, because IDREFs
16
+ // *must* target IDs that exist, whereas selector #ids do not.
17
+
18
+ /**
19
+ * Determines whether or not we're validating an ID in a CSS
20
+ * selector context.
21
+ * @type bool
22
+ */
23
+ protected $selector;
24
+
25
+ /**
26
+ * @param bool $selector
27
+ */
28
+ public function __construct($selector = false)
29
+ {
30
+ $this->selector = $selector;
31
+ }
32
+
33
+ /**
34
+ * @param string $id
35
+ * @param HTMLPurifier_Config $config
36
+ * @param HTMLPurifier_Context $context
37
+ * @return bool|string
38
+ */
39
+ public function validate($id, $config, $context)
40
+ {
41
+ if (!$this->selector && !$config->get('Attr.EnableID')) {
42
+ return false;
43
+ }
44
+
45
+ $id = trim($id); // trim it first
46
+
47
+ if ($id === '') {
48
+ return false;
49
+ }
50
+
51
+ $prefix = $config->get('Attr.IDPrefix');
52
+ if ($prefix !== '') {
53
+ $prefix .= $config->get('Attr.IDPrefixLocal');
54
+ // prevent re-appending the prefix
55
+ if (strpos($id, $prefix) !== 0) {
56
+ $id = $prefix . $id;
57
+ }
58
+ } elseif ($config->get('Attr.IDPrefixLocal') !== '') {
59
+ trigger_error(
60
+ '%Attr.IDPrefixLocal cannot be used unless ' .
61
+ '%Attr.IDPrefix is set',
62
+ E_USER_WARNING
63
+ );
64
+ }
65
+
66
+ if (!$this->selector) {
67
+ $id_accumulator =& $context->get('IDAccumulator');
68
+ if (isset($id_accumulator->ids[$id])) {
69
+ return false;
70
+ }
71
+ }
72
+
73
+ // we purposely avoid using regex, hopefully this is faster
74
+
75
+ if ($config->get('Attr.ID.HTML5') === true) {
76
+ if (preg_match('/[\t\n\x0b\x0c ]/', $id)) {
77
+ return false;
78
+ }
79
+ } else {
80
+ if (ctype_alpha($id)) {
81
+ // OK
82
+ } else {
83
+ if (!ctype_alpha(@$id[0])) {
84
+ return false;
85
+ }
86
+ // primitive style of regexps, I suppose
87
+ $trim = trim(
88
+ $id,
89
+ 'A..Za..z0..9:-._'
90
+ );
91
+ if ($trim !== '') {
92
+ return false;
93
+ }
94
+ }
95
+ }
96
+
97
+ $regexp = $config->get('Attr.IDBlacklistRegexp');
98
+ if ($regexp && preg_match($regexp, $id)) {
99
+ return false;
100
+ }
101
+
102
+ if (!$this->selector) {
103
+ $id_accumulator->add($id);
104
+ }
105
+
106
+ // if no change was made to the ID, return the result
107
+ // else, return the new id if stripping whitespace made it
108
+ // valid, or return false.
109
+ return $id;
110
+ }
111
+ }
112
+
113
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Length.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates the HTML type length (not to be confused with CSS's length).
5
+ *
6
+ * This accepts integer pixels or percentages as lengths for certain
7
+ * HTML attributes.
8
+ */
9
+
10
+ class HTMLPurifier_AttrDef_HTML_Length extends HTMLPurifier_AttrDef_HTML_Pixels
11
+ {
12
+
13
+ /**
14
+ * @param string $string
15
+ * @param HTMLPurifier_Config $config
16
+ * @param HTMLPurifier_Context $context
17
+ * @return bool|string
18
+ */
19
+ public function validate($string, $config, $context)
20
+ {
21
+ $string = trim($string);
22
+ if ($string === '') {
23
+ return false;
24
+ }
25
+
26
+ $parent_result = parent::validate($string, $config, $context);
27
+ if ($parent_result !== false) {
28
+ return $parent_result;
29
+ }
30
+
31
+ $length = strlen($string);
32
+ $last_char = $string[$length - 1];
33
+
34
+ if ($last_char !== '%') {
35
+ return false;
36
+ }
37
+
38
+ $points = substr($string, 0, $length - 1);
39
+
40
+ if (!is_numeric($points)) {
41
+ return false;
42
+ }
43
+
44
+ $points = (int)$points;
45
+
46
+ if ($points < 0) {
47
+ return '0%';
48
+ }
49
+ if ($points > 100) {
50
+ return '100%';
51
+ }
52
+ return ((string)$points) . '%';
53
+ }
54
+ }
55
+
56
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a rel/rev link attribute against a directive of allowed values
5
+ * @note We cannot use Enum because link types allow multiple
6
+ * values.
7
+ * @note Assumes link types are ASCII text
8
+ */
9
+ class HTMLPurifier_AttrDef_HTML_LinkTypes extends HTMLPurifier_AttrDef
10
+ {
11
+
12
+ /**
13
+ * Name config attribute to pull.
14
+ * @type string
15
+ */
16
+ protected $name;
17
+
18
+ /**
19
+ * @param string $name
20
+ */
21
+ public function __construct($name)
22
+ {
23
+ $configLookup = array(
24
+ 'rel' => 'AllowedRel',
25
+ 'rev' => 'AllowedRev'
26
+ );
27
+ if (!isset($configLookup[$name])) {
28
+ trigger_error(
29
+ 'Unrecognized attribute name for link ' .
30
+ 'relationship.',
31
+ E_USER_ERROR
32
+ );
33
+ return;
34
+ }
35
+ $this->name = $configLookup[$name];
36
+ }
37
+
38
+ /**
39
+ * @param string $string
40
+ * @param HTMLPurifier_Config $config
41
+ * @param HTMLPurifier_Context $context
42
+ * @return bool|string
43
+ */
44
+ public function validate($string, $config, $context)
45
+ {
46
+ $allowed = $config->get('Attr.' . $this->name);
47
+ if (empty($allowed)) {
48
+ return false;
49
+ }
50
+
51
+ $string = $this->parseCDATA($string);
52
+ $parts = explode(' ', $string);
53
+
54
+ // lookup to prevent duplicates
55
+ $ret_lookup = array();
56
+ foreach ($parts as $part) {
57
+ $part = strtolower(trim($part));
58
+ if (!isset($allowed[$part])) {
59
+ continue;
60
+ }
61
+ $ret_lookup[$part] = true;
62
+ }
63
+
64
+ if (empty($ret_lookup)) {
65
+ return false;
66
+ }
67
+ $string = implode(' ', array_keys($ret_lookup));
68
+ return $string;
69
+ }
70
+ }
71
+
72
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/MultiLength.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a MultiLength as defined by the HTML spec.
5
+ *
6
+ * A multilength is either a integer (pixel count), a percentage, or
7
+ * a relative number.
8
+ */
9
+ class HTMLPurifier_AttrDef_HTML_MultiLength extends HTMLPurifier_AttrDef_HTML_Length
10
+ {
11
+
12
+ /**
13
+ * @param string $string
14
+ * @param HTMLPurifier_Config $config
15
+ * @param HTMLPurifier_Context $context
16
+ * @return bool|string
17
+ */
18
+ public function validate($string, $config, $context)
19
+ {
20
+ $string = trim($string);
21
+ if ($string === '') {
22
+ return false;
23
+ }
24
+
25
+ $parent_result = parent::validate($string, $config, $context);
26
+ if ($parent_result !== false) {
27
+ return $parent_result;
28
+ }
29
+
30
+ $length = strlen($string);
31
+ $last_char = $string[$length - 1];
32
+
33
+ if ($last_char !== '*') {
34
+ return false;
35
+ }
36
+
37
+ $int = substr($string, 0, $length - 1);
38
+
39
+ if ($int == '') {
40
+ return '*';
41
+ }
42
+ if (!is_numeric($int)) {
43
+ return false;
44
+ }
45
+
46
+ $int = (int)$int;
47
+ if ($int < 0) {
48
+ return false;
49
+ }
50
+ if ($int == 0) {
51
+ return '0';
52
+ }
53
+ if ($int == 1) {
54
+ return '*';
55
+ }
56
+ return ((string)$int) . '*';
57
+ }
58
+ }
59
+
60
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates contents based on NMTOKENS attribute type.
5
+ */
6
+ class HTMLPurifier_AttrDef_HTML_Nmtokens extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * @param string $string
11
+ * @param HTMLPurifier_Config $config
12
+ * @param HTMLPurifier_Context $context
13
+ * @return bool|string
14
+ */
15
+ public function validate($string, $config, $context)
16
+ {
17
+ $string = trim($string);
18
+
19
+ // early abort: '' and '0' (strings that convert to false) are invalid
20
+ if (!$string) {
21
+ return false;
22
+ }
23
+
24
+ $tokens = $this->split($string, $config, $context);
25
+ $tokens = $this->filter($tokens, $config, $context);
26
+ if (empty($tokens)) {
27
+ return false;
28
+ }
29
+ return implode(' ', $tokens);
30
+ }
31
+
32
+ /**
33
+ * Splits a space separated list of tokens into its constituent parts.
34
+ * @param string $string
35
+ * @param HTMLPurifier_Config $config
36
+ * @param HTMLPurifier_Context $context
37
+ * @return array
38
+ */
39
+ protected function split($string, $config, $context)
40
+ {
41
+ // OPTIMIZABLE!
42
+ // do the preg_match, capture all subpatterns for reformulation
43
+
44
+ // we don't support U+00A1 and up codepoints or
45
+ // escaping because I don't know how to do that with regexps
46
+ // and plus it would complicate optimization efforts (you never
47
+ // see that anyway).
48
+ $pattern = '/(?:(?<=\s)|\A)' . // look behind for space or string start
49
+ '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)' .
50
+ '(?:(?=\s)|\z)/'; // look ahead for space or string end
51
+ preg_match_all($pattern, $string, $matches);
52
+ return $matches[1];
53
+ }
54
+
55
+ /**
56
+ * Template method for removing certain tokens based on arbitrary criteria.
57
+ * @note If we wanted to be really functional, we'd do an array_filter
58
+ * with a callback. But... we're not.
59
+ * @param array $tokens
60
+ * @param HTMLPurifier_Config $config
61
+ * @param HTMLPurifier_Context $context
62
+ * @return array
63
+ */
64
+ protected function filter($tokens, $config, $context)
65
+ {
66
+ return $tokens;
67
+ }
68
+ }
69
+
70
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Pixels.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates an integer representation of pixels according to the HTML spec.
5
+ */
6
+ class HTMLPurifier_AttrDef_HTML_Pixels extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * @type int
11
+ */
12
+ protected $max;
13
+
14
+ /**
15
+ * @param int $max
16
+ */
17
+ public function __construct($max = null)
18
+ {
19
+ $this->max = $max;
20
+ }
21
+
22
+ /**
23
+ * @param string $string
24
+ * @param HTMLPurifier_Config $config
25
+ * @param HTMLPurifier_Context $context
26
+ * @return bool|string
27
+ */
28
+ public function validate($string, $config, $context)
29
+ {
30
+ $string = trim($string);
31
+ if ($string === '0') {
32
+ return $string;
33
+ }
34
+ if ($string === '') {
35
+ return false;
36
+ }
37
+ $length = strlen($string);
38
+ if (substr($string, $length - 2) == 'px') {
39
+ $string = substr($string, 0, $length - 2);
40
+ }
41
+ if (!is_numeric($string)) {
42
+ return false;
43
+ }
44
+ $int = (int)$string;
45
+
46
+ if ($int < 0) {
47
+ return '0';
48
+ }
49
+
50
+ // upper-bound value, extremely high values can
51
+ // crash operating systems, see <http://ha.ckers.org/imagecrash.html>
52
+ // WARNING, above link WILL crash you if you're using Windows
53
+
54
+ if ($this->max !== null && $int > $this->max) {
55
+ return (string)$this->max;
56
+ }
57
+ return (string)$int;
58
+ }
59
+
60
+ /**
61
+ * @param string $string
62
+ * @return HTMLPurifier_AttrDef
63
+ */
64
+ public function make($string)
65
+ {
66
+ if ($string === '') {
67
+ $max = null;
68
+ } else {
69
+ $max = (int)$string;
70
+ }
71
+ $class = get_class($this);
72
+ return new $class($max);
73
+ }
74
+ }
75
+
76
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Integer.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates an integer.
5
+ * @note While this class was modeled off the CSS definition, no currently
6
+ * allowed CSS uses this type. The properties that do are: widows,
7
+ * orphans, z-index, counter-increment, counter-reset. Some of the
8
+ * HTML attributes, however, find use for a non-negative version of this.
9
+ */
10
+ class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
11
+ {
12
+
13
+ /**
14
+ * Whether or not negative values are allowed.
15
+ * @type bool
16
+ */
17
+ protected $negative = true;
18
+
19
+ /**
20
+ * Whether or not zero is allowed.
21
+ * @type bool
22
+ */
23
+ protected $zero = true;
24
+
25
+ /**
26
+ * Whether or not positive values are allowed.
27
+ * @type bool
28
+ */
29
+ protected $positive = true;
30
+
31
+ /**
32
+ * @param $negative Bool indicating whether or not negative values are allowed
33
+ * @param $zero Bool indicating whether or not zero is allowed
34
+ * @param $positive Bool indicating whether or not positive values are allowed
35
+ */
36
+ public function __construct($negative = true, $zero = true, $positive = true)
37
+ {
38
+ $this->negative = $negative;
39
+ $this->zero = $zero;
40
+ $this->positive = $positive;
41
+ }
42
+
43
+ /**
44
+ * @param string $integer
45
+ * @param HTMLPurifier_Config $config
46
+ * @param HTMLPurifier_Context $context
47
+ * @return bool|string
48
+ */
49
+ public function validate($integer, $config, $context)
50
+ {
51
+ $integer = $this->parseCDATA($integer);
52
+ if ($integer === '') {
53
+ return false;
54
+ }
55
+
56
+ // we could possibly simply typecast it to integer, but there are
57
+ // certain fringe cases that must not return an integer.
58
+
59
+ // clip leading sign
60
+ if ($this->negative && $integer[0] === '-') {
61
+ $digits = substr($integer, 1);
62
+ if ($digits === '0') {
63
+ $integer = '0';
64
+ } // rm minus sign for zero
65
+ } elseif ($this->positive && $integer[0] === '+') {
66
+ $digits = $integer = substr($integer, 1); // rm unnecessary plus
67
+ } else {
68
+ $digits = $integer;
69
+ }
70
+
71
+ // test if it's numeric
72
+ if (!ctype_digit($digits)) {
73
+ return false;
74
+ }
75
+
76
+ // perform scope tests
77
+ if (!$this->zero && $integer == 0) {
78
+ return false;
79
+ }
80
+ if (!$this->positive && $integer > 0) {
81
+ return false;
82
+ }
83
+ if (!$this->negative && $integer < 0) {
84
+ return false;
85
+ }
86
+
87
+ return $integer;
88
+ }
89
+ }
90
+
91
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Lang.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates the HTML attribute lang, effectively a language code.
5
+ * @note Built according to RFC 3066, which obsoleted RFC 1766
6
+ */
7
+ class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
8
+ {
9
+
10
+ /**
11
+ * @param string $string
12
+ * @param HTMLPurifier_Config $config
13
+ * @param HTMLPurifier_Context $context
14
+ * @return bool|string
15
+ */
16
+ public function validate($string, $config, $context)
17
+ {
18
+ $string = trim($string);
19
+ if (!$string) {
20
+ return false;
21
+ }
22
+
23
+ $subtags = explode('-', $string);
24
+ $num_subtags = count($subtags);
25
+
26
+ if ($num_subtags == 0) { // sanity check
27
+ return false;
28
+ }
29
+
30
+ // process primary subtag : $subtags[0]
31
+ $length = strlen($subtags[0]);
32
+ switch ($length) {
33
+ case 0:
34
+ return false;
35
+ case 1:
36
+ if (!($subtags[0] == 'x' || $subtags[0] == 'i')) {
37
+ return false;
38
+ }
39
+ break;
40
+ case 2:
41
+ case 3:
42
+ if (!ctype_alpha($subtags[0])) {
43
+ return false;
44
+ } elseif (!ctype_lower($subtags[0])) {
45
+ $subtags[0] = strtolower($subtags[0]);
46
+ }
47
+ break;
48
+ default:
49
+ return false;
50
+ }
51
+
52
+ $new_string = $subtags[0];
53
+ if ($num_subtags == 1) {
54
+ return $new_string;
55
+ }
56
+
57
+ // process second subtag : $subtags[1]
58
+ $length = strlen($subtags[1]);
59
+ if ($length == 0 || ($length == 1 && $subtags[1] != 'x') || $length > 8 || !ctype_alnum($subtags[1])) {
60
+ return $new_string;
61
+ }
62
+ if (!ctype_lower($subtags[1])) {
63
+ $subtags[1] = strtolower($subtags[1]);
64
+ }
65
+
66
+ $new_string .= '-' . $subtags[1];
67
+ if ($num_subtags == 2) {
68
+ return $new_string;
69
+ }
70
+
71
+ // process all other subtags, index 2 and up
72
+ for ($i = 2; $i < $num_subtags; $i++) {
73
+ $length = strlen($subtags[$i]);
74
+ if ($length == 0 || $length > 8 || !ctype_alnum($subtags[$i])) {
75
+ return $new_string;
76
+ }
77
+ if (!ctype_lower($subtags[$i])) {
78
+ $subtags[$i] = strtolower($subtags[$i]);
79
+ }
80
+ $new_string .= '-' . $subtags[$i];
81
+ }
82
+ return $new_string;
83
+ }
84
+ }
85
+
86
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Switch.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Decorator that, depending on a token, switches between two definitions.
5
+ */
6
+ class HTMLPurifier_AttrDef_Switch
7
+ {
8
+
9
+ /**
10
+ * @type string
11
+ */
12
+ protected $tag;
13
+
14
+ /**
15
+ * @type HTMLPurifier_AttrDef
16
+ */
17
+ protected $withTag;
18
+
19
+ /**
20
+ * @type HTMLPurifier_AttrDef
21
+ */
22
+ protected $withoutTag;
23
+
24
+ /**
25
+ * @param string $tag Tag name to switch upon
26
+ * @param HTMLPurifier_AttrDef $with_tag Call if token matches tag
27
+ * @param HTMLPurifier_AttrDef $without_tag Call if token doesn't match, or there is no token
28
+ */
29
+ public function __construct($tag, $with_tag, $without_tag)
30
+ {
31
+ $this->tag = $tag;
32
+ $this->withTag = $with_tag;
33
+ $this->withoutTag = $without_tag;
34
+ }
35
+
36
+ /**
37
+ * @param string $string
38
+ * @param HTMLPurifier_Config $config
39
+ * @param HTMLPurifier_Context $context
40
+ * @return bool|string
41
+ */
42
+ public function validate($string, $config, $context)
43
+ {
44
+ $token = $context->get('CurrentToken', true);
45
+ if (!$token || $token->name !== $this->tag) {
46
+ return $this->withoutTag->validate($string, $config, $context);
47
+ } else {
48
+ return $this->withTag->validate($string, $config, $context);
49
+ }
50
+ }
51
+ }
52
+
53
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/Text.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates arbitrary text according to the HTML spec.
5
+ */
6
+ class HTMLPurifier_AttrDef_Text extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * @param string $string
11
+ * @param HTMLPurifier_Config $config
12
+ * @param HTMLPurifier_Context $context
13
+ * @return bool|string
14
+ */
15
+ public function validate($string, $config, $context)
16
+ {
17
+ return $this->parseCDATA($string);
18
+ }
19
+ }
20
+
21
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a URI as defined by RFC 3986.
5
+ * @note Scheme-specific mechanics deferred to HTMLPurifier_URIScheme
6
+ */
7
+ class HTMLPurifier_AttrDef_URI extends HTMLPurifier_AttrDef
8
+ {
9
+
10
+ /**
11
+ * @type HTMLPurifier_URIParser
12
+ */
13
+ protected $parser;
14
+
15
+ /**
16
+ * @type bool
17
+ */
18
+ protected $embedsResource;
19
+
20
+ /**
21
+ * @param bool $embeds_resource Does the URI here result in an extra HTTP request?
22
+ */
23
+ public function __construct($embeds_resource = false)
24
+ {
25
+ $this->parser = new HTMLPurifier_URIParser();
26
+ $this->embedsResource = (bool)$embeds_resource;
27
+ }
28
+
29
+ /**
30
+ * @param string $string
31
+ * @return HTMLPurifier_AttrDef_URI
32
+ */
33
+ public function make($string)
34
+ {
35
+ $embeds = ($string === 'embedded');
36
+ return new HTMLPurifier_AttrDef_URI($embeds);
37
+ }
38
+
39
+ /**
40
+ * @param string $uri
41
+ * @param HTMLPurifier_Config $config
42
+ * @param HTMLPurifier_Context $context
43
+ * @return bool|string
44
+ */
45
+ public function validate($uri, $config, $context)
46
+ {
47
+ if ($config->get('URI.Disable')) {
48
+ return false;
49
+ }
50
+
51
+ $uri = $this->parseCDATA($uri);
52
+
53
+ // parse the URI
54
+ $uri = $this->parser->parse($uri);
55
+ if ($uri === false) {
56
+ return false;
57
+ }
58
+
59
+ // add embedded flag to context for validators
60
+ $context->register('EmbeddedURI', $this->embedsResource);
61
+
62
+ $ok = false;
63
+ do {
64
+
65
+ // generic validation
66
+ $result = $uri->validate($config, $context);
67
+ if (!$result) {
68
+ break;
69
+ }
70
+
71
+ // chained filtering
72
+ $uri_def = $config->getDefinition('URI');
73
+ $result = $uri_def->filter($uri, $config, $context);
74
+ if (!$result) {
75
+ break;
76
+ }
77
+
78
+ // scheme-specific validation
79
+ $scheme_obj = $uri->getSchemeObj($config, $context);
80
+ if (!$scheme_obj) {
81
+ break;
82
+ }
83
+ if ($this->embedsResource && !$scheme_obj->browsable) {
84
+ break;
85
+ }
86
+ $result = $scheme_obj->validate($uri, $config, $context);
87
+ if (!$result) {
88
+ break;
89
+ }
90
+
91
+ // Post chained filtering
92
+ $result = $uri_def->postFilter($uri, $config, $context);
93
+ if (!$result) {
94
+ break;
95
+ }
96
+
97
+ // survived gauntlet
98
+ $ok = true;
99
+
100
+ } while (false);
101
+
102
+ $context->destroy('EmbeddedURI');
103
+ if (!$ok) {
104
+ return false;
105
+ }
106
+ // back to string
107
+ return $uri->toString();
108
+ }
109
+ }
110
+
111
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class HTMLPurifier_AttrDef_URI_Email extends HTMLPurifier_AttrDef
4
+ {
5
+
6
+ /**
7
+ * Unpacks a mailbox into its display-name and address
8
+ * @param string $string
9
+ * @return mixed
10
+ */
11
+ public function unpack($string)
12
+ {
13
+ // needs to be implemented
14
+ }
15
+
16
+ }
17
+
18
+ // sub-implementations
19
+
20
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Primitive email validation class based on the regexp found at
5
+ * http://www.regular-expressions.info/email.html
6
+ */
7
+ class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_URI_Email
8
+ {
9
+
10
+ /**
11
+ * @param string $string
12
+ * @param HTMLPurifier_Config $config
13
+ * @param HTMLPurifier_Context $context
14
+ * @return bool|string
15
+ */
16
+ public function validate($string, $config, $context)
17
+ {
18
+ // no support for named mailboxes i.e. "Bob <bob@example.com>"
19
+ // that needs more percent encoding to be done
20
+ if ($string == '') {
21
+ return false;
22
+ }
23
+ $string = trim($string);
24
+ $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string);
25
+ return $result ? $string : false;
26
+ }
27
+ }
28
+
29
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates a host according to the IPv4, IPv6 and DNS (future) specifications.
5
+ */
6
+ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
7
+ {
8
+
9
+ /**
10
+ * IPv4 sub-validator.
11
+ * @type HTMLPurifier_AttrDef_URI_IPv4
12
+ */
13
+ protected $ipv4;
14
+
15
+ /**
16
+ * IPv6 sub-validator.
17
+ * @type HTMLPurifier_AttrDef_URI_IPv6
18
+ */
19
+ protected $ipv6;
20
+
21
+ public function __construct()
22
+ {
23
+ $this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();
24
+ $this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();
25
+ }
26
+
27
+ /**
28
+ * @param string $string
29
+ * @param HTMLPurifier_Config $config
30
+ * @param HTMLPurifier_Context $context
31
+ * @return bool|string
32
+ */
33
+ public function validate($string, $config, $context)
34
+ {
35
+ $length = strlen($string);
36
+ // empty hostname is OK; it's usually semantically equivalent:
37
+ // the default host as defined by a URI scheme is used:
38
+ //
39
+ // If the URI scheme defines a default for host, then that
40
+ // default applies when the host subcomponent is undefined
41
+ // or when the registered name is empty (zero length).
42
+ if ($string === '') {
43
+ return '';
44
+ }
45
+ if ($length > 1 && $string[0] === '[' && $string[$length - 1] === ']') {
46
+ //IPv6
47
+ $ip = substr($string, 1, $length - 2);
48
+ $valid = $this->ipv6->validate($ip, $config, $context);
49
+ if ($valid === false) {
50
+ return false;
51
+ }
52
+ return '[' . $valid . ']';
53
+ }
54
+
55
+ // need to do checks on unusual encodings too
56
+ $ipv4 = $this->ipv4->validate($string, $config, $context);
57
+ if ($ipv4 !== false) {
58
+ return $ipv4;
59
+ }
60
+
61
+ // A regular domain name.
62
+
63
+ // This doesn't match I18N domain names, but we don't have proper IRI support,
64
+ // so force users to insert Punycode.
65
+
66
+ // There is not a good sense in which underscores should be
67
+ // allowed, since it's technically not! (And if you go as
68
+ // far to allow everything as specified by the DNS spec...
69
+ // well, that's literally everything, modulo some space limits
70
+ // for the components and the overall name (which, by the way,
71
+ // we are NOT checking!). So we (arbitrarily) decide this:
72
+ // let's allow underscores wherever we would have allowed
73
+ // hyphens, if they are enabled. This is a pretty good match
74
+ // for browser behavior, for example, a large number of browsers
75
+ // cannot handle foo_.example.com, but foo_bar.example.com is
76
+ // fairly well supported.
77
+ $underscore = $config->get('Core.AllowHostnameUnderscore') ? '_' : '';
78
+
79
+ // Based off of RFC 1738, but amended so that
80
+ // as per RFC 3696, the top label need only not be all numeric.
81
+ // The productions describing this are:
82
+ $a = '[a-z]'; // alpha
83
+ $an = '[a-z0-9]'; // alphanum
84
+ $and = "[a-z0-9-$underscore]"; // alphanum | "-"
85
+ // domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
86
+ $domainlabel = "$an(?:$and*$an)?";
87
+ // AMENDED as per RFC 3696
88
+ // toplabel = alphanum | alphanum *( alphanum | "-" ) alphanum
89
+ // side condition: not all numeric
90
+ $toplabel = "$an(?:$and*$an)?";
91
+ // hostname = *( domainlabel "." ) toplabel [ "." ]
92
+ if (preg_match("/^(?:$domainlabel\.)*($toplabel)\.?$/i", $string, $matches)) {
93
+ if (!ctype_digit($matches[1])) {
94
+ return $string;
95
+ }
96
+ }
97
+
98
+ // PHP 5.3 and later support this functionality natively
99
+ if (function_exists('idn_to_ascii')) {
100
+ if (defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46')) {
101
+ $string = idn_to_ascii($string, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
102
+ } else {
103
+ $string = idn_to_ascii($string);
104
+ }
105
+
106
+ // If we have Net_IDNA2 support, we can support IRIs by
107
+ // punycoding them. (This is the most portable thing to do,
108
+ // since otherwise we have to assume browsers support
109
+ } elseif ($config->get('Core.EnableIDNA')) {
110
+ $idna = new Net_IDNA2(array('encoding' => 'utf8', 'overlong' => false, 'strict' => true));
111
+ // we need to encode each period separately
112
+ $parts = explode('.', $string);
113
+ try {
114
+ $new_parts = array();
115
+ foreach ($parts as $part) {
116
+ $encodable = false;
117
+ for ($i = 0, $c = strlen($part); $i < $c; $i++) {
118
+ if (ord($part[$i]) > 0x7a) {
119
+ $encodable = true;
120
+ break;
121
+ }
122
+ }
123
+ if (!$encodable) {
124
+ $new_parts[] = $part;
125
+ } else {
126
+ $new_parts[] = $idna->encode($part);
127
+ }
128
+ }
129
+ $string = implode('.', $new_parts);
130
+ } catch (Exception $e) {
131
+ // XXX error reporting
132
+ }
133
+ }
134
+ // Try again
135
+ if (preg_match("/^($domainlabel\.)*$toplabel\.?$/i", $string)) {
136
+ return $string;
137
+ }
138
+ return false;
139
+ }
140
+ }
141
+
142
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv4.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates an IPv4 address
5
+ * @author Feyd @ forums.devnetwork.net (public domain)
6
+ */
7
+ class HTMLPurifier_AttrDef_URI_IPv4 extends HTMLPurifier_AttrDef
8
+ {
9
+
10
+ /**
11
+ * IPv4 regex, protected so that IPv6 can reuse it.
12
+ * @type string
13
+ */
14
+ protected $ip4;
15
+
16
+ /**
17
+ * @param string $aIP
18
+ * @param HTMLPurifier_Config $config
19
+ * @param HTMLPurifier_Context $context
20
+ * @return bool|string
21
+ */
22
+ public function validate($aIP, $config, $context)
23
+ {
24
+ if (!$this->ip4) {
25
+ $this->_loadRegex();
26
+ }
27
+
28
+ if (preg_match('#^' . $this->ip4 . '$#s', $aIP)) {
29
+ return $aIP;
30
+ }
31
+ return false;
32
+ }
33
+
34
+ /**
35
+ * Lazy load function to prevent regex from being stuffed in
36
+ * cache.
37
+ */
38
+ protected function _loadRegex()
39
+ {
40
+ $oct = '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])'; // 0-255
41
+ $this->ip4 = "(?:{$oct}\\.{$oct}\\.{$oct}\\.{$oct})";
42
+ }
43
+ }
44
+
45
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv6.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates an IPv6 address.
5
+ * @author Feyd @ forums.devnetwork.net (public domain)
6
+ * @note This function requires brackets to have been removed from address
7
+ * in URI.
8
+ */
9
+ class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
10
+ {
11
+
12
+ /**
13
+ * @param string $aIP
14
+ * @param HTMLPurifier_Config $config
15
+ * @param HTMLPurifier_Context $context
16
+ * @return bool|string
17
+ */
18
+ public function validate($aIP, $config, $context)
19
+ {
20
+ if (!$this->ip4) {
21
+ $this->_loadRegex();
22
+ }
23
+
24
+ $original = $aIP;
25
+
26
+ $hex = '[0-9a-fA-F]';
27
+ $blk = '(?:' . $hex . '{1,4})';
28
+ $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128
29
+
30
+ // prefix check
31
+ if (strpos($aIP, '/') !== false) {
32
+ if (preg_match('#' . $pre . '$#s', $aIP, $find)) {
33
+ $aIP = substr($aIP, 0, 0 - strlen($find[0]));
34
+ unset($find);
35
+ } else {
36
+ return false;
37
+ }
38
+ }
39
+
40
+ // IPv4-compatiblity check
41
+ if (preg_match('#(?<=:' . ')' . $this->ip4 . '$#s', $aIP, $find)) {
42
+ $aIP = substr($aIP, 0, 0 - strlen($find[0]));
43
+ $ip = explode('.', $find[0]);
44
+ $ip = array_map('dechex', $ip);
45
+ $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3];
46
+ unset($find, $ip);
47
+ }
48
+
49
+ // compression check
50
+ $aIP = explode('::', $aIP);
51
+ $c = count($aIP);
52
+ if ($c > 2) {
53
+ return false;
54
+ } elseif ($c == 2) {
55
+ list($first, $second) = $aIP;
56
+ $first = explode(':', $first);
57
+ $second = explode(':', $second);
58
+
59
+ if (count($first) + count($second) > 8) {
60
+ return false;
61
+ }
62
+
63
+ while (count($first) < 8) {
64
+ array_push($first, '0');
65
+ }
66
+
67
+ array_splice($first, 8 - count($second), 8, $second);
68
+ $aIP = $first;
69
+ unset($first, $second);
70
+ } else {
71
+ $aIP = explode(':', $aIP[0]);
72
+ }
73
+ $c = count($aIP);
74
+
75
+ if ($c != 8) {
76
+ return false;
77
+ }
78
+
79
+ // All the pieces should be 16-bit hex strings. Are they?
80
+ foreach ($aIP as $piece) {
81
+ if (!preg_match('#^[0-9a-fA-F]{4}$#s', sprintf('%04s', $piece))) {
82
+ return false;
83
+ }
84
+ }
85
+ return $original;
86
+ }
87
+ }
88
+
89
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Processes an entire attribute array for corrections needing multiple values.
5
+ *
6
+ * Occasionally, a certain attribute will need to be removed and popped onto
7
+ * another value. Instead of creating a complex return syntax for
8
+ * HTMLPurifier_AttrDef, we just pass the whole attribute array to a
9
+ * specialized object and have that do the special work. That is the
10
+ * family of HTMLPurifier_AttrTransform.
11
+ *
12
+ * An attribute transformation can be assigned to run before or after
13
+ * HTMLPurifier_AttrDef validation. See HTMLPurifier_HTMLDefinition for
14
+ * more details.
15
+ */
16
+
17
+ abstract class HTMLPurifier_AttrTransform
18
+ {
19
+
20
+ /**
21
+ * Abstract: makes changes to the attributes dependent on multiple values.
22
+ *
23
+ * @param array $attr Assoc array of attributes, usually from
24
+ * HTMLPurifier_Token_Tag::$attr
25
+ * @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object.
26
+ * @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object
27
+ * @return array Processed attribute array.
28
+ */
29
+ abstract public function transform($attr, $config, $context);
30
+
31
+ /**
32
+ * Prepends CSS properties to the style attribute, creating the
33
+ * attribute if it doesn't exist.
34
+ * @param array &$attr Attribute array to process (passed by reference)
35
+ * @param string $css CSS to prepend
36
+ */
37
+ public function prependCSS(&$attr, $css)
38
+ {
39
+ $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
40
+ $attr['style'] = $css . $attr['style'];
41
+ }
42
+
43
+ /**
44
+ * Retrieves and removes an attribute
45
+ * @param array &$attr Attribute array to process (passed by reference)
46
+ * @param mixed $key Key of attribute to confiscate
47
+ * @return mixed
48
+ */
49
+ public function confiscateAttr(&$attr, $key)
50
+ {
51
+ if (!isset($attr[$key])) {
52
+ return null;
53
+ }
54
+ $value = $attr[$key];
55
+ unset($attr[$key]);
56
+ return $value;
57
+ }
58
+ }
59
+
60
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Background.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Pre-transform that changes proprietary background attribute to CSS.
5
+ */
6
+ class HTMLPurifier_AttrTransform_Background extends HTMLPurifier_AttrTransform
7
+ {
8
+ /**
9
+ * @param array $attr
10
+ * @param HTMLPurifier_Config $config
11
+ * @param HTMLPurifier_Context $context
12
+ * @return array
13
+ */
14
+ public function transform($attr, $config, $context)
15
+ {
16
+ if (!isset($attr['background'])) {
17
+ return $attr;
18
+ }
19
+
20
+ $background = $this->confiscateAttr($attr, 'background');
21
+ // some validation should happen here
22
+
23
+ $this->prependCSS($attr, "background-image:url($background);");
24
+ return $attr;
25
+ }
26
+ }
27
+
28
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/BdoDir.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // this MUST be placed in post, as it assumes that any value in dir is valid
4
+
5
+ /**
6
+ * Post-trasnform that ensures that bdo tags have the dir attribute set.
7
+ */
8
+ class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
9
+ {
10
+
11
+ /**
12
+ * @param array $attr
13
+ * @param HTMLPurifier_Config $config
14
+ * @param HTMLPurifier_Context $context
15
+ * @return array
16
+ */
17
+ public function transform($attr, $config, $context)
18
+ {
19
+ if (isset($attr['dir'])) {
20
+ return $attr;
21
+ }
22
+ $attr['dir'] = $config->get('Attr.DefaultTextDir');
23
+ return $attr;
24
+ }
25
+ }
26
+
27
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/BgColor.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Pre-transform that changes deprecated bgcolor attribute to CSS.
5
+ */
6
+ class HTMLPurifier_AttrTransform_BgColor extends HTMLPurifier_AttrTransform
7
+ {
8
+ /**
9
+ * @param array $attr
10
+ * @param HTMLPurifier_Config $config
11
+ * @param HTMLPurifier_Context $context
12
+ * @return array
13
+ */
14
+ public function transform($attr, $config, $context)
15
+ {
16
+ if (!isset($attr['bgcolor'])) {
17
+ return $attr;
18
+ }
19
+
20
+ $bgcolor = $this->confiscateAttr($attr, 'bgcolor');
21
+ // some validation should happen here
22
+
23
+ $this->prependCSS($attr, "background-color:$bgcolor;");
24
+ return $attr;
25
+ }
26
+ }
27
+
28
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/BoolToCSS.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Pre-transform that changes converts a boolean attribute to fixed CSS
5
+ */
6
+ class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform
7
+ {
8
+ /**
9
+ * Name of boolean attribute that is trigger.
10
+ * @type string
11
+ */
12
+ protected $attr;
13
+
14
+ /**
15
+ * CSS declarations to add to style, needs trailing semicolon.
16
+ * @type string
17
+ */
18
+ protected $css;
19
+
20
+ /**
21
+ * @param string $attr attribute name to convert from
22
+ * @param string $css CSS declarations to add to style (needs semicolon)
23
+ */
24
+ public function __construct($attr, $css)
25
+ {
26
+ $this->attr = $attr;
27
+ $this->css = $css;
28
+ }
29
+
30
+ /**
31
+ * @param array $attr
32
+ * @param HTMLPurifier_Config $config
33
+ * @param HTMLPurifier_Context $context
34
+ * @return array
35
+ */
36
+ public function transform($attr, $config, $context)
37
+ {
38
+ if (!isset($attr[$this->attr])) {
39
+ return $attr;
40
+ }
41
+ unset($attr[$this->attr]);
42
+ $this->prependCSS($attr, $this->css);
43
+ return $attr;
44
+ }
45
+ }
46
+
47
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Border.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Pre-transform that changes deprecated border attribute to CSS.
5
+ */
6
+ class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform
7
+ {
8
+ /**
9
+ * @param array $attr
10
+ * @param HTMLPurifier_Config $config
11
+ * @param HTMLPurifier_Context $context
12
+ * @return array
13
+ */
14
+ public function transform($attr, $config, $context)
15
+ {
16
+ if (!isset($attr['border'])) {
17
+ return $attr;
18
+ }
19
+ $border_width = $this->confiscateAttr($attr, 'border');
20
+ // some validation should happen here
21
+ $this->prependCSS($attr, "border:{$border_width}px solid;");
22
+ return $attr;
23
+ }
24
+ }
25
+
26
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/EnumToCSS.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Generic pre-transform that converts an attribute with a fixed number of
5
+ * values (enumerated) to CSS.
6
+ */
7
+ class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform
8
+ {
9
+ /**
10
+ * Name of attribute to transform from.
11
+ * @type string
12
+ */
13
+ protected $attr;
14
+
15
+ /**
16
+ * Lookup array of attribute values to CSS.
17
+ * @type array
18
+ */
19
+ protected $enumToCSS = array();
20
+
21
+ /**
22
+ * Case sensitivity of the matching.
23
+ * @type bool
24
+ * @warning Currently can only be guaranteed to work with ASCII
25
+ * values.
26
+ */
27
+ protected $caseSensitive = false;
28
+
29
+ /**
30
+ * @param string $attr Attribute name to transform from
31
+ * @param array $enum_to_css Lookup array of attribute values to CSS
32
+ * @param bool $case_sensitive Case sensitivity indicator, default false
33
+ */
34
+ public function __construct($attr, $enum_to_css, $case_sensitive = false)
35
+ {
36
+ $this->attr = $attr;
37
+ $this->enumToCSS = $enum_to_css;
38
+ $this->caseSensitive = (bool)$case_sensitive;
39
+ }
40
+
41
+ /**
42
+ * @param array $attr
43
+ * @param HTMLPurifier_Config $config
44
+ * @param HTMLPurifier_Context $context
45
+ * @return array
46
+ */
47
+ public function transform($attr, $config, $context)
48
+ {
49
+ if (!isset($attr[$this->attr])) {
50
+ return $attr;
51
+ }
52
+
53
+ $value = trim($attr[$this->attr]);
54
+ unset($attr[$this->attr]);
55
+
56
+ if (!$this->caseSensitive) {
57
+ $value = strtolower($value);
58
+ }
59
+
60
+ if (!isset($this->enumToCSS[$value])) {
61
+ return $attr;
62
+ }
63
+ $this->prependCSS($attr, $this->enumToCSS[$value]);
64
+ return $attr;
65
+ }
66
+ }
67
+
68
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/ImgRequired.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // must be called POST validation
4
+
5
+ /**
6
+ * Transform that supplies default values for the src and alt attributes
7
+ * in img tags, as well as prevents the img tag from being removed
8
+ * because of a missing alt tag. This needs to be registered as both
9
+ * a pre and post attribute transform.
10
+ */
11
+ class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
12
+ {
13
+
14
+ /**
15
+ * @param array $attr
16
+ * @param HTMLPurifier_Config $config
17
+ * @param HTMLPurifier_Context $context
18
+ * @return array
19
+ */
20
+ public function transform($attr, $config, $context)
21
+ {
22
+ $src = true;
23
+ if (!isset($attr['src'])) {
24
+ if ($config->get('Core.RemoveInvalidImg')) {
25
+ return $attr;
26
+ }
27
+ $attr['src'] = $config->get('Attr.DefaultInvalidImage');
28
+ $src = false;
29
+ }
30
+
31
+ if (!isset($attr['alt'])) {
32
+ if ($src) {
33
+ $alt = $config->get('Attr.DefaultImageAlt');
34
+ if ($alt === null) {
35
+ $attr['alt'] = basename($attr['src']);
36
+ } else {
37
+ $attr['alt'] = $alt;
38
+ }
39
+ } else {
40
+ $attr['alt'] = $config->get('Attr.DefaultInvalidImageAlt');
41
+ }
42
+ }
43
+ return $attr;
44
+ }
45
+ }
46
+
47
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/ImgSpace.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Pre-transform that changes deprecated hspace and vspace attributes to CSS
5
+ */
6
+ class HTMLPurifier_AttrTransform_ImgSpace extends HTMLPurifier_AttrTransform
7
+ {
8
+ /**
9
+ * @type string
10
+ */
11
+ protected $attr;
12
+
13
+ /**
14
+ * @type array
15
+ */
16
+ protected $css = array(
17
+ 'hspace' => array('left', 'right'),
18
+ 'vspace' => array('top', 'bottom')
19
+ );
20
+
21
+ /**
22
+ * @param string $attr
23
+ */
24
+ public function __construct($attr)
25
+ {
26
+ $this->attr = $attr;
27
+ if (!isset($this->css[$attr])) {
28
+ trigger_error(htmlspecialchars($attr) . ' is not valid space attribute');
29
+ }
30
+ }
31
+
32
+ /**
33
+ * @param array $attr
34
+ * @param HTMLPurifier_Config $config
35
+ * @param HTMLPurifier_Context $context
36
+ * @return array
37
+ */
38
+ public function transform($attr, $config, $context)
39
+ {
40
+ if (!isset($attr[$this->attr])) {
41
+ return $attr;
42
+ }
43
+
44
+ $width = $this->confiscateAttr($attr, $this->attr);
45
+ // some validation could happen here
46
+
47
+ if (!isset($this->css[$this->attr])) {
48
+ return $attr;
49
+ }
50
+
51
+ $style = '';
52
+ foreach ($this->css[$this->attr] as $suffix) {
53
+ $property = "margin-$suffix";
54
+ $style .= "$property:{$width}px;";
55
+ }
56
+ $this->prependCSS($attr, $style);
57
+ return $attr;
58
+ }
59
+ }
60
+
61
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Input.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Performs miscellaneous cross attribute validation and filtering for
5
+ * input elements. This is meant to be a post-transform.
6
+ */
7
+ class HTMLPurifier_AttrTransform_Input extends HTMLPurifier_AttrTransform
8
+ {
9
+ /**
10
+ * @type HTMLPurifier_AttrDef_HTML_Pixels
11
+ */
12
+ protected $pixels;
13
+
14
+ public function __construct()
15
+ {
16
+ $this->pixels = new HTMLPurifier_AttrDef_HTML_Pixels();
17
+ }
18
+
19
+ /**
20
+ * @param array $attr
21
+ * @param HTMLPurifier_Config $config
22
+ * @param HTMLPurifier_Context $context
23
+ * @return array
24
+ */
25
+ public function transform($attr, $config, $context)
26
+ {
27
+ if (!isset($attr['type'])) {
28
+ $t = 'text';
29
+ } else {
30
+ $t = strtolower($attr['type']);
31
+ }
32
+ if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') {
33
+ unset($attr['checked']);
34
+ }
35
+ if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') {
36
+ unset($attr['maxlength']);
37
+ }
38
+ if (isset($attr['size']) && $t !== 'text' && $t !== 'password') {
39
+ $result = $this->pixels->validate($attr['size'], $config, $context);
40
+ if ($result === false) {
41
+ unset($attr['size']);
42
+ } else {
43
+ $attr['size'] = $result;
44
+ }
45
+ }
46
+ if (isset($attr['src']) && $t !== 'image') {
47
+ unset($attr['src']);
48
+ }
49
+ if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) {
50
+ $attr['value'] = '';
51
+ }
52
+ return $attr;
53
+ }
54
+ }
55
+
56
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Lang.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Post-transform that copies lang's value to xml:lang (and vice-versa)
5
+ * @note Theoretically speaking, this could be a pre-transform, but putting
6
+ * post is more efficient.
7
+ */
8
+ class HTMLPurifier_AttrTransform_Lang extends HTMLPurifier_AttrTransform
9
+ {
10
+
11
+ /**
12
+ * @param array $attr
13
+ * @param HTMLPurifier_Config $config
14
+ * @param HTMLPurifier_Context $context
15
+ * @return array
16
+ */
17
+ public function transform($attr, $config, $context)
18
+ {
19
+ $lang = isset($attr['lang']) ? $attr['lang'] : false;
20
+ $xml_lang = isset($attr['xml:lang']) ? $attr['xml:lang'] : false;
21
+
22
+ if ($lang !== false && $xml_lang === false) {
23
+ $attr['xml:lang'] = $lang;
24
+ } elseif ($xml_lang !== false) {
25
+ $attr['lang'] = $xml_lang;
26
+ }
27
+ return $attr;
28
+ }
29
+ }
30
+
31
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Length.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class for handling width/height length attribute transformations to CSS
5
+ */
6
+ class HTMLPurifier_AttrTransform_Length extends HTMLPurifier_AttrTransform
7
+ {
8
+
9
+ /**
10
+ * @type string
11
+ */
12
+ protected $name;
13
+
14
+ /**
15
+ * @type string
16
+ */
17
+ protected $cssName;
18
+
19
+ public function __construct($name, $css_name = null)
20
+ {
21
+ $this->name = $name;
22
+ $this->cssName = $css_name ? $css_name : $name;
23
+ }
24
+
25
+ /**
26
+ * @param array $attr
27
+ * @param HTMLPurifier_Config $config
28
+ * @param HTMLPurifier_Context $context
29
+ * @return array
30
+ */
31
+ public function transform($attr, $config, $context)
32
+ {
33
+ if (!isset($attr[$this->name])) {
34
+ return $attr;
35
+ }
36
+ $length = $this->confiscateAttr($attr, $this->name);
37
+ if (ctype_digit($length)) {
38
+ $length .= 'px';
39
+ }
40
+ $this->prependCSS($attr, $this->cssName . ":$length;");
41
+ return $attr;
42
+ }
43
+ }
44
+
45
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Name.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Pre-transform that changes deprecated name attribute to ID if necessary
5
+ */
6
+ class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
7
+ {
8
+
9
+ /**
10
+ * @param array $attr
11
+ * @param HTMLPurifier_Config $config
12
+ * @param HTMLPurifier_Context $context
13
+ * @return array
14
+ */
15
+ public function transform($attr, $config, $context)
16
+ {
17
+ // Abort early if we're using relaxed definition of name
18
+ if ($config->get('HTML.Attr.Name.UseCDATA')) {
19
+ return $attr;
20
+ }
21
+ if (!isset($attr['name'])) {
22
+ return $attr;
23
+ }
24
+ $id = $this->confiscateAttr($attr, 'name');
25
+ if (isset($attr['id'])) {
26
+ return $attr;
27
+ }
28
+ $attr['id'] = $id;
29
+ return $attr;
30
+ }
31
+ }
32
+
33
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/NameSync.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Post-transform that performs validation to the name attribute; if
5
+ * it is present with an equivalent id attribute, it is passed through;
6
+ * otherwise validation is performed.
7
+ */
8
+ class HTMLPurifier_AttrTransform_NameSync extends HTMLPurifier_AttrTransform
9
+ {
10
+
11
+ public function __construct()
12
+ {
13
+ $this->idDef = new HTMLPurifier_AttrDef_HTML_ID();
14
+ }
15
+
16
+ /**
17
+ * @param array $attr
18
+ * @param HTMLPurifier_Config $config
19
+ * @param HTMLPurifier_Context $context
20
+ * @return array
21
+ */
22
+ public function transform($attr, $config, $context)
23
+ {
24
+ if (!isset($attr['name'])) {
25
+ return $attr;
26
+ }
27
+ $name = $attr['name'];
28
+ if (isset($attr['id']) && $attr['id'] === $name) {
29
+ return $attr;
30
+ }
31
+ $result = $this->idDef->validate($name, $config, $context);
32
+ if ($result === false) {
33
+ unset($attr['name']);
34
+ } else {
35
+ $attr['name'] = $result;
36
+ }
37
+ return $attr;
38
+ }
39
+ }
40
+
41
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Nofollow.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // must be called POST validation
4
+
5
+ /**
6
+ * Adds rel="nofollow" to all outbound links. This transform is
7
+ * only attached if Attr.Nofollow is TRUE.
8
+ */
9
+ class HTMLPurifier_AttrTransform_Nofollow extends HTMLPurifier_AttrTransform
10
+ {
11
+ /**
12
+ * @type HTMLPurifier_URIParser
13
+ */
14
+ private $parser;
15
+
16
+ public function __construct()
17
+ {
18
+ $this->parser = new HTMLPurifier_URIParser();
19
+ }
20
+
21
+ /**
22
+ * @param array $attr
23
+ * @param HTMLPurifier_Config $config
24
+ * @param HTMLPurifier_Context $context
25
+ * @return array
26
+ */
27
+ public function transform($attr, $config, $context)
28
+ {
29
+ if (!isset($attr['href'])) {
30
+ return $attr;
31
+ }
32
+
33
+ // XXX Kind of inefficient
34
+ $url = $this->parser->parse($attr['href']);
35
+ $scheme = $url->getSchemeObj($config, $context);
36
+
37
+ if ($scheme->browsable && !$url->isLocal($config, $context)) {
38
+ if (isset($attr['rel'])) {
39
+ $rels = explode(' ', $attr['rel']);
40
+ if (!in_array('nofollow', $rels)) {
41
+ $rels[] = 'nofollow';
42
+ }
43
+ $attr['rel'] = implode(' ', $rels);
44
+ } else {
45
+ $attr['rel'] = 'nofollow';
46
+ }
47
+ }
48
+ return $attr;
49
+ }
50
+ }
51
+
52
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/SafeEmbed.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class HTMLPurifier_AttrTransform_SafeEmbed extends HTMLPurifier_AttrTransform
4
+ {
5
+ /**
6
+ * @type string
7
+ */
8
+ public $name = "SafeEmbed";
9
+
10
+ /**
11
+ * @param array $attr
12
+ * @param HTMLPurifier_Config $config
13
+ * @param HTMLPurifier_Context $context
14
+ * @return array
15
+ */
16
+ public function transform($attr, $config, $context)
17
+ {
18
+ $attr['allowscriptaccess'] = 'never';
19
+ $attr['allownetworking'] = 'internal';
20
+ $attr['type'] = 'application/x-shockwave-flash';
21
+ return $attr;
22
+ }
23
+ }
24
+
25
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/SafeObject.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Writes default type for all objects. Currently only supports flash.
5
+ */
6
+ class HTMLPurifier_AttrTransform_SafeObject extends HTMLPurifier_AttrTransform
7
+ {
8
+ /**
9
+ * @type string
10
+ */
11
+ public $name = "SafeObject";
12
+
13
+ /**
14
+ * @param array $attr
15
+ * @param HTMLPurifier_Config $config
16
+ * @param HTMLPurifier_Context $context
17
+ * @return array
18
+ */
19
+ public function transform($attr, $config, $context)
20
+ {
21
+ if (!isset($attr['type'])) {
22
+ $attr['type'] = 'application/x-shockwave-flash';
23
+ }
24
+ return $attr;
25
+ }
26
+ }
27
+
28
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/SafeParam.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates name/value pairs in param tags to be used in safe objects. This
5
+ * will only allow name values it recognizes, and pre-fill certain attributes
6
+ * with required values.
7
+ *
8
+ * @note
9
+ * This class only supports Flash. In the future, Quicktime support
10
+ * may be added.
11
+ *
12
+ * @warning
13
+ * This class expects an injector to add the necessary parameters tags.
14
+ */
15
+ class HTMLPurifier_AttrTransform_SafeParam extends HTMLPurifier_AttrTransform
16
+ {
17
+ /**
18
+ * @type string
19
+ */
20
+ public $name = "SafeParam";
21
+
22
+ /**
23
+ * @type HTMLPurifier_AttrDef_URI
24
+ */
25
+ private $uri;
26
+
27
+ public function __construct()
28
+ {
29
+ $this->uri = new HTMLPurifier_AttrDef_URI(true); // embedded
30
+ $this->wmode = new HTMLPurifier_AttrDef_Enum(array('window', 'opaque', 'transparent'));
31
+ }
32
+
33
+ /**
34
+ * @param array $attr
35
+ * @param HTMLPurifier_Config $config
36
+ * @param HTMLPurifier_Context $context
37
+ * @return array
38
+ */
39
+ public function transform($attr, $config, $context)
40
+ {
41
+ // If we add support for other objects, we'll need to alter the
42
+ // transforms.
43
+ switch ($attr['name']) {
44
+ // application/x-shockwave-flash
45
+ // Keep this synchronized with Injector/SafeObject.php
46
+ case 'allowScriptAccess':
47
+ $attr['value'] = 'never';
48
+ break;
49
+ case 'allowNetworking':
50
+ $attr['value'] = 'internal';
51
+ break;
52
+ case 'allowFullScreen':
53
+ if ($config->get('HTML.FlashAllowFullScreen')) {
54
+ $attr['value'] = ($attr['value'] == 'true') ? 'true' : 'false';
55
+ } else {
56
+ $attr['value'] = 'false';
57
+ }
58
+ break;
59
+ case 'wmode':
60
+ $attr['value'] = $this->wmode->validate($attr['value'], $config, $context);
61
+ break;
62
+ case 'movie':
63
+ case 'src':
64
+ $attr['name'] = "movie";
65
+ $attr['value'] = $this->uri->validate($attr['value'], $config, $context);
66
+ break;
67
+ case 'flashvars':
68
+ // we're going to allow arbitrary inputs to the SWF, on
69
+ // the reasoning that it could only hack the SWF, not us.
70
+ break;
71
+ // add other cases to support other param name/value pairs
72
+ default:
73
+ $attr['name'] = $attr['value'] = null;
74
+ }
75
+ return $attr;
76
+ }
77
+ }
78
+
79
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/ScriptRequired.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Implements required attribute stipulation for <script>
5
+ */
6
+ class HTMLPurifier_AttrTransform_ScriptRequired extends HTMLPurifier_AttrTransform
7
+ {
8
+ /**
9
+ * @param array $attr
10
+ * @param HTMLPurifier_Config $config
11
+ * @param HTMLPurifier_Context $context
12
+ * @return array
13
+ */
14
+ public function transform($attr, $config, $context)
15
+ {
16
+ if (!isset($attr['type'])) {
17
+ $attr['type'] = 'text/javascript';
18
+ }
19
+ return $attr;
20
+ }
21
+ }
22
+
23
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/TargetBlank.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // must be called POST validation
4
+
5
+ /**
6
+ * Adds target="blank" to all outbound links. This transform is
7
+ * only attached if Attr.TargetBlank is TRUE. This works regardless
8
+ * of whether or not Attr.AllowedFrameTargets
9
+ */
10
+ class HTMLPurifier_AttrTransform_TargetBlank extends HTMLPurifier_AttrTransform
11
+ {
12
+ /**
13
+ * @type HTMLPurifier_URIParser
14
+ */
15
+ private $parser;
16
+
17
+ public function __construct()
18
+ {
19
+ $this->parser = new HTMLPurifier_URIParser();
20
+ }
21
+
22
+ /**
23
+ * @param array $attr
24
+ * @param HTMLPurifier_Config $config
25
+ * @param HTMLPurifier_Context $context
26
+ * @return array
27
+ */
28
+ public function transform($attr, $config, $context)
29
+ {
30
+ if (!isset($attr['href'])) {
31
+ return $attr;
32
+ }
33
+
34
+ // XXX Kind of inefficient
35
+ $url = $this->parser->parse($attr['href']);
36
+ $scheme = $url->getSchemeObj($config, $context);
37
+
38
+ if ($scheme->browsable && !$url->isBenign($config, $context)) {
39
+ $attr['target'] = '_blank';
40
+ }
41
+ return $attr;
42
+ }
43
+ }
44
+
45
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/TargetNoopener.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // must be called POST validation
4
+
5
+ /**
6
+ * Adds rel="noopener" to any links which target a different window
7
+ * than the current one. This is used to prevent malicious websites
8
+ * from silently replacing the original window, which could be used
9
+ * to do phishing.
10
+ * This transform is controlled by %HTML.TargetNoopener.
11
+ */
12
+ class HTMLPurifier_AttrTransform_TargetNoopener extends HTMLPurifier_AttrTransform
13
+ {
14
+ /**
15
+ * @param array $attr
16
+ * @param HTMLPurifier_Config $config
17
+ * @param HTMLPurifier_Context $context
18
+ * @return array
19
+ */
20
+ public function transform($attr, $config, $context)
21
+ {
22
+ if (isset($attr['rel'])) {
23
+ $rels = explode(' ', $attr['rel']);
24
+ } else {
25
+ $rels = array();
26
+ }
27
+ if (isset($attr['target']) && !in_array('noopener', $rels)) {
28
+ $rels[] = 'noopener';
29
+ }
30
+ if (!empty($rels) || isset($attr['rel'])) {
31
+ $attr['rel'] = implode(' ', $rels);
32
+ }
33
+
34
+ return $attr;
35
+ }
36
+ }
37
+
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/TargetNoreferrer.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // must be called POST validation
4
+
5
+ /**
6
+ * Adds rel="noreferrer" to any links which target a different window
7
+ * than the current one. This is used to prevent malicious websites
8
+ * from silently replacing the original window, which could be used
9
+ * to do phishing.
10
+ * This transform is controlled by %HTML.TargetNoreferrer.
11
+ */
12
+ class HTMLPurifier_AttrTransform_TargetNoreferrer extends HTMLPurifier_AttrTransform
13
+ {
14
+ /**
15
+ * @param array $attr
16
+ * @param HTMLPurifier_Config $config
17
+ * @param HTMLPurifier_Context $context
18
+ * @return array
19
+ */
20
+ public function transform($attr, $config, $context)
21
+ {
22
+ if (isset($attr['rel'])) {
23
+ $rels = explode(' ', $attr['rel']);
24
+ } else {
25
+ $rels = array();
26
+ }
27
+ if (isset($attr['target']) && !in_array('noreferrer', $rels)) {
28
+ $rels[] = 'noreferrer';
29
+ }
30
+ if (!empty($rels) || isset($attr['rel'])) {
31
+ $attr['rel'] = implode(' ', $rels);
32
+ }
33
+
34
+ return $attr;
35
+ }
36
+ }
37
+
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Textarea.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Sets height/width defaults for <textarea>
5
+ */
6
+ class HTMLPurifier_AttrTransform_Textarea extends HTMLPurifier_AttrTransform
7
+ {
8
+ /**
9
+ * @param array $attr
10
+ * @param HTMLPurifier_Config $config
11
+ * @param HTMLPurifier_Context $context
12
+ * @return array
13
+ */
14
+ public function transform($attr, $config, $context)
15
+ {
16
+ // Calculated from Firefox
17
+ if (!isset($attr['cols'])) {
18
+ $attr['cols'] = '22';
19
+ }
20
+ if (!isset($attr['rows'])) {
21
+ $attr['rows'] = '3';
22
+ }
23
+ return $attr;
24
+ }
25
+ }
26
+
27
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTypes.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Provides lookup array of attribute types to HTMLPurifier_AttrDef objects
5
+ */
6
+ class HTMLPurifier_AttrTypes
7
+ {
8
+ /**
9
+ * Lookup array of attribute string identifiers to concrete implementations.
10
+ * @type HTMLPurifier_AttrDef[]
11
+ */
12
+ protected $info = array();
13
+
14
+ /**
15
+ * Constructs the info array, supplying default implementations for attribute
16
+ * types.
17
+ */
18
+ public function __construct()
19
+ {
20
+ // XXX This is kind of poor, since we don't actually /clone/
21
+ // instances; instead, we use the supplied make() attribute. So,
22
+ // the underlying class must know how to deal with arguments.
23
+ // With the old implementation of Enum, that ignored its
24
+ // arguments when handling a make dispatch, the IAlign
25
+ // definition wouldn't work.
26
+
27
+ // pseudo-types, must be instantiated via shorthand
28
+ $this->info['Enum'] = new HTMLPurifier_AttrDef_Enum();
29
+ $this->info['Bool'] = new HTMLPurifier_AttrDef_HTML_Bool();
30
+
31
+ $this->info['CDATA'] = new HTMLPurifier_AttrDef_Text();
32
+ $this->info['ID'] = new HTMLPurifier_AttrDef_HTML_ID();
33
+ $this->info['Length'] = new HTMLPurifier_AttrDef_HTML_Length();
34
+ $this->info['MultiLength'] = new HTMLPurifier_AttrDef_HTML_MultiLength();
35
+ $this->info['NMTOKENS'] = new HTMLPurifier_AttrDef_HTML_Nmtokens();
36
+ $this->info['Pixels'] = new HTMLPurifier_AttrDef_HTML_Pixels();
37
+ $this->info['Text'] = new HTMLPurifier_AttrDef_Text();
38
+ $this->info['URI'] = new HTMLPurifier_AttrDef_URI();
39
+ $this->info['LanguageCode'] = new HTMLPurifier_AttrDef_Lang();
40
+ $this->info['Color'] = new HTMLPurifier_AttrDef_HTML_Color();
41
+ $this->info['IAlign'] = self::makeEnum('top,middle,bottom,left,right');
42
+ $this->info['LAlign'] = self::makeEnum('top,bottom,left,right');
43
+ $this->info['FrameTarget'] = new HTMLPurifier_AttrDef_HTML_FrameTarget();
44
+
45
+ // unimplemented aliases
46
+ $this->info['ContentType'] = new HTMLPurifier_AttrDef_Text();
47
+ $this->info['ContentTypes'] = new HTMLPurifier_AttrDef_Text();
48
+ $this->info['Charsets'] = new HTMLPurifier_AttrDef_Text();
49
+ $this->info['Character'] = new HTMLPurifier_AttrDef_Text();
50
+
51
+ // "proprietary" types
52
+ $this->info['Class'] = new HTMLPurifier_AttrDef_HTML_Class();
53
+
54
+ // number is really a positive integer (one or more digits)
55
+ // FIXME: ^^ not always, see start and value of list items
56
+ $this->info['Number'] = new HTMLPurifier_AttrDef_Integer(false, false, true);
57
+ }
58
+
59
+ private static function makeEnum($in)
60
+ {
61
+ return new HTMLPurifier_AttrDef_Clone(new HTMLPurifier_AttrDef_Enum(explode(',', $in)));
62
+ }
63
+
64
+ /**
65
+ * Retrieves a type
66
+ * @param string $type String type name
67
+ * @return HTMLPurifier_AttrDef Object AttrDef for type
68
+ */
69
+ public function get($type)
70
+ {
71
+ // determine if there is any extra info tacked on
72
+ if (strpos($type, '#') !== false) {
73
+ list($type, $string) = explode('#', $type, 2);
74
+ } else {
75
+ $string = '';
76
+ }
77
+
78
+ if (!isset($this->info[$type])) {
79
+ trigger_error('Cannot retrieve undefined attribute type ' . $type, E_USER_ERROR);
80
+ return;
81
+ }
82
+ return $this->info[$type]->make($string);
83
+ }
84
+
85
+ /**
86
+ * Sets a new implementation for a type
87
+ * @param string $type String type name
88
+ * @param HTMLPurifier_AttrDef $impl Object AttrDef for type
89
+ */
90
+ public function set($type, $impl)
91
+ {
92
+ $this->info[$type] = $impl;
93
+ }
94
+ }
95
+
96
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrValidator.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Validates the attributes of a token. Doesn't manage required attributes
5
+ * very well. The only reason we factored this out was because RemoveForeignElements
6
+ * also needed it besides ValidateAttributes.
7
+ */
8
+ class HTMLPurifier_AttrValidator
9
+ {
10
+
11
+ /**
12
+ * Validates the attributes of a token, mutating it as necessary.
13
+ * that has valid tokens
14
+ * @param HTMLPurifier_Token $token Token to validate.
15
+ * @param HTMLPurifier_Config $config Instance of HTMLPurifier_Config
16
+ * @param HTMLPurifier_Context $context Instance of HTMLPurifier_Context
17
+ */
18
+ public function validateToken($token, $config, $context)
19
+ {
20
+ $definition = $config->getHTMLDefinition();
21
+ $e =& $context->get('ErrorCollector', true);
22
+
23
+ // initialize IDAccumulator if necessary
24
+ $ok =& $context->get('IDAccumulator', true);
25
+ if (!$ok) {
26
+ $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
27
+ $context->register('IDAccumulator', $id_accumulator);
28
+ }
29
+
30
+ // initialize CurrentToken if necessary
31
+ $current_token =& $context->get('CurrentToken', true);
32
+ if (!$current_token) {
33
+ $context->register('CurrentToken', $token);
34
+ }
35
+
36
+ if (!$token instanceof HTMLPurifier_Token_Start &&
37
+ !$token instanceof HTMLPurifier_Token_Empty
38
+ ) {
39
+ return;
40
+ }
41
+
42
+ // create alias to global definition array, see also $defs
43
+ // DEFINITION CALL
44
+ $d_defs = $definition->info_global_attr;
45
+
46
+ // don't update token until the very end, to ensure an atomic update
47
+ $attr = $token->attr;
48
+
49
+ // do global transformations (pre)
50
+ // nothing currently utilizes this
51
+ foreach ($definition->info_attr_transform_pre as $transform) {
52
+ $attr = $transform->transform($o = $attr, $config, $context);
53
+ if ($e) {
54
+ if ($attr != $o) {
55
+ $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
56
+ }
57
+ }
58
+ }
59
+
60
+ // do local transformations only applicable to this element (pre)
61
+ // ex. <p align="right"> to <p style="text-align:right;">
62
+ foreach ($definition->info[$token->name]->attr_transform_pre as $transform) {
63
+ $attr = $transform->transform($o = $attr, $config, $context);
64
+ if ($e) {
65
+ if ($attr != $o) {
66
+ $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
67
+ }
68
+ }
69
+ }
70
+
71
+ // create alias to this element's attribute definition array, see
72
+ // also $d_defs (global attribute definition array)
73
+ // DEFINITION CALL
74
+ $defs = $definition->info[$token->name]->attr;
75
+
76
+ $attr_key = false;
77
+ $context->register('CurrentAttr', $attr_key);
78
+
79
+ // iterate through all the attribute keypairs
80
+ // Watch out for name collisions: $key has previously been used
81
+ foreach ($attr as $attr_key => $value) {
82
+
83
+ // call the definition
84
+ if (isset($defs[$attr_key])) {
85
+ // there is a local definition defined
86
+ if ($defs[$attr_key] === false) {
87
+ // We've explicitly been told not to allow this element.
88
+ // This is usually when there's a global definition
89
+ // that must be overridden.
90
+ // Theoretically speaking, we could have a
91
+ // AttrDef_DenyAll, but this is faster!
92
+ $result = false;
93
+ } else {
94
+ // validate according to the element's definition
95
+ $result = $defs[$attr_key]->validate(
96
+ $value,
97
+ $config,
98
+ $context
99
+ );
100
+ }
101
+ } elseif (isset($d_defs[$attr_key])) {
102
+ // there is a global definition defined, validate according
103
+ // to the global definition
104
+ $result = $d_defs[$attr_key]->validate(
105
+ $value,
106
+ $config,
107
+ $context
108
+ );
109
+ } else {
110
+ // system never heard of the attribute? DELETE!
111
+ $result = false;
112
+ }
113
+
114
+ // put the results into effect
115
+ if ($result === false || $result === null) {
116
+ // this is a generic error message that should replaced
117
+ // with more specific ones when possible
118
+ if ($e) {
119
+ $e->send(E_ERROR, 'AttrValidator: Attribute removed');
120
+ }
121
+
122
+ // remove the attribute
123
+ unset($attr[$attr_key]);
124
+ } elseif (is_string($result)) {
125
+ // generally, if a substitution is happening, there
126
+ // was some sort of implicit correction going on. We'll
127
+ // delegate it to the attribute classes to say exactly what.
128
+
129
+ // simple substitution
130
+ $attr[$attr_key] = $result;
131
+ } else {
132
+ // nothing happens
133
+ }
134
+
135
+ // we'd also want slightly more complicated substitution
136
+ // involving an array as the return value,
137
+ // although we're not sure how colliding attributes would
138
+ // resolve (certain ones would be completely overriden,
139
+ // others would prepend themselves).
140
+ }
141
+
142
+ $context->destroy('CurrentAttr');
143
+
144
+ // post transforms
145
+
146
+ // global (error reporting untested)
147
+ foreach ($definition->info_attr_transform_post as $transform) {
148
+ $attr = $transform->transform($o = $attr, $config, $context);
149
+ if ($e) {
150
+ if ($attr != $o) {
151
+ $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
152
+ }
153
+ }
154
+ }
155
+
156
+ // local (error reporting untested)
157
+ foreach ($definition->info[$token->name]->attr_transform_post as $transform) {
158
+ $attr = $transform->transform($o = $attr, $config, $context);
159
+ if ($e) {
160
+ if ($attr != $o) {
161
+ $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
162
+ }
163
+ }
164
+ }
165
+
166
+ $token->attr = $attr;
167
+
168
+ // destroy CurrentToken if we made it ourselves
169
+ if (!$current_token) {
170
+ $context->destroy('CurrentToken');
171
+ }
172
+
173
+ }
174
+
175
+
176
+ }
177
+
178
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/Bootstrap.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // constants are slow, so we use as few as possible
4
+ if (!defined('HTMLPURIFIER_PREFIX')) {
5
+ define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/..'));
6
+ }
7
+
8
+ // accomodations for versions earlier than 5.0.2
9
+ // borrowed from PHP_Compat, LGPL licensed, by Aidan Lister <aidan@php.net>
10
+ if (!defined('PHP_EOL')) {
11
+ switch (strtoupper(substr(PHP_OS, 0, 3))) {
12
+ case 'WIN':
13
+ define('PHP_EOL', "\r\n");
14
+ break;
15
+ case 'DAR':
16
+ define('PHP_EOL', "\r");
17
+ break;
18
+ default:
19
+ define('PHP_EOL', "\n");
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Bootstrap class that contains meta-functionality for HTML Purifier such as
25
+ * the autoload function.
26
+ *
27
+ * @note
28
+ * This class may be used without any other files from HTML Purifier.
29
+ */
30
+ class HTMLPurifier_Bootstrap
31
+ {
32
+
33
+ /**
34
+ * Autoload function for HTML Purifier
35
+ * @param string $class Class to load
36
+ * @return bool
37
+ */
38
+ public static function autoload($class)
39
+ {
40
+ $file = HTMLPurifier_Bootstrap::getPath($class);
41
+ if (!$file) {
42
+ return false;
43
+ }
44
+ // Technically speaking, it should be ok and more efficient to
45
+ // just do 'require', but Antonio Parraga reports that with
46
+ // Zend extensions such as Zend debugger and APC, this invariant
47
+ // may be broken. Since we have efficient alternatives, pay
48
+ // the cost here and avoid the bug.
49
+ require_once HTMLPURIFIER_PREFIX . '/' . $file;
50
+ return true;
51
+ }
52
+
53
+ /**
54
+ * Returns the path for a specific class.
55
+ * @param string $class Class path to get
56
+ * @return string
57
+ */
58
+ public static function getPath($class)
59
+ {
60
+ if (strncmp('HTMLPurifier', $class, 12) !== 0) {
61
+ return false;
62
+ }
63
+ // Custom implementations
64
+ if (strncmp('HTMLPurifier_Language_', $class, 22) === 0) {
65
+ $code = str_replace('_', '-', substr($class, 22));
66
+ $file = 'HTMLPurifier/Language/classes/' . $code . '.php';
67
+ } else {
68
+ $file = str_replace('_', '/', $class) . '.php';
69
+ }
70
+ if (!file_exists(HTMLPURIFIER_PREFIX . '/' . $file)) {
71
+ return false;
72
+ }
73
+ return $file;
74
+ }
75
+
76
+ /**
77
+ * "Pre-registers" our autoloader on the SPL stack.
78
+ */
79
+ public static function registerAutoload()
80
+ {
81
+ $autoload = array('HTMLPurifier_Bootstrap', 'autoload');
82
+ if (($funcs = spl_autoload_functions()) === false) {
83
+ spl_autoload_register($autoload);
84
+ } elseif (function_exists('spl_autoload_unregister')) {
85
+ if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
86
+ // prepend flag exists, no need for shenanigans
87
+ spl_autoload_register($autoload, true, true);
88
+ } else {
89
+ $buggy = version_compare(PHP_VERSION, '5.2.11', '<');
90
+ $compat = version_compare(PHP_VERSION, '5.1.2', '<=') &&
91
+ version_compare(PHP_VERSION, '5.1.0', '>=');
92
+ foreach ($funcs as $func) {
93
+ if ($buggy && is_array($func)) {
94
+ // :TRICKY: There are some compatibility issues and some
95
+ // places where we need to error out
96
+ $reflector = new ReflectionMethod($func[0], $func[1]);
97
+ if (!$reflector->isStatic()) {
98
+ throw new Exception(
99
+ 'HTML Purifier autoloader registrar is not compatible
100
+ with non-static object methods due to PHP Bug #44144;
101
+ Please do not use HTMLPurifier.autoload.php (or any
102
+ file that includes this file); instead, place the code:
103
+ spl_autoload_register(array(\'HTMLPurifier_Bootstrap\', \'autoload\'))
104
+ after your own autoloaders.'
105
+ );
106
+ }
107
+ // Suprisingly, spl_autoload_register supports the
108
+ // Class::staticMethod callback format, although call_user_func doesn't
109
+ if ($compat) {
110
+ $func = implode('::', $func);
111
+ }
112
+ }
113
+ spl_autoload_unregister($func);
114
+ }
115
+ spl_autoload_register($autoload);
116
+ foreach ($funcs as $func) {
117
+ spl_autoload_register($func);
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+
124
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/CSSDefinition.php ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Defines allowed CSS attributes and what their values are.
5
+ * @see HTMLPurifier_HTMLDefinition
6
+ */
7
+ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
8
+ {
9
+
10
+ public $type = 'CSS';
11
+
12
+ /**
13
+ * Assoc array of attribute name to definition object.
14
+ * @type HTMLPurifier_AttrDef[]
15
+ */
16
+ public $info = array();
17
+
18
+ /**
19
+ * Constructs the info array. The meat of this class.
20
+ * @param HTMLPurifier_Config $config
21
+ */
22
+ protected function doSetup($config)
23
+ {
24
+ $this->info['text-align'] = new HTMLPurifier_AttrDef_Enum(
25
+ array('left', 'right', 'center', 'justify'),
26
+ false
27
+ );
28
+
29
+ $border_style =
30
+ $this->info['border-bottom-style'] =
31
+ $this->info['border-right-style'] =
32
+ $this->info['border-left-style'] =
33
+ $this->info['border-top-style'] = new HTMLPurifier_AttrDef_Enum(
34
+ array(
35
+ 'none',
36
+ 'hidden',
37
+ 'dotted',
38
+ 'dashed',
39
+ 'solid',
40
+ 'double',
41
+ 'groove',
42
+ 'ridge',
43
+ 'inset',
44
+ 'outset'
45
+ ),
46
+ false
47
+ );
48
+
49
+ $this->info['border-style'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_style);
50
+
51
+ $this->info['clear'] = new HTMLPurifier_AttrDef_Enum(
52
+ array('none', 'left', 'right', 'both'),
53
+ false
54
+ );
55
+ $this->info['float'] = new HTMLPurifier_AttrDef_Enum(
56
+ array('none', 'left', 'right'),
57
+ false
58
+ );
59
+ $this->info['font-style'] = new HTMLPurifier_AttrDef_Enum(
60
+ array('normal', 'italic', 'oblique'),
61
+ false
62
+ );
63
+ $this->info['font-variant'] = new HTMLPurifier_AttrDef_Enum(
64
+ array('normal', 'small-caps'),
65
+ false
66
+ );
67
+
68
+ $uri_or_none = new HTMLPurifier_AttrDef_CSS_Composite(
69
+ array(
70
+ new HTMLPurifier_AttrDef_Enum(array('none')),
71
+ new HTMLPurifier_AttrDef_CSS_URI()
72
+ )
73
+ );
74
+
75
+ $this->info['list-style-position'] = new HTMLPurifier_AttrDef_Enum(
76
+ array('inside', 'outside'),
77
+ false
78
+ );
79
+ $this->info['list-style-type'] = new HTMLPurifier_AttrDef_Enum(
80
+ array(
81
+ 'disc',
82
+ 'circle',
83
+ 'square',
84
+ 'decimal',
85
+ 'lower-roman',
86
+ 'upper-roman',
87
+ 'lower-alpha',
88
+ 'upper-alpha',
89
+ 'none'
90
+ ),
91
+ false
92
+ );
93
+ $this->info['list-style-image'] = $uri_or_none;
94
+
95
+ $this->info['list-style'] = new HTMLPurifier_AttrDef_CSS_ListStyle($config);
96
+
97
+ $this->info['text-transform'] = new HTMLPurifier_AttrDef_Enum(
98
+ array('capitalize', 'uppercase', 'lowercase', 'none'),
99
+ false
100
+ );
101
+ $this->info['color'] = new HTMLPurifier_AttrDef_CSS_Color();
102
+
103
+ $this->info['background-image'] = $uri_or_none;
104
+ $this->info['background-repeat'] = new HTMLPurifier_AttrDef_Enum(
105
+ array('repeat', 'repeat-x', 'repeat-y', 'no-repeat')
106
+ );
107
+ $this->info['background-attachment'] = new HTMLPurifier_AttrDef_Enum(
108
+ array('scroll', 'fixed')
109
+ );
110
+ $this->info['background-position'] = new HTMLPurifier_AttrDef_CSS_BackgroundPosition();
111
+
112
+ $border_color =
113
+ $this->info['border-top-color'] =
114
+ $this->info['border-bottom-color'] =
115
+ $this->info['border-left-color'] =
116
+ $this->info['border-right-color'] =
117
+ $this->info['background-color'] = new HTMLPurifier_AttrDef_CSS_Composite(
118
+ array(
119
+ new HTMLPurifier_AttrDef_Enum(array('transparent')),
120
+ new HTMLPurifier_AttrDef_CSS_Color()
121
+ )
122
+ );
123
+
124
+ $this->info['background'] = new HTMLPurifier_AttrDef_CSS_Background($config);
125
+
126
+ $this->info['border-color'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_color);
127
+
128
+ $border_width =
129
+ $this->info['border-top-width'] =
130
+ $this->info['border-bottom-width'] =
131
+ $this->info['border-left-width'] =
132
+ $this->info['border-right-width'] = new HTMLPurifier_AttrDef_CSS_Composite(
133
+ array(
134
+ new HTMLPurifier_AttrDef_Enum(array('thin', 'medium', 'thick')),
135
+ new HTMLPurifier_AttrDef_CSS_Length('0') //disallow negative
136
+ )
137
+ );
138
+
139
+ $this->info['border-width'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_width);
140
+
141
+ $this->info['letter-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(
142
+ array(
143
+ new HTMLPurifier_AttrDef_Enum(array('normal')),
144
+ new HTMLPurifier_AttrDef_CSS_Length()
145
+ )
146
+ );
147
+
148
+ $this->info['word-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(
149
+ array(
150
+ new HTMLPurifier_AttrDef_Enum(array('normal')),
151
+ new HTMLPurifier_AttrDef_CSS_Length()
152
+ )
153
+ );
154
+
155
+ $this->info['font-size'] = new HTMLPurifier_AttrDef_CSS_Composite(
156
+ array(
157
+ new HTMLPurifier_AttrDef_Enum(
158
+ array(
159
+ 'xx-small',
160
+ 'x-small',
161
+ 'small',
162
+ 'medium',
163
+ 'large',
164
+ 'x-large',
165
+ 'xx-large',
166
+ 'larger',
167
+ 'smaller'
168
+ )
169
+ ),
170
+ new HTMLPurifier_AttrDef_CSS_Percentage(),
171
+ new HTMLPurifier_AttrDef_CSS_Length()
172
+ )
173
+ );
174
+
175
+ $this->info['line-height'] = new HTMLPurifier_AttrDef_CSS_Composite(
176
+ array(
177
+ new HTMLPurifier_AttrDef_Enum(array('normal')),
178
+ new HTMLPurifier_AttrDef_CSS_Number(true), // no negatives
179
+ new HTMLPurifier_AttrDef_CSS_Length('0'),
180
+ new HTMLPurifier_AttrDef_CSS_Percentage(true)
181
+ )
182
+ );
183
+
184
+ $margin =
185
+ $this->info['margin-top'] =
186
+ $this->info['margin-bottom'] =
187
+ $this->info['margin-left'] =
188
+ $this->info['margin-right'] = new HTMLPurifier_AttrDef_CSS_Composite(
189
+ array(
190
+ new HTMLPurifier_AttrDef_CSS_Length(),
191
+ new HTMLPurifier_AttrDef_CSS_Percentage(),
192
+ new HTMLPurifier_AttrDef_Enum(array('auto'))
193
+ )
194
+ );
195
+
196
+ $this->info['margin'] = new HTMLPurifier_AttrDef_CSS_Multiple($margin);
197
+
198
+ // non-negative
199
+ $padding =
200
+ $this->info['padding-top'] =
201
+ $this->info['padding-bottom'] =
202
+ $this->info['padding-left'] =
203
+ $this->info['padding-right'] = new HTMLPurifier_AttrDef_CSS_Composite(
204
+ array(
205
+ new HTMLPurifier_AttrDef_CSS_Length('0'),
206
+ new HTMLPurifier_AttrDef_CSS_Percentage(true)
207
+ )
208
+ );
209
+
210
+ $this->info['padding'] = new HTMLPurifier_AttrDef_CSS_Multiple($padding);
211
+
212
+ $this->info['text-indent'] = new HTMLPurifier_AttrDef_CSS_Composite(
213
+ array(
214
+ new HTMLPurifier_AttrDef_CSS_Length(),
215
+ new HTMLPurifier_AttrDef_CSS_Percentage()
216
+ )
217
+ );
218
+
219
+ $trusted_wh = new HTMLPurifier_AttrDef_CSS_Composite(
220
+ array(
221
+ new HTMLPurifier_AttrDef_CSS_Length('0'),
222
+ new HTMLPurifier_AttrDef_CSS_Percentage(true),
223
+ new HTMLPurifier_AttrDef_Enum(array('auto', 'initial', 'inherit'))
224
+ )
225
+ );
226
+ $trusted_min_wh = new HTMLPurifier_AttrDef_CSS_Composite(
227
+ array(
228
+ new HTMLPurifier_AttrDef_CSS_Length('0'),
229
+ new HTMLPurifier_AttrDef_CSS_Percentage(true),
230
+ new HTMLPurifier_AttrDef_Enum(array('initial', 'inherit'))
231
+ )
232
+ );
233
+ $trusted_max_wh = new HTMLPurifier_AttrDef_CSS_Composite(
234
+ array(
235
+ new HTMLPurifier_AttrDef_CSS_Length('0'),
236
+ new HTMLPurifier_AttrDef_CSS_Percentage(true),
237
+ new HTMLPurifier_AttrDef_Enum(array('none', 'initial', 'inherit'))
238
+ )
239
+ );
240
+ $max = $config->get('CSS.MaxImgLength');
241
+
242
+ $this->info['width'] =
243
+ $this->info['height'] =
244
+ $max === null ?
245
+ $trusted_wh :
246
+ new HTMLPurifier_AttrDef_Switch(
247
+ 'img',
248
+ // For img tags:
249
+ new HTMLPurifier_AttrDef_CSS_Composite(
250
+ array(
251
+ new HTMLPurifier_AttrDef_CSS_Length('0', $max),
252
+ new HTMLPurifier_AttrDef_Enum(array('auto'))
253
+ )
254
+ ),
255
+ // For everyone else:
256
+ $trusted_wh
257
+ );
258
+ $this->info['min-width'] =
259
+ $this->info['min-height'] =
260
+ $max === null ?
261
+ $trusted_min_wh :
262
+ new HTMLPurifier_AttrDef_Switch(
263
+ 'img',
264
+ // For img tags:
265
+ new HTMLPurifier_AttrDef_CSS_Composite(
266
+ array(
267
+ new HTMLPurifier_AttrDef_CSS_Length('0', $max),
268
+ new HTMLPurifier_AttrDef_Enum(array('initial', 'inherit'))
269
+ )
270
+ ),
271
+ // For everyone else:
272
+ $trusted_min_wh
273
+ );
274
+ $this->info['max-width'] =
275
+ $this->info['max-height'] =
276
+ $max === null ?
277
+ $trusted_max_wh :
278
+ new HTMLPurifier_AttrDef_Switch(
279
+ 'img',
280
+ // For img tags:
281
+ new HTMLPurifier_AttrDef_CSS_Composite(
282
+ array(
283
+ new HTMLPurifier_AttrDef_CSS_Length('0', $max),
284
+ new HTMLPurifier_AttrDef_Enum(array('none', 'initial', 'inherit'))
285
+ )
286
+ ),
287
+ // For everyone else:
288
+ $trusted_max_wh
289
+ );
290
+
291
+ $this->info['text-decoration'] = new HTMLPurifier_AttrDef_CSS_TextDecoration();
292
+
293
+ $this->info['font-family'] = new HTMLPurifier_AttrDef_CSS_FontFamily();
294
+
295
+ // this could use specialized code
296
+ $this->info['font-weight'] = new HTMLPurifier_AttrDef_Enum(
297
+ array(
298
+ 'normal',
299
+ 'bold',
300
+ 'bolder',
301
+ 'lighter',
302
+ '100',
303
+ '200',
304
+ '300',
305
+ '400',
306
+ '500',
307
+ '600',
308
+ '700',
309
+ '800',
310
+ '900'
311
+ ),
312
+ false
313
+ );
314
+
315
+ // MUST be called after other font properties, as it references
316
+ // a CSSDefinition object
317
+ $this->info['font'] = new HTMLPurifier_AttrDef_CSS_Font($config);
318
+
319
+ // same here
320
+ $this->info['border'] =
321
+ $this->info['border-bottom'] =
322
+ $this->info['border-top'] =
323
+ $this->info['border-left'] =
324
+ $this->info['border-right'] = new HTMLPurifier_AttrDef_CSS_Border($config);
325
+
326
+ $this->info['border-collapse'] = new HTMLPurifier_AttrDef_Enum(
327
+ array('collapse', 'separate')
328
+ );
329
+
330
+ $this->info['caption-side'] = new HTMLPurifier_AttrDef_Enum(
331
+ array('top', 'bottom')
332
+ );
333
+
334
+ $this->info['table-layout'] = new HTMLPurifier_AttrDef_Enum(
335
+ array('auto', 'fixed')
336
+ );
337
+
338
+ $this->info['vertical-align'] = new HTMLPurifier_AttrDef_CSS_Composite(
339
+ array(
340
+ new HTMLPurifier_AttrDef_Enum(
341
+ array(
342
+ 'baseline',
343
+ 'sub',
344
+ 'super',
345
+ 'top',
346
+ 'text-top',
347
+ 'middle',
348
+ 'bottom',
349
+ 'text-bottom'
350
+ )
351
+ ),
352
+ new HTMLPurifier_AttrDef_CSS_Length(),
353
+ new HTMLPurifier_AttrDef_CSS_Percentage()
354
+ )
355
+ );
356
+
357
+ $this->info['border-spacing'] = new HTMLPurifier_AttrDef_CSS_Multiple(new HTMLPurifier_AttrDef_CSS_Length(), 2);
358
+
359
+ // These CSS properties don't work on many browsers, but we live
360
+ // in THE FUTURE!
361
+ $this->info['white-space'] = new HTMLPurifier_AttrDef_Enum(
362
+ array('nowrap', 'normal', 'pre', 'pre-wrap', 'pre-line')
363
+ );
364
+
365
+ if ($config->get('CSS.Proprietary')) {
366
+ $this->doSetupProprietary($config);
367
+ }
368
+
369
+ if ($config->get('CSS.AllowTricky')) {
370
+ $this->doSetupTricky($config);
371
+ }
372
+
373
+ if ($config->get('CSS.Trusted')) {
374
+ $this->doSetupTrusted($config);
375
+ }
376
+
377
+ $allow_important = $config->get('CSS.AllowImportant');
378
+ // wrap all attr-defs with decorator that handles !important
379
+ foreach ($this->info as $k => $v) {
380
+ $this->info[$k] = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($v, $allow_important);
381
+ }
382
+
383
+ $this->setupConfigStuff($config);
384
+ }
385
+
386
+ /**
387
+ * @param HTMLPurifier_Config $config
388
+ */
389
+ protected function doSetupProprietary($config)
390
+ {
391
+ // Internet Explorer only scrollbar colors
392
+ $this->info['scrollbar-arrow-color'] = new HTMLPurifier_AttrDef_CSS_Color();
393
+ $this->info['scrollbar-base-color'] = new HTMLPurifier_AttrDef_CSS_Color();
394
+ $this->info['scrollbar-darkshadow-color'] = new HTMLPurifier_AttrDef_CSS_Color();
395
+ $this->info['scrollbar-face-color'] = new HTMLPurifier_AttrDef_CSS_Color();
396
+ $this->info['scrollbar-highlight-color'] = new HTMLPurifier_AttrDef_CSS_Color();
397
+ $this->info['scrollbar-shadow-color'] = new HTMLPurifier_AttrDef_CSS_Color();
398
+
399
+ // vendor specific prefixes of opacity
400
+ $this->info['-moz-opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue();
401
+ $this->info['-khtml-opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue();
402
+
403
+ // only opacity, for now
404
+ $this->info['filter'] = new HTMLPurifier_AttrDef_CSS_Filter();
405
+
406
+ // more CSS3
407
+ $this->info['page-break-after'] =
408
+ $this->info['page-break-before'] = new HTMLPurifier_AttrDef_Enum(
409
+ array(
410
+ 'auto',
411
+ 'always',
412
+ 'avoid',
413
+ 'left',
414
+ 'right'
415
+ )
416
+ );
417
+ $this->info['page-break-inside'] = new HTMLPurifier_AttrDef_Enum(array('auto', 'avoid'));
418
+
419
+ $border_radius = new HTMLPurifier_AttrDef_CSS_Composite(
420
+ array(
421
+ new HTMLPurifier_AttrDef_CSS_Percentage(true), // disallow negative
422
+ new HTMLPurifier_AttrDef_CSS_Length('0') // disallow negative
423
+ ));
424
+
425
+ $this->info['border-top-left-radius'] =
426
+ $this->info['border-top-right-radius'] =
427
+ $this->info['border-bottom-right-radius'] =
428
+ $this->info['border-bottom-left-radius'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_radius, 2);
429
+ // TODO: support SLASH syntax
430
+ $this->info['border-radius'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_radius, 4);
431
+
432
+ }
433
+
434
+ /**
435
+ * @param HTMLPurifier_Config $config
436
+ */
437
+ protected function doSetupTricky($config)
438
+ {
439
+ $this->info['display'] = new HTMLPurifier_AttrDef_Enum(
440
+ array(
441
+ 'inline',
442
+ 'block',
443
+ 'list-item',
444
+ 'run-in',
445
+ 'compact',
446
+ 'marker',
447
+ 'table',
448
+ 'inline-block',
449
+ 'inline-table',
450
+ 'table-row-group',
451
+ 'table-header-group',
452
+ 'table-footer-group',
453
+ 'table-row',
454
+ 'table-column-group',
455
+ 'table-column',
456
+ 'table-cell',
457
+ 'table-caption',
458
+ 'none'
459
+ )
460
+ );
461
+ $this->info['visibility'] = new HTMLPurifier_AttrDef_Enum(
462
+ array('visible', 'hidden', 'collapse')
463
+ );
464
+ $this->info['overflow'] = new HTMLPurifier_AttrDef_Enum(array('visible', 'hidden', 'auto', 'scroll'));
465
+ $this->info['opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue();
466
+ }
467
+
468
+ /**
469
+ * @param HTMLPurifier_Config $config
470
+ */
471
+ protected function doSetupTrusted($config)
472
+ {
473
+ $this->info['position'] = new HTMLPurifier_AttrDef_Enum(
474
+ array('static', 'relative', 'absolute', 'fixed')
475
+ );
476
+ $this->info['top'] =
477
+ $this->info['left'] =
478
+ $this->info['right'] =
479
+ $this->info['bottom'] = new HTMLPurifier_AttrDef_CSS_Composite(
480
+ array(
481
+ new HTMLPurifier_AttrDef_CSS_Length(),
482
+ new HTMLPurifier_AttrDef_CSS_Percentage(),
483
+ new HTMLPurifier_AttrDef_Enum(array('auto')),
484
+ )
485
+ );
486
+ $this->info['z-index'] = new HTMLPurifier_AttrDef_CSS_Composite(
487
+ array(
488
+ new HTMLPurifier_AttrDef_Integer(),
489
+ new HTMLPurifier_AttrDef_Enum(array('auto')),
490
+ )
491
+ );
492
+ }
493
+
494
+ /**
495
+ * Performs extra config-based processing. Based off of
496
+ * HTMLPurifier_HTMLDefinition.
497
+ * @param HTMLPurifier_Config $config
498
+ * @todo Refactor duplicate elements into common class (probably using
499
+ * composition, not inheritance).
500
+ */
501
+ protected function setupConfigStuff($config)
502
+ {
503
+ // setup allowed elements
504
+ $support = "(for information on implementing this, see the " .
505
+ "support forums) ";
506
+ $allowed_properties = $config->get('CSS.AllowedProperties');
507
+ if ($allowed_properties !== null) {
508
+ foreach ($this->info as $name => $d) {
509
+ if (!isset($allowed_properties[$name])) {
510
+ unset($this->info[$name]);
511
+ }
512
+ unset($allowed_properties[$name]);
513
+ }
514
+ // emit errors
515
+ foreach ($allowed_properties as $name => $d) {
516
+ // :TODO: Is this htmlspecialchars() call really necessary?
517
+ $name = htmlspecialchars($name);
518
+ trigger_error("Style attribute '$name' is not supported $support", E_USER_WARNING);
519
+ }
520
+ }
521
+
522
+ $forbidden_properties = $config->get('CSS.ForbiddenProperties');
523
+ if ($forbidden_properties !== null) {
524
+ foreach ($this->info as $name => $d) {
525
+ if (isset($forbidden_properties[$name])) {
526
+ unset($this->info[$name]);
527
+ }
528
+ }
529
+ }
530
+ }
531
+ }
532
+
533
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Defines allowed child nodes and validates nodes against it.
5
+ */
6
+ abstract class HTMLPurifier_ChildDef
7
+ {
8
+ /**
9
+ * Type of child definition, usually right-most part of class name lowercase.
10
+ * Used occasionally in terms of context.
11
+ * @type string
12
+ */
13
+ public $type;
14
+
15
+ /**
16
+ * Indicates whether or not an empty array of children is okay.
17
+ *
18
+ * This is necessary for redundant checking when changes affecting
19
+ * a child node may cause a parent node to now be disallowed.
20
+ * @type bool
21
+ */
22
+ public $allow_empty;
23
+
24
+ /**
25
+ * Lookup array of all elements that this definition could possibly allow.
26
+ * @type array
27
+ */
28
+ public $elements = array();
29
+
30
+ /**
31
+ * Get lookup of tag names that should not close this element automatically.
32
+ * All other elements will do so.
33
+ * @param HTMLPurifier_Config $config HTMLPurifier_Config object
34
+ * @return array
35
+ */
36
+ public function getAllowedElements($config)
37
+ {
38
+ return $this->elements;
39
+ }
40
+
41
+ /**
42
+ * Validates nodes according to definition and returns modification.
43
+ *
44
+ * @param HTMLPurifier_Node[] $children Array of HTMLPurifier_Node
45
+ * @param HTMLPurifier_Config $config HTMLPurifier_Config object
46
+ * @param HTMLPurifier_Context $context HTMLPurifier_Context object
47
+ * @return bool|array true to leave nodes as is, false to remove parent node, array of replacement children
48
+ */
49
+ abstract public function validateChildren($children, $config, $context);
50
+ }
51
+
52
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Chameleon.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Definition that uses different definitions depending on context.
5
+ *
6
+ * The del and ins tags are notable because they allow different types of
7
+ * elements depending on whether or not they're in a block or inline context.
8
+ * Chameleon allows this behavior to happen by using two different
9
+ * definitions depending on context. While this somewhat generalized,
10
+ * it is specifically intended for those two tags.
11
+ */
12
+ class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef
13
+ {
14
+
15
+ /**
16
+ * Instance of the definition object to use when inline. Usually stricter.
17
+ * @type HTMLPurifier_ChildDef_Optional
18
+ */
19
+ public $inline;
20
+
21
+ /**
22
+ * Instance of the definition object to use when block.
23
+ * @type HTMLPurifier_ChildDef_Optional
24
+ */
25
+ public $block;
26
+
27
+ /**
28
+ * @type string
29
+ */
30
+ public $type = 'chameleon';
31
+
32
+ /**
33
+ * @param array $inline List of elements to allow when inline.
34
+ * @param array $block List of elements to allow when block.
35
+ */
36
+ public function __construct($inline, $block)
37
+ {
38
+ $this->inline = new HTMLPurifier_ChildDef_Optional($inline);
39
+ $this->block = new HTMLPurifier_ChildDef_Optional($block);
40
+ $this->elements = $this->block->elements;
41
+ }
42
+
43
+ /**
44
+ * @param HTMLPurifier_Node[] $children
45
+ * @param HTMLPurifier_Config $config
46
+ * @param HTMLPurifier_Context $context
47
+ * @return bool
48
+ */
49
+ public function validateChildren($children, $config, $context)
50
+ {
51
+ if ($context->get('IsInline') === false) {
52
+ return $this->block->validateChildren(
53
+ $children,
54
+ $config,
55
+ $context
56
+ );
57
+ } else {
58
+ return $this->inline->validateChildren(
59
+ $children,
60
+ $config,
61
+ $context
62
+ );
63
+ }
64
+ }
65
+ }
66
+
67
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Custom.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Custom validation class, accepts DTD child definitions
5
+ *
6
+ * @warning Currently this class is an all or nothing proposition, that is,
7
+ * it will only give a bool return value.
8
+ */
9
+ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
10
+ {
11
+ /**
12
+ * @type string
13
+ */
14
+ public $type = 'custom';
15
+
16
+ /**
17
+ * @type bool
18
+ */
19
+ public $allow_empty = false;
20
+
21
+ /**
22
+ * Allowed child pattern as defined by the DTD.
23
+ * @type string
24
+ */
25
+ public $dtd_regex;
26
+
27
+ /**
28
+ * PCRE regex derived from $dtd_regex.
29
+ * @type string
30
+ */
31
+ private $_pcre_regex;
32
+
33
+ /**
34
+ * @param $dtd_regex Allowed child pattern from the DTD
35
+ */
36
+ public function __construct($dtd_regex)
37
+ {
38
+ $this->dtd_regex = $dtd_regex;
39
+ $this->_compileRegex();
40
+ }
41
+
42
+ /**
43
+ * Compiles the PCRE regex from a DTD regex ($dtd_regex to $_pcre_regex)
44
+ */
45
+ protected function _compileRegex()
46
+ {
47
+ $raw = str_replace(' ', '', $this->dtd_regex);
48
+ if ($raw[0] != '(') {
49
+ $raw = "($raw)";
50
+ }
51
+ $el = '[#a-zA-Z0-9_.-]+';
52
+ $reg = $raw;
53
+
54
+ // COMPLICATED! AND MIGHT BE BUGGY! I HAVE NO CLUE WHAT I'M
55
+ // DOING! Seriously: if there's problems, please report them.
56
+
57
+ // collect all elements into the $elements array
58
+ preg_match_all("/$el/", $reg, $matches);
59
+ foreach ($matches[0] as $match) {
60
+ $this->elements[$match] = true;
61
+ }
62
+
63
+ // setup all elements as parentheticals with leading commas
64
+ $reg = preg_replace("/$el/", '(,\\0)', $reg);
65
+
66
+ // remove commas when they were not solicited
67
+ $reg = preg_replace("/([^,(|]\(+),/", '\\1', $reg);
68
+
69
+ // remove all non-paranthetical commas: they are handled by first regex
70
+ $reg = preg_replace("/,\(/", '(', $reg);
71
+
72
+ $this->_pcre_regex = $reg;
73
+ }
74
+
75
+ /**
76
+ * @param HTMLPurifier_Node[] $children
77
+ * @param HTMLPurifier_Config $config
78
+ * @param HTMLPurifier_Context $context
79
+ * @return bool
80
+ */
81
+ public function validateChildren($children, $config, $context)
82
+ {
83
+ $list_of_children = '';
84
+ $nesting = 0; // depth into the nest
85
+ foreach ($children as $node) {
86
+ if (!empty($node->is_whitespace)) {
87
+ continue;
88
+ }
89
+ $list_of_children .= $node->name . ',';
90
+ }
91
+ // add leading comma to deal with stray comma declarations
92
+ $list_of_children = ',' . rtrim($list_of_children, ',');
93
+ $okay =
94
+ preg_match(
95
+ '/^,?' . $this->_pcre_regex . '$/',
96
+ $list_of_children
97
+ );
98
+ return (bool)$okay;
99
+ }
100
+ }
101
+
102
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Empty.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Definition that disallows all elements.
5
+ * @warning validateChildren() in this class is actually never called, because
6
+ * empty elements are corrected in HTMLPurifier_Strategy_MakeWellFormed
7
+ * before child definitions are parsed in earnest by
8
+ * HTMLPurifier_Strategy_FixNesting.
9
+ */
10
+ class HTMLPurifier_ChildDef_Empty extends HTMLPurifier_ChildDef
11
+ {
12
+ /**
13
+ * @type bool
14
+ */
15
+ public $allow_empty = true;
16
+
17
+ /**
18
+ * @type string
19
+ */
20
+ public $type = 'empty';
21
+
22
+ public function __construct()
23
+ {
24
+ }
25
+
26
+ /**
27
+ * @param HTMLPurifier_Node[] $children
28
+ * @param HTMLPurifier_Config $config
29
+ * @param HTMLPurifier_Context $context
30
+ * @return array
31
+ */
32
+ public function validateChildren($children, $config, $context)
33
+ {
34
+ return array();
35
+ }
36
+ }
37
+
38
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/List.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Definition for list containers ul and ol.
5
+ *
6
+ * What does this do? The big thing is to handle ol/ul at the top
7
+ * level of list nodes, which should be handled specially by /folding/
8
+ * them into the previous list node. We generally shouldn't ever
9
+ * see other disallowed elements, because the autoclose behavior
10
+ * in MakeWellFormed handles it.
11
+ */
12
+ class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
13
+ {
14
+ /**
15
+ * @type string
16
+ */
17
+ public $type = 'list';
18
+ /**
19
+ * @type array
20
+ */
21
+ // lying a little bit, so that we can handle ul and ol ourselves
22
+ // XXX: This whole business with 'wrap' is all a bit unsatisfactory
23
+ public $elements = array('li' => true, 'ul' => true, 'ol' => true);
24
+
25
+ /**
26
+ * @param array $children
27
+ * @param HTMLPurifier_Config $config
28
+ * @param HTMLPurifier_Context $context
29
+ * @return array
30
+ */
31
+ public function validateChildren($children, $config, $context)
32
+ {
33
+ // Flag for subclasses
34
+ $this->whitespace = false;
35
+
36
+ // if there are no tokens, delete parent node
37
+ if (empty($children)) {
38
+ return false;
39
+ }
40
+
41
+ // if li is not allowed, delete parent node
42
+ if (!isset($config->getHTMLDefinition()->info['li'])) {
43
+ trigger_error("Cannot allow ul/ol without allowing li", E_USER_WARNING);
44
+ return false;
45
+ }
46
+
47
+ // the new set of children
48
+ $result = array();
49
+
50
+ // a little sanity check to make sure it's not ALL whitespace
51
+ $all_whitespace = true;
52
+
53
+ $current_li = null;
54
+
55
+ foreach ($children as $node) {
56
+ if (!empty($node->is_whitespace)) {
57
+ $result[] = $node;
58
+ continue;
59
+ }
60
+ $all_whitespace = false; // phew, we're not talking about whitespace
61
+
62
+ if ($node->name === 'li') {
63
+ // good
64
+ $current_li = $node;
65
+ $result[] = $node;
66
+ } else {
67
+ // we want to tuck this into the previous li
68
+ // Invariant: we expect the node to be ol/ul
69
+ // ToDo: Make this more robust in the case of not ol/ul
70
+ // by distinguishing between existing li and li created
71
+ // to handle non-list elements; non-list elements should
72
+ // not be appended to an existing li; only li created
73
+ // for non-list. This distinction is not currently made.
74
+ if ($current_li === null) {
75
+ $current_li = new HTMLPurifier_Node_Element('li');
76
+ $result[] = $current_li;
77
+ }
78
+ $current_li->children[] = $node;
79
+ $current_li->empty = false; // XXX fascinating! Check for this error elsewhere ToDo
80
+ }
81
+ }
82
+ if (empty($result)) {
83
+ return false;
84
+ }
85
+ if ($all_whitespace) {
86
+ return false;
87
+ }
88
+ return $result;
89
+ }
90
+ }
91
+
92
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Optional.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Definition that allows a set of elements, and allows no children.
5
+ * @note This is a hack to reuse code from HTMLPurifier_ChildDef_Required,
6
+ * really, one shouldn't inherit from the other. Only altered behavior
7
+ * is to overload a returned false with an array. Thus, it will never
8
+ * return false.
9
+ */
10
+ class HTMLPurifier_ChildDef_Optional extends HTMLPurifier_ChildDef_Required
11
+ {
12
+ /**
13
+ * @type bool
14
+ */
15
+ public $allow_empty = true;
16
+
17
+ /**
18
+ * @type string
19
+ */
20
+ public $type = 'optional';
21
+
22
+ /**
23
+ * @param array $children
24
+ * @param HTMLPurifier_Config $config
25
+ * @param HTMLPurifier_Context $context
26
+ * @return array
27
+ */
28
+ public function validateChildren($children, $config, $context)
29
+ {
30
+ $result = parent::validateChildren($children, $config, $context);
31
+ // we assume that $children is not modified
32
+ if ($result === false) {
33
+ if (empty($children)) {
34
+ return true;
35
+ } elseif ($this->whitespace) {
36
+ return $children;
37
+ } else {
38
+ return array();
39
+ }
40
+ }
41
+ return $result;
42
+ }
43
+ }
44
+
45
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Required.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Definition that allows a set of elements, but disallows empty children.
5
+ */
6
+ class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
7
+ {
8
+ /**
9
+ * Lookup table of allowed elements.
10
+ * @type array
11
+ */
12
+ public $elements = array();
13
+
14
+ /**
15
+ * Whether or not the last passed node was all whitespace.
16
+ * @type bool
17
+ */
18
+ protected $whitespace = false;
19
+
20
+ /**
21
+ * @param array|string $elements List of allowed element names (lowercase).
22
+ */
23
+ public function __construct($elements)
24
+ {
25
+ if (is_string($elements)) {
26
+ $elements = str_replace(' ', '', $elements);
27
+ $elements = explode('|', $elements);
28
+ }
29
+ $keys = array_keys($elements);
30
+ if ($keys == array_keys($keys)) {
31
+ $elements = array_flip($elements);
32
+ foreach ($elements as $i => $x) {
33
+ $elements[$i] = true;
34
+ if (empty($i)) {
35
+ unset($elements[$i]);
36
+ } // remove blank
37
+ }
38
+ }
39
+ $this->elements = $elements;
40
+ }
41
+
42
+ /**
43
+ * @type bool
44
+ */
45
+ public $allow_empty = false;
46
+
47
+ /**
48
+ * @type string
49
+ */
50
+ public $type = 'required';
51
+
52
+ /**
53
+ * @param array $children
54
+ * @param HTMLPurifier_Config $config
55
+ * @param HTMLPurifier_Context $context
56
+ * @return array
57
+ */
58
+ public function validateChildren($children, $config, $context)
59
+ {
60
+ // Flag for subclasses
61
+ $this->whitespace = false;
62
+
63
+ // if there are no tokens, delete parent node
64
+ if (empty($children)) {
65
+ return false;
66
+ }
67
+
68
+ // the new set of children
69
+ $result = array();
70
+
71
+ // whether or not parsed character data is allowed
72
+ // this controls whether or not we silently drop a tag
73
+ // or generate escaped HTML from it
74
+ $pcdata_allowed = isset($this->elements['#PCDATA']);
75
+
76
+ // a little sanity check to make sure it's not ALL whitespace
77
+ $all_whitespace = true;
78
+
79
+ $stack = array_reverse($children);
80
+ while (!empty($stack)) {
81
+ $node = array_pop($stack);
82
+ if (!empty($node->is_whitespace)) {
83
+ $result[] = $node;
84
+ continue;
85
+ }
86
+ $all_whitespace = false; // phew, we're not talking about whitespace
87
+
88
+ if (!isset($this->elements[$node->name])) {
89
+ // special case text
90
+ // XXX One of these ought to be redundant or something
91
+ if ($pcdata_allowed && $node instanceof HTMLPurifier_Node_Text) {
92
+ $result[] = $node;
93
+ continue;
94
+ }
95
+ // spill the child contents in
96
+ // ToDo: Make configurable
97
+ if ($node instanceof HTMLPurifier_Node_Element) {
98
+ for ($i = count($node->children) - 1; $i >= 0; $i--) {
99
+ $stack[] = $node->children[$i];
100
+ }
101
+ continue;
102
+ }
103
+ continue;
104
+ }
105
+ $result[] = $node;
106
+ }
107
+ if (empty($result)) {
108
+ return false;
109
+ }
110
+ if ($all_whitespace) {
111
+ $this->whitespace = true;
112
+ return false;
113
+ }
114
+ return $result;
115
+ }
116
+ }
117
+
118
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/StrictBlockquote.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Takes the contents of blockquote when in strict and reformats for validation.
5
+ */
6
+ class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Required
7
+ {
8
+ /**
9
+ * @type array
10
+ */
11
+ protected $real_elements;
12
+
13
+ /**
14
+ * @type array
15
+ */
16
+ protected $fake_elements;
17
+
18
+ /**
19
+ * @type bool
20
+ */
21
+ public $allow_empty = true;
22
+
23
+ /**
24
+ * @type string
25
+ */
26
+ public $type = 'strictblockquote';
27
+
28
+ /**
29
+ * @type bool
30
+ */
31
+ protected $init = false;
32
+
33
+ /**
34
+ * @param HTMLPurifier_Config $config
35
+ * @return array
36
+ * @note We don't want MakeWellFormed to auto-close inline elements since
37
+ * they might be allowed.
38
+ */
39
+ public function getAllowedElements($config)
40
+ {
41
+ $this->init($config);
42
+ return $this->fake_elements;
43
+ }
44
+
45
+ /**
46
+ * @param array $children
47
+ * @param HTMLPurifier_Config $config
48
+ * @param HTMLPurifier_Context $context
49
+ * @return array
50
+ */
51
+ public function validateChildren($children, $config, $context)
52
+ {
53
+ $this->init($config);
54
+
55
+ // trick the parent class into thinking it allows more
56
+ $this->elements = $this->fake_elements;
57
+ $result = parent::validateChildren($children, $config, $context);
58
+ $this->elements = $this->real_elements;
59
+
60
+ if ($result === false) {
61
+ return array();
62
+ }
63
+ if ($result === true) {
64
+ $result = $children;
65
+ }
66
+
67
+ $def = $config->getHTMLDefinition();
68
+ $block_wrap_name = $def->info_block_wrapper;
69
+ $block_wrap = false;
70
+ $ret = array();
71
+
72
+ foreach ($result as $node) {
73
+ if ($block_wrap === false) {
74
+ if (($node instanceof HTMLPurifier_Node_Text && !$node->is_whitespace) ||
75
+ ($node instanceof HTMLPurifier_Node_Element && !isset($this->elements[$node->name]))) {
76
+ $block_wrap = new HTMLPurifier_Node_Element($def->info_block_wrapper);
77
+ $ret[] = $block_wrap;
78
+ }
79
+ } else {
80
+ if ($node instanceof HTMLPurifier_Node_Element && isset($this->elements[$node->name])) {
81
+ $block_wrap = false;
82
+
83
+ }
84
+ }
85
+ if ($block_wrap) {
86
+ $block_wrap->children[] = $node;
87
+ } else {
88
+ $ret[] = $node;
89
+ }
90
+ }
91
+ return $ret;
92
+ }
93
+
94
+ /**
95
+ * @param HTMLPurifier_Config $config
96
+ */
97
+ private function init($config)
98
+ {
99
+ if (!$this->init) {
100
+ $def = $config->getHTMLDefinition();
101
+ // allow all inline elements
102
+ $this->real_elements = $this->elements;
103
+ $this->fake_elements = $def->info_content_sets['Flow'];
104
+ $this->fake_elements['#PCDATA'] = true;
105
+ $this->init = true;
106
+ }
107
+ }
108
+ }
109
+
110
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Table.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Definition for tables. The general idea is to extract out all of the
5
+ * essential bits, and then reconstruct it later.
6
+ *
7
+ * This is a bit confusing, because the DTDs and the W3C
8
+ * validators seem to disagree on the appropriate definition. The
9
+ * DTD claims:
10
+ *
11
+ * (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)
12
+ *
13
+ * But actually, the HTML4 spec then has this to say:
14
+ *
15
+ * The TBODY start tag is always required except when the table
16
+ * contains only one table body and no table head or foot sections.
17
+ * The TBODY end tag may always be safely omitted.
18
+ *
19
+ * So the DTD is kind of wrong. The validator is, unfortunately, kind
20
+ * of on crack.
21
+ *
22
+ * The definition changed again in XHTML1.1; and in my opinion, this
23
+ * formulation makes the most sense.
24
+ *
25
+ * caption?, ( col* | colgroup* ), (( thead?, tfoot?, tbody+ ) | ( tr+ ))
26
+ *
27
+ * Essentially, we have two modes: thead/tfoot/tbody mode, and tr mode.
28
+ * If we encounter a thead, tfoot or tbody, we are placed in the former
29
+ * mode, and we *must* wrap any stray tr segments with a tbody. But if
30
+ * we don't run into any of them, just have tr tags is OK.
31
+ */
32
+ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
33
+ {
34
+ /**
35
+ * @type bool
36
+ */
37
+ public $allow_empty = false;
38
+
39
+ /**
40
+ * @type string
41
+ */
42
+ public $type = 'table';
43
+
44
+ /**
45
+ * @type array
46
+ */
47
+ public $elements = array(
48
+ 'tr' => true,
49
+ 'tbody' => true,
50
+ 'thead' => true,
51
+ 'tfoot' => true,
52
+ 'caption' => true,
53
+ 'colgroup' => true,
54
+ 'col' => true
55
+ );
56
+
57
+ public function __construct()
58
+ {
59
+ }
60
+
61
+ /**
62
+ * @param array $children
63
+ * @param HTMLPurifier_Config $config
64
+ * @param HTMLPurifier_Context $context
65
+ * @return array
66
+ */
67
+ public function validateChildren($children, $config, $context)
68
+ {
69
+ if (empty($children)) {
70
+ return false;
71
+ }
72
+
73
+ // only one of these elements is allowed in a table
74
+ $caption = false;
75
+ $thead = false;
76
+ $tfoot = false;
77
+
78
+ // whitespace
79
+ $initial_ws = array();
80
+ $after_caption_ws = array();
81
+ $after_thead_ws = array();
82
+ $after_tfoot_ws = array();
83
+
84
+ // as many of these as you want
85
+ $cols = array();
86
+ $content = array();
87
+
88
+ $tbody_mode = false; // if true, then we need to wrap any stray
89
+ // <tr>s with a <tbody>.
90
+
91
+ $ws_accum =& $initial_ws;
92
+
93
+ foreach ($children as $node) {
94
+ if ($node instanceof HTMLPurifier_Node_Comment) {
95
+ $ws_accum[] = $node;
96
+ continue;
97
+ }
98
+ switch ($node->name) {
99
+ case 'tbody':
100
+ $tbody_mode = true;
101
+ // fall through
102
+ case 'tr':
103
+ $content[] = $node;
104
+ $ws_accum =& $content;
105
+ break;
106
+ case 'caption':
107
+ // there can only be one caption!
108
+ if ($caption !== false) break;
109
+ $caption = $node;
110
+ $ws_accum =& $after_caption_ws;
111
+ break;
112
+ case 'thead':
113
+ $tbody_mode = true;
114
+ // XXX This breaks rendering properties with
115
+ // Firefox, which never floats a <thead> to
116
+ // the top. Ever. (Our scheme will float the
117
+ // first <thead> to the top.) So maybe
118
+ // <thead>s that are not first should be
119
+ // turned into <tbody>? Very tricky, indeed.
120
+ if ($thead === false) {
121
+ $thead = $node;
122
+ $ws_accum =& $after_thead_ws;
123
+ } else {
124
+ // Oops, there's a second one! What
125
+ // should we do? Current behavior is to
126
+ // transmutate the first and last entries into
127
+ // tbody tags, and then put into content.
128
+ // Maybe a better idea is to *attach
129
+ // it* to the existing thead or tfoot?
130
+ // We don't do this, because Firefox
131
+ // doesn't float an extra tfoot to the
132
+ // bottom like it does for the first one.
133
+ $node->name = 'tbody';
134
+ $content[] = $node;
135
+ $ws_accum =& $content;
136
+ }
137
+ break;
138
+ case 'tfoot':
139
+ // see above for some aveats
140
+ $tbody_mode = true;
141
+ if ($tfoot === false) {
142
+ $tfoot = $node;
143
+ $ws_accum =& $after_tfoot_ws;
144
+ } else {
145
+ $node->name = 'tbody';
146
+ $content[] = $node;
147
+ $ws_accum =& $content;
148
+ }
149
+ break;
150
+ case 'colgroup':
151
+ case 'col':
152
+ $cols[] = $node;
153
+ $ws_accum =& $cols;
154
+ break;
155
+ case '#PCDATA':
156
+ // How is whitespace handled? We treat is as sticky to
157
+ // the *end* of the previous element. So all of the
158
+ // nonsense we have worked on is to keep things
159
+ // together.
160
+ if (!empty($node->is_whitespace)) {
161
+ $ws_accum[] = $node;
162
+ }
163
+ break;
164
+ }
165
+ }
166
+
167
+ if (empty($content)) {
168
+ return false;
169
+ }
170
+
171
+ $ret = $initial_ws;
172
+ if ($caption !== false) {
173
+ $ret[] = $caption;
174
+ $ret = array_merge($ret, $after_caption_ws);
175
+ }
176
+ if ($cols !== false) {
177
+ $ret = array_merge($ret, $cols);
178
+ }
179
+ if ($thead !== false) {
180
+ $ret[] = $thead;
181
+ $ret = array_merge($ret, $after_thead_ws);
182
+ }
183
+ if ($tfoot !== false) {
184
+ $ret[] = $tfoot;
185
+ $ret = array_merge($ret, $after_tfoot_ws);
186
+ }
187
+
188
+ if ($tbody_mode) {
189
+ // we have to shuffle tr into tbody
190
+ $current_tr_tbody = null;
191
+
192
+ foreach($content as $node) {
193
+ switch ($node->name) {
194
+ case 'tbody':
195
+ $current_tr_tbody = null;
196
+ $ret[] = $node;
197
+ break;
198
+ case 'tr':
199
+ if ($current_tr_tbody === null) {
200
+ $current_tr_tbody = new HTMLPurifier_Node_Element('tbody');
201
+ $ret[] = $current_tr_tbody;
202
+ }
203
+ $current_tr_tbody->children[] = $node;
204
+ break;
205
+ case '#PCDATA':
206
+ //assert($node->is_whitespace);
207
+ if ($current_tr_tbody === null) {
208
+ $ret[] = $node;
209
+ } else {
210
+ $current_tr_tbody->children[] = $node;
211
+ }
212
+ break;
213
+ }
214
+ }
215
+ } else {
216
+ $ret = array_merge($ret, $content);
217
+ }
218
+
219
+ return $ret;
220
+
221
+ }
222
+ }
223
+
224
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/Config.php ADDED
@@ -0,0 +1,920 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Configuration object that triggers customizable behavior.
5
+ *
6
+ * @warning This class is strongly defined: that means that the class
7
+ * will fail if an undefined directive is retrieved or set.
8
+ *
9
+ * @note Many classes that could (although many times don't) use the
10
+ * configuration object make it a mandatory parameter. This is
11
+ * because a configuration object should always be forwarded,
12
+ * otherwise, you run the risk of missing a parameter and then
13
+ * being stumped when a configuration directive doesn't work.
14
+ *
15
+ * @todo Reconsider some of the public member variables
16
+ */
17
+ class HTMLPurifier_Config
18
+ {
19
+
20
+ /**
21
+ * HTML Purifier's version
22
+ * @type string
23
+ */
24
+ public $version = '4.13.0';
25
+
26
+ /**
27
+ * Whether or not to automatically finalize
28
+ * the object if a read operation is done.
29
+ * @type bool
30
+ */
31
+ public $autoFinalize = true;
32
+
33
+ // protected member variables
34
+
35
+ /**
36
+ * Namespace indexed array of serials for specific namespaces.
37
+ * @see getSerial() for more info.
38
+ * @type string[]
39
+ */
40
+ protected $serials = array();
41
+
42
+ /**
43
+ * Serial for entire configuration object.
44
+ * @type string
45
+ */
46
+ protected $serial;
47
+
48
+ /**
49
+ * Parser for variables.
50
+ * @type HTMLPurifier_VarParser_Flexible
51
+ */
52
+ protected $parser = null;
53
+
54
+ /**
55
+ * Reference HTMLPurifier_ConfigSchema for value checking.
56
+ * @type HTMLPurifier_ConfigSchema
57
+ * @note This is public for introspective purposes. Please don't
58
+ * abuse!
59
+ */
60
+ public $def;
61
+
62
+ /**
63
+ * Indexed array of definitions.
64
+ * @type HTMLPurifier_Definition[]
65
+ */
66
+ protected $definitions;
67
+
68
+ /**
69
+ * Whether or not config is finalized.
70
+ * @type bool
71
+ */
72
+ protected $finalized = false;
73
+
74
+ /**
75
+ * Property list containing configuration directives.
76
+ * @type array
77
+ */
78
+ protected $plist;
79
+
80
+ /**
81
+ * Whether or not a set is taking place due to an alias lookup.
82
+ * @type bool
83
+ */
84
+ private $aliasMode;
85
+
86
+ /**
87
+ * Set to false if you do not want line and file numbers in errors.
88
+ * (useful when unit testing). This will also compress some errors
89
+ * and exceptions.
90
+ * @type bool
91
+ */
92
+ public $chatty = true;
93
+
94
+ /**
95
+ * Current lock; only gets to this namespace are allowed.
96
+ * @type string
97
+ */
98
+ private $lock;
99
+
100
+ /**
101
+ * Constructor
102
+ * @param HTMLPurifier_ConfigSchema $definition ConfigSchema that defines
103
+ * what directives are allowed.
104
+ * @param HTMLPurifier_PropertyList $parent
105
+ */
106
+ public function __construct($definition, $parent = null)
107
+ {
108
+ $parent = $parent ? $parent : $definition->defaultPlist;
109
+ $this->plist = new HTMLPurifier_PropertyList($parent);
110
+ $this->def = $definition; // keep a copy around for checking
111
+ $this->parser = new HTMLPurifier_VarParser_Flexible();
112
+ }
113
+
114
+ /**
115
+ * Convenience constructor that creates a config object based on a mixed var
116
+ * @param mixed $config Variable that defines the state of the config
117
+ * object. Can be: a HTMLPurifier_Config() object,
118
+ * an array of directives based on loadArray(),
119
+ * or a string filename of an ini file.
120
+ * @param HTMLPurifier_ConfigSchema $schema Schema object
121
+ * @return HTMLPurifier_Config Configured object
122
+ */
123
+ public static function create($config, $schema = null)
124
+ {
125
+ if ($config instanceof HTMLPurifier_Config) {
126
+ // pass-through
127
+ return $config;
128
+ }
129
+ if (!$schema) {
130
+ $ret = HTMLPurifier_Config::createDefault();
131
+ } else {
132
+ $ret = new HTMLPurifier_Config($schema);
133
+ }
134
+ if (is_string($config)) {
135
+ $ret->loadIni($config);
136
+ } elseif (is_array($config)) $ret->loadArray($config);
137
+ return $ret;
138
+ }
139
+
140
+ /**
141
+ * Creates a new config object that inherits from a previous one.
142
+ * @param HTMLPurifier_Config $config Configuration object to inherit from.
143
+ * @return HTMLPurifier_Config object with $config as its parent.
144
+ */
145
+ public static function inherit(HTMLPurifier_Config $config)
146
+ {
147
+ return new HTMLPurifier_Config($config->def, $config->plist);
148
+ }
149
+
150
+ /**
151
+ * Convenience constructor that creates a default configuration object.
152
+ * @return HTMLPurifier_Config default object.
153
+ */
154
+ public static function createDefault()
155
+ {
156
+ $definition = HTMLPurifier_ConfigSchema::instance();
157
+ $config = new HTMLPurifier_Config($definition);
158
+ return $config;
159
+ }
160
+
161
+ /**
162
+ * Retrieves a value from the configuration.
163
+ *
164
+ * @param string $key String key
165
+ * @param mixed $a
166
+ *
167
+ * @return mixed
168
+ */
169
+ public function get($key, $a = null)
170
+ {
171
+ if ($a !== null) {
172
+ $this->triggerError(
173
+ "Using deprecated API: use \$config->get('$key.$a') instead",
174
+ E_USER_WARNING
175
+ );
176
+ $key = "$key.$a";
177
+ }
178
+ if (!$this->finalized) {
179
+ $this->autoFinalize();
180
+ }
181
+ if (!isset($this->def->info[$key])) {
182
+ // can't add % due to SimpleTest bug
183
+ $this->triggerError(
184
+ 'Cannot retrieve value of undefined directive ' . htmlspecialchars($key),
185
+ E_USER_WARNING
186
+ );
187
+ return;
188
+ }
189
+ if (isset($this->def->info[$key]->isAlias)) {
190
+ $d = $this->def->info[$key];
191
+ $this->triggerError(
192
+ 'Cannot get value from aliased directive, use real name ' . $d->key,
193
+ E_USER_ERROR
194
+ );
195
+ return;
196
+ }
197
+ if ($this->lock) {
198
+ list($ns) = explode('.', $key);
199
+ if ($ns !== $this->lock) {
200
+ $this->triggerError(
201
+ 'Cannot get value of namespace ' . $ns . ' when lock for ' .
202
+ $this->lock .
203
+ ' is active, this probably indicates a Definition setup method ' .
204
+ 'is accessing directives that are not within its namespace',
205
+ E_USER_ERROR
206
+ );
207
+ return;
208
+ }
209
+ }
210
+ return $this->plist->get($key);
211
+ }
212
+
213
+ /**
214
+ * Retrieves an array of directives to values from a given namespace
215
+ *
216
+ * @param string $namespace String namespace
217
+ *
218
+ * @return array
219
+ */
220
+ public function getBatch($namespace)
221
+ {
222
+ if (!$this->finalized) {
223
+ $this->autoFinalize();
224
+ }
225
+ $full = $this->getAll();
226
+ if (!isset($full[$namespace])) {
227
+ $this->triggerError(
228
+ 'Cannot retrieve undefined namespace ' .
229
+ htmlspecialchars($namespace),
230
+ E_USER_WARNING
231
+ );
232
+ return;
233
+ }
234
+ return $full[$namespace];
235
+ }
236
+
237
+ /**
238
+ * Returns a SHA-1 signature of a segment of the configuration object
239
+ * that uniquely identifies that particular configuration
240
+ *
241
+ * @param string $namespace Namespace to get serial for
242
+ *
243
+ * @return string
244
+ * @note Revision is handled specially and is removed from the batch
245
+ * before processing!
246
+ */
247
+ public function getBatchSerial($namespace)
248
+ {
249
+ if (empty($this->serials[$namespace])) {
250
+ $batch = $this->getBatch($namespace);
251
+ unset($batch['DefinitionRev']);
252
+ $this->serials[$namespace] = sha1(serialize($batch));
253
+ }
254
+ return $this->serials[$namespace];
255
+ }
256
+
257
+ /**
258
+ * Returns a SHA-1 signature for the entire configuration object
259
+ * that uniquely identifies that particular configuration
260
+ *
261
+ * @return string
262
+ */
263
+ public function getSerial()
264
+ {
265
+ if (empty($this->serial)) {
266
+ $this->serial = sha1(serialize($this->getAll()));
267
+ }
268
+ return $this->serial;
269
+ }
270
+
271
+ /**
272
+ * Retrieves all directives, organized by namespace
273
+ *
274
+ * @warning This is a pretty inefficient function, avoid if you can
275
+ */
276
+ public function getAll()
277
+ {
278
+ if (!$this->finalized) {
279
+ $this->autoFinalize();
280
+ }
281
+ $ret = array();
282
+ foreach ($this->plist->squash() as $name => $value) {
283
+ list($ns, $key) = explode('.', $name, 2);
284
+ $ret[$ns][$key] = $value;
285
+ }
286
+ return $ret;
287
+ }
288
+
289
+ /**
290
+ * Sets a value to configuration.
291
+ *
292
+ * @param string $key key
293
+ * @param mixed $value value
294
+ * @param mixed $a
295
+ */
296
+ public function set($key, $value, $a = null)
297
+ {
298
+ if (strpos($key, '.') === false) {
299
+ $namespace = $key;
300
+ $directive = $value;
301
+ $value = $a;
302
+ $key = "$key.$directive";
303
+ $this->triggerError("Using deprecated API: use \$config->set('$key', ...) instead", E_USER_NOTICE);
304
+ } else {
305
+ list($namespace) = explode('.', $key);
306
+ }
307
+ if ($this->isFinalized('Cannot set directive after finalization')) {
308
+ return;
309
+ }
310
+ if (!isset($this->def->info[$key])) {
311
+ $this->triggerError(
312
+ 'Cannot set undefined directive ' . htmlspecialchars($key) . ' to value',
313
+ E_USER_WARNING
314
+ );
315
+ return;
316
+ }
317
+ $def = $this->def->info[$key];
318
+
319
+ if (isset($def->isAlias)) {
320
+ if ($this->aliasMode) {
321
+ $this->triggerError(
322
+ 'Double-aliases not allowed, please fix '.
323
+ 'ConfigSchema bug with' . $key,
324
+ E_USER_ERROR
325
+ );
326
+ return;
327
+ }
328
+ $this->aliasMode = true;
329
+ $this->set($def->key, $value);
330
+ $this->aliasMode = false;
331
+ $this->triggerError("$key is an alias, preferred directive name is {$def->key}", E_USER_NOTICE);
332
+ return;
333
+ }
334
+
335
+ // Raw type might be negative when using the fully optimized form
336
+ // of stdClass, which indicates allow_null == true
337
+ $rtype = is_int($def) ? $def : $def->type;
338
+ if ($rtype < 0) {
339
+ $type = -$rtype;
340
+ $allow_null = true;
341
+ } else {
342
+ $type = $rtype;
343
+ $allow_null = isset($def->allow_null);
344
+ }
345
+
346
+ try {
347
+ $value = $this->parser->parse($value, $type, $allow_null);
348
+ } catch (HTMLPurifier_VarParserException $e) {
349
+ $this->triggerError(
350
+ 'Value for ' . $key . ' is of invalid type, should be ' .
351
+ HTMLPurifier_VarParser::getTypeName($type),
352
+ E_USER_WARNING
353
+ );
354
+ return;
355
+ }
356
+ if (is_string($value) && is_object($def)) {
357
+ // resolve value alias if defined
358
+ if (isset($def->aliases[$value])) {
359
+ $value = $def->aliases[$value];
360
+ }
361
+ // check to see if the value is allowed
362
+ if (isset($def->allowed) && !isset($def->allowed[$value])) {
363
+ $this->triggerError(
364
+ 'Value not supported, valid values are: ' .
365
+ $this->_listify($def->allowed),
366
+ E_USER_WARNING
367
+ );
368
+ return;
369
+ }
370
+ }
371
+ $this->plist->set($key, $value);
372
+
373
+ // reset definitions if the directives they depend on changed
374
+ // this is a very costly process, so it's discouraged
375
+ // with finalization
376
+ if ($namespace == 'HTML' || $namespace == 'CSS' || $namespace == 'URI') {
377
+ $this->definitions[$namespace] = null;
378
+ }
379
+
380
+ $this->serials[$namespace] = false;
381
+ }
382
+
383
+ /**
384
+ * Convenience function for error reporting
385
+ *
386
+ * @param array $lookup
387
+ *
388
+ * @return string
389
+ */
390
+ private function _listify($lookup)
391
+ {
392
+ $list = array();
393
+ foreach ($lookup as $name => $b) {
394
+ $list[] = $name;
395
+ }
396
+ return implode(', ', $list);
397
+ }
398
+
399
+ /**
400
+ * Retrieves object reference to the HTML definition.
401
+ *
402
+ * @param bool $raw Return a copy that has not been setup yet. Must be
403
+ * called before it's been setup, otherwise won't work.
404
+ * @param bool $optimized If true, this method may return null, to
405
+ * indicate that a cached version of the modified
406
+ * definition object is available and no further edits
407
+ * are necessary. Consider using
408
+ * maybeGetRawHTMLDefinition, which is more explicitly
409
+ * named, instead.
410
+ *
411
+ * @return HTMLPurifier_HTMLDefinition|null
412
+ */
413
+ public function getHTMLDefinition($raw = false, $optimized = false)
414
+ {
415
+ return $this->getDefinition('HTML', $raw, $optimized);
416
+ }
417
+
418
+ /**
419
+ * Retrieves object reference to the CSS definition
420
+ *
421
+ * @param bool $raw Return a copy that has not been setup yet. Must be
422
+ * called before it's been setup, otherwise won't work.
423
+ * @param bool $optimized If true, this method may return null, to
424
+ * indicate that a cached version of the modified
425
+ * definition object is available and no further edits
426
+ * are necessary. Consider using
427
+ * maybeGetRawCSSDefinition, which is more explicitly
428
+ * named, instead.
429
+ *
430
+ * @return HTMLPurifier_CSSDefinition|null
431
+ */
432
+ public function getCSSDefinition($raw = false, $optimized = false)
433
+ {
434
+ return $this->getDefinition('CSS', $raw, $optimized);
435
+ }
436
+
437
+ /**
438
+ * Retrieves object reference to the URI definition
439
+ *
440
+ * @param bool $raw Return a copy that has not been setup yet. Must be
441
+ * called before it's been setup, otherwise won't work.
442
+ * @param bool $optimized If true, this method may return null, to
443
+ * indicate that a cached version of the modified
444
+ * definition object is available and no further edits
445
+ * are necessary. Consider using
446
+ * maybeGetRawURIDefinition, which is more explicitly
447
+ * named, instead.
448
+ *
449
+ * @return HTMLPurifier_URIDefinition|null
450
+ */
451
+ public function getURIDefinition($raw = false, $optimized = false)
452
+ {
453
+ return $this->getDefinition('URI', $raw, $optimized);
454
+ }
455
+
456
+ /**
457
+ * Retrieves a definition
458
+ *
459
+ * @param string $type Type of definition: HTML, CSS, etc
460
+ * @param bool $raw Whether or not definition should be returned raw
461
+ * @param bool $optimized Only has an effect when $raw is true. Whether
462
+ * or not to return null if the result is already present in
463
+ * the cache. This is off by default for backwards
464
+ * compatibility reasons, but you need to do things this
465
+ * way in order to ensure that caching is done properly.
466
+ * Check out enduser-customize.html for more details.
467
+ * We probably won't ever change this default, as much as the
468
+ * maybe semantics is the "right thing to do."
469
+ *
470
+ * @throws HTMLPurifier_Exception
471
+ * @return HTMLPurifier_Definition|null
472
+ */
473
+ public function getDefinition($type, $raw = false, $optimized = false)
474
+ {
475
+ if ($optimized && !$raw) {
476
+ throw new HTMLPurifier_Exception("Cannot set optimized = true when raw = false");
477
+ }
478
+ if (!$this->finalized) {
479
+ $this->autoFinalize();
480
+ }
481
+ // temporarily suspend locks, so we can handle recursive definition calls
482
+ $lock = $this->lock;
483
+ $this->lock = null;
484
+ $factory = HTMLPurifier_DefinitionCacheFactory::instance();
485
+ $cache = $factory->create($type, $this);
486
+ $this->lock = $lock;
487
+ if (!$raw) {
488
+ // full definition
489
+ // ---------------
490
+ // check if definition is in memory
491
+ if (!empty($this->definitions[$type])) {
492
+ $def = $this->definitions[$type];
493
+ // check if the definition is setup
494
+ if ($def->setup) {
495
+ return $def;
496
+ } else {
497
+ $def->setup($this);
498
+ if ($def->optimized) {
499
+ $cache->add($def, $this);
500
+ }
501
+ return $def;
502
+ }
503
+ }
504
+ // check if definition is in cache
505
+ $def = $cache->get($this);
506
+ if ($def) {
507
+ // definition in cache, save to memory and return it
508
+ $this->definitions[$type] = $def;
509
+ return $def;
510
+ }
511
+ // initialize it
512
+ $def = $this->initDefinition($type);
513
+ // set it up
514
+ $this->lock = $type;
515
+ $def->setup($this);
516
+ $this->lock = null;
517
+ // save in cache
518
+ $cache->add($def, $this);
519
+ // return it
520
+ return $def;
521
+ } else {
522
+ // raw definition
523
+ // --------------
524
+ // check preconditions
525
+ $def = null;
526
+ if ($optimized) {
527
+ if (is_null($this->get($type . '.DefinitionID'))) {
528
+ // fatally error out if definition ID not set
529
+ throw new HTMLPurifier_Exception(
530
+ "Cannot retrieve raw version without specifying %$type.DefinitionID"
531
+ );
532
+ }
533
+ }
534
+ if (!empty($this->definitions[$type])) {
535
+ $def = $this->definitions[$type];
536
+ if ($def->setup && !$optimized) {
537
+ $extra = $this->chatty ?
538
+ " (try moving this code block earlier in your initialization)" :
539
+ "";
540
+ throw new HTMLPurifier_Exception(
541
+ "Cannot retrieve raw definition after it has already been setup" .
542
+ $extra
543
+ );
544
+ }
545
+ if ($def->optimized === null) {
546
+ $extra = $this->chatty ? " (try flushing your cache)" : "";
547
+ throw new HTMLPurifier_Exception(
548
+ "Optimization status of definition is unknown" . $extra
549
+ );
550
+ }
551
+ if ($def->optimized !== $optimized) {
552
+ $msg = $optimized ? "optimized" : "unoptimized";
553
+ $extra = $this->chatty ?
554
+ " (this backtrace is for the first inconsistent call, which was for a $msg raw definition)"
555
+ : "";
556
+ throw new HTMLPurifier_Exception(
557
+ "Inconsistent use of optimized and unoptimized raw definition retrievals" . $extra
558
+ );
559
+ }
560
+ }
561
+ // check if definition was in memory
562
+ if ($def) {
563
+ if ($def->setup) {
564
+ // invariant: $optimized === true (checked above)
565
+ return null;
566
+ } else {
567
+ return $def;
568
+ }
569
+ }
570
+ // if optimized, check if definition was in cache
571
+ // (because we do the memory check first, this formulation
572
+ // is prone to cache slamming, but I think
573
+ // guaranteeing that either /all/ of the raw
574
+ // setup code or /none/ of it is run is more important.)
575
+ if ($optimized) {
576
+ // This code path only gets run once; once we put
577
+ // something in $definitions (which is guaranteed by the
578
+ // trailing code), we always short-circuit above.
579
+ $def = $cache->get($this);
580
+ if ($def) {
581
+ // save the full definition for later, but don't
582
+ // return it yet
583
+ $this->definitions[$type] = $def;
584
+ return null;
585
+ }
586
+ }
587
+ // check invariants for creation
588
+ if (!$optimized) {
589
+ if (!is_null($this->get($type . '.DefinitionID'))) {
590
+ if ($this->chatty) {
591
+ $this->triggerError(
592
+ 'Due to a documentation error in previous version of HTML Purifier, your ' .
593
+ 'definitions are not being cached. If this is OK, you can remove the ' .
594
+ '%$type.DefinitionRev and %$type.DefinitionID declaration. Otherwise, ' .
595
+ 'modify your code to use maybeGetRawDefinition, and test if the returned ' .
596
+ 'value is null before making any edits (if it is null, that means that a ' .
597
+ 'cached version is available, and no raw operations are necessary). See ' .
598
+ '<a href="http://htmlpurifier.org/docs/enduser-customize.html#optimized">' .
599
+ 'Customize</a> for more details',
600
+ E_USER_WARNING
601
+ );
602
+ } else {
603
+ $this->triggerError(
604
+ "Useless DefinitionID declaration",
605
+ E_USER_WARNING
606
+ );
607
+ }
608
+ }
609
+ }
610
+ // initialize it
611
+ $def = $this->initDefinition($type);
612
+ $def->optimized = $optimized;
613
+ return $def;
614
+ }
615
+ throw new HTMLPurifier_Exception("The impossible happened!");
616
+ }
617
+
618
+ /**
619
+ * Initialise definition
620
+ *
621
+ * @param string $type What type of definition to create
622
+ *
623
+ * @return HTMLPurifier_CSSDefinition|HTMLPurifier_HTMLDefinition|HTMLPurifier_URIDefinition
624
+ * @throws HTMLPurifier_Exception
625
+ */
626
+ private function initDefinition($type)
627
+ {
628
+ // quick checks failed, let's create the object
629
+ if ($type == 'HTML') {
630
+ $def = new HTMLPurifier_HTMLDefinition();
631
+ } elseif ($type == 'CSS') {
632
+ $def = new HTMLPurifier_CSSDefinition();
633
+ } elseif ($type == 'URI') {
634
+ $def = new HTMLPurifier_URIDefinition();
635
+ } else {
636
+ throw new HTMLPurifier_Exception(
637
+ "Definition of $type type not supported"
638
+ );
639
+ }
640
+ $this->definitions[$type] = $def;
641
+ return $def;
642
+ }
643
+
644
+ public function maybeGetRawDefinition($name)
645
+ {
646
+ return $this->getDefinition($name, true, true);
647
+ }
648
+
649
+ /**
650
+ * @return HTMLPurifier_HTMLDefinition|null
651
+ */
652
+ public function maybeGetRawHTMLDefinition()
653
+ {
654
+ return $this->getDefinition('HTML', true, true);
655
+ }
656
+
657
+ /**
658
+ * @return HTMLPurifier_CSSDefinition|null
659
+ */
660
+ public function maybeGetRawCSSDefinition()
661
+ {
662
+ return $this->getDefinition('CSS', true, true);
663
+ }
664
+
665
+ /**
666
+ * @return HTMLPurifier_URIDefinition|null
667
+ */
668
+ public function maybeGetRawURIDefinition()
669
+ {
670
+ return $this->getDefinition('URI', true, true);
671
+ }
672
+
673
+ /**
674
+ * Loads configuration values from an array with the following structure:
675
+ * Namespace.Directive => Value
676
+ *
677
+ * @param array $config_array Configuration associative array
678
+ */
679
+ public function loadArray($config_array)
680
+ {
681
+ if ($this->isFinalized('Cannot load directives after finalization')) {
682
+ return;
683
+ }
684
+ foreach ($config_array as $key => $value) {
685
+ $key = str_replace('_', '.', $key);
686
+ if (strpos($key, '.') !== false) {
687
+ $this->set($key, $value);
688
+ } else {
689
+ $namespace = $key;
690
+ $namespace_values = $value;
691
+ foreach ($namespace_values as $directive => $value2) {
692
+ $this->set($namespace .'.'. $directive, $value2);
693
+ }
694
+ }
695
+ }
696
+ }
697
+
698
+ /**
699
+ * Returns a list of array(namespace, directive) for all directives
700
+ * that are allowed in a web-form context as per an allowed
701
+ * namespaces/directives list.
702
+ *
703
+ * @param array $allowed List of allowed namespaces/directives
704
+ * @param HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
705
+ *
706
+ * @return array
707
+ */
708
+ public static function getAllowedDirectivesForForm($allowed, $schema = null)
709
+ {
710
+ if (!$schema) {
711
+ $schema = HTMLPurifier_ConfigSchema::instance();
712
+ }
713
+ if ($allowed !== true) {
714
+ if (is_string($allowed)) {
715
+ $allowed = array($allowed);
716
+ }
717
+ $allowed_ns = array();
718
+ $allowed_directives = array();
719
+ $blacklisted_directives = array();
720
+ foreach ($allowed as $ns_or_directive) {
721
+ if (strpos($ns_or_directive, '.') !== false) {
722
+ // directive
723
+ if ($ns_or_directive[0] == '-') {
724
+ $blacklisted_directives[substr($ns_or_directive, 1)] = true;
725
+ } else {
726
+ $allowed_directives[$ns_or_directive] = true;
727
+ }
728
+ } else {
729
+ // namespace
730
+ $allowed_ns[$ns_or_directive] = true;
731
+ }
732
+ }
733
+ }
734
+ $ret = array();
735
+ foreach ($schema->info as $key => $def) {
736
+ list($ns, $directive) = explode('.', $key, 2);
737
+ if ($allowed !== true) {
738
+ if (isset($blacklisted_directives["$ns.$directive"])) {
739
+ continue;
740
+ }
741
+ if (!isset($allowed_directives["$ns.$directive"]) && !isset($allowed_ns[$ns])) {
742
+ continue;
743
+ }
744
+ }
745
+ if (isset($def->isAlias)) {
746
+ continue;
747
+ }
748
+ if ($directive == 'DefinitionID' || $directive == 'DefinitionRev') {
749
+ continue;
750
+ }
751
+ $ret[] = array($ns, $directive);
752
+ }
753
+ return $ret;
754
+ }
755
+
756
+ /**
757
+ * Loads configuration values from $_GET/$_POST that were posted
758
+ * via ConfigForm
759
+ *
760
+ * @param array $array $_GET or $_POST array to import
761
+ * @param string|bool $index Index/name that the config variables are in
762
+ * @param array|bool $allowed List of allowed namespaces/directives
763
+ * @param bool $mq_fix Boolean whether or not to enable magic quotes fix
764
+ * @param HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
765
+ *
766
+ * @return mixed
767
+ */
768
+ public static function loadArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null)
769
+ {
770
+ $ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $schema);
771
+ $config = HTMLPurifier_Config::create($ret, $schema);
772
+ return $config;
773
+ }
774
+
775
+ /**
776
+ * Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
777
+ *
778
+ * @param array $array $_GET or $_POST array to import
779
+ * @param string|bool $index Index/name that the config variables are in
780
+ * @param array|bool $allowed List of allowed namespaces/directives
781
+ * @param bool $mq_fix Boolean whether or not to enable magic quotes fix
782
+ */
783
+ public function mergeArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true)
784
+ {
785
+ $ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $this->def);
786
+ $this->loadArray($ret);
787
+ }
788
+
789
+ /**
790
+ * Prepares an array from a form into something usable for the more
791
+ * strict parts of HTMLPurifier_Config
792
+ *
793
+ * @param array $array $_GET or $_POST array to import
794
+ * @param string|bool $index Index/name that the config variables are in
795
+ * @param array|bool $allowed List of allowed namespaces/directives
796
+ * @param bool $mq_fix Boolean whether or not to enable magic quotes fix
797
+ * @param HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
798
+ *
799
+ * @return array
800
+ */
801
+ public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null)
802
+ {
803
+ if ($index !== false) {
804
+ $array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
805
+ }
806
+ $mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc();
807
+
808
+ $allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $schema);
809
+ $ret = array();
810
+ foreach ($allowed as $key) {
811
+ list($ns, $directive) = $key;
812
+ $skey = "$ns.$directive";
813
+ if (!empty($array["Null_$skey"])) {
814
+ $ret[$ns][$directive] = null;
815
+ continue;
816
+ }
817
+ if (!isset($array[$skey])) {
818
+ continue;
819
+ }
820
+ $value = $mq ? stripslashes($array[$skey]) : $array[$skey];
821
+ $ret[$ns][$directive] = $value;
822
+ }
823
+ return $ret;
824
+ }
825
+
826
+ /**
827
+ * Loads configuration values from an ini file
828
+ *
829
+ * @param string $filename Name of ini file
830
+ */
831
+ public function loadIni($filename)
832
+ {
833
+ if ($this->isFinalized('Cannot load directives after finalization')) {
834
+ return;
835
+ }
836
+ $array = parse_ini_file($filename, true);
837
+ $this->loadArray($array);
838
+ }
839
+
840
+ /**
841
+ * Checks whether or not the configuration object is finalized.
842
+ *
843
+ * @param string|bool $error String error message, or false for no error
844
+ *
845
+ * @return bool
846
+ */
847
+ public function isFinalized($error = false)
848
+ {
849
+ if ($this->finalized && $error) {
850
+ $this->triggerError($error, E_USER_ERROR);
851
+ }
852
+ return $this->finalized;
853
+ }
854
+
855
+ /**
856
+ * Finalizes configuration only if auto finalize is on and not
857
+ * already finalized
858
+ */
859
+ public function autoFinalize()
860
+ {
861
+ if ($this->autoFinalize) {
862
+ $this->finalize();
863
+ } else {
864
+ $this->plist->squash(true);
865
+ }
866
+ }
867
+
868
+ /**
869
+ * Finalizes a configuration object, prohibiting further change
870
+ */
871
+ public function finalize()
872
+ {
873
+ $this->finalized = true;
874
+ $this->parser = null;
875
+ }
876
+
877
+ /**
878
+ * Produces a nicely formatted error message by supplying the
879
+ * stack frame information OUTSIDE of HTMLPurifier_Config.
880
+ *
881
+ * @param string $msg An error message
882
+ * @param int $no An error number
883
+ */
884
+ protected function triggerError($msg, $no)
885
+ {
886
+ // determine previous stack frame
887
+ $extra = '';
888
+ if ($this->chatty) {
889
+ $trace = debug_backtrace();
890
+ // zip(tail(trace), trace) -- but PHP is not Haskell har har
891
+ for ($i = 0, $c = count($trace); $i < $c - 1; $i++) {
892
+ // XXX this is not correct on some versions of HTML Purifier
893
+ if (isset($trace[$i + 1]['class']) && $trace[$i + 1]['class'] === 'HTMLPurifier_Config') {
894
+ continue;
895
+ }
896
+ $frame = $trace[$i];
897
+ $extra = " invoked on line {$frame['line']} in file {$frame['file']}";
898
+ break;
899
+ }
900
+ }
901
+ trigger_error($msg . $extra, $no);
902
+ }
903
+
904
+ /**
905
+ * Returns a serialized form of the configuration object that can
906
+ * be reconstituted.
907
+ *
908
+ * @return string
909
+ */
910
+ public function serialize()
911
+ {
912
+ $this->getDefinition('HTML');
913
+ $this->getDefinition('CSS');
914
+ $this->getDefinition('URI');
915
+ return serialize($this);
916
+ }
917
+
918
+ }
919
+
920
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Configuration definition, defines directives and their defaults.
5
+ */
6
+ class HTMLPurifier_ConfigSchema
7
+ {
8
+ /**
9
+ * Defaults of the directives and namespaces.
10
+ * @type array
11
+ * @note This shares the exact same structure as HTMLPurifier_Config::$conf
12
+ */
13
+ public $defaults = array();
14
+
15
+ /**
16
+ * The default property list. Do not edit this property list.
17
+ * @type array
18
+ */
19
+ public $defaultPlist;
20
+
21
+ /**
22
+ * Definition of the directives.
23
+ * The structure of this is:
24
+ *
25
+ * array(
26
+ * 'Namespace' => array(
27
+ * 'Directive' => new stdClass(),
28
+ * )
29
+ * )
30
+ *
31
+ * The stdClass may have the following properties:
32
+ *
33
+ * - If isAlias isn't set:
34
+ * - type: Integer type of directive, see HTMLPurifier_VarParser for definitions
35
+ * - allow_null: If set, this directive allows null values
36
+ * - aliases: If set, an associative array of value aliases to real values
37
+ * - allowed: If set, a lookup array of allowed (string) values
38
+ * - If isAlias is set:
39
+ * - namespace: Namespace this directive aliases to
40
+ * - name: Directive name this directive aliases to
41
+ *
42
+ * In certain degenerate cases, stdClass will actually be an integer. In
43
+ * that case, the value is equivalent to an stdClass with the type
44
+ * property set to the integer. If the integer is negative, type is
45
+ * equal to the absolute value of integer, and allow_null is true.
46
+ *
47
+ * This class is friendly with HTMLPurifier_Config. If you need introspection
48
+ * about the schema, you're better of using the ConfigSchema_Interchange,
49
+ * which uses more memory but has much richer information.
50
+ * @type array
51
+ */
52
+ public $info = array();
53
+
54
+ /**
55
+ * Application-wide singleton
56
+ * @type HTMLPurifier_ConfigSchema
57
+ */
58
+ protected static $singleton;
59
+
60
+ public function __construct()
61
+ {
62
+ $this->defaultPlist = new HTMLPurifier_PropertyList();
63
+ }
64
+
65
+ /**
66
+ * Unserializes the default ConfigSchema.
67
+ * @return HTMLPurifier_ConfigSchema
68
+ */
69
+ public static function makeFromSerial()
70
+ {
71
+ $contents = file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema.ser');
72
+ $r = unserialize($contents);
73
+ if (!$r) {
74
+ $hash = sha1($contents);
75
+ trigger_error("Unserialization of configuration schema failed, sha1 of file was $hash", E_USER_ERROR);
76
+ }
77
+ return $r;
78
+ }
79
+
80
+ /**
81
+ * Retrieves an instance of the application-wide configuration definition.
82
+ * @param HTMLPurifier_ConfigSchema $prototype
83
+ * @return HTMLPurifier_ConfigSchema
84
+ */
85
+ public static function instance($prototype = null)
86
+ {
87
+ if ($prototype !== null) {
88
+ HTMLPurifier_ConfigSchema::$singleton = $prototype;
89
+ } elseif (HTMLPurifier_ConfigSchema::$singleton === null || $prototype === true) {
90
+ HTMLPurifier_ConfigSchema::$singleton = HTMLPurifier_ConfigSchema::makeFromSerial();
91
+ }
92
+ return HTMLPurifier_ConfigSchema::$singleton;
93
+ }
94
+
95
+ /**
96
+ * Defines a directive for configuration
97
+ * @warning Will fail of directive's namespace is defined.
98
+ * @warning This method's signature is slightly different from the legacy
99
+ * define() static method! Beware!
100
+ * @param string $key Name of directive
101
+ * @param mixed $default Default value of directive
102
+ * @param string $type Allowed type of the directive. See
103
+ * HTMLPurifier_VarParser::$types for allowed values
104
+ * @param bool $allow_null Whether or not to allow null values
105
+ */
106
+ public function add($key, $default, $type, $allow_null)
107
+ {
108
+ $obj = new stdClass();
109
+ $obj->type = is_int($type) ? $type : HTMLPurifier_VarParser::$types[$type];
110
+ if ($allow_null) {
111
+ $obj->allow_null = true;
112
+ }
113
+ $this->info[$key] = $obj;
114
+ $this->defaults[$key] = $default;
115
+ $this->defaultPlist->set($key, $default);
116
+ }
117
+
118
+ /**
119
+ * Defines a directive value alias.
120
+ *
121
+ * Directive value aliases are convenient for developers because it lets
122
+ * them set a directive to several values and get the same result.
123
+ * @param string $key Name of Directive
124
+ * @param array $aliases Hash of aliased values to the real alias
125
+ */
126
+ public function addValueAliases($key, $aliases)
127
+ {
128
+ if (!isset($this->info[$key]->aliases)) {
129
+ $this->info[$key]->aliases = array();
130
+ }
131
+ foreach ($aliases as $alias => $real) {
132
+ $this->info[$key]->aliases[$alias] = $real;
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Defines a set of allowed values for a directive.
138
+ * @warning This is slightly different from the corresponding static
139
+ * method definition.
140
+ * @param string $key Name of directive
141
+ * @param array $allowed Lookup array of allowed values
142
+ */
143
+ public function addAllowedValues($key, $allowed)
144
+ {
145
+ $this->info[$key]->allowed = $allowed;
146
+ }
147
+
148
+ /**
149
+ * Defines a directive alias for backwards compatibility
150
+ * @param string $key Directive that will be aliased
151
+ * @param string $new_key Directive that the alias will be to
152
+ */
153
+ public function addAlias($key, $new_key)
154
+ {
155
+ $obj = new stdClass;
156
+ $obj->key = $new_key;
157
+ $obj->isAlias = true;
158
+ $this->info[$key] = $obj;
159
+ }
160
+
161
+ /**
162
+ * Replaces any stdClass that only has the type property with type integer.
163
+ */
164
+ public function postProcess()
165
+ {
166
+ foreach ($this->info as $key => $v) {
167
+ if (count((array) $v) == 1) {
168
+ $this->info[$key] = $v->type;
169
+ } elseif (count((array) $v) == 2 && isset($v->allow_null)) {
170
+ $this->info[$key] = -$v->type;
171
+ }
172
+ }
173
+ }
174
+ }
175
+
176
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Converts HTMLPurifier_ConfigSchema_Interchange to our runtime
5
+ * representation used to perform checks on user configuration.
6
+ */
7
+ class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
8
+ {
9
+
10
+ /**
11
+ * @param HTMLPurifier_ConfigSchema_Interchange $interchange
12
+ * @return HTMLPurifier_ConfigSchema
13
+ */
14
+ public function build($interchange)
15
+ {
16
+ $schema = new HTMLPurifier_ConfigSchema();
17
+ foreach ($interchange->directives as $d) {
18
+ $schema->add(
19
+ $d->id->key,
20
+ $d->default,
21
+ $d->type,
22
+ $d->typeAllowsNull
23
+ );
24
+ if ($d->allowed !== null) {
25
+ $schema->addAllowedValues(
26
+ $d->id->key,
27
+ $d->allowed
28
+ );
29
+ }
30
+ foreach ($d->aliases as $alias) {
31
+ $schema->addAlias(
32
+ $alias->key,
33
+ $d->id->key
34
+ );
35
+ }
36
+ if ($d->valueAliases !== null) {
37
+ $schema->addValueAliases(
38
+ $d->id->key,
39
+ $d->valueAliases
40
+ );
41
+ }
42
+ }
43
+ $schema->postProcess();
44
+ return $schema;
45
+ }
46
+ }
47
+
48
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Builder/Xml.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Converts HTMLPurifier_ConfigSchema_Interchange to an XML format,
5
+ * which can be further processed to generate documentation.
6
+ */
7
+ class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
8
+ {
9
+
10
+ /**
11
+ * @type HTMLPurifier_ConfigSchema_Interchange
12
+ */
13
+ protected $interchange;
14
+
15
+ /**
16
+ * @type string
17
+ */
18
+ private $namespace;
19
+
20
+ /**
21
+ * @param string $html
22
+ */
23
+ protected function writeHTMLDiv($html)
24
+ {
25
+ $this->startElement('div');
26
+
27
+ $purifier = HTMLPurifier::getInstance();
28
+ $html = $purifier->purify($html);
29
+ $this->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
30
+ $this->writeRaw($html);
31
+
32
+ $this->endElement(); // div
33
+ }
34
+
35
+ /**
36
+ * @param mixed $var
37
+ * @return string
38
+ */
39
+ protected function export($var)
40
+ {
41
+ if ($var === array()) {
42
+ return 'array()';
43
+ }
44
+ return var_export($var, true);
45
+ }
46
+
47
+ /**
48
+ * @param HTMLPurifier_ConfigSchema_Interchange $interchange
49
+ */
50
+ public function build($interchange)
51
+ {
52
+ // global access, only use as last resort
53
+ $this->interchange = $interchange;
54
+
55
+ $this->setIndent(true);
56
+ $this->startDocument('1.0', 'UTF-8');
57
+ $this->startElement('configdoc');
58
+ $this->writeElement('title', $interchange->name);
59
+
60
+ foreach ($interchange->directives as $directive) {
61
+ $this->buildDirective($directive);
62
+ }
63
+
64
+ if ($this->namespace) {
65
+ $this->endElement();
66
+ } // namespace
67
+
68
+ $this->endElement(); // configdoc
69
+ $this->flush();
70
+ }
71
+
72
+ /**
73
+ * @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive
74
+ */
75
+ public function buildDirective($directive)
76
+ {
77
+ // Kludge, although I suppose having a notion of a "root namespace"
78
+ // certainly makes things look nicer when documentation is built.
79
+ // Depends on things being sorted.
80
+ if (!$this->namespace || $this->namespace !== $directive->id->getRootNamespace()) {
81
+ if ($this->namespace) {
82
+ $this->endElement();
83
+ } // namespace
84
+ $this->namespace = $directive->id->getRootNamespace();
85
+ $this->startElement('namespace');
86
+ $this->writeAttribute('id', $this->namespace);
87
+ $this->writeElement('name', $this->namespace);
88
+ }
89
+
90
+ $this->startElement('directive');
91
+ $this->writeAttribute('id', $directive->id->toString());
92
+
93
+ $this->writeElement('name', $directive->id->getDirective());
94
+
95
+ $this->startElement('aliases');
96
+ foreach ($directive->aliases as $alias) {
97
+ $this->writeElement('alias', $alias->toString());
98
+ }
99
+ $this->endElement(); // aliases
100
+
101
+ $this->startElement('constraints');
102
+ if ($directive->version) {
103
+ $this->writeElement('version', $directive->version);
104
+ }
105
+ $this->startElement('type');
106
+ if ($directive->typeAllowsNull) {
107
+ $this->writeAttribute('allow-null', 'yes');
108
+ }
109
+ $this->text($directive->type);
110
+ $this->endElement(); // type
111
+ if ($directive->allowed) {
112
+ $this->startElement('allowed');
113
+ foreach ($directive->allowed as $value => $x) {
114
+ $this->writeElement('value', $value);
115
+ }
116
+ $this->endElement(); // allowed
117
+ }
118
+ $this->writeElement('default', $this->export($directive->default));
119
+ $this->writeAttribute('xml:space', 'preserve');
120
+ if ($directive->external) {
121
+ $this->startElement('external');
122
+ foreach ($directive->external as $project) {
123
+ $this->writeElement('project', $project);
124
+ }
125
+ $this->endElement();
126
+ }
127
+ $this->endElement(); // constraints
128
+
129
+ if ($directive->deprecatedVersion) {
130
+ $this->startElement('deprecated');
131
+ $this->writeElement('version', $directive->deprecatedVersion);
132
+ $this->writeElement('use', $directive->deprecatedUse->toString());
133
+ $this->endElement(); // deprecated
134
+ }
135
+
136
+ $this->startElement('description');
137
+ $this->writeHTMLDiv($directive->description);
138
+ $this->endElement(); // description
139
+
140
+ $this->endElement(); // directive
141
+ }
142
+ }
143
+
144
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Exception.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Exceptions related to configuration schema
5
+ */
6
+ class HTMLPurifier_ConfigSchema_Exception extends HTMLPurifier_Exception
7
+ {
8
+
9
+ }
10
+
11
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Interchange.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Generic schema interchange format that can be converted to a runtime
5
+ * representation (HTMLPurifier_ConfigSchema) or HTML documentation. Members
6
+ * are completely validated.
7
+ */
8
+ class HTMLPurifier_ConfigSchema_Interchange
9
+ {
10
+
11
+ /**
12
+ * Name of the application this schema is describing.
13
+ * @type string
14
+ */
15
+ public $name;
16
+
17
+ /**
18
+ * Array of Directive ID => array(directive info)
19
+ * @type HTMLPurifier_ConfigSchema_Interchange_Directive[]
20
+ */
21
+ public $directives = array();
22
+
23
+ /**
24
+ * Adds a directive array to $directives
25
+ * @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive
26
+ * @throws HTMLPurifier_ConfigSchema_Exception
27
+ */
28
+ public function addDirective($directive)
29
+ {
30
+ if (isset($this->directives[$i = $directive->id->toString()])) {
31
+ throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'");
32
+ }
33
+ $this->directives[$i] = $directive;
34
+ }
35
+
36
+ /**
37
+ * Convenience function to perform standard validation. Throws exception
38
+ * on failed validation.
39
+ */
40
+ public function validate()
41
+ {
42
+ $validator = new HTMLPurifier_ConfigSchema_Validator();
43
+ return $validator->validate($this);
44
+ }
45
+ }
46
+
47
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Interchange/Directive.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Interchange component class describing configuration directives.
5
+ */
6
+ class HTMLPurifier_ConfigSchema_Interchange_Directive
7
+ {
8
+
9
+ /**
10
+ * ID of directive.
11
+ * @type HTMLPurifier_ConfigSchema_Interchange_Id
12
+ */
13
+ public $id;
14
+
15
+ /**
16
+ * Type, e.g. 'integer' or 'istring'.
17
+ * @type string
18
+ */
19
+ public $type;
20
+
21
+ /**
22
+ * Default value, e.g. 3 or 'DefaultVal'.
23
+ * @type mixed
24
+ */
25
+ public $default;
26
+
27
+ /**
28
+ * HTML description.
29
+ * @type string
30
+ */
31
+ public $description;
32
+
33
+ /**
34
+ * Whether or not null is allowed as a value.
35
+ * @type bool
36
+ */
37
+ public $typeAllowsNull = false;
38
+
39
+ /**
40
+ * Lookup table of allowed scalar values.
41
+ * e.g. array('allowed' => true).
42
+ * Null if all values are allowed.
43
+ * @type array
44
+ */
45
+ public $allowed;
46
+
47
+ /**
48
+ * List of aliases for the directive.
49
+ * e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))).
50
+ * @type HTMLPurifier_ConfigSchema_Interchange_Id[]
51
+ */
52
+ public $aliases = array();
53
+
54
+ /**
55
+ * Hash of value aliases, e.g. array('alt' => 'real'). Null if value
56
+ * aliasing is disabled (necessary for non-scalar types).
57
+ * @type array
58
+ */
59
+ public $valueAliases;
60
+
61
+ /**
62
+ * Version of HTML Purifier the directive was introduced, e.g. '1.3.1'.
63
+ * Null if the directive has always existed.
64
+ * @type string
65
+ */
66
+ public $version;
67
+
68
+ /**
69
+ * ID of directive that supercedes this old directive.
70
+ * Null if not deprecated.
71
+ * @type HTMLPurifier_ConfigSchema_Interchange_Id
72
+ */
73
+ public $deprecatedUse;
74
+
75
+ /**
76
+ * Version of HTML Purifier this directive was deprecated. Null if not
77
+ * deprecated.
78
+ * @type string
79
+ */
80
+ public $deprecatedVersion;
81
+
82
+ /**
83
+ * List of external projects this directive depends on, e.g. array('CSSTidy').
84
+ * @type array
85
+ */
86
+ public $external = array();
87
+ }
88
+
89
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Interchange/Id.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Represents a directive ID in the interchange format.
5
+ */
6
+ class HTMLPurifier_ConfigSchema_Interchange_Id
7
+ {
8
+
9
+ /**
10
+ * @type string
11
+ */
12
+ public $key;
13
+
14
+ /**
15
+ * @param string $key
16
+ */
17
+ public function __construct($key)
18
+ {
19
+ $this->key = $key;
20
+ }
21
+
22
+ /**
23
+ * @return string
24
+ * @warning This is NOT magic, to ensure that people don't abuse SPL and
25
+ * cause problems for PHP 5.0 support.
26
+ */
27
+ public function toString()
28
+ {
29
+ return $this->key;
30
+ }
31
+
32
+ /**
33
+ * @return string
34
+ */
35
+ public function getRootNamespace()
36
+ {
37
+ return substr($this->key, 0, strpos($this->key, "."));
38
+ }
39
+
40
+ /**
41
+ * @return string
42
+ */
43
+ public function getDirective()
44
+ {
45
+ return substr($this->key, strpos($this->key, ".") + 1);
46
+ }
47
+
48
+ /**
49
+ * @param string $id
50
+ * @return HTMLPurifier_ConfigSchema_Interchange_Id
51
+ */
52
+ public static function make($id)
53
+ {
54
+ return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
55
+ }
56
+ }
57
+
58
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class HTMLPurifier_ConfigSchema_InterchangeBuilder
4
+ {
5
+
6
+ /**
7
+ * Used for processing DEFAULT, nothing else.
8
+ * @type HTMLPurifier_VarParser
9
+ */
10
+ protected $varParser;
11
+
12
+ /**
13
+ * @param HTMLPurifier_VarParser $varParser
14
+ */
15
+ public function __construct($varParser = null)
16
+ {
17
+ $this->varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native();
18
+ }
19
+
20
+ /**
21
+ * @param string $dir
22
+ * @return HTMLPurifier_ConfigSchema_Interchange
23
+ */
24
+ public static function buildFromDirectory($dir = null)
25
+ {
26
+ $builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
27
+ $interchange = new HTMLPurifier_ConfigSchema_Interchange();
28
+ return $builder->buildDir($interchange, $dir);
29
+ }
30
+
31
+ /**
32
+ * @param HTMLPurifier_ConfigSchema_Interchange $interchange
33
+ * @param string $dir
34
+ * @return HTMLPurifier_ConfigSchema_Interchange
35
+ */
36
+ public function buildDir($interchange, $dir = null)
37
+ {
38
+ if (!$dir) {
39
+ $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema';
40
+ }
41
+ if (file_exists($dir . '/info.ini')) {
42
+ $info = parse_ini_file($dir . '/info.ini');
43
+ $interchange->name = $info['name'];
44
+ }
45
+
46
+ $files = array();
47
+ $dh = opendir($dir);
48
+ while (false !== ($file = readdir($dh))) {
49
+ if (!$file || $file[0] == '.' || strrchr($file, '.') !== '.txt') {
50
+ continue;
51
+ }
52
+ $files[] = $file;
53
+ }
54
+ closedir($dh);
55
+
56
+ sort($files);
57
+ foreach ($files as $file) {
58
+ $this->buildFile($interchange, $dir . '/' . $file);
59
+ }
60
+ return $interchange;
61
+ }
62
+
63
+ /**
64
+ * @param HTMLPurifier_ConfigSchema_Interchange $interchange
65
+ * @param string $file
66
+ */
67
+ public function buildFile($interchange, $file)
68
+ {
69
+ $parser = new HTMLPurifier_StringHashParser();
70
+ $this->build(
71
+ $interchange,
72
+ new HTMLPurifier_StringHash($parser->parseFile($file))
73
+ );
74
+ }
75
+
76
+ /**
77
+ * Builds an interchange object based on a hash.
78
+ * @param HTMLPurifier_ConfigSchema_Interchange $interchange HTMLPurifier_ConfigSchema_Interchange object to build
79
+ * @param HTMLPurifier_StringHash $hash source data
80
+ * @throws HTMLPurifier_ConfigSchema_Exception
81
+ */
82
+ public function build($interchange, $hash)
83
+ {
84
+ if (!$hash instanceof HTMLPurifier_StringHash) {
85
+ $hash = new HTMLPurifier_StringHash($hash);
86
+ }
87
+ if (!isset($hash['ID'])) {
88
+ throw new HTMLPurifier_ConfigSchema_Exception('Hash does not have any ID');
89
+ }
90
+ if (strpos($hash['ID'], '.') === false) {
91
+ if (count($hash) == 2 && isset($hash['DESCRIPTION'])) {
92
+ $hash->offsetGet('DESCRIPTION'); // prevent complaining
93
+ } else {
94
+ throw new HTMLPurifier_ConfigSchema_Exception('All directives must have a namespace');
95
+ }
96
+ } else {
97
+ $this->buildDirective($interchange, $hash);
98
+ }
99
+ $this->_findUnused($hash);
100
+ }
101
+
102
+ /**
103
+ * @param HTMLPurifier_ConfigSchema_Interchange $interchange
104
+ * @param HTMLPurifier_StringHash $hash
105
+ * @throws HTMLPurifier_ConfigSchema_Exception
106
+ */
107
+ public function buildDirective($interchange, $hash)
108
+ {
109
+ $directive = new HTMLPurifier_ConfigSchema_Interchange_Directive();
110
+
111
+ // These are required elements:
112
+ $directive->id = $this->id($hash->offsetGet('ID'));
113
+ $id = $directive->id->toString(); // convenience
114
+
115
+ if (isset($hash['TYPE'])) {
116
+ $type = explode('/', $hash->offsetGet('TYPE'));
117
+ if (isset($type[1])) {
118
+ $directive->typeAllowsNull = true;
119
+ }
120
+ $directive->type = $type[0];
121
+ } else {
122
+ throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined");
123
+ }
124
+
125
+ if (isset($hash['DEFAULT'])) {
126
+ try {
127
+ $directive->default = $this->varParser->parse(
128
+ $hash->offsetGet('DEFAULT'),
129
+ $directive->type,
130
+ $directive->typeAllowsNull
131
+ );
132
+ } catch (HTMLPurifier_VarParserException $e) {
133
+ throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'");
134
+ }
135
+ }
136
+
137
+ if (isset($hash['DESCRIPTION'])) {
138
+ $directive->description = $hash->offsetGet('DESCRIPTION');
139
+ }
140
+
141
+ if (isset($hash['ALLOWED'])) {
142
+ $directive->allowed = $this->lookup($this->evalArray($hash->offsetGet('ALLOWED')));
143
+ }
144
+
145
+ if (isset($hash['VALUE-ALIASES'])) {
146
+ $directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
147
+ }
148
+
149
+ if (isset($hash['ALIASES'])) {
150
+ $raw_aliases = trim($hash->offsetGet('ALIASES'));
151
+ $aliases = preg_split('/\s*,\s*/', $raw_aliases);
152
+ foreach ($aliases as $alias) {
153
+ $directive->aliases[] = $this->id($alias);
154
+ }
155
+ }
156
+
157
+ if (isset($hash['VERSION'])) {
158
+ $directive->version = $hash->offsetGet('VERSION');
159
+ }
160
+
161
+ if (isset($hash['DEPRECATED-USE'])) {
162
+ $directive->deprecatedUse = $this->id($hash->offsetGet('DEPRECATED-USE'));
163
+ }
164
+
165
+ if (isset($hash['DEPRECATED-VERSION'])) {
166
+ $directive->deprecatedVersion = $hash->offsetGet('DEPRECATED-VERSION');
167
+ }
168
+
169
+ if (isset($hash['EXTERNAL'])) {
170
+ $directive->external = preg_split('/\s*,\s*/', trim($hash->offsetGet('EXTERNAL')));
171
+ }
172
+
173
+ $interchange->addDirective($directive);
174
+ }
175
+
176
+ /**
177
+ * Evaluates an array PHP code string without array() wrapper
178
+ * @param string $contents
179
+ */
180
+ protected function evalArray($contents)
181
+ {
182
+ return eval('return array(' . $contents . ');');
183
+ }
184
+
185
+ /**
186
+ * Converts an array list into a lookup array.
187
+ * @param array $array
188
+ * @return array
189
+ */
190
+ protected function lookup($array)
191
+ {
192
+ $ret = array();
193
+ foreach ($array as $val) {
194
+ $ret[$val] = true;
195
+ }
196
+ return $ret;
197
+ }
198
+
199
+ /**
200
+ * Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id
201
+ * object based on a string Id.
202
+ * @param string $id
203
+ * @return HTMLPurifier_ConfigSchema_Interchange_Id
204
+ */
205
+ protected function id($id)
206
+ {
207
+ return HTMLPurifier_ConfigSchema_Interchange_Id::make($id);
208
+ }
209
+
210
+ /**
211
+ * Triggers errors for any unused keys passed in the hash; such keys
212
+ * may indicate typos, missing values, etc.
213
+ * @param HTMLPurifier_StringHash $hash Hash to check.
214
+ */
215
+ protected function _findUnused($hash)
216
+ {
217
+ $accessed = $hash->getAccessed();
218
+ foreach ($hash as $k => $v) {
219
+ if (!isset($accessed[$k])) {
220
+ trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE);
221
+ }
222
+ }
223
+ }
224
+ }
225
+
226
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Validator.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Performs validations on HTMLPurifier_ConfigSchema_Interchange
5
+ *
6
+ * @note If you see '// handled by InterchangeBuilder', that means a
7
+ * design decision in that class would prevent this validation from
8
+ * ever being necessary. We have them anyway, however, for
9
+ * redundancy.
10
+ */
11
+ class HTMLPurifier_ConfigSchema_Validator
12
+ {
13
+
14
+ /**
15
+ * @type HTMLPurifier_ConfigSchema_Interchange
16
+ */
17
+ protected $interchange;
18
+
19
+ /**
20
+ * @type array
21
+ */
22
+ protected $aliases;
23
+
24
+ /**
25
+ * Context-stack to provide easy to read error messages.
26
+ * @type array
27
+ */
28
+ protected $context = array();
29
+
30
+ /**
31
+ * to test default's type.
32
+ * @type HTMLPurifier_VarParser
33
+ */
34
+ protected $parser;
35
+
36
+ public function __construct()
37
+ {
38
+ $this->parser = new HTMLPurifier_VarParser();
39
+ }
40
+
41
+ /**
42
+ * Validates a fully-formed interchange object.
43
+ * @param HTMLPurifier_ConfigSchema_Interchange $interchange
44
+ * @return bool
45
+ */
46
+ public function validate($interchange)
47
+ {
48
+ $this->interchange = $interchange;
49
+ $this->aliases = array();
50
+ // PHP is a bit lax with integer <=> string conversions in
51
+ // arrays, so we don't use the identical !== comparison
52
+ foreach ($interchange->directives as $i => $directive) {
53
+ $id = $directive->id->toString();
54
+ if ($i != $id) {
55
+ $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'");
56
+ }
57
+ $this->validateDirective($directive);
58
+ }
59
+ return true;
60
+ }
61
+
62
+ /**
63
+ * Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
64
+ * @param HTMLPurifier_ConfigSchema_Interchange_Id $id
65
+ */
66
+ public function validateId($id)
67
+ {
68
+ $id_string = $id->toString();
69
+ $this->context[] = "id '$id_string'";
70
+ if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
71
+ // handled by InterchangeBuilder
72
+ $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
73
+ }
74
+ // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)
75
+ // we probably should check that it has at least one namespace
76
+ $this->with($id, 'key')
77
+ ->assertNotEmpty()
78
+ ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder
79
+ array_pop($this->context);
80
+ }
81
+
82
+ /**
83
+ * Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
84
+ * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
85
+ */
86
+ public function validateDirective($d)
87
+ {
88
+ $id = $d->id->toString();
89
+ $this->context[] = "directive '$id'";
90
+ $this->validateId($d->id);
91
+
92
+ $this->with($d, 'description')
93
+ ->assertNotEmpty();
94
+
95
+ // BEGIN - handled by InterchangeBuilder
96
+ $this->with($d, 'type')
97
+ ->assertNotEmpty();
98
+ $this->with($d, 'typeAllowsNull')
99
+ ->assertIsBool();
100
+ try {
101
+ // This also tests validity of $d->type
102
+ $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);
103
+ } catch (HTMLPurifier_VarParserException $e) {
104
+ $this->error('default', 'had error: ' . $e->getMessage());
105
+ }
106
+ // END - handled by InterchangeBuilder
107
+
108
+ if (!is_null($d->allowed) || !empty($d->valueAliases)) {
109
+ // allowed and valueAliases require that we be dealing with
110
+ // strings, so check for that early.
111
+ $d_int = HTMLPurifier_VarParser::$types[$d->type];
112
+ if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) {
113
+ $this->error('type', 'must be a string type when used with allowed or value aliases');
114
+ }
115
+ }
116
+
117
+ $this->validateDirectiveAllowed($d);
118
+ $this->validateDirectiveValueAliases($d);
119
+ $this->validateDirectiveAliases($d);
120
+
121
+ array_pop($this->context);
122
+ }
123
+
124
+ /**
125
+ * Extra validation if $allowed member variable of
126
+ * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
127
+ * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
128
+ */
129
+ public function validateDirectiveAllowed($d)
130
+ {
131
+ if (is_null($d->allowed)) {
132
+ return;
133
+ }
134
+ $this->with($d, 'allowed')
135
+ ->assertNotEmpty()
136
+ ->assertIsLookup(); // handled by InterchangeBuilder
137
+ if (is_string($d->default) && !isset($d->allowed[$d->default])) {
138
+ $this->error('default', 'must be an allowed value');
139
+ }
140
+ $this->context[] = 'allowed';
141
+ foreach ($d->allowed as $val => $x) {
142
+ if (!is_string($val)) {
143
+ $this->error("value $val", 'must be a string');
144
+ }
145
+ }
146
+ array_pop($this->context);
147
+ }
148
+
149
+ /**
150
+ * Extra validation if $valueAliases member variable of
151
+ * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
152
+ * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
153
+ */
154
+ public function validateDirectiveValueAliases($d)
155
+ {
156
+ if (is_null($d->valueAliases)) {
157
+ return;
158
+ }
159
+ $this->with($d, 'valueAliases')
160
+ ->assertIsArray(); // handled by InterchangeBuilder
161
+ $this->context[] = 'valueAliases';
162
+ foreach ($d->valueAliases as $alias => $real) {
163
+ if (!is_string($alias)) {
164
+ $this->error("alias $alias", 'must be a string');
165
+ }
166
+ if (!is_string($real)) {
167
+ $this->error("alias target $real from alias '$alias'", 'must be a string');
168
+ }
169
+ if ($alias === $real) {
170
+ $this->error("alias '$alias'", "must not be an alias to itself");
171
+ }
172
+ }
173
+ if (!is_null($d->allowed)) {
174
+ foreach ($d->valueAliases as $alias => $real) {
175
+ if (isset($d->allowed[$alias])) {
176
+ $this->error("alias '$alias'", 'must not be an allowed value');
177
+ } elseif (!isset($d->allowed[$real])) {
178
+ $this->error("alias '$alias'", 'must be an alias to an allowed value');
179
+ }
180
+ }
181
+ }
182
+ array_pop($this->context);
183
+ }
184
+
185
+ /**
186
+ * Extra validation if $aliases member variable of
187
+ * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
188
+ * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
189
+ */
190
+ public function validateDirectiveAliases($d)
191
+ {
192
+ $this->with($d, 'aliases')
193
+ ->assertIsArray(); // handled by InterchangeBuilder
194
+ $this->context[] = 'aliases';
195
+ foreach ($d->aliases as $alias) {
196
+ $this->validateId($alias);
197
+ $s = $alias->toString();
198
+ if (isset($this->interchange->directives[$s])) {
199
+ $this->error("alias '$s'", 'collides with another directive');
200
+ }
201
+ if (isset($this->aliases[$s])) {
202
+ $other_directive = $this->aliases[$s];
203
+ $this->error("alias '$s'", "collides with alias for directive '$other_directive'");
204
+ }
205
+ $this->aliases[$s] = $d->id->toString();
206
+ }
207
+ array_pop($this->context);
208
+ }
209
+
210
+ // protected helper functions
211
+
212
+ /**
213
+ * Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom
214
+ * for validating simple member variables of objects.
215
+ * @param $obj
216
+ * @param $member
217
+ * @return HTMLPurifier_ConfigSchema_ValidatorAtom
218
+ */
219
+ protected function with($obj, $member)
220
+ {
221
+ return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member);
222
+ }
223
+
224
+ /**
225
+ * Emits an error, providing helpful context.
226
+ * @throws HTMLPurifier_ConfigSchema_Exception
227
+ */
228
+ protected function error($target, $msg)
229
+ {
230
+ if ($target !== false) {
231
+ $prefix = ucfirst($target) . ' in ' . $this->getFormattedContext();
232
+ } else {
233
+ $prefix = ucfirst($this->getFormattedContext());
234
+ }
235
+ throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg));
236
+ }
237
+
238
+ /**
239
+ * Returns a formatted context string.
240
+ * @return string
241
+ */
242
+ protected function getFormattedContext()
243
+ {
244
+ return implode(' in ', array_reverse($this->context));
245
+ }
246
+ }
247
+
248
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/ValidatorAtom.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fluent interface for validating the contents of member variables.
5
+ * This should be immutable. See HTMLPurifier_ConfigSchema_Validator for
6
+ * use-cases. We name this an 'atom' because it's ONLY for validations that
7
+ * are independent and usually scalar.
8
+ */
9
+ class HTMLPurifier_ConfigSchema_ValidatorAtom
10
+ {
11
+ /**
12
+ * @type string
13
+ */
14
+ protected $context;
15
+
16
+ /**
17
+ * @type object
18
+ */
19
+ protected $obj;
20
+
21
+ /**
22
+ * @type string
23
+ */
24
+ protected $member;
25
+
26
+ /**
27
+ * @type mixed
28
+ */
29
+ protected $contents;
30
+
31
+ public function __construct($context, $obj, $member)
32
+ {
33
+ $this->context = $context;
34
+ $this->obj = $obj;
35
+ $this->member = $member;
36
+ $this->contents =& $obj->$member;
37
+ }
38
+
39
+ /**
40
+ * @return HTMLPurifier_ConfigSchema_ValidatorAtom
41
+ */
42
+ public function assertIsString()
43
+ {
44
+ if (!is_string($this->contents)) {
45
+ $this->error('must be a string');
46
+ }
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * @return HTMLPurifier_ConfigSchema_ValidatorAtom
52
+ */
53
+ public function assertIsBool()
54
+ {
55
+ if (!is_bool($this->contents)) {
56
+ $this->error('must be a boolean');
57
+ }
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * @return HTMLPurifier_ConfigSchema_ValidatorAtom
63
+ */
64
+ public function assertIsArray()
65
+ {
66
+ if (!is_array($this->contents)) {
67
+ $this->error('must be an array');
68
+ }
69
+ return $this;
70
+ }
71
+
72
+ /**
73
+ * @return HTMLPurifier_ConfigSchema_ValidatorAtom
74
+ */
75
+ public function assertNotNull()
76
+ {
77
+ if ($this->contents === null) {
78
+ $this->error('must not be null');
79
+ }
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * @return HTMLPurifier_ConfigSchema_ValidatorAtom
85
+ */
86
+ public function assertAlnum()
87
+ {
88
+ $this->assertIsString();
89
+ if (!ctype_alnum($this->contents)) {
90
+ $this->error('must be alphanumeric');
91
+ }
92
+ return $this;
93
+ }
94
+
95
+ /**
96
+ * @return HTMLPurifier_ConfigSchema_ValidatorAtom
97
+ */
98
+ public function assertNotEmpty()
99
+ {
100
+ if (empty($this->contents)) {
101
+ $this->error('must not be empty');
102
+ }
103
+ return $this;
104
+ }
105
+
106
+ /**
107
+ * @return HTMLPurifier_ConfigSchema_ValidatorAtom
108
+ */
109
+ public function assertIsLookup()
110
+ {
111
+ $this->assertIsArray();
112
+ foreach ($this->contents as $v) {
113
+ if ($v !== true) {
114
+ $this->error('must be a lookup array');
115
+ }
116
+ }
117
+ return $this;
118
+ }
119
+
120
+ /**
121
+ * @param string $msg
122
+ * @throws HTMLPurifier_ConfigSchema_Exception
123
+ */
124
+ protected function error($msg)
125
+ {
126
+ throw new HTMLPurifier_ConfigSchema_Exception(ucfirst($this->member) . ' in ' . $this->context . ' ' . $msg);
127
+ }
128
+ }
129
+
130
+ // vim: et sw=4 sts=4
vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema.ser ADDED
@@ -0,0 +1 @@
 
1
+ O:25:"HTMLPurifier_ConfigSchema":3:{s:8:"defaults";a:127:{s:19:"Attr.AllowedClasses";N;s:24:"Attr.AllowedFrameTargets";a:0:{}s:15:"Attr.AllowedRel";a:0:{}s:15:"Attr.AllowedRev";a:0:{}s:18:"Attr.ClassUseCDATA";N;s:20:"Attr.DefaultImageAlt";N;s:24:"Attr.DefaultInvalidImage";s:0:"";s:27:"Attr.DefaultInvalidImageAlt";s:13:"Invalid image";s:19:"Attr.DefaultTextDir";s:3:"ltr";s:13:"Attr.EnableID";b:0;s:21:"Attr.ForbiddenClasses";a:0:{}s:13:"Attr.ID.HTML5";N;s:16:"Attr.IDBlacklist";a:0:{}s:22:"Attr.IDBlacklistRegexp";N;s:13:"Attr.IDPrefix";s:0:"";s:18:"Attr.IDPrefixLocal";s:0:"";s:24:"AutoFormat.AutoParagraph";b:0;s:17:"AutoFormat.Custom";a:0:{}s:25:"AutoFormat.DisplayLinkURI";b:0;s:18:"AutoFormat.Linkify";b:0;s:33:"AutoFormat.PurifierLinkify.DocURL";s:3:"#%s";s:26:"AutoFormat.PurifierLinkify";b:0;s:32:"AutoFormat.RemoveEmpty.Predicate";a:4:{s:8:"colgroup";a:0:{}s:2:"th";a:0:{}s:2:"td";a:0:{}s:6:"iframe";a:1:{i:0;s:3:"src";}}s:44:"AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions";a:2:{s:2:"td";b:1;s:2:"th";b:1;}s:33:"AutoFormat.RemoveEmpty.RemoveNbsp";b:0;s:22:"AutoFormat.RemoveEmpty";b:0;s:39:"AutoFormat.RemoveSpansWithoutAttributes";b:0;s:19:"CSS.AllowDuplicates";b:0;s:18:"CSS.AllowImportant";b:0;s:15:"CSS.AllowTricky";b:0;s:16:"CSS.AllowedFonts";N;s:21:"CSS.AllowedProperties";N;s:17:"CSS.DefinitionRev";i:1;s:23:"CSS.ForbiddenProperties";a:0:{}s:16:"CSS.MaxImgLength";s:6:"1200px";s:15:"CSS.Proprietary";b:0;s:11:"CSS.Trusted";b:0;s:20:"Cache.DefinitionImpl";s:10:"Serializer";s:20:"Cache.SerializerPath";N;s:27:"Cache.SerializerPermissions";i:493;s:22:"Core.AggressivelyFixLt";b:1;s:29:"Core.AggressivelyRemoveScript";b:1;s:28:"Core.AllowHostnameUnderscore";b:0;s:23:"Core.AllowParseManyTags";b:0;s:18:"Core.CollectErrors";b:0;s:18:"Core.ColorKeywords";a:148:{s:9:"aliceblue";s:7:"#F0F8FF";s:12:"antiquewhite";s:7:"#FAEBD7";s:4:"aqua";s:7:"#00FFFF";s:10:"aquamarine";s:7:"#7FFFD4";s:5:"azure";s:7:"#F0FFFF";s:5:"beige";s:7:"#F5F5DC";s:6:"bisque";s:7:"#FFE4C4";s:5:"black";s:7:"#000000";s:14:"blanchedalmond";s:7:"#FFEBCD";s:4:"blue";s:7:"#0000FF";s:10:"blueviolet";s:7:"#8A2BE2";s:5:"brown";s:7:"#A52A2A";s:9:"burlywood";s:7:"#DEB887";s:9:"cadetblue";s:7:"#5F9EA0";s:10:"chartreuse";s:7:"#7FFF00";s:9:"chocolate";s:7:"#D2691E";s:5:"coral";s:7:"#FF7F50";s:14:"cornflowerblue";s:7:"#6495ED";s:8:"cornsilk";s:7:"#FFF8DC";s:7:"crimson";s:7:"#DC143C";s:4:"cyan";s:7:"#00FFFF";s:8:"darkblue";s:7:"#00008B";s:8:"darkcyan";s:7:"#008B8B";s:13:"darkgoldenrod";s:7:"#B8860B";s:8:"darkgray";s:7:"#A9A9A9";s:8:"darkgrey";s:7:"#A9A9A9";s:9:"darkgreen";s:7:"#006400";s:9:"darkkhaki";s:7:"#BDB76B";s:11:"darkmagenta";s:7:"#8B008B";s:14:"darkolivegreen";s:7:"#556B2F";s:10:"darkorange";s:7:"#FF8C00";s:10:"darkorchid";s:7:"#9932CC";s:7:"darkred";s:7:"#8B0000";s:10:"darksalmon";s:7:"#E9967A";s:12:"darkseagreen";s:7:"#8FBC8F";s:13:"darkslateblue";s:7:"#483D8B";s:13:"darkslategray";s:7:"#2F4F4F";s:13:"darkslategrey";s:7:"#2F4F4F";s:13:"darkturquoise";s:7:"#00CED1";s:10:"darkviolet";s:7:"#9400D3";s:8:"deeppink";s:7:"#FF1493";s:11:"deepskyblue";s:7:"#00BFFF";s:7:"dimgray";s:7:"#696969";s:7:"dimgrey";s:7:"#696969";s:10:"dodgerblue";s:7:"#1E90FF";s:9:"firebrick";s:7:"#B22222";s:11:"floralwhite";s:7:"#FFFAF0";s:11:"forestgreen";s:7:"#228B22";s:7:"fuchsia";s:7:"#FF00FF";s:9:"gainsboro";s:7:"#DCDCDC";s:10:"ghostwhite";s:7:"#F8F8FF";s:4:"gold";s:7:"#FFD700";s:9:"goldenrod";s:7:"#DAA520";s:4:"gray";s:7:"#808080";s:4:"grey";s:7:"#808080";s:5:"green";s:7:"#008000";s:11:"greenyellow";s:7:"#ADFF2F";s:8:"honeydew";s:7:"#F0FFF0";s:7:"hotpink";s:7:"#FF69B4";s:9:"indianred";s:7:"#CD5C5C";s:6:"indigo";s:7:"#4B0082";s:5:"ivory";s:7:"#FFFFF0";s:5:"khaki";s:7:"#F0E68C";s:8:"lavender";s:7:"#E6E6FA";s:13:"lavenderblush";s:7:"#FFF0F5";s:9:"lawngreen";s:7:"#7CFC00";s:12:"lemonchiffon";s:7:"#FFFACD";s:9:"lightblue";s:7:"#ADD8E6";s:10:"lightcoral";s:7:"#F08080";s:9:"lightcyan";s:7:"#E0FFFF";s:20:"lightgoldenrodyellow";s:7:"#FAFAD2";s:9:"lightgray";s:7:"#D3D3D3";s:9:"lightgrey";s:7:"#D3D3D3";s:10:"lightgreen";s:7:"#90EE90";s:9:"lightpink";s:7:"#FFB6C1";s:11:"lightsalmon";s:7:"#FFA07A";s:13:"lightseagreen";s:7:"#20B2AA";s:12:"lightskyblue";s:7:"#87CEFA";s:14:"lightslategray";s:7:"#778899";s:14:"lightslategrey";s:7:"#778899";s:14:"lightsteelblue";s:7:"#B0C4DE";s:11:"lightyellow";s:7:"#FFFFE0";s:4:"lime";s:7:"#00FF00";s:9:"limegreen";s:7:"#32CD32";s:5:"linen";s:7:"#FAF0E6";s:7:"magenta";s:7:"#FF00FF";s:6:"maroon";s:7:"#800000";s:16:"mediumaquamarine";s:7:"#66CDAA";s:10:"mediumblue";s:7:"#0000CD";s:12:"mediumorchid";s:7:"#BA55D3";s:12:"mediumpurple";s:7:"#9370DB";s:14:"mediumseagreen";s:7:"#3CB371";s:15:"mediumslateblue";s:7:"#7B68EE";s:17:"mediumspringgreen";s:7:"#00FA9A";s:15:"mediumturquoise";s:7:"#48D1CC";s:15:"mediumvioletred";s:7:"#C71585";s:12:"midnightblue";s:7:"#191970";s:9:"mintcream";s:7:"#F5FFFA";s:9:"mistyrose";s:7:"#FFE4E1";s:8:"moccasin";s:7:"#FFE4B5";s:11:"navajowhite";s:7:"#FFDEAD";s:4:"navy";s:7:"#000080";s:7:"oldlace";s:7:"#FDF5E6";s:5:"olive";s:7:"#808000";s:9:"olivedrab";s:7:"#6B8E23";s:6:"orange";s:7:"#FFA500";s:9:"orangered";s:7:"#FF4500";s:6:"orchid";s:7:"#DA70D6";s:13:"palegoldenrod";s:7:"#EEE8AA";s:9:"palegreen";s:7:"#98FB98";s:13:"paleturquoise";s:7:"#AFEEEE";s:13:"palevioletred";s:7:"#DB7093";s:10:"papayawhip";s:7:"#FFEFD5";s:9:"peachpuff";s:7:"#FFDAB9";s:4:"peru";s:7:"#CD853F";s:4:"pink";s:7:"#FFC0CB";s:4:"plum";s:7:"#DDA0DD";s:10:"powderblue";s:7:"#B0E0E6";s:6:"purple";s:7:"#800080";s:13:"rebeccapurple";s:7:"#663399";s:3:"red";s:7:"#FF0000";s:9:"rosybrown";s:7:"#BC8F8F";s:9:"royalblue";s:7:"#4169E1";s:11:"saddlebrown";s:7:"#8B4513";s:6:"salmon";s:7:"#FA8072";s:10:"sandybrown";s:7:"#F4A460";s:8:"seagreen";s:7:"#2E8B57";s:8:"seashell";s:7:"#FFF5EE";s:6:"sienna";s:7:"#A0522D";s:6:"silver";s:7:"#C0C0C0";s:7:"skyblue";s:7:"#87CEEB";s:9:"slateblue";s:7:"#6A5ACD";s:9:"slategray";s:7:"#708090";s:9:"slategrey";s:7:"#708090";s:4:"snow";s:7:"#FFFAFA";s:11:"springgreen";s:7:"#00FF7F";s:9:"steelblue";s:7:"#4682B4";s:3:"tan";s:7:"#D2B48C";s:4:"teal";s:7:"#008080";s:7:"thistle";s:7:"#D8BFD8";s:6:"tomato";s:7:"#FF6347";s:9:"turquoise";s:7:"#40E0D0";s:6:"violet";s:7:"#EE82EE";s:5:"wheat";s:7:"#F5DEB3";s:5:"white";s:7:"#FFFFFF";s:10:"whitesmoke";s:7:"#F5F5F5";s:6:"yellow";s:7:"#FFFF00";s:11:"yellowgreen";s:7:"#9ACD32";}s:30:"Core.ConvertDocumentToFragment";b:1;s:36:"Core.DirectLexLineNumberSyncInterval";i:0;s:20:"Core.DisableExcludes";b:0;s:15:"Core.EnableIDNA";b:0;s:13:"Core.Encoding";s:5:"utf-8";s:26:"Core.EscapeInvalidChildren";b:0;s:22:"Core.EscapeInvalidTags";b:0;s:29:"Core.EscapeNonASCIICharacters";b:0;s:19:"Core.HiddenElements";a:2:{s:6:"script";b:1;s:5:"style";b:1;}s:13:"Core.Language";s:2:"en";s:24:"Core.LegacyEntityDecoder";b:0;s:14:"Core.LexerImpl";N;s:24:"Core.MaintainLineNumbers";N;s:22:"Core.NormalizeNewlines";b:1;s:21:"Core.RemoveInvalidImg";b:1;s:33:"Core.RemoveProcessingInstructions";b:0;s:25:"Core.RemoveScriptContents";N;s:13:"Filter.Custom";a:0:{}s:34:"Filter.ExtractStyleBlocks.Escaping";b:1;s:31:"Filter.ExtractStyleBlocks.Scope";N;s:34:"Filter.ExtractStyleBlocks.TidyImpl";N;s:25:"Filter.ExtractStyleBlocks";b:0;s:14:"Filter.YouTube";b:0;s:12:"HTML.Allowed";N;s:22:"HTML.AllowedAttributes";N;s:20:"HTML.AllowedComments";a:0:{}s:26:"HTML.AllowedCommentsRegexp";N;s:20:"HTML.AllowedElements";N;s:19:"HTML.AllowedModules";N;s:23:"HTML.Attr.Name.UseCDATA";b:0;s:17:"HTML.BlockWrapper";s:1:"p";s:16:"HTML.CoreModules";a:7:{s:9:"Structure";b:1;s:4:"Text";b:1;s:9:"Hypertext";b:1;s:4:"List";b:1;s:22:"NonXMLCommonAttributes";b:1;s:19:"XMLCommonAttributes";b:1;s:16:"CommonAttributes";b:1;}s:18:"HTML.CustomDoctype";N;s:17:"HTML.DefinitionID";N;s:18:"HTML.DefinitionRev";i:1;s:12:"HTML.Doctype";N;s:25:"HTML.FlashAllowFullScreen";b:0;s:24:"HTML.ForbiddenAttributes";a:0:{}s:22:"HTML.ForbiddenElements";a:0:{}s:10:"HTML.Forms";b:0;s:17:"HTML.MaxImgLength";i:1200;s:13:"HTML.Nofollow";b:0;s:11:"HTML.Parent";s:3:"div";s:16:"HTML.Proprietary";b:0;s:14:"HTML.SafeEmbed";b:0;s:15:"HTML.SafeIframe";b:0;s:15:"HTML.SafeObject";b:0;s:18:"HTML.SafeScripting";a:0:{}s:11:"HTML.Strict";b:0;s:16:"HTML.TargetBlank";b:0;s:19:"HTML.TargetNoopener";b:1;s:21:"HTML.TargetNoreferrer";b:1;s:12:"HTML.TidyAdd";a:0:{}s:14:"HTML.TidyLevel";s:6:"medium";s:15:"HTML.TidyRemove";a:0:{}s:12:"HTML.Trusted";b:0;s:10:"HTML.XHTML";b:1;s:28:"Output.CommentScriptContents";b:1;s:19:"Output.FixInnerHTML";b:1;s:18:"Output.FlashCompat";b:0;s:14:"Output.Newline";N;s:15:"Output.SortAttr";b:0;s:17:"Output.TidyFormat";b:0;s:17:"Test.ForceNoIconv";b:0;s:18:"URI.AllowedSchemes";a:7:{s:4:"http";b:1;s:5:"https";b:1;s:6:"mailto";b:1;s:3:"ftp";b:1;s:4:"nntp";b:1;s:4:"news";b:1;s:3:"tel";b:1;}s:8:"URI.Base";N;s:17:"URI.DefaultScheme";s:4:"http";s:16:"URI.DefinitionID";N;s:17:"URI.DefinitionRev";i:1;s:11:"URI.Disable";b:0;s:19:"URI.DisableExternal";b:0;s:28:"URI.DisableExternalResources";b:0;s:20:"URI.DisableResources";b:0;s:8:"URI.Host";N;s:17:"URI.HostBlacklist";a:0:{}s:16:"URI.MakeAbsolute";b:0;s:9:"URI.Munge";N;s:18:"URI.MungeResources";b:0;s:18:"URI.MungeSecretKey";N;s:26:"URI.OverrideAllowedSchemes";b:1;s:20:"URI.SafeIframeRegexp";N;}s:12:"defaultPlist";O:25:"HTMLPurifier_PropertyList":3:{s:7:"