├── composer.json ├── wrAPI ├── exceptions │ ├── JsonException.php │ ├── wrAPIException.php │ ├── FileNotFoundException.php │ └── MethodNotSupportedException.php ├── apis │ ├── Google │ │ ├── .Facebook.php.swp │ │ ├── Directory.php │ │ ├── Auth.php │ │ └── Drive.php │ ├── Api_Interface.php │ └── Abstract_Api.php └── wrAPI.php ├── purifier └── standalone │ └── HTMLPurifier │ ├── ConfigSchema │ ├── schema │ │ ├── info.ini │ │ ├── Attr.IDBlacklist.txt │ │ ├── HTML.TidyAdd.txt │ │ ├── HTML.TidyRemove.txt │ │ ├── CSS.Proprietary.txt │ │ ├── Test.ForceNoIconv.txt │ │ ├── Core.EscapeInvalidTags.txt │ │ ├── CSS.DefinitionRev.txt │ │ ├── URI.DefinitionRev.txt │ │ ├── Attr.AllowedClasses.txt │ │ ├── HTML.Strict.txt │ │ ├── CSS.AllowImportant.txt │ │ ├── HTML.Trusted.txt │ │ ├── HTML.CustomDoctype.txt │ │ ├── HTML.XHTML.txt │ │ ├── Attr.AllowedRev.txt │ │ ├── Attr.ForbiddenClasses.txt │ │ ├── URI.DefaultScheme.txt │ │ ├── URI.DefinitionID.txt │ │ ├── AutoFormat.Linkify.txt │ │ ├── Output.FlashCompat.txt │ │ ├── Attr.AllowedRel.txt │ │ ├── Core.Language.txt │ │ ├── Output.CommentScriptContents.txt │ │ ├── URI.Disable.txt │ │ ├── Attr.DefaultInvalidImageAlt.txt │ │ ├── Core.NormalizeNewlines.txt │ │ ├── Attr.DefaultTextDir.txt │ │ ├── Core.RemoveScriptContents.txt │ │ ├── HTML.FlashAllowFullScreen.txt │ │ ├── Filter.Custom.txt │ │ ├── URI.HostBlacklist.txt │ │ ├── AutoFormat.Custom.txt │ │ ├── Attr.IDBlacklistRegexp.txt │ │ ├── HTML.Parent.txt │ │ ├── Attr.DefaultInvalidImage.txt │ │ ├── AutoFormat.RemoveSpansWithoutAttributes.txt │ │ ├── AutoFormat.PurifierLinkify.txt │ │ ├── AutoFormat.DisplayLinkURI.txt │ │ ├── URI.OverrideAllowedSchemes.txt │ │ ├── HTML.Proprietary.txt │ │ ├── Cache.SerializerPath.txt │ │ ├── Core.RemoveInvalidImg.txt │ │ ├── AutoFormat.PurifierLinkify.DocURL.txt │ │ ├── Output.Newline.txt │ │ ├── AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt │ │ ├── Cache.DefinitionImpl.txt │ │ ├── Core.EscapeInvalidChildren.txt │ │ ├── URI.MakeAbsolute.txt │ │ ├── Core.RemoveProcessingInstructions.txt │ │ ├── Core.CollectErrors.txt │ │ ├── URI.DisableExternal.txt │ │ ├── HTML.SafeObject.txt │ │ ├── URI.DisableResources.txt │ │ ├── CSS.AllowTricky.txt │ │ ├── Core.ConvertDocumentToFragment.txt │ │ ├── HTML.Doctype.txt │ │ ├── Attr.IDPrefix.txt │ │ ├── HTML.Attr.Name.UseCDATA.txt │ │ ├── Attr.DefaultImageAlt.txt │ │ ├── CSS.ForbiddenProperties.txt │ │ ├── AutoFormat.RemoveEmpty.RemoveNbsp.txt │ │ ├── HTML.SafeEmbed.txt │ │ ├── URI.AllowedSchemes.txt │ │ ├── HTML.MaxImgLength.txt │ │ ├── Filter.ExtractStyleBlocks.Escaping.txt │ │ ├── Filter.YouTube.txt │ │ ├── Output.SortAttr.txt │ │ ├── HTML.DefinitionRev.txt │ │ ├── URI.DisableExternalResources.txt │ │ ├── Core.MaintainLineNumbers.txt │ │ ├── Attr.AllowedFrameTargets.txt │ │ ├── Core.EscapeNonASCIICharacters.txt │ │ ├── HTML.BlockWrapper.txt │ │ ├── Core.HiddenElements.txt │ │ ├── Filter.ExtractStyleBlocks.TidyImpl.txt │ │ ├── URI.MungeResources.txt │ │ ├── CSS.AllowedProperties.txt │ │ ├── CSS.MaxImgLength.txt │ │ ├── HTML.AllowedAttributes.txt │ │ ├── Attr.EnableID.txt │ │ ├── Attr.IDPrefixLocal.txt │ │ ├── URI.Base.txt │ │ ├── Core.DirectLexLineNumberSyncInterval.txt │ │ ├── HTML.CoreModules.txt │ │ ├── HTML.TidyLevel.txt │ │ ├── Core.AggressivelyFixLt.txt │ │ ├── Core.ColorKeywords.txt │ │ ├── HTML.AllowedModules.txt │ │ ├── Core.Encoding.txt │ │ ├── HTML.ForbiddenElements.txt │ │ ├── URI.Host.txt │ │ ├── Output.TidyFormat.txt │ │ ├── HTML.ForbiddenAttributes.txt │ │ ├── HTML.AllowedElements.txt │ │ ├── Attr.ClassUseCDATA.txt │ │ ├── HTML.Allowed.txt │ │ ├── URI.MungeSecretKey.txt │ │ ├── Core.LexerImpl.txt │ │ ├── AutoFormat.AutoParagraph.txt │ │ ├── Filter.ExtractStyleBlocks.Scope.txt │ │ ├── HTML.DefinitionID.txt │ │ ├── AutoFormat.RemoveEmpty.txt │ │ ├── Filter.ExtractStyleBlocks.txt │ │ └── URI.Munge.txt │ ├── Exception.php │ ├── Interchange │ │ ├── Id.php │ │ └── Directive.php │ ├── Interchange.php │ ├── Builder │ │ ├── ConfigSchema.php │ │ └── Xml.php │ ├── ValidatorAtom.php │ ├── InterchangeBuilder.php │ ├── Validator.php │ └── schema.ser │ ├── Printer │ ├── ConfigForm.js │ ├── ConfigForm.css │ ├── CSSDefinition.php │ └── HTMLDefinition.php │ ├── Language │ ├── classes │ │ └── en-x-test.php │ └── messages │ │ ├── en-x-test.php │ │ ├── en-x-testmini.php │ │ └── en.php │ ├── DefinitionCache │ └── Serializer │ │ └── URI │ │ └── 4.2.0,05c766101e813c246917b022f97b5e6e,1.ser │ ├── Filter │ ├── YouTube.php │ └── ExtractStyleBlocks.php │ ├── EntityLookup │ └── entities.ser │ ├── Lexer │ └── PEARSax3.php │ └── Printer.php ├── phpunit.xml.dist ├── tests ├── bootstrap.php └── test_wordpress_plugin_tests.php ├── options-ajax.php ├── extend-cron.php ├── extend-headline.php ├── js └── options.js ├── readme.txt ├── README.md ├── .travis.yml ├── extend-clean.php ├── options.php └── docs-to-wp.php /composer.json: -------------------------------------------------------------------------------- 1 | { "require-dev": { "codeclimate/php-test-reporter": "dev-master" } } 2 | -------------------------------------------------------------------------------- /wrAPI/exceptions/JsonException.php: -------------------------------------------------------------------------------- 1 | 8 | Whether or not to allow safe, proprietary CSS values. 9 |

10 | --# vim: et sw=4 sts=4 11 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Language/messages/en-x-test.php: -------------------------------------------------------------------------------- 1 | 'HTML Purifier X' 9 | ); 10 | 11 | // vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Test.ForceNoIconv.txt: -------------------------------------------------------------------------------- 1 | Test.ForceNoIconv 2 | TYPE: bool 3 | DEFAULT: false 4 | --DESCRIPTION-- 5 | When set to true, HTMLPurifier_Encoder will act as if iconv does not exist 6 | and use only pure PHP implementations. 7 | --# vim: et sw=4 sts=4 8 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidTags.txt: -------------------------------------------------------------------------------- 1 | Core.EscapeInvalidTags 2 | TYPE: bool 3 | DEFAULT: false 4 | --DESCRIPTION-- 5 | When true, invalid tags will be written back to the document as plain text. 6 | Otherwise, they are silently dropped. 7 | --# vim: et sw=4 sts=4 8 | -------------------------------------------------------------------------------- /wrAPI/apis/Api_Interface.php: -------------------------------------------------------------------------------- 1 | 8 | Revision identifier for your custom definition. See 9 | %HTML.DefinitionRev for details. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.DefinitionRev.txt: -------------------------------------------------------------------------------- 1 | URI.DefinitionRev 2 | TYPE: int 3 | VERSION: 2.1.0 4 | DEFAULT: 1 5 | --DESCRIPTION-- 6 | 7 |

8 | Revision identifier for your custom definition. See 9 | %HTML.DefinitionRev for details. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.AllowedClasses.txt: -------------------------------------------------------------------------------- 1 | Attr.AllowedClasses 2 | TYPE: lookup/null 3 | VERSION: 4.0.0 4 | DEFAULT: null 5 | --DESCRIPTION-- 6 | List of allowed class values in the class attribute. By default, this is null, 7 | which means all classes are allowed. 8 | --# vim: et sw=4 sts=4 9 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.Strict.txt: -------------------------------------------------------------------------------- 1 | HTML.Strict 2 | TYPE: bool 3 | VERSION: 1.3.0 4 | DEFAULT: false 5 | DEPRECATED-VERSION: 1.7.0 6 | DEPRECATED-USE: HTML.Doctype 7 | --DESCRIPTION-- 8 | Determines whether or not to use Transitional (loose) or Strict rulesets. 9 | --# vim: et sw=4 sts=4 10 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/CSS.AllowImportant.txt: -------------------------------------------------------------------------------- 1 | CSS.AllowImportant 2 | TYPE: bool 3 | DEFAULT: false 4 | VERSION: 3.1.0 5 | --DESCRIPTION-- 6 | This parameter determines whether or not !important cascade modifiers should 7 | be allowed in user CSS. If false, !important will stripped. 8 | --# vim: et sw=4 sts=4 9 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.Trusted.txt: -------------------------------------------------------------------------------- 1 | HTML.Trusted 2 | TYPE: bool 3 | VERSION: 2.0.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | Indicates whether or not the user input is trusted or not. If the input is 7 | trusted, a more expansive set of allowed tags and attributes will be used. 8 | --# vim: et sw=4 sts=4 9 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt: -------------------------------------------------------------------------------- 1 | HTML.CustomDoctype 2 | TYPE: string/null 3 | VERSION: 2.0.1 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 | A custom doctype for power-users who defined there own document 8 | type. This directive only applies when %HTML.Doctype is blank. 9 | --# vim: et sw=4 sts=4 10 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.XHTML.txt: -------------------------------------------------------------------------------- 1 | HTML.XHTML 2 | TYPE: bool 3 | DEFAULT: true 4 | VERSION: 1.1.0 5 | DEPRECATED-VERSION: 1.7.0 6 | DEPRECATED-USE: HTML.Doctype 7 | --DESCRIPTION-- 8 | Determines whether or not output is XHTML 1.0 or HTML 4.01 flavor. 9 | --ALIASES-- 10 | Core.XHTML 11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Language/messages/en-x-testmini.php: -------------------------------------------------------------------------------- 1 | 'HTML Purifier XNone' 10 | ); 11 | 12 | // vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRev.txt: -------------------------------------------------------------------------------- 1 | Attr.AllowedRev 2 | TYPE: lookup 3 | VERSION: 1.6.0 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 | List of allowed reverse document relationships in the rev attribute. This 7 | attribute is a bit of an edge-case; if you don't know what it is for, stay 8 | away. 9 | --# vim: et sw=4 sts=4 10 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.ForbiddenClasses.txt: -------------------------------------------------------------------------------- 1 | Attr.ForbiddenClasses 2 | TYPE: lookup 3 | VERSION: 4.0.0 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 | List of forbidden class values in the class attribute. By default, this is 7 | empty, which means that no classes are forbidden. See also %Attr.AllowedClasses. 8 | --# vim: et sw=4 sts=4 9 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt: -------------------------------------------------------------------------------- 1 | URI.DefaultScheme 2 | TYPE: string 3 | DEFAULT: 'http' 4 | --DESCRIPTION-- 5 | 6 |

7 | Defines through what scheme the output will be served, in order to 8 | select the proper object validator when no scheme information is present. 9 |

10 | --# vim: et sw=4 sts=4 11 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.DefinitionID.txt: -------------------------------------------------------------------------------- 1 | URI.DefinitionID 2 | TYPE: string/null 3 | VERSION: 2.1.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | Unique identifier for a custom-built URI definition. If you want 9 | to add custom URIFilters, you must specify this value. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.Linkify.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.Linkify 2 | TYPE: bool 3 | VERSION: 2.0.1 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | 7 |

8 | This directive turns on linkification, auto-linking http, ftp and 9 | https URLs. a tags with the href attribute 10 | must be allowed. 11 |

12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Output.FlashCompat.txt: -------------------------------------------------------------------------------- 1 | Output.FlashCompat 2 | TYPE: bool 3 | VERSION: 4.1.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | If true, HTML Purifier will generate Internet Explorer compatibility 8 | code for all object code. This is highly recommended if you enable 9 | %HTML.SafeObject. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRel.txt: -------------------------------------------------------------------------------- 1 | Attr.AllowedRel 2 | TYPE: lookup 3 | VERSION: 1.6.0 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 | List of allowed forward document relationships in the rel attribute. Common 7 | values may be nofollow or print. By default, this is empty, meaning that no 8 | document relationships are allowed. 9 | --# vim: et sw=4 sts=4 10 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Printer/ConfigForm.css: -------------------------------------------------------------------------------- 1 | 2 | .hp-config {} 3 | 4 | .hp-config tbody th {text-align:right; padding-right:0.5em;} 5 | .hp-config thead, .hp-config .namespace {background:#3C578C; color:#FFF;} 6 | .hp-config .namespace th {text-align:center;} 7 | .hp-config .verbose {display:none;} 8 | .hp-config .controls {text-align:center;} 9 | 10 | /* vim: et sw=4 sts=4 */ 11 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.Language.txt: -------------------------------------------------------------------------------- 1 | Core.Language 2 | TYPE: string 3 | VERSION: 2.0.0 4 | DEFAULT: 'en' 5 | --DESCRIPTION-- 6 | 7 | ISO 639 language code for localizable things in HTML Purifier to use, 8 | which is mainly error reporting. There is currently only an English (en) 9 | translation, so this directive is currently useless. 10 | --# vim: et sw=4 sts=4 11 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Output.CommentScriptContents.txt: -------------------------------------------------------------------------------- 1 | Output.CommentScriptContents 2 | TYPE: bool 3 | VERSION: 2.0.0 4 | DEFAULT: true 5 | --DESCRIPTION-- 6 | Determines whether or not HTML Purifier should attempt to fix up the 7 | contents of script tags for legacy browsers with comments. 8 | --ALIASES-- 9 | Core.CommentScriptContents 10 | --# vim: et sw=4 sts=4 11 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.Disable.txt: -------------------------------------------------------------------------------- 1 | URI.Disable 2 | TYPE: bool 3 | VERSION: 1.3.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | 7 |

8 | Disables all URIs in all forms. Not sure why you'd want to do that 9 | (after all, the Internet's founded on the notion of a hyperlink). 10 |

11 | 12 | --ALIASES-- 13 | Attr.DisableURI 14 | --# vim: et sw=4 sts=4 15 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImageAlt.txt: -------------------------------------------------------------------------------- 1 | Attr.DefaultInvalidImageAlt 2 | TYPE: string 3 | DEFAULT: 'Invalid image' 4 | --DESCRIPTION-- 5 | This is the content of the alt tag of an invalid image if the user had not 6 | previously specified an alt attribute. It has no effect when the image is 7 | valid but there was no alt attribute present. 8 | --# vim: et sw=4 sts=4 9 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.NormalizeNewlines.txt: -------------------------------------------------------------------------------- 1 | Core.NormalizeNewlines 2 | TYPE: bool 3 | VERSION: 4.2.0 4 | DEFAULT: true 5 | --DESCRIPTION-- 6 |

7 | Whether or not to normalize newlines to the operating 8 | system default. When false, HTML Purifier 9 | will attempt to preserve mixed newline files. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.DefaultTextDir.txt: -------------------------------------------------------------------------------- 1 | Attr.DefaultTextDir 2 | TYPE: string 3 | DEFAULT: 'ltr' 4 | --DESCRIPTION-- 5 | Defines the default text direction (ltr or rtl) of the document being 6 | parsed. This generally is the same as the value of the dir attribute in 7 | HTML, or ltr if that is not specified. 8 | --ALLOWED-- 9 | 'ltr', 'rtl' 10 | --# vim: et sw=4 sts=4 11 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.RemoveScriptContents.txt: -------------------------------------------------------------------------------- 1 | Core.RemoveScriptContents 2 | TYPE: bool/null 3 | DEFAULT: NULL 4 | VERSION: 2.0.0 5 | DEPRECATED-VERSION: 2.1.0 6 | DEPRECATED-USE: Core.HiddenElements 7 | --DESCRIPTION-- 8 |

9 | This directive enables HTML Purifier to remove not only script tags 10 | but all of their contents. 11 |

12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.FlashAllowFullScreen.txt: -------------------------------------------------------------------------------- 1 | HTML.FlashAllowFullScreen 2 | TYPE: bool 3 | VERSION: 4.2.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | Whether or not to permit embedded Flash content from 8 | %HTML.SafeObject to expand to the full screen. Corresponds to 9 | the allowFullScreen parameter. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt: -------------------------------------------------------------------------------- 1 | Filter.Custom 2 | TYPE: list 3 | VERSION: 3.1.0 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 |

7 | This directive can be used to add custom filters; it is nearly the 8 | equivalent of the now deprecated HTMLPurifier->addFilter() 9 | method. Specify an array of concrete implementations. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.HostBlacklist.txt: -------------------------------------------------------------------------------- 1 | URI.HostBlacklist 2 | TYPE: list 3 | VERSION: 1.3.0 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 | List of strings that are forbidden in the host of any URI. Use it to kill 7 | domain names of spam, etc. Note that it will catch anything in the domain, 8 | so moo.com will catch moo.com.example.com. 9 | --# vim: et sw=4 sts=4 10 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.Custom.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.Custom 2 | TYPE: list 3 | VERSION: 2.0.1 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 | 7 |

8 | This directive can be used to add custom auto-format injectors. 9 | Specify an array of injector names (class name minus the prefix) 10 | or concrete implementations. Injector class must exist. 11 |

12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/DefinitionCache/Serializer/URI/4.2.0,05c766101e813c246917b022f97b5e6e,1.ser: -------------------------------------------------------------------------------- 1 | O:26:"HTMLPurifier_URIDefinition":7:{s:4:"type";s:3:"URI";s:10:"*filters";a:1:{s:13:"HostBlacklist";O:36:"HTMLPurifier_URIFilter_HostBlacklist":3:{s:4:"name";s:13:"HostBlacklist";s:12:"*blacklist";a:0:{}s:4:"post";b:0;}}s:14:"*postFilters";a:0:{}s:4:"base";N;s:4:"host";N;s:13:"defaultScheme";s:4:"http";s:5:"setup";b:1;} -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklistRegexp.txt: -------------------------------------------------------------------------------- 1 | Attr.IDBlacklistRegexp 2 | TYPE: string/null 3 | VERSION: 1.6.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | PCRE regular expression to be matched against all IDs. If the expression is 7 | matches, the ID is rejected. Use this with care: may cause significant 8 | degradation. ID matching is done after all other validation. 9 | --# vim: et sw=4 sts=4 10 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.Parent.txt: -------------------------------------------------------------------------------- 1 | HTML.Parent 2 | TYPE: string 3 | VERSION: 1.3.0 4 | DEFAULT: 'div' 5 | --DESCRIPTION-- 6 | 7 |

8 | String name of element that HTML fragment passed to library will be 9 | inserted in. An interesting variation would be using span as the 10 | parent element, meaning that only inline tags would be allowed. 11 |

12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImage.txt: -------------------------------------------------------------------------------- 1 | Attr.DefaultInvalidImage 2 | TYPE: string 3 | DEFAULT: '' 4 | --DESCRIPTION-- 5 | This is the default image an img tag will be pointed to if it does not have 6 | a valid src attribute. In future versions, we may allow the image tag to 7 | be removed completely, but due to design issues, this is not possible right 8 | now. 9 | --# vim: et sw=4 sts=4 10 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveSpansWithoutAttributes.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.RemoveSpansWithoutAttributes 2 | TYPE: bool 3 | VERSION: 4.0.1 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | This directive causes span tags without any attributes 8 | to be removed. It will also remove spans that had all attributes 9 | removed during processing. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.PurifierLinkify 2 | TYPE: bool 3 | VERSION: 2.0.1 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | 7 |

8 | Internal auto-formatter that converts configuration directives in 9 | syntax %Namespace.Directive to links. a tags 10 | with the href attribute must be allowed. 11 |

12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.DisplayLinkURI.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.DisplayLinkURI 2 | TYPE: bool 3 | VERSION: 3.2.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | This directive turns on the in-text display of URIs in <a> tags, and disables 8 | those links. For example, example becomes 9 | example (http://example.com). 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.OverrideAllowedSchemes.txt: -------------------------------------------------------------------------------- 1 | URI.OverrideAllowedSchemes 2 | TYPE: bool 3 | DEFAULT: true 4 | --DESCRIPTION-- 5 | If this is set to true (which it is by default), you can override 6 | %URI.AllowedSchemes by simply registering a HTMLPurifier_URIScheme to the 7 | registry. If false, you will also have to update that directive in order 8 | to add more schemes. 9 | --# vim: et sw=4 sts=4 10 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.Proprietary.txt: -------------------------------------------------------------------------------- 1 | HTML.Proprietary 2 | TYPE: bool 3 | VERSION: 3.1.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | Whether or not to allow proprietary elements and attributes in your 8 | documents, as per HTMLPurifier_HTMLModule_Proprietary. 9 | Warning: This can cause your documents to stop 10 | validating! 11 |

12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPath.txt: -------------------------------------------------------------------------------- 1 | Cache.SerializerPath 2 | TYPE: string/null 3 | VERSION: 2.0.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | Absolute path with no trailing slash to store serialized definitions in. 9 | Default is within the 10 | HTML Purifier library inside DefinitionCache/Serializer. This 11 | path must be writable by the webserver. 12 |

13 | --# vim: et sw=4 sts=4 14 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.RemoveInvalidImg.txt: -------------------------------------------------------------------------------- 1 | Core.RemoveInvalidImg 2 | TYPE: bool 3 | DEFAULT: true 4 | VERSION: 1.3.0 5 | --DESCRIPTION-- 6 | 7 |

8 | This directive enables pre-emptive URI checking in img 9 | tags, as the attribute validation strategy is not authorized to 10 | remove elements from the document. Revert to pre-1.3.0 behavior by setting to false. 11 |

12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.DocURL.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.PurifierLinkify.DocURL 2 | TYPE: string 3 | VERSION: 2.0.1 4 | DEFAULT: '#%s' 5 | ALIASES: AutoFormatParam.PurifierLinkifyDocURL 6 | --DESCRIPTION-- 7 |

8 | Location of configuration documentation to link to, let %s substitute 9 | into the configuration's namespace and directive names sans the percent 10 | sign. 11 |

12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | tests 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Output.Newline.txt: -------------------------------------------------------------------------------- 1 | Output.Newline 2 | TYPE: string/null 3 | VERSION: 2.0.1 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | Newline string to format final output with. If left null, HTML Purifier 9 | will auto-detect the default newline type of the system and use that; 10 | you can manually override it here. Remember, \r\n is Windows, \r 11 | is Mac, and \n is Unix. 12 |

13 | --# vim: et sw=4 sts=4 14 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions 2 | TYPE: lookup 3 | VERSION: 4.0.0 4 | DEFAULT: array('td' => true, 'th' => true) 5 | --DESCRIPTION-- 6 |

7 | When %AutoFormat.RemoveEmpty and %AutoFormat.RemoveEmpty.RemoveNbsp 8 | are enabled, this directive defines what HTML elements should not be 9 | removede if they have only a non-breaking space in them. 10 |

11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Cache.DefinitionImpl.txt: -------------------------------------------------------------------------------- 1 | Cache.DefinitionImpl 2 | TYPE: string/null 3 | VERSION: 2.0.0 4 | DEFAULT: 'Serializer' 5 | --DESCRIPTION-- 6 | 7 | This directive defines which method to use when caching definitions, 8 | the complex data-type that makes HTML Purifier tick. Set to null 9 | to disable caching (not recommended, as you will see a definite 10 | performance degradation). 11 | 12 | --ALIASES-- 13 | Core.DefinitionCache 14 | --# vim: et sw=4 sts=4 15 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidChildren.txt: -------------------------------------------------------------------------------- 1 | Core.EscapeInvalidChildren 2 | TYPE: bool 3 | DEFAULT: false 4 | --DESCRIPTION-- 5 | When true, a child is found that is not allowed in the context of the 6 | parent element will be transformed into text as if it were ASCII. When 7 | false, that element and all internal tags will be dropped, though text will 8 | be preserved. There is no option for dropping the element but preserving 9 | child nodes. 10 | --# vim: et sw=4 sts=4 11 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.MakeAbsolute.txt: -------------------------------------------------------------------------------- 1 | URI.MakeAbsolute 2 | TYPE: bool 3 | VERSION: 2.1.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | 7 |

8 | Converts all URIs into absolute forms. This is useful when the HTML 9 | being filtered assumes a specific base path, but will actually be 10 | viewed in a different context (and setting an alternate base URI is 11 | not possible). %URI.Base must be set for this directive to work. 12 |

13 | --# vim: et sw=4 sts=4 14 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.RemoveProcessingInstructions.txt: -------------------------------------------------------------------------------- 1 | Core.RemoveProcessingInstructions 2 | TYPE: bool 3 | VERSION: 4.2.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | Instead of escaping processing instructions in the form <? ... 7 | ?>, remove it out-right. This may be useful if the HTML 8 | you are validating contains XML processing instruction gunk, however, 9 | it can also be user-unfriendly for people attempting to post PHP 10 | snippets. 11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.CollectErrors.txt: -------------------------------------------------------------------------------- 1 | Core.CollectErrors 2 | TYPE: bool 3 | VERSION: 2.0.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | 7 | Whether or not to collect errors found while filtering the document. This 8 | is a useful way to give feedback to your users. Warning: 9 | Currently this feature is very patchy and experimental, with lots of 10 | possible error messages not yet implemented. It will not cause any 11 | problems, but it may not help your users either. 12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.DisableExternal.txt: -------------------------------------------------------------------------------- 1 | URI.DisableExternal 2 | TYPE: bool 3 | VERSION: 1.2.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | Disables links to external websites. This is a highly effective anti-spam 7 | and anti-pagerank-leech measure, but comes at a hefty price: nolinks or 8 | images outside of your domain will be allowed. Non-linkified URIs will 9 | still be preserved. If you want to be able to link to subdomains or use 10 | absolute URIs, specify %URI.Host for your website. 11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.SafeObject.txt: -------------------------------------------------------------------------------- 1 | HTML.SafeObject 2 | TYPE: bool 3 | VERSION: 3.1.1 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | Whether or not to permit object tags in documents, with a number of extra 8 | security features added to prevent script execution. This is similar to 9 | what websites like MySpace do to object tags. You should also enable 10 | %Output.FlashCompat in order to generate Internet Explorer 11 | compatibility code for your object tags. 12 |

13 | --# vim: et sw=4 sts=4 14 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.DisableResources.txt: -------------------------------------------------------------------------------- 1 | URI.DisableResources 2 | TYPE: bool 3 | VERSION: 4.2.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | Disables embedding resources, essentially meaning no pictures. You can 8 | still link to them though. See %URI.DisableExternalResources for why 9 | this might be a good idea. 10 |

11 |

12 | Note: While this directive has been available since 1.3.0, 13 | it didn't actually start doing anything until 4.2.0. 14 |

15 | --# vim: et sw=4 sts=4 16 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/CSS.AllowTricky.txt: -------------------------------------------------------------------------------- 1 | CSS.AllowTricky 2 | TYPE: bool 3 | DEFAULT: false 4 | VERSION: 3.1.0 5 | --DESCRIPTION-- 6 | This parameter determines whether or not to allow "tricky" CSS properties and 7 | values. Tricky CSS properties/values can drastically modify page layout or 8 | be used for deceptive practices but do not directly constitute a security risk. 9 | For example, display:none; is considered a tricky property that 10 | will only be allowed if this directive is set to true. 11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.ConvertDocumentToFragment.txt: -------------------------------------------------------------------------------- 1 | Core.ConvertDocumentToFragment 2 | TYPE: bool 3 | DEFAULT: true 4 | --DESCRIPTION-- 5 | 6 | This parameter determines whether or not the filter should convert 7 | input that is a full document with html and body tags to a fragment 8 | of just the contents of a body tag. This parameter is simply something 9 | HTML Purifier can do during an edge-case: for most inputs, this 10 | processing is not necessary. 11 | 12 | --ALIASES-- 13 | Core.AcceptFullDocuments 14 | --# vim: et sw=4 sts=4 15 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.Doctype.txt: -------------------------------------------------------------------------------- 1 | HTML.Doctype 2 | TYPE: string/null 3 | DEFAULT: NULL 4 | --DESCRIPTION-- 5 | Doctype to use during filtering. Technically speaking this is not actually 6 | a doctype (as it does not identify a corresponding DTD), but we are using 7 | this name for sake of simplicity. When non-blank, this will override any 8 | older directives like %HTML.XHTML or %HTML.Strict. 9 | --ALLOWED-- 10 | 'HTML 4.01 Transitional', 'HTML 4.01 Strict', 'XHTML 1.0 Transitional', 'XHTML 1.0 Strict', 'XHTML 1.1' 11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefix.txt: -------------------------------------------------------------------------------- 1 | Attr.IDPrefix 2 | TYPE: string 3 | VERSION: 1.2.0 4 | DEFAULT: '' 5 | --DESCRIPTION-- 6 | String to prefix to IDs. If you have no idea what IDs your pages may use, 7 | you may opt to simply add a prefix to all user-submitted ID attributes so 8 | that they are still usable, but will not conflict with core page IDs. 9 | Example: setting the directive to 'user_' will result in a user submitted 10 | 'foo' to become 'user_foo' Be sure to set %HTML.EnableAttrID to true 11 | before using this. 12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.Attr.Name.UseCDATA.txt: -------------------------------------------------------------------------------- 1 | HTML.Attr.Name.UseCDATA 2 | TYPE: bool 3 | DEFAULT: false 4 | VERSION: 4.0.0 5 | --DESCRIPTION-- 6 | The W3C specification DTD defines the name attribute to be CDATA, not ID, due 7 | to limitations of DTD. In certain documents, this relaxed behavior is desired, 8 | whether it is to specify duplicate names, or to specify names that would be 9 | illegal IDs (for example, names that begin with a digit.) Set this configuration 10 | directive to true to use the relaxed parsing rules. 11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.DefaultImageAlt.txt: -------------------------------------------------------------------------------- 1 | Attr.DefaultImageAlt 2 | TYPE: string/null 3 | DEFAULT: null 4 | VERSION: 3.2.0 5 | --DESCRIPTION-- 6 | This is the content of the alt tag of an image if the user had not 7 | previously specified an alt attribute. This applies to all images without 8 | a valid alt attribute, as opposed to %Attr.DefaultInvalidImageAlt, which 9 | only applies to invalid images, and overrides in the case of an invalid image. 10 | Default behavior with null is to use the basename of the src tag for the alt. 11 | --# vim: et sw=4 sts=4 12 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/CSS.ForbiddenProperties.txt: -------------------------------------------------------------------------------- 1 | CSS.ForbiddenProperties 2 | TYPE: lookup 3 | VERSION: 4.2.0 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 |

7 | This is the logical inverse of %CSS.AllowedProperties, and it will 8 | override that directive or any other directive. If possible, 9 | %CSS.AllowedProperties is recommended over this directive, 10 | because it can sometimes be difficult to tell whether or not you've 11 | forbidden all of the CSS properties you truly would like to disallow. 12 |

13 | --# vim: et sw=4 sts=4 14 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.RemoveEmpty.RemoveNbsp 2 | TYPE: bool 3 | VERSION: 4.0.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | When enabled, HTML Purifier will treat any elements that contain only 8 | non-breaking spaces as well as regular whitespace as empty, and remove 9 | them when %AutoForamt.RemoveEmpty is enabled. 10 |

11 |

12 | See %AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions for a list of elements 13 | that don't have this behavior applied to them. 14 |

15 | --# vim: et sw=4 sts=4 16 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.SafeEmbed.txt: -------------------------------------------------------------------------------- 1 | HTML.SafeEmbed 2 | TYPE: bool 3 | VERSION: 3.1.1 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | Whether or not to permit embed tags in documents, with a number of extra 8 | security features added to prevent script execution. This is similar to 9 | what websites like MySpace do to embed tags. Embed is a proprietary 10 | element and will cause your website to stop validating; you should 11 | see if you can use %Output.FlashCompat with %HTML.SafeObject instead 12 | first.

13 | --# vim: et sw=4 sts=4 14 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.AllowedSchemes.txt: -------------------------------------------------------------------------------- 1 | URI.AllowedSchemes 2 | TYPE: lookup 3 | --DEFAULT-- 4 | array ( 5 | 'http' => true, 6 | 'https' => true, 7 | 'mailto' => true, 8 | 'ftp' => true, 9 | 'nntp' => true, 10 | 'news' => true, 11 | ) 12 | --DESCRIPTION-- 13 | Whitelist that defines the schemes that a URI is allowed to have. This 14 | prevents XSS attacks from using pseudo-schemes like javascript or mocha. 15 | There is also support for the data and file 16 | URI schemes, but they are not enabled by default. 17 | --# vim: et sw=4 sts=4 18 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.MaxImgLength.txt: -------------------------------------------------------------------------------- 1 | HTML.MaxImgLength 2 | TYPE: int/null 3 | DEFAULT: 1200 4 | VERSION: 3.1.1 5 | --DESCRIPTION-- 6 |

7 | This directive controls the maximum number of pixels in the width and 8 | height attributes in img tags. This is 9 | in place to prevent imagecrash attacks, disable with null at your own risk. 10 | This directive is similar to %CSS.MaxImgLength, and both should be 11 | concurrently edited, although there are 12 | subtle differences in the input format (the HTML max is an integer). 13 |

14 | --# vim: et sw=4 sts=4 15 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Escaping.txt: -------------------------------------------------------------------------------- 1 | Filter.ExtractStyleBlocks.Escaping 2 | TYPE: bool 3 | VERSION: 3.0.0 4 | DEFAULT: true 5 | ALIASES: Filter.ExtractStyleBlocksEscaping, FilterParam.ExtractStyleBlocksEscaping 6 | --DESCRIPTION-- 7 | 8 |

9 | Whether or not to escape the dangerous characters <, > and & 10 | as \3C, \3E and \26, respectively. This is can be safely set to false 11 | if the contents of StyleBlocks will be placed in an external stylesheet, 12 | where there is no risk of it being interpreted as HTML. 13 |

14 | --# vim: et sw=4 sts=4 15 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt: -------------------------------------------------------------------------------- 1 | Filter.YouTube 2 | TYPE: bool 3 | VERSION: 3.1.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | Warning: Deprecated in favor of %HTML.SafeObject and 8 | %Output.FlashCompat (turn both on to allow YouTube videos and other 9 | Flash content). 10 |

11 |

12 | This directive enables YouTube video embedding in HTML Purifier. Check 13 | this document 14 | on embedding videos for more information on what this filter does. 15 |

16 | --# vim: et sw=4 sts=4 17 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Output.SortAttr.txt: -------------------------------------------------------------------------------- 1 | Output.SortAttr 2 | TYPE: bool 3 | VERSION: 3.2.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | If true, HTML Purifier will sort attributes by name before writing them back 8 | to the document, converting a tag like: <el b="" a="" c="" /> 9 | to <el a="" b="" c="" />. This is a workaround for 10 | a bug in FCKeditor which causes it to swap attributes order, adding noise 11 | to text diffs. If you're not seeing this bug, chances are, you don't need 12 | this directive. 13 |

14 | --# vim: et sw=4 sts=4 15 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionRev.txt: -------------------------------------------------------------------------------- 1 | HTML.DefinitionRev 2 | TYPE: int 3 | VERSION: 2.0.0 4 | DEFAULT: 1 5 | --DESCRIPTION-- 6 | 7 |

8 | Revision identifier for your custom definition specified in 9 | %HTML.DefinitionID. This serves the same purpose: uniquely identifying 10 | your custom definition, but this one does so in a chronological 11 | context: revision 3 is more up-to-date then revision 2. Thus, when 12 | this gets incremented, the cache handling is smart enough to clean 13 | up any older revisions of your definition as well as flush the 14 | cache. 15 |

16 | --# vim: et sw=4 sts=4 17 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.DisableExternalResources.txt: -------------------------------------------------------------------------------- 1 | URI.DisableExternalResources 2 | TYPE: bool 3 | VERSION: 1.3.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | Disables the embedding of external resources, preventing users from 7 | embedding things like images from other hosts. This prevents access 8 | tracking (good for email viewers), bandwidth leeching, cross-site request 9 | forging, goatse.cx posting, and other nasties, but also results in a loss 10 | of end-user functionality (they can't directly post a pic they posted from 11 | Flickr anymore). Use it if you don't have a robust user-content moderation 12 | team. 13 | --# vim: et sw=4 sts=4 14 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.MaintainLineNumbers.txt: -------------------------------------------------------------------------------- 1 | Core.MaintainLineNumbers 2 | TYPE: bool/null 3 | VERSION: 2.0.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | If true, HTML Purifier will add line number information to all tokens. 9 | This is useful when error reporting is turned on, but can result in 10 | significant performance degradation and should not be used when 11 | unnecessary. This directive must be used with the DirectLex lexer, 12 | as the DOMLex lexer does not (yet) support this functionality. 13 | If the value is null, an appropriate value will be selected based 14 | on other configuration. 15 |

16 | --# vim: et sw=4 sts=4 17 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.AllowedFrameTargets.txt: -------------------------------------------------------------------------------- 1 | Attr.AllowedFrameTargets 2 | TYPE: lookup 3 | DEFAULT: array() 4 | --DESCRIPTION-- 5 | Lookup table of all allowed link frame targets. Some commonly used link 6 | targets include _blank, _self, _parent and _top. Values should be 7 | lowercase, as validation will be done in a case-sensitive manner despite 8 | W3C's recommendation. XHTML 1.0 Strict does not permit the target attribute 9 | so this directive will have no effect in that doctype. XHTML 1.1 does not 10 | enable the Target module by default, you will have to manually enable it 11 | (see the module documentation for more details.) 12 | --# vim: et sw=4 sts=4 13 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.EscapeNonASCIICharacters.txt: -------------------------------------------------------------------------------- 1 | Core.EscapeNonASCIICharacters 2 | TYPE: bool 3 | VERSION: 1.4.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | This directive overcomes a deficiency in %Core.Encoding by blindly 7 | converting all non-ASCII characters into decimal numeric entities before 8 | converting it to its native encoding. This means that even characters that 9 | can be expressed in the non-UTF-8 encoding will be entity-ized, which can 10 | be a real downer for encodings like Big5. It also assumes that the ASCII 11 | repetoire is available, although this is the case for almost all encodings. 12 | Anyway, use UTF-8! 13 | --# vim: et sw=4 sts=4 14 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.BlockWrapper.txt: -------------------------------------------------------------------------------- 1 | HTML.BlockWrapper 2 | TYPE: string 3 | VERSION: 1.3.0 4 | DEFAULT: 'p' 5 | --DESCRIPTION-- 6 | 7 |

8 | String name of element to wrap inline elements that are inside a block 9 | context. This only occurs in the children of blockquote in strict mode. 10 |

11 |

12 | Example: by default value, 13 | <blockquote>Foo</blockquote> would become 14 | <blockquote><p>Foo</p></blockquote>. 15 | The <p> tags can be replaced with whatever you desire, 16 | as long as it is a block level element. 17 |

18 | --# vim: et sw=4 sts=4 19 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.HiddenElements.txt: -------------------------------------------------------------------------------- 1 | Core.HiddenElements 2 | TYPE: lookup 3 | --DEFAULT-- 4 | array ( 5 | 'script' => true, 6 | 'style' => true, 7 | ) 8 | --DESCRIPTION-- 9 | 10 |

11 | This directive is a lookup array of elements which should have their 12 | contents removed when they are not allowed by the HTML definition. 13 | For example, the contents of a script tag are not 14 | normally shown in a document, so if script tags are to be removed, 15 | their contents should be removed to. This is opposed to a b 16 | tag, which defines some presentational changes but does not hide its 17 | contents. 18 |

19 | --# vim: et sw=4 sts=4 20 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.TidyImpl.txt: -------------------------------------------------------------------------------- 1 | Filter.ExtractStyleBlocks.TidyImpl 2 | TYPE: mixed/null 3 | VERSION: 3.1.0 4 | DEFAULT: NULL 5 | ALIASES: FilterParam.ExtractStyleBlocksTidyImpl 6 | --DESCRIPTION-- 7 |

8 | If left NULL, HTML Purifier will attempt to instantiate a csstidy 9 | class to use for internal cleaning. This will usually be good enough. 10 |

11 |

12 | However, for trusted user input, you can set this to false to 13 | disable cleaning. In addition, you can supply your own concrete implementation 14 | of Tidy's interface to use, although I don't know why you'd want to do that. 15 |

16 | --# vim: et sw=4 sts=4 17 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.MungeResources.txt: -------------------------------------------------------------------------------- 1 | URI.MungeResources 2 | TYPE: bool 3 | VERSION: 3.1.1 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | If true, any URI munging directives like %URI.Munge 8 | will also apply to embedded resources, such as <img src="">. 9 | Be careful enabling this directive if you have a redirector script 10 | that does not use the Location HTTP header; all of your images 11 | and other embedded resources will break. 12 |

13 |

14 | Warning: It is strongly advised you use this in conjunction 15 | %URI.MungeSecretKey to mitigate the security risk of an open redirector. 16 |

17 | --# vim: et sw=4 sts=4 18 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/CSS.AllowedProperties.txt: -------------------------------------------------------------------------------- 1 | CSS.AllowedProperties 2 | TYPE: lookup/null 3 | VERSION: 3.1.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | If HTML Purifier's style attributes set is unsatisfactory for your needs, 9 | you can overload it with your own list of tags to allow. Note that this 10 | method is subtractive: it does its job by taking away from HTML Purifier 11 | usual feature set, so you cannot add an attribute that HTML Purifier never 12 | supported in the first place. 13 |

14 |

15 | Warning: If another directive conflicts with the 16 | elements here, that directive will win and override. 17 |

18 | --# vim: et sw=4 sts=4 19 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/CSS.MaxImgLength.txt: -------------------------------------------------------------------------------- 1 | CSS.MaxImgLength 2 | TYPE: string/null 3 | DEFAULT: '1200px' 4 | VERSION: 3.1.1 5 | --DESCRIPTION-- 6 |

7 | This parameter sets the maximum allowed length on img tags, 8 | effectively the width and height properties. 9 | Only absolute units of measurement (in, pt, pc, mm, cm) and pixels (px) are allowed. This is 10 | in place to prevent imagecrash attacks, disable with null at your own risk. 11 | This directive is similar to %HTML.MaxImgLength, and both should be 12 | concurrently edited, although there are 13 | subtle differences in the input format (the CSS max is a number with 14 | a unit). 15 |

16 | --# vim: et sw=4 sts=4 17 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.AllowedAttributes.txt: -------------------------------------------------------------------------------- 1 | HTML.AllowedAttributes 2 | TYPE: lookup/null 3 | VERSION: 1.3.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | If HTML Purifier's attribute set is unsatisfactory, overload it! 9 | The syntax is "tag.attr" or "*.attr" for the global attributes 10 | (style, id, class, dir, lang, xml:lang). 11 |

12 |

13 | Warning: If another directive conflicts with the 14 | elements here, that directive will win and override. For 15 | example, %HTML.EnableAttrID will take precedence over *.id in this 16 | directive. You must set that directive to true before you can use 17 | IDs at all. 18 |

19 | --# vim: et sw=4 sts=4 20 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.EnableID.txt: -------------------------------------------------------------------------------- 1 | Attr.EnableID 2 | TYPE: bool 3 | DEFAULT: false 4 | VERSION: 1.2.0 5 | --DESCRIPTION-- 6 | Allows the ID attribute in HTML. This is disabled by default due to the 7 | fact that without proper configuration user input can easily break the 8 | validation of a webpage by specifying an ID that is already on the 9 | surrounding HTML. If you don't mind throwing caution to the wind, enable 10 | this directive, but I strongly recommend you also consider blacklisting IDs 11 | you use (%Attr.IDBlacklist) or prefixing all user supplied IDs 12 | (%Attr.IDPrefix). When set to true HTML Purifier reverts to the behavior of 13 | pre-1.2.0 versions. 14 | --ALIASES-- 15 | HTML.EnableAttrID 16 | --# vim: et sw=4 sts=4 17 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefixLocal.txt: -------------------------------------------------------------------------------- 1 | Attr.IDPrefixLocal 2 | TYPE: string 3 | VERSION: 1.2.0 4 | DEFAULT: '' 5 | --DESCRIPTION-- 6 | Temporary prefix for IDs used in conjunction with %Attr.IDPrefix. If you 7 | need to allow multiple sets of user content on web page, you may need to 8 | have a seperate prefix that changes with each iteration. This way, 9 | seperately submitted user content displayed on the same page doesn't 10 | clobber each other. Ideal values are unique identifiers for the content it 11 | represents (i.e. the id of the row in the database). Be sure to add a 12 | seperator (like an underscore) at the end. Warning: this directive will 13 | not work unless %Attr.IDPrefix is set to a non-empty value! 14 | --# vim: et sw=4 sts=4 15 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.Base.txt: -------------------------------------------------------------------------------- 1 | URI.Base 2 | TYPE: string/null 3 | VERSION: 2.1.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | The base URI is the URI of the document this purified HTML will be 9 | inserted into. This information is important if HTML Purifier needs 10 | to calculate absolute URIs from relative URIs, such as when %URI.MakeAbsolute 11 | is on. You may use a non-absolute URI for this value, but behavior 12 | may vary (%URI.MakeAbsolute deals nicely with both absolute and 13 | relative paths, but forwards-compatibility is not guaranteed). 14 | Warning: If set, the scheme on this URI 15 | overrides the one specified by %URI.DefaultScheme. 16 |

17 | --# vim: et sw=4 sts=4 18 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.DirectLexLineNumberSyncInterval.txt: -------------------------------------------------------------------------------- 1 | Core.DirectLexLineNumberSyncInterval 2 | TYPE: int 3 | VERSION: 2.0.0 4 | DEFAULT: 0 5 | --DESCRIPTION-- 6 | 7 |

8 | Specifies the number of tokens the DirectLex line number tracking 9 | implementations should process before attempting to resyncronize the 10 | current line count by manually counting all previous new-lines. When 11 | at 0, this functionality is disabled. Lower values will decrease 12 | performance, and this is only strictly necessary if the counting 13 | algorithm is buggy (in which case you should report it as a bug). 14 | This has no effect when %Core.MaintainLineNumbers is disabled or DirectLex is 15 | not being used. 16 |

17 | --# vim: et sw=4 sts=4 18 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.CoreModules.txt: -------------------------------------------------------------------------------- 1 | HTML.CoreModules 2 | TYPE: lookup 3 | VERSION: 2.0.0 4 | --DEFAULT-- 5 | array ( 6 | 'Structure' => true, 7 | 'Text' => true, 8 | 'Hypertext' => true, 9 | 'List' => true, 10 | 'NonXMLCommonAttributes' => true, 11 | 'XMLCommonAttributes' => true, 12 | 'CommonAttributes' => true, 13 | ) 14 | --DESCRIPTION-- 15 | 16 |

17 | Certain modularized doctypes (XHTML, namely), have certain modules 18 | that must be included for the doctype to be an conforming document 19 | type: put those modules here. By default, XHTML's core modules 20 | are used. You can set this to a blank array to disable core module 21 | protection, but this is not recommended. 22 |

23 | --# vim: et sw=4 sts=4 24 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.TidyLevel.txt: -------------------------------------------------------------------------------- 1 | HTML.TidyLevel 2 | TYPE: string 3 | VERSION: 2.0.0 4 | DEFAULT: 'medium' 5 | --DESCRIPTION-- 6 | 7 |

General level of cleanliness the Tidy module should enforce. 8 | There are four allowed values:

9 |
10 |
none
11 |
No extra tidying should be done
12 |
light
13 |
Only fix elements that would be discarded otherwise due to 14 | lack of support in doctype
15 |
medium
16 |
Enforce best practices
17 |
heavy
18 |
Transform all deprecated elements and attributes to standards 19 | compliant equivalents
20 |
21 | 22 | --ALLOWED-- 23 | 'none', 'light', 'medium', 'heavy' 24 | --# vim: et sw=4 sts=4 25 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyFixLt.txt: -------------------------------------------------------------------------------- 1 | Core.AggressivelyFixLt 2 | TYPE: bool 3 | VERSION: 2.1.0 4 | DEFAULT: true 5 | --DESCRIPTION-- 6 |

7 | This directive enables aggressive pre-filter fixes HTML Purifier can 8 | perform in order to ensure that open angled-brackets do not get killed 9 | during parsing stage. Enabling this will result in two preg_replace_callback 10 | calls and at least two preg_replace calls for every HTML document parsed; 11 | if your users make very well-formed HTML, you can set this directive false. 12 | This has no effect when DirectLex is used. 13 |

14 |

15 | Notice: This directive's default turned from false to true 16 | in HTML Purifier 3.2.0. 17 |

18 | --# vim: et sw=4 sts=4 19 | -------------------------------------------------------------------------------- /wrAPI/apis/Google/Directory.php: -------------------------------------------------------------------------------- 1 | _addCustomHeader( 'Content-Length: ' . strlen( $data ) ); 12 | 13 | return $this->_curl( 14 | strtolower( $name ), 15 | 'https://www.googleapis.com/admin/directory/v1' . $arguments[ 0 ], 16 | $data 17 | ); 18 | 19 | } 20 | 21 | public function connect( $params ){ 22 | 23 | $this->_addCustomHeader( 'Authorization: '.$params['token_type'].' '.$params['access_token'] ); 24 | $this->_addCustomHeader( 'Content-Type: application/json' ); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt: -------------------------------------------------------------------------------- 1 | Core.ColorKeywords 2 | TYPE: hash 3 | VERSION: 2.0.0 4 | --DEFAULT-- 5 | array ( 6 | 'maroon' => '#800000', 7 | 'red' => '#FF0000', 8 | 'orange' => '#FFA500', 9 | 'yellow' => '#FFFF00', 10 | 'olive' => '#808000', 11 | 'purple' => '#800080', 12 | 'fuchsia' => '#FF00FF', 13 | 'white' => '#FFFFFF', 14 | 'lime' => '#00FF00', 15 | 'green' => '#008000', 16 | 'navy' => '#000080', 17 | 'blue' => '#0000FF', 18 | 'aqua' => '#00FFFF', 19 | 'teal' => '#008080', 20 | 'black' => '#000000', 21 | 'silver' => '#C0C0C0', 22 | 'gray' => '#808080', 23 | ) 24 | --DESCRIPTION-- 25 | 26 | Lookup array of color names to six digit hexadecimal number corresponding 27 | to color, with preceding hash mark. Used when parsing colors. 28 | --# vim: et sw=4 sts=4 29 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | array( 'Docs-to-WordPress/docs-to-wp.php' ), 13 | ); 14 | 15 | // If the develop repo location is defined (as WP_DEVELOP_DIR), use that 16 | // location. Otherwise, we'll just assume that this plugin is installed in a 17 | // WordPress develop SVN checkout. 18 | 19 | if( false !== getenv( 'WP_DEVELOP_DIR' ) ) { 20 | require getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit/includes/bootstrap.php'; 21 | } else { 22 | require '../../../../tests/phpunit/includes/bootstrap.php'; 23 | } 24 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.AllowedModules.txt: -------------------------------------------------------------------------------- 1 | HTML.AllowedModules 2 | TYPE: lookup/null 3 | VERSION: 2.0.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | A doctype comes with a set of usual modules to use. Without having 9 | to mucking about with the doctypes, you can quickly activate or 10 | disable these modules by specifying which modules you wish to allow 11 | with this directive. This is most useful for unit testing specific 12 | modules, although end users may find it useful for their own ends. 13 |

14 |

15 | If you specify a module that does not exist, the manager will silently 16 | fail to use it, so be careful! User-defined modules are not affected 17 | by this directive. Modules defined in %HTML.CoreModules are not 18 | affected by this directive. 19 |

20 | --# vim: et sw=4 sts=4 21 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.Encoding.txt: -------------------------------------------------------------------------------- 1 | Core.Encoding 2 | TYPE: istring 3 | DEFAULT: 'utf-8' 4 | --DESCRIPTION-- 5 | If for some reason you are unable to convert all webpages to UTF-8, you can 6 | use this directive as a stop-gap compatibility change to let HTML Purifier 7 | deal with non UTF-8 input. This technique has notable deficiencies: 8 | absolutely no characters outside of the selected character encoding will be 9 | preserved, not even the ones that have been ampersand escaped (this is due 10 | to a UTF-8 specific feature that automatically resolves all 11 | entities), making it pretty useless for anything except the most I18N-blind 12 | applications, although %Core.EscapeNonASCIICharacters offers fixes this 13 | trouble with another tradeoff. This directive only accepts ISO-8859-1 if 14 | iconv is not enabled. 15 | --# vim: et sw=4 sts=4 16 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenElements.txt: -------------------------------------------------------------------------------- 1 | HTML.ForbiddenElements 2 | TYPE: lookup 3 | VERSION: 3.1.0 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 |

7 | This was, perhaps, the most requested feature ever in HTML 8 | Purifier. Please don't abuse it! This is the logical inverse of 9 | %HTML.AllowedElements, and it will override that directive, or any 10 | other directive. 11 |

12 |

13 | If possible, %HTML.Allowed is recommended over this directive, because it 14 | can sometimes be difficult to tell whether or not you've forbidden all of 15 | the behavior you would like to disallow. If you forbid img 16 | with the expectation of preventing images on your site, you'll be in for 17 | a nasty surprise when people start using the background-image 18 | CSS property. 19 |

20 | --# vim: et sw=4 sts=4 21 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.Host.txt: -------------------------------------------------------------------------------- 1 | URI.Host 2 | TYPE: string/null 3 | VERSION: 1.2.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | Defines the domain name of the server, so we can determine whether or 9 | an absolute URI is from your website or not. Not strictly necessary, 10 | as users should be using relative URIs to reference resources on your 11 | website. It will, however, let you use absolute URIs to link to 12 | subdomains of the domain you post here: i.e. example.com will allow 13 | sub.example.com. However, higher up domains will still be excluded: 14 | if you set %URI.Host to sub.example.com, example.com will be blocked. 15 | Note: This directive overrides %URI.Base because 16 | a given page may be on a sub-domain, but you wish HTML Purifier to be 17 | more relaxed and allow some of the parent domains too. 18 |

19 | --# vim: et sw=4 sts=4 20 | -------------------------------------------------------------------------------- /wrAPI/apis/Google/Auth.php: -------------------------------------------------------------------------------- 1 | _curl( 7 | strtolower( $name ), 8 | 'https://accounts.google.com/o/oauth2' . $arguments[ 0 ], 9 | $arguments[ 1 ] 10 | ); 11 | 12 | } 13 | 14 | public function connect( $params ){ 15 | 16 | header('Location: https://accounts.google.com/o/oauth2/auth?' . http_build_query( $params ) ); 17 | 18 | } 19 | 20 | /* Only useful for Offline access */ 21 | public function refresh( $token, $client_id, $client_secret ){ 22 | $data = array( 23 | 'refresh_token' => $token, 24 | 'client_id' => $client_id, 25 | 'client_secret' => $client_secret, 26 | 'grant_type' => 'refresh_token' 27 | ); 28 | 29 | return $this->_curl( 'post', 'https://www.googleapis.com/oauth2/v3/token', http_build_query( $data ) ); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Output.TidyFormat.txt: -------------------------------------------------------------------------------- 1 | Output.TidyFormat 2 | TYPE: bool 3 | VERSION: 1.1.1 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | Determines whether or not to run Tidy on the final output for pretty 8 | formatting reasons, such as indentation and wrap. 9 |

10 |

11 | This can greatly improve readability for editors who are hand-editing 12 | the HTML, but is by no means necessary as HTML Purifier has already 13 | fixed all major errors the HTML may have had. Tidy is a non-default 14 | extension, and this directive will silently fail if Tidy is not 15 | available. 16 |

17 |

18 | If you are looking to make the overall look of your page's source 19 | better, I recommend running Tidy on the entire page rather than just 20 | user-content (after all, the indentation relative to the containing 21 | blocks will be incorrect). 22 |

23 | --ALIASES-- 24 | Core.TidyFormat 25 | --# vim: et sw=4 sts=4 26 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/Interchange/Id.php: -------------------------------------------------------------------------------- 1 | key = $key; 13 | } 14 | 15 | /** 16 | * @warning This is NOT magic, to ensure that people don't abuse SPL and 17 | * cause problems for PHP 5.0 support. 18 | */ 19 | public function toString() { 20 | return $this->key; 21 | } 22 | 23 | public function getRootNamespace() { 24 | return substr($this->key, 0, strpos($this->key, ".")); 25 | } 26 | 27 | public function getDirective() { 28 | return substr($this->key, strpos($this->key, ".") + 1); 29 | } 30 | 31 | public static function make($id) { 32 | return new HTMLPurifier_ConfigSchema_Interchange_Id($id); 33 | } 34 | 35 | } 36 | 37 | // vim: et sw=4 sts=4 38 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenAttributes.txt: -------------------------------------------------------------------------------- 1 | HTML.ForbiddenAttributes 2 | TYPE: lookup 3 | VERSION: 3.1.0 4 | DEFAULT: array() 5 | --DESCRIPTION-- 6 |

7 | While this directive is similar to %HTML.AllowedAttributes, for 8 | forwards-compatibility with XML, this attribute has a different syntax. Instead of 9 | tag.attr, use tag@attr. To disallow href 10 | attributes in a tags, set this directive to 11 | a@href. You can also disallow an attribute globally with 12 | attr or *@attr (either syntax is fine; the latter 13 | is provided for consistency with %HTML.AllowedAttributes). 14 |

15 |

16 | Warning: This directive complements %HTML.ForbiddenElements, 17 | accordingly, check 18 | out that directive for a discussion of why you 19 | should think twice before using this directive. 20 |

21 | --# vim: et sw=4 sts=4 22 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.AllowedElements.txt: -------------------------------------------------------------------------------- 1 | HTML.AllowedElements 2 | TYPE: lookup/null 3 | VERSION: 1.3.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 |

7 | If HTML Purifier's tag set is unsatisfactory for your needs, you can 8 | overload it with your own list of tags to allow. If you change 9 | this, you probably also want to change %HTML.AllowedAttributes; see 10 | also %HTML.Allowed which lets you set allowed elements and 11 | attributes at the same time. 12 |

13 |

14 | If you attempt to allow an element that HTML Purifier does not know 15 | about, HTML Purifier will raise an error. You will need to manually 16 | tell HTML Purifier about this element by using the 17 | advanced customization features. 18 |

19 |

20 | Warning: If another directive conflicts with the 21 | elements here, that directive will win and override. 22 |

23 | --# vim: et sw=4 sts=4 24 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Attr.ClassUseCDATA.txt: -------------------------------------------------------------------------------- 1 | Attr.ClassUseCDATA 2 | TYPE: bool/null 3 | DEFAULT: null 4 | VERSION: 4.0.0 5 | --DESCRIPTION-- 6 | If null, class will auto-detect the doctype and, if matching XHTML 1.1 or 7 | XHTML 2.0, will use the restrictive NMTOKENS specification of class. Otherwise, 8 | it will use a relaxed CDATA definition. If true, the relaxed CDATA definition 9 | is forced; if false, the NMTOKENS definition is forced. To get behavior 10 | of HTML Purifier prior to 4.0.0, set this directive to false. 11 | 12 | Some rational behind the auto-detection: 13 | in previous versions of HTML Purifier, it was assumed that the form of 14 | class was NMTOKENS, as specified by the XHTML Modularization (representing 15 | XHTML 1.1 and XHTML 2.0). The DTDs for HTML 4.01 and XHTML 1.0, however 16 | specify class as CDATA. HTML 5 effectively defines it as CDATA, but 17 | with the additional constraint that each name should be unique (this is not 18 | explicitly outlined in previous specifications). 19 | --# vim: et sw=4 sts=4 20 | -------------------------------------------------------------------------------- /wrAPI/apis/Google/Drive.php: -------------------------------------------------------------------------------- 1 | _addCustomHeader( 'Content-Length: ' . strlen( $data ) ); 12 | 13 | return $this->_curl( 14 | strtolower( $name ), 15 | 'https://www.googleapis.com/drive/v2' . $arguments[ 0 ], 16 | $data, 17 | !isset( $arguments[2] ) 18 | ); 19 | 20 | } 21 | 22 | public function connect( $params ){ 23 | 24 | $this->_addCustomHeader( 'Authorization: '.$params['token_type'].' '.$params['access_token'] ); 25 | $this->_addCustomHeader( 'Content-Type: application/json' ); 26 | 27 | } 28 | 29 | public function downloadFile( $url ){ 30 | 31 | error_log( $url ); 32 | 33 | return $this->_curl( 'get', $url, array(), false ); 34 | 35 | } 36 | 37 | public function moveFile( $url ) { 38 | 39 | 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /options-ajax.php: -------------------------------------------------------------------------------- 1 | true ) ); 26 | 27 | } 28 | 29 | } 30 | 31 | function docs_to_wp_init_ajax() { 32 | 33 | if( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) 34 | return; 35 | 36 | $ajax = new Docs_To_WP_Options_Ajax(); 37 | 38 | } 39 | 40 | add_action('admin_init', 'docs_to_wp_init_ajax'); 41 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.Allowed.txt: -------------------------------------------------------------------------------- 1 | HTML.Allowed 2 | TYPE: itext/null 3 | VERSION: 2.0.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | This is a preferred convenience directive that combines 9 | %HTML.AllowedElements and %HTML.AllowedAttributes. 10 | Specify elements and attributes that are allowed using: 11 | element1[attr1|attr2],element2.... For example, 12 | if you would like to only allow paragraphs and links, specify 13 | a[href],p. You can specify attributes that apply 14 | to all elements using an asterisk, e.g. *[lang]. 15 | You can also use newlines instead of commas to separate elements. 16 |

17 |

18 | Warning: 19 | All of the constraints on the component directives are still enforced. 20 | The syntax is a subset of TinyMCE's valid_elements 21 | whitelist: directly copy-pasting it here will probably result in 22 | broken whitelists. If %HTML.AllowedElements or %HTML.AllowedAttributes 23 | are set, this directive has no effect. 24 |

25 | --# vim: et sw=4 sts=4 26 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt: -------------------------------------------------------------------------------- 1 | URI.MungeSecretKey 2 | TYPE: string/null 3 | VERSION: 3.1.1 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 |

7 | This directive enables secure checksum generation along with %URI.Munge. 8 | It should be set to a secure key that is not shared with anyone else. 9 | The checksum can be placed in the URI using %t. Use of this checksum 10 | affords an additional level of protection by allowing a redirector 11 | to check if a URI has passed through HTML Purifier with this line: 12 |

13 | 14 |
$checksum === sha1($secret_key . ':' . $url)
15 | 16 |

17 | If the output is TRUE, the redirector script should accept the URI. 18 |

19 | 20 |

21 | Please note that it would still be possible for an attacker to procure 22 | secure hashes en-mass by abusing your website's Preview feature or the 23 | like, but this service affords an additional level of protection 24 | that should be combined with website blacklisting. 25 |

26 | 27 |

28 | Remember this has no effect if %URI.Munge is not on. 29 |

30 | --# vim: et sw=4 sts=4 31 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.LexerImpl.txt: -------------------------------------------------------------------------------- 1 | Core.LexerImpl 2 | TYPE: mixed/null 3 | VERSION: 2.0.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | This parameter determines what lexer implementation can be used. The 9 | valid values are: 10 |

11 |
12 |
null
13 |
14 | Recommended, the lexer implementation will be auto-detected based on 15 | your PHP-version and configuration. 16 |
17 |
string lexer identifier
18 |
19 | This is a slim way of manually overridding the implementation. 20 | Currently recognized values are: DOMLex (the default PHP5 21 | implementation) 22 | and DirectLex (the default PHP4 implementation). Only use this if 23 | you know what you are doing: usually, the auto-detection will 24 | manage things for cases you aren't even aware of. 25 |
26 |
object lexer instance
27 |
28 | Super-advanced: you can specify your own, custom, implementation that 29 | implements the interface defined by HTMLPurifier_Lexer. 30 | I may remove this option simply because I don't expect anyone 31 | to use it. 32 |
33 |
34 | --# vim: et sw=4 sts=4 35 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Printer/CSSDefinition.php: -------------------------------------------------------------------------------- 1 | def = $config->getCSSDefinition(); 10 | $ret = ''; 11 | 12 | $ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer')); 13 | $ret .= $this->start('table'); 14 | 15 | $ret .= $this->element('caption', 'Properties ($info)'); 16 | 17 | $ret .= $this->start('thead'); 18 | $ret .= $this->start('tr'); 19 | $ret .= $this->element('th', 'Property', array('class' => 'heavy')); 20 | $ret .= $this->element('th', 'Definition', array('class' => 'heavy', 'style' => 'width:auto;')); 21 | $ret .= $this->end('tr'); 22 | $ret .= $this->end('thead'); 23 | 24 | ksort($this->def->info); 25 | foreach ($this->def->info as $property => $obj) { 26 | $name = $this->getClass($obj, 'AttrDef_'); 27 | $ret .= $this->row($property, $name); 28 | } 29 | 30 | $ret .= $this->end('table'); 31 | $ret .= $this->end('div'); 32 | 33 | return $ret; 34 | } 35 | 36 | } 37 | 38 | // vim: et sw=4 sts=4 39 | -------------------------------------------------------------------------------- /extend-cron.php: -------------------------------------------------------------------------------- 1 | 60, 'display' => 'Every Minute' ); 13 | return $schedules; 14 | } 15 | 16 | //On activation, add the recurring cron job 17 | register_activation_hook( __FILE__, 'dtwp_schedule_event' ); 18 | function dtwp_schedule_event() { 19 | wp_schedule_event( time(), 'min', 'dtwp_cronjob' ); 20 | } 21 | 22 | //Run the cron job 23 | add_action( 'dtwp_cronjob', 'dtwp_check_gdocs' ); 24 | function dtwp_check_gdocs( ) { 25 | 26 | //Init the Docs to WP 27 | $docs_to_wp = new Docs_To_WP(); 28 | 29 | //We're just going to call one function: 30 | $result = $docs_to_wp->startTransfer(); 31 | do_action( 'docs_to_wp_post_cron_run', $result ); 32 | 33 | } 34 | 35 | 36 | //Deactivation 37 | register_deactivation_hook(__FILE__, 'dtwp_deactivate_cron'); 38 | function dtwp_deactivate_cron() { 39 | wp_clear_scheduled_hook( 'dtwp_cronjob' ); 40 | } 41 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/Interchange.php: -------------------------------------------------------------------------------- 1 | array(directive info) 18 | */ 19 | public $directives = array(); 20 | 21 | /** 22 | * Adds a directive array to $directives 23 | */ 24 | public function addDirective($directive) { 25 | if (isset($this->directives[$i = $directive->id->toString()])) { 26 | throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'"); 27 | } 28 | $this->directives[$i] = $directive; 29 | } 30 | 31 | /** 32 | * Convenience function to perform standard validation. Throws exception 33 | * on failed validation. 34 | */ 35 | public function validate() { 36 | $validator = new HTMLPurifier_ConfigSchema_Validator(); 37 | return $validator->validate($this); 38 | } 39 | 40 | } 41 | 42 | // vim: et sw=4 sts=4 43 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.AutoParagraph.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.AutoParagraph 2 | TYPE: bool 3 | VERSION: 2.0.1 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 | 7 |

8 | This directive turns on auto-paragraphing, where double newlines are 9 | converted in to paragraphs whenever possible. Auto-paragraphing: 10 |

11 | 17 |

18 | p tags must be allowed for this directive to take effect. 19 | We do not use br tags for paragraphing, as that is 20 | semantically incorrect. 21 |

22 |

23 | To prevent auto-paragraphing as a content-producer, refrain from using 24 | double-newlines except to specify a new paragraph or in contexts where 25 | it has special meaning (whitespace usually has no meaning except in 26 | tags like pre, so this should not be difficult.) To prevent 27 | the paragraphing of inline text adjacent to block elements, wrap them 28 | in div tags (the behavior is slightly different outside of 29 | the root node.) 30 |

31 | --# vim: et sw=4 sts=4 32 | -------------------------------------------------------------------------------- /extend-headline.php: -------------------------------------------------------------------------------- 1 | $post_array[ 'post_title' ] ) ); 15 | 16 | //Sometimes people forget a pipe, and we don't want to put the entire post in the headline 17 | if( is_array( $exploded_fields ) && count( $exploded_fields ) >= 2 && count( $exploded_fields ) > 0 ) { 18 | 19 | //Save the old title in case you want to do something with it 20 | $old_title = $post_array[ 'post_title' ]; 21 | 22 | //Set the title to the first occurance. 23 | $post_array[ 'post_title' ] = strip_tags( $exploded_fields[ 0 ] ); 24 | 25 | //Unset the title 26 | unset( $exploded_fields[ 0 ] ); 27 | 28 | //Now restore the post content and save it 29 | $post_array[ 'post_content' ] = implode( '|', $exploded_fields ); 30 | 31 | } 32 | 33 | return $post_array; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Scope.txt: -------------------------------------------------------------------------------- 1 | Filter.ExtractStyleBlocks.Scope 2 | TYPE: string/null 3 | VERSION: 3.0.0 4 | DEFAULT: NULL 5 | ALIASES: Filter.ExtractStyleBlocksScope, FilterParam.ExtractStyleBlocksScope 6 | --DESCRIPTION-- 7 | 8 |

9 | If you would like users to be able to define external stylesheets, but 10 | only allow them to specify CSS declarations for a specific node and 11 | prevent them from fiddling with other elements, use this directive. 12 | It accepts any valid CSS selector, and will prepend this to any 13 | CSS declaration extracted from the document. For example, if this 14 | directive is set to #user-content and a user uses the 15 | selector a:hover, the final selector will be 16 | #user-content a:hover. 17 |

18 |

19 | The comma shorthand may be used; consider the above example, with 20 | #user-content, #user-content2, the final selector will 21 | be #user-content a:hover, #user-content2 a:hover. 22 |

23 |

24 | Warning: It is possible for users to bypass this measure 25 | using a naughty + selector. This is a bug in CSS Tidy 1.3, not HTML 26 | Purifier, and I am working to get it fixed. Until then, HTML Purifier 27 | performs a basic check to prevent this. 28 |

29 | --# vim: et sw=4 sts=4 30 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php: -------------------------------------------------------------------------------- 1 | directives as $d) { 13 | $schema->add( 14 | $d->id->key, 15 | $d->default, 16 | $d->type, 17 | $d->typeAllowsNull 18 | ); 19 | if ($d->allowed !== null) { 20 | $schema->addAllowedValues( 21 | $d->id->key, 22 | $d->allowed 23 | ); 24 | } 25 | foreach ($d->aliases as $alias) { 26 | $schema->addAlias( 27 | $alias->key, 28 | $d->id->key 29 | ); 30 | } 31 | if ($d->valueAliases !== null) { 32 | $schema->addValueAliases( 33 | $d->id->key, 34 | $d->valueAliases 35 | ); 36 | } 37 | } 38 | $schema->postProcess(); 39 | return $schema; 40 | } 41 | 42 | } 43 | 44 | // vim: et sw=4 sts=4 45 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionID.txt: -------------------------------------------------------------------------------- 1 | HTML.DefinitionID 2 | TYPE: string/null 3 | DEFAULT: NULL 4 | VERSION: 2.0.0 5 | --DESCRIPTION-- 6 | 7 |

8 | Unique identifier for a custom-built HTML definition. If you edit 9 | the raw version of the HTMLDefinition, introducing changes that the 10 | configuration object does not reflect, you must specify this variable. 11 | If you change your custom edits, you should change this directive, or 12 | clear your cache. Example: 13 |

14 |
15 | $config = HTMLPurifier_Config::createDefault();
16 | $config->set('HTML', 'DefinitionID', '1');
17 | $def = $config->getHTMLDefinition();
18 | $def->addAttribute('a', 'tabindex', 'Number');
19 | 
20 |

21 | In the above example, the configuration is still at the defaults, but 22 | using the advanced API, an extra attribute has been added. The 23 | configuration object normally has no way of knowing that this change 24 | has taken place, so it needs an extra directive: %HTML.DefinitionID. 25 | If someone else attempts to use the default configuration, these two 26 | pieces of code will not clobber each other in the cache, since one has 27 | an extra directive attached to it. 28 |

29 |

30 | You must specify a value to this directive to use the 31 | advanced API features. 32 |

33 | --# vim: et sw=4 sts=4 34 | -------------------------------------------------------------------------------- /wrAPI/wrAPI.php: -------------------------------------------------------------------------------- 1 | 1 ){ 42 | $filename = implode('/', $name); 43 | }else{ 44 | $filename = $name[ 0 ] . '/' . $name[ 0 ]; 45 | } 46 | 47 | if( !file_exists( dirname( __FILE__ ) . '/apis/' . $filename . '.php' ) ){ 48 | 49 | throw new FileNotFoundException("Error: $api_name was not found."); 50 | 51 | } 52 | 53 | require_once( dirname( __FILE__ ) . '/apis/' . $filename . '.php' ); 54 | 55 | return new $api_name(); 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Filter/YouTube.php: -------------------------------------------------------------------------------- 1 | ]+>.+?'. 10 | 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s'; 11 | $pre_replace = '\1'; 12 | return preg_replace($pre_regex, $pre_replace, $html); 13 | } 14 | 15 | public function postFilter($html, $config, $context) { 16 | $post_regex = '#((?:v|cp)/[A-Za-z0-9\-_=]+)#'; 17 | return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html); 18 | } 19 | 20 | protected function armorUrl($url) { 21 | return str_replace('--', '--', $url); 22 | } 23 | 24 | protected function postFilterCallback($matches) { 25 | $url = $this->armorUrl($matches[1]); 26 | return ''. 28 | ''. 29 | ''. 34 | ''; 35 | 36 | } 37 | } 38 | 39 | // vim: et sw=4 sts=4 40 | -------------------------------------------------------------------------------- /tests/test_wordpress_plugin_tests.php: -------------------------------------------------------------------------------- 1 | assertTrue( true ); 16 | 17 | } 18 | 19 | /** 20 | * If these tests are being run on Travis CI, verify that the version of 21 | * WordPress installed is the version that we requested. 22 | * 23 | * @requires PHP 5.3 24 | */ 25 | function test_wp_version() { 26 | 27 | $this->markTestSkipped( 'Test skipped' ); 28 | 29 | if ( !getenv( 'TRAVIS' ) ) 30 | $this->markTestSkipped( 'Test skipped since Travis CI was not detected.' ); 31 | 32 | $requested_version = getenv( 'WP_VERSION' ) . '-src'; 33 | 34 | // The "master" version requires special handling. 35 | if ( $requested_version == 'master-src' ) { 36 | $file = file_get_contents( 'https://develop.svn.wordpress.org/trunk/src/wp-includes/version.php' ); 37 | preg_match( '#\$wp_version = \'([^\']+)\';#', $file, $matches ); 38 | $requested_version = $matches[1]; 39 | } 40 | 41 | $this->assertEquals( get_bloginfo( 'version' ), $requested_version ); 42 | 43 | } 44 | 45 | /** 46 | * Ensure that the plugin has been installed and activated. 47 | */ 48 | function test_plugin_activated() { 49 | 50 | $this->assertTrue( is_plugin_active( 'Docs-to-WordPress/docs-to-wp.php' ) ); 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.txt: -------------------------------------------------------------------------------- 1 | AutoFormat.RemoveEmpty 2 | TYPE: bool 3 | VERSION: 3.2.0 4 | DEFAULT: false 5 | --DESCRIPTION-- 6 |

7 | When enabled, HTML Purifier will attempt to remove empty elements that 8 | contribute no semantic information to the document. The following types 9 | of nodes will be removed: 10 |

11 | 25 |

26 | Please be very careful when using this functionality; while it may not 27 | seem that empty elements contain useful information, they can alter the 28 | layout of a document given appropriate styling. This directive is most 29 | useful when you are processing machine-generated HTML, please avoid using 30 | it on regular user HTML. 31 |

32 |

33 | Elements that contain only whitespace will be treated as empty. Non-breaking 34 | spaces, however, do not count as whitespace. See 35 | %AutoFormat.RemoveEmpty.RemoveNbsp for alternate behavior. 36 |

37 |

38 | This algorithm is not perfect; you may still notice some empty tags, 39 | particularly if a node had elements, but those elements were later removed 40 | because they were not permitted in that context, or tags that, after 41 | being auto-closed by another tag, where empty. This is for safety reasons 42 | to prevent clever code from breaking validation. The general rule of thumb: 43 | if a tag looked empty on the way in, it will get removed; if HTML Purifier 44 | made it empty, it will stay. 45 |

46 | --# vim: et sw=4 sts=4 47 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/Interchange/Directive.php: -------------------------------------------------------------------------------- 1 | true). 36 | * Null if all values are allowed. 37 | */ 38 | public $allowed; 39 | 40 | /** 41 | * List of aliases for the directive, 42 | * e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))). 43 | */ 44 | public $aliases = array(); 45 | 46 | /** 47 | * Hash of value aliases, e.g. array('alt' => 'real'). Null if value 48 | * aliasing is disabled (necessary for non-scalar types). 49 | */ 50 | public $valueAliases; 51 | 52 | /** 53 | * Version of HTML Purifier the directive was introduced, e.g. '1.3.1'. 54 | * Null if the directive has always existed. 55 | */ 56 | public $version; 57 | 58 | /** 59 | * ID of directive that supercedes this old directive, is an instance 60 | * of HTMLPurifier_ConfigSchema_Interchange_Id. Null if not deprecated. 61 | */ 62 | public $deprecatedUse; 63 | 64 | /** 65 | * Version of HTML Purifier this directive was deprecated. Null if not 66 | * deprecated. 67 | */ 68 | public $deprecatedVersion; 69 | 70 | /** 71 | * List of external projects this directive depends on, e.g. array('CSSTidy'). 72 | */ 73 | public $external = array(); 74 | 75 | } 76 | 77 | // vim: et sw=4 sts=4 78 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/ValidatorAtom.php: -------------------------------------------------------------------------------- 1 | context = $context; 16 | $this->obj = $obj; 17 | $this->member = $member; 18 | $this->contents =& $obj->$member; 19 | } 20 | 21 | public function assertIsString() { 22 | if (!is_string($this->contents)) $this->error('must be a string'); 23 | return $this; 24 | } 25 | 26 | public function assertIsBool() { 27 | if (!is_bool($this->contents)) $this->error('must be a boolean'); 28 | return $this; 29 | } 30 | 31 | public function assertIsArray() { 32 | if (!is_array($this->contents)) $this->error('must be an array'); 33 | return $this; 34 | } 35 | 36 | public function assertNotNull() { 37 | if ($this->contents === null) $this->error('must not be null'); 38 | return $this; 39 | } 40 | 41 | public function assertAlnum() { 42 | $this->assertIsString(); 43 | if (!ctype_alnum($this->contents)) $this->error('must be alphanumeric'); 44 | return $this; 45 | } 46 | 47 | public function assertNotEmpty() { 48 | if (empty($this->contents)) $this->error('must not be empty'); 49 | return $this; 50 | } 51 | 52 | public function assertIsLookup() { 53 | $this->assertIsArray(); 54 | foreach ($this->contents as $v) { 55 | if ($v !== true) $this->error('must be a lookup array'); 56 | } 57 | return $this; 58 | } 59 | 60 | protected function error($msg) { 61 | throw new HTMLPurifier_ConfigSchema_Exception(ucfirst($this->member) . ' in ' . $this->context . ' ' . $msg); 62 | } 63 | 64 | } 65 | 66 | // vim: et sw=4 sts=4 67 | -------------------------------------------------------------------------------- /js/options.js: -------------------------------------------------------------------------------- 1 | var D2WPOptions = { 2 | parseTimeout: null, 3 | submit: function(){ 4 | 5 | jQuery.post( ajaxurl, ( data = { 6 | action: 'docs_to_wp_save_options', 7 | d2w_cid: jQuery('#docs_to_wp_client_id').val(), 8 | d2w_secret: jQuery('#docs_to_wp_client_secret').val(), 9 | d2w_origin: jQuery('#docs_to_wp_origin_share_link').data('folder_id'), 10 | d2w_dest: jQuery('#docs_to_wp_destination_share_link').data('folder_id') 11 | }), function( response ) { 12 | console.log( data ); 13 | console.log( response ); 14 | }, 'json' ); 15 | 16 | }, 17 | parse: function() { 18 | var elemid = jQuery(this).attr('id'); 19 | clearTimeout(D2WPOptions.parseTimeout); 20 | D2WPOptions.parseTimeout = setTimeout(function(){ 21 | 22 | var parser = document.createElement('a'); 23 | parser.href = jQuery('#' + elemid).val(); 24 | 25 | var params = {}; 26 | var parts = parser.search.substr(1).split('&'); 27 | for( var part in parts ){ 28 | 29 | var part = parts[part].split('='); 30 | params[ decodeURIComponent( part[ 0 ] ) ] = decodeURIComponent( part[ 1 ] ); 31 | 32 | } 33 | 34 | if( params.id ){ 35 | jQuery('#' + elemid).data('folder_id', params.id); 36 | jQuery('#' + elemid).next().html("
ID: " + params.id + "
"); 37 | } 38 | 39 | }, 500); 40 | }, 41 | rebuildURL: function( elem ) { 42 | 43 | if( !elem.val().length ) 44 | return; 45 | 46 | // https://drive.google.com/folderview?id=0AvbaiFDF9adfs8ALJDfadsf9JLKSDFjavadvasdf&usp=sharing 47 | var id = elem.val(); 48 | elem.val( 'https://drive.google.com/folderview?id=' + id ); 49 | elem.data('folder_id', id); 50 | elem.next().html("
ID: " + id + "
"); 51 | 52 | }, 53 | init: function() { 54 | 55 | jQuery('#docs_to_wp_options_submit').click( D2WPOptions.submit ); 56 | jQuery('#docs_to_wp_origin_share_link').keyup( D2WPOptions.parse ); 57 | jQuery('#docs_to_wp_destination_share_link').keyup( D2WPOptions.parse ); 58 | D2WPOptions.rebuildURL( jQuery('#docs_to_wp_origin_share_link') ); 59 | D2WPOptions.rebuildURL( jQuery('#docs_to_wp_destination_share_link') ); 60 | jQuery('#docs_to_wp_options_check_gdocs').click( function() { 61 | jQuery.get(ajaxurl, { 62 | action: 'check_gdocs' 63 | }, function( data ){ 64 | console.log(data); 65 | }, 'json'); 66 | }); 67 | } 68 | }; 69 | 70 | jQuery(document).ready( D2WPOptions.init ); 71 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Docs to WordPress === 2 | Contributors: wpdavis, anubisthejackle 3 | Donate link: http://dev.bangordailynews.com/ 4 | Tags: docs,google,google docs,syndication 5 | Requires at least: 3.7 6 | Tested up to: 4.1.1 7 | Stable tag: 1.1 8 | 9 | Easily move posts from Google Docs to WordPress 10 | 11 | == Description == 12 | This plugin will grab docs out of a collection in Google Docs, create or update a post in WordPress and then move the doc to a new collection. Google Docs no longer supports xmlrpc, so this is perhaps the easiest way to move content from your Google Docs account to your self-hosted WordPress install. 13 | 14 | You can see more details at http://dev.bangordailynews.com/2011/06/16/marrying-google-docs-and-wordpress-or-really-any-cms/ 15 | 16 | == Installation == 17 | 18 | 1. Upload `docs-to-wordpress` to the `/wp-content/plugins/` directory 19 | 2. Activate the plugin through the 'Plugins' menu in WordPress 20 | 3. Create a [Google App](https://console.developers.google.com/project) for your website. 21 | 4. Enter Client ID and Client Secret into settings page. 22 | 5. You should be redirected to a Google login page. Grant full permissions. 23 | 6. If you wish, activate the extender plugin that removes formatting from Google Docs and removes comments, placing them in a separate meta box 24 | 7. To run the plugin, you will need to either activate the included Cron Extender or put code in a separate file and point a cron job to it. 25 | 26 | Tara Kerwin has made a helpful installation walkthrough video available at https://youtu.be/oFLjn2VOn-U 27 | 28 | = To run using WP CRON = 29 | Activate the cron extender. 30 | 31 | = To run using real cron = 32 | Create a file to run cron against, and put the following code in it: 33 | 34 | `startTransfer();` 38 | 39 | You will need to have a folder to draw the docs from and an optional folder to put the docs in after they've been processed. 40 | 41 | First create the folder that you want to store unpublished docs in. This is your "Origin" folder. Next create the folder that you will move converted files to. This is the "Target" folder. If you're using Cron, you're going to want to write stories in a separate folder, and then move them to the Origin folder for publishing, when they're ready. 42 | 43 | == Changelog == 44 | 45 | = 1.1 = 46 | Version bump. Removes anonymous functions, so it can be used as far back as PHP 5.2 47 | 48 | = 1.0-beta = 49 | Update to remove deprecated Google API and use Drive API v2 50 | Updates to code to clean it up, remove extraneous loops. 51 | Added Options page. Changes to make it easier to use. 52 | 53 | = 0.4-beta = 54 | Use HTTPS instead of HTTP, per new Google API spec. 55 | 56 | Fix a few bugs with carrying over bold and italic 57 | 58 | = 0.3-beta = 59 | In extend-clean.php, extract the styles and apply them so bolding and italicizing goes through. Also, don't strip heading styles. Props nacin and Rob Flaherty. 60 | 61 | = 0.2-beta = 62 | Added the cron extender 63 | 64 | = 0.1-beta = 65 | Initial release 66 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt: -------------------------------------------------------------------------------- 1 | Filter.ExtractStyleBlocks 2 | TYPE: bool 3 | VERSION: 3.1.0 4 | DEFAULT: false 5 | EXTERNAL: CSSTidy 6 | --DESCRIPTION-- 7 |

8 | This directive turns on the style block extraction filter, which removes 9 | style blocks from input HTML, cleans them up with CSSTidy, 10 | and places them in the StyleBlocks context variable, for further 11 | use by you, usually to be placed in an external stylesheet, or a 12 | style block in the head of your document. 13 |

14 |

15 | Sample usage: 16 |

17 |
';
21 | ?>
22 | 
24 | 
25 | 
26 |   Filter.ExtractStyleBlocks
27 | body {color:#F00;} Some text';
32 | 
33 |     $config = HTMLPurifier_Config::createDefault();
34 |     $config->set('Filter', 'ExtractStyleBlocks', true);
35 |     $purifier = new HTMLPurifier($config);
36 | 
37 |     $html = $purifier->purify($dirty);
38 | 
39 |     // This implementation writes the stylesheets to the styles/ directory.
40 |     // You can also echo the styles inside the document, but it's a bit
41 |     // more difficult to make sure they get interpreted properly by
42 |     // browsers; try the usual CSS armoring techniques.
43 |     $styles = $purifier->context->get('StyleBlocks');
44 |     $dir = 'styles/';
45 |     if (!is_dir($dir)) mkdir($dir);
46 |     $hash = sha1($_GET['html']);
47 |     foreach ($styles as $i => $style) {
48 |         file_put_contents($name = $dir . $hash . "_$i");
49 |         echo '';
50 |     }
51 | ?>
52 | 
53 | 
54 |   
55 | 56 |
57 | 58 | 59 | ]]>
60 |

61 | Warning: It is possible for a user to mount an 62 | imagecrash attack using this CSS. Counter-measures are difficult; 63 | it is not simply enough to limit the range of CSS lengths (using 64 | relative lengths with many nesting levels allows for large values 65 | to be attained without actually specifying them in the stylesheet), 66 | and the flexible nature of selectors makes it difficult to selectively 67 | disable lengths on image tags (HTML Purifier, however, does disable 68 | CSS width and height in inline styling). There are probably two effective 69 | counter measures: an explicit width and height set to auto in all 70 | images in your document (unlikely) or the disabling of width and 71 | height (somewhat reasonable). Whether or not these measures should be 72 | used is left to the reader. 73 |

74 | --# vim: et sw=4 sts=4 75 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.Munge.txt: -------------------------------------------------------------------------------- 1 | URI.Munge 2 | TYPE: string/null 3 | VERSION: 1.3.0 4 | DEFAULT: NULL 5 | --DESCRIPTION-- 6 | 7 |

8 | Munges all browsable (usually http, https and ftp) 9 | absolute URIs into another URI, usually a URI redirection service. 10 | This directive accepts a URI, formatted with a %s where 11 | the url-encoded original URI should be inserted (sample: 12 | http://www.google.com/url?q=%s). 13 |

14 |

15 | Uses for this directive: 16 |

17 | 30 |

31 | Prior to HTML Purifier 3.1.1, this directive also enabled the munging 32 | of browsable external resources, which could break things if your redirection 33 | script was a splash page or used meta tags. To revert to 34 | previous behavior, please use %URI.MungeResources. 35 |

36 |

37 | You may want to also use %URI.MungeSecretKey along with this directive 38 | in order to enforce what URIs your redirector script allows. Open 39 | redirector scripts can be a security risk and negatively affect the 40 | reputation of your domain name. 41 |

42 |

43 | Starting with HTML Purifier 3.1.1, there is also these substitutions: 44 |

45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
KeyDescriptionExample <a href="">
%r1 - The URI embeds a resource
(blank) - The URI is merely a link
%nThe name of the tag this URI came froma
%mThe name of the attribute this URI came fromhref
%pThe name of the CSS property this URI came from, or blank if irrelevant
76 |

77 | Admittedly, these letters are somewhat arbitrary; the only stipulation 78 | was that they couldn't be a through f. r is for resource (I would have preferred 79 | e, but you take what you can get), n is for name, m 80 | was picked because it came after n (and I couldn't use a), p is for 81 | property. 82 |

83 | --# vim: et sw=4 sts=4 84 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docs to WordPress # 2 | [![Build Status](https://travis-ci.org/bangordailynews/Docs-to-WordPress.svg?branch=master)](https://travis-ci.org/bangordailynews/Docs-to-WordPress) - [![Code Climate](https://codeclimate.com/github/bangordailynews/Docs-to-WordPress/badges/gpa.svg)](https://codeclimate.com/github/bangordailynews/Docs-to-WordPress) 3 | 4 | **Contributors:** wpdavis, anubisthejackle 5 | 6 | **Donate link:** http://wpdavis.com/ 7 | 8 | **Tags:** docs,google,google docs,syndication 9 | 10 | **Requires at least:** 3.7 11 | 12 | **Tested up to:** 4.1.1 13 | 14 | **Stable tag:** 1.1 15 | 16 | 17 | Easily move posts from Google Docs to WordPress 18 | 19 | ## Description ## 20 | This plugin will grab docs out of a collection in Google Docs, create or update a post in WordPress and then move the doc to a new collection. Google Docs no longer supports xmlrpc, so this is perhaps the easiest way to move content from your Google Docs account to your self-hosted WordPress install. 21 | 22 | You can see more details at http://dev.bangordailynews.com/2011/06/16/marrying-google-docs-and-wordpress-or-really-any-cms/ 23 | 24 | ## Installation ## 25 | 26 | 1. Upload `docs-to-wordpress` to the `/wp-content/plugins/` directory 27 | 2. Activate the plugin through the 'Plugins' menu in WordPress 28 | 3. Create a [Google App](https://console.developers.google.com/project) for your website. 29 | 4. Enter Client ID and Client Secret into settings page. 30 | 5. You should be redirected to a Google login page. Grant full permissions. 31 | 6. If you wish, activate the extender plugin that removes formatting from Google Docs and removes comments, placing them in a separate meta box 32 | 7. To run the plugin, you will need to either activate the included Cron Extender or put code in a separate file and point a cron job to it. 33 | 34 | Tara Kerwin has made a helpful installation walkthrough video available at https://youtu.be/oFLjn2VOn-U 35 | 36 | ### To run using WP CRON ### 37 | Activate the cron extender. 38 | 39 | ### To run using real cron ### 40 | Create a file to run cron against, and put the following code in it: 41 | 42 | ``` 43 | startTransfer(); 47 | ``` 48 | 49 | You will need to have a folder to draw the docs from and an optional folder to put the docs in after they've been processed. 50 | 51 | First create the folder that you want to store unpublished docs in. This is your "Origin" folder. Next create the folder that you will move converted files to. This is the "Target" folder. If you're using Cron, you're going to want to write stories in a separate folder, and then move them to the Origin folder for publishing, when they're ready. 52 | 53 | ## Changelog ## 54 | 55 | ### 1.1 ### 56 | Version bump. Removes anonymous functions, so it can be used as far back as PHP 5.2 57 | 58 | ### 1.0-beta ### 59 | Update to remove deprecated Google API and use Drive API v2 60 | Updates to code to clean it up, remove extraneous loops. 61 | Added Options page. Changes to make it easier to use. 62 | 63 | ### 0.4-beta ### 64 | Use HTTPS instead of HTTP, per new Google API spec. 65 | 66 | Fix a few bugs with carrying over bold and italic 67 | 68 | ### 0.3-beta ### 69 | In extend-clean.php, extract the styles and apply them so bolding and italicizing goes through. Also, don't strip heading styles. Props nacin and Rob Flaherty. 70 | 71 | ### 0.2-beta ### 72 | Added the cron extender 73 | 74 | ### 0.1-beta ### 75 | Initial release 76 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Travis CI Configuration File 2 | 3 | # Use Travis CI's faster Docker-based infrastructure. 4 | sudo: false 5 | 6 | # Tell Travis CI we're using PHP 7 | language: php 8 | 9 | # PHP version used in first build configuration. 10 | php: 11 | - "5.5" 12 | 13 | # WordPress version used in first build configuration. 14 | env: 15 | - WP_VERSION=master 16 | 17 | # Next we define our matrix of additional build configurations to test against. 18 | # The versions listed above will automatically create our first configuration, 19 | # so it doesn't need to be re-defined below. 20 | 21 | # WP_VERSION specifies the tag to use. The way these tests are configured to run 22 | # requires at least WordPress 3.8. Specify "master" to test against SVN trunk. 23 | 24 | # Note that Travis CI supports listing these above to automatically build a 25 | # matrix of configurations, but we're being nice here by manually building a 26 | # total of four configurations even though we're testing 4 versions of PHP 27 | # along with 2 versions of WordPress (which would build 8 configs otherwise). 28 | # This takes half as long to run while still providing adequate coverage. 29 | 30 | matrix: 31 | include: 32 | - php: "nightly" 33 | env: WP_VERSION=master 34 | - php: "nightly" 35 | env: WP_VERSION=4.1 36 | - php: "nightly" 37 | env: WP_VERSION=4.0 38 | - php: "nightly" 39 | env: WP_VERSION=3.9 40 | - php: "nightly" 41 | env: WP_VERSION=3.8 42 | - php: "nightly" 43 | env: WP_VERSION=3.7 44 | - php: "5.5" 45 | env: WP_VERSION=4.1 46 | - php: "5.5" 47 | env: WP_VERSION=4.0 48 | - php: "5.5" 49 | env: WP_VERSION=3.9 50 | - php: "5.5" 51 | env: WP_VERSION=3.8 52 | - php: "5.4" 53 | env: WP_VERSION=master 54 | - php: "5.4" 55 | env: WP_VERSION=4.1 56 | - php: "5.4" 57 | env: WP_VERSION=4.0 58 | - php: "5.4" 59 | env: WP_VERSION=3.9 60 | - php: "5.4" 61 | env: WP_VERSION=3.8 62 | - php: "5.4" 63 | env: WP_VERSION=3.7 64 | - php: "5.3" 65 | env: WP_VERSION=master 66 | - php: "5.3" 67 | env: WP_VERSION=4.1 68 | - php: "5.3" 69 | env: WP_VERSION=4.0 70 | - php: "5.3" 71 | env: WP_VERSION=3.9 72 | - php: "5.3" 73 | env: WP_VERSION=3.8 74 | - php: "5.3" 75 | env: WP_VERSION=3.7 76 | - php: "5.2" 77 | env: WP_VERSION=master 78 | - php: "5.2" 79 | env: WP_VERSION=4.1 80 | - php: "5.2" 81 | env: WP_VERSION=4.0 82 | - php: "5.2" 83 | env: WP_VERSION=3.9 84 | - php: "5.2" 85 | env: WP_VERSION=3.8 86 | - php: "5.2" 87 | env: WP_VERSION=3.7 88 | allow_failures: 89 | - php: "nightly" 90 | 91 | # Clones WordPress and configures our testing environment. 92 | before_script: 93 | - export PHP_VERSION=`phpenv version-name` 94 | - if [ "$PHP_VERSION" != "5.2" ] ; then composer install --dev ; fi 95 | - export PLUGIN_SLUG=$(basename $(pwd)) 96 | - git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress 97 | - cd .. 98 | - mv "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG" 99 | - cd /tmp/wordpress 100 | - mysql -e "CREATE DATABASE wordpress_tests;" -uroot 101 | - cp wp-tests-config-sample.php wp-tests-config.php 102 | - sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php 103 | - sed -i "s/yourusernamehere/travis/" wp-tests-config.php 104 | - sed -i "s/yourpasswordhere//" wp-tests-config.php 105 | - cd "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG" 106 | 107 | script: phpunit 108 | 109 | after_script: 110 | - if [ "$PHP_VERSION" != "5.2" ] ; then ./vendor/bin/test-reporter ; fi 111 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Language/messages/en.php: -------------------------------------------------------------------------------- 1 | 'HTML Purifier', 8 | 9 | // for unit testing purposes 10 | 'LanguageFactoryTest: Pizza' => 'Pizza', 11 | 'LanguageTest: List' => '$1', 12 | 'LanguageTest: Hash' => '$1.Keys; $1.Values', 13 | 14 | 'Item separator' => ', ', 15 | 'Item separator last' => ' and ', // non-Harvard style 16 | 17 | 'ErrorCollector: No errors' => 'No errors detected. However, because error reporting is still incomplete, there may have been errors that the error collector was not notified of; please inspect the output HTML carefully.', 18 | 'ErrorCollector: At line' => ' at line $line', 19 | 'ErrorCollector: Incidental errors' => 'Incidental errors', 20 | 21 | 'Lexer: Unclosed comment' => 'Unclosed comment', 22 | 'Lexer: Unescaped lt' => 'Unescaped less-than sign (<) should be <', 23 | 'Lexer: Missing gt' => 'Missing greater-than sign (>), previous less-than sign (<) should be escaped', 24 | 'Lexer: Missing attribute key' => 'Attribute declaration has no key', 25 | 'Lexer: Missing end quote' => 'Attribute declaration has no end quote', 26 | 'Lexer: Extracted body' => 'Removed document metadata tags', 27 | 28 | 'Strategy_RemoveForeignElements: Tag transform' => '<$1> element transformed into $CurrentToken.Serialized', 29 | 'Strategy_RemoveForeignElements: Missing required attribute' => '$CurrentToken.Compact element missing required attribute $1', 30 | 'Strategy_RemoveForeignElements: Foreign element to text' => 'Unrecognized $CurrentToken.Serialized tag converted to text', 31 | 'Strategy_RemoveForeignElements: Foreign element removed' => 'Unrecognized $CurrentToken.Serialized tag removed', 32 | 'Strategy_RemoveForeignElements: Comment removed' => 'Comment containing "$CurrentToken.Data" removed', 33 | 'Strategy_RemoveForeignElements: Foreign meta element removed' => 'Unrecognized $CurrentToken.Serialized meta tag and all descendants removed', 34 | 'Strategy_RemoveForeignElements: Token removed to end' => 'Tags and text starting from $1 element where removed to end', 35 | 'Strategy_RemoveForeignElements: Trailing hyphen in comment removed' => 'Trailing hyphen(s) in comment removed', 36 | 'Strategy_RemoveForeignElements: Hyphens in comment collapsed' => 'Double hyphens in comments are not allowed, and were collapsed into single hyphens', 37 | 38 | 'Strategy_MakeWellFormed: Unnecessary end tag removed' => 'Unnecessary $CurrentToken.Serialized tag removed', 39 | 'Strategy_MakeWellFormed: Unnecessary end tag to text' => 'Unnecessary $CurrentToken.Serialized tag converted to text', 40 | 'Strategy_MakeWellFormed: Tag auto closed' => '$1.Compact started on line $1.Line auto-closed by $CurrentToken.Compact', 41 | 'Strategy_MakeWellFormed: Tag carryover' => '$1.Compact started on line $1.Line auto-continued into $CurrentToken.Compact', 42 | 'Strategy_MakeWellFormed: Stray end tag removed' => 'Stray $CurrentToken.Serialized tag removed', 43 | 'Strategy_MakeWellFormed: Stray end tag to text' => 'Stray $CurrentToken.Serialized tag converted to text', 44 | 'Strategy_MakeWellFormed: Tag closed by element end' => '$1.Compact tag started on line $1.Line closed by end of $CurrentToken.Serialized', 45 | 'Strategy_MakeWellFormed: Tag closed by document end' => '$1.Compact tag started on line $1.Line closed by end of document', 46 | 47 | 'Strategy_FixNesting: Node removed' => '$CurrentToken.Compact node removed', 48 | 'Strategy_FixNesting: Node excluded' => '$CurrentToken.Compact node removed due to descendant exclusion by ancestor element', 49 | 'Strategy_FixNesting: Node reorganized' => 'Contents of $CurrentToken.Compact node reorganized to enforce its content model', 50 | 'Strategy_FixNesting: Node contents removed' => 'Contents of $CurrentToken.Compact node removed', 51 | 52 | 'AttrValidator: Attributes transformed' => 'Attributes on $CurrentToken.Compact transformed from $1.Keys to $2.Keys', 53 | 'AttrValidator: Attribute removed' => '$CurrentAttr.Name attribute on $CurrentToken.Compact removed', 54 | 55 | ); 56 | 57 | $errorNames = array( 58 | E_ERROR => 'Error', 59 | E_WARNING => 'Warning', 60 | E_NOTICE => 'Notice' 61 | ); 62 | 63 | // vim: et sw=4 sts=4 64 | -------------------------------------------------------------------------------- /wrAPI/apis/Abstract_Api.php: -------------------------------------------------------------------------------- 1 | _customHeaders[] = $header; 59 | } 60 | 61 | protected function _curl( $method, $path, $options, $json = true ) { 62 | if( $this->debugging === true ) 63 | return $this->_curlTest( $method, $path, $options ); 64 | 65 | $curl = curl_init(); 66 | switch( strtolower( $method ) ){ 67 | 68 | case 'get': 69 | $params = '?'; 70 | if( !is_array( $options ) || count( $options ) <= 0 ) 71 | break; 72 | 73 | foreach( $options as $key => $value ){ 74 | $params .= urlencode( $key ) . '=' . urlencode( $value ); 75 | } 76 | 77 | if( $params != '?' ){ 78 | $path .= $params; 79 | } 80 | break; 81 | 82 | case 'post': 83 | curl_setopt( $curl, CURLOPT_POST, true ); 84 | if( !empty( $options ) ) 85 | curl_setopt( $curl, CURLOPT_POSTFIELDS, $options ); 86 | break; 87 | 88 | case 'put': 89 | case 'delete': 90 | curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, strtoupper( $method ) ); 91 | if( !empty( $options ) ) 92 | curl_setopt( $curl, CURLOPT_POSTFIELDS, $options); 93 | break; 94 | 95 | default: 96 | throw new MethodNotSupportedException( 'Sorry, '.$method.' is an unsupported method.' ); 97 | break; 98 | 99 | } 100 | 101 | curl_setopt( $curl, CURLOPT_URL, $path ); 102 | curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); 103 | 104 | if(count( $this->_customHeaders ) > 0){ 105 | curl_setopt( $curl, CURLOPT_HTTPHEADER, $this->_customHeaders ); 106 | } 107 | 108 | $exec_result = curl_exec( $curl ); 109 | 110 | $this->_customHeaders = array(); 111 | if( $json === true ) 112 | return $this->_validate( $exec_result ); 113 | else 114 | return $exec_result; 115 | 116 | } 117 | 118 | protected function _curlTest( $method, $path, $options ) { 119 | 120 | if( is_string( $options ) ) 121 | return $this->_validate( $options ); 122 | 123 | return $this->_validate( json_encode( $options ) ); 124 | 125 | } 126 | 127 | public function debug() { 128 | 129 | $this->debugging = !$this->debugging; 130 | return $this->debugging; 131 | 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/Builder/Xml.php: -------------------------------------------------------------------------------- 1 | startElement('div'); 15 | 16 | $purifier = HTMLPurifier::getInstance(); 17 | $html = $purifier->purify($html); 18 | $this->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); 19 | $this->writeRaw($html); 20 | 21 | $this->endElement(); // div 22 | } 23 | 24 | protected function export($var) { 25 | if ($var === array()) return 'array()'; 26 | return var_export($var, true); 27 | } 28 | 29 | public function build($interchange) { 30 | // global access, only use as last resort 31 | $this->interchange = $interchange; 32 | 33 | $this->setIndent(true); 34 | $this->startDocument('1.0', 'UTF-8'); 35 | $this->startElement('configdoc'); 36 | $this->writeElement('title', $interchange->name); 37 | 38 | foreach ($interchange->directives as $directive) { 39 | $this->buildDirective($directive); 40 | } 41 | 42 | if ($this->namespace) $this->endElement(); // namespace 43 | 44 | $this->endElement(); // configdoc 45 | $this->flush(); 46 | } 47 | 48 | public function buildDirective($directive) { 49 | 50 | // Kludge, although I suppose having a notion of a "root namespace" 51 | // certainly makes things look nicer when documentation is built. 52 | // Depends on things being sorted. 53 | if (!$this->namespace || $this->namespace !== $directive->id->getRootNamespace()) { 54 | if ($this->namespace) $this->endElement(); // namespace 55 | $this->namespace = $directive->id->getRootNamespace(); 56 | $this->startElement('namespace'); 57 | $this->writeAttribute('id', $this->namespace); 58 | $this->writeElement('name', $this->namespace); 59 | } 60 | 61 | $this->startElement('directive'); 62 | $this->writeAttribute('id', $directive->id->toString()); 63 | 64 | $this->writeElement('name', $directive->id->getDirective()); 65 | 66 | $this->startElement('aliases'); 67 | foreach ($directive->aliases as $alias) $this->writeElement('alias', $alias->toString()); 68 | $this->endElement(); // aliases 69 | 70 | $this->startElement('constraints'); 71 | if ($directive->version) $this->writeElement('version', $directive->version); 72 | $this->startElement('type'); 73 | if ($directive->typeAllowsNull) $this->writeAttribute('allow-null', 'yes'); 74 | $this->text($directive->type); 75 | $this->endElement(); // type 76 | if ($directive->allowed) { 77 | $this->startElement('allowed'); 78 | foreach ($directive->allowed as $value => $x) $this->writeElement('value', $value); 79 | $this->endElement(); // allowed 80 | } 81 | $this->writeElement('default', $this->export($directive->default)); 82 | $this->writeAttribute('xml:space', 'preserve'); 83 | if ($directive->external) { 84 | $this->startElement('external'); 85 | foreach ($directive->external as $project) $this->writeElement('project', $project); 86 | $this->endElement(); 87 | } 88 | $this->endElement(); // constraints 89 | 90 | if ($directive->deprecatedVersion) { 91 | $this->startElement('deprecated'); 92 | $this->writeElement('version', $directive->deprecatedVersion); 93 | $this->writeElement('use', $directive->deprecatedUse->toString()); 94 | $this->endElement(); // deprecated 95 | } 96 | 97 | $this->startElement('description'); 98 | $this->writeHTMLDiv($directive->description); 99 | $this->endElement(); // description 100 | 101 | $this->endElement(); // directive 102 | } 103 | 104 | } 105 | 106 | // vim: et sw=4 sts=4 107 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/EntityLookup/entities.ser: -------------------------------------------------------------------------------- 1 | a:246:{s:4:"nbsp";s:2:" ";s:5:"iexcl";s:2:"¡";s:4:"cent";s:2:"¢";s:5:"pound";s:2:"£";s:6:"curren";s:2:"¤";s:3:"yen";s:2:"¥";s:6:"brvbar";s:2:"¦";s:4:"sect";s:2:"§";s:3:"uml";s:2:"¨";s:4:"copy";s:2:"©";s:4:"ordf";s:2:"ª";s:5:"laquo";s:2:"«";s:3:"not";s:2:"¬";s:3:"shy";s:2:"­";s:3:"reg";s:2:"®";s:4:"macr";s:2:"¯";s:3:"deg";s:2:"°";s:6:"plusmn";s:2:"±";s:5:"acute";s:2:"´";s:5:"micro";s:2:"µ";s:4:"para";s:2:"¶";s:6:"middot";s:2:"·";s:5:"cedil";s:2:"¸";s:4:"ordm";s:2:"º";s:5:"raquo";s:2:"»";s:6:"iquest";s:2:"¿";s:6:"Agrave";s:2:"À";s:6:"Aacute";s:2:"Á";s:5:"Acirc";s:2:"Â";s:6:"Atilde";s:2:"Ã";s:4:"Auml";s:2:"Ä";s:5:"Aring";s:2:"Å";s:5:"AElig";s:2:"Æ";s:6:"Ccedil";s:2:"Ç";s:6:"Egrave";s:2:"È";s:6:"Eacute";s:2:"É";s:5:"Ecirc";s:2:"Ê";s:4:"Euml";s:2:"Ë";s:6:"Igrave";s:2:"Ì";s:6:"Iacute";s:2:"Í";s:5:"Icirc";s:2:"Î";s:4:"Iuml";s:2:"Ï";s:3:"ETH";s:2:"Ð";s:6:"Ntilde";s:2:"Ñ";s:6:"Ograve";s:2:"Ò";s:6:"Oacute";s:2:"Ó";s:5:"Ocirc";s:2:"Ô";s:6:"Otilde";s:2:"Õ";s:4:"Ouml";s:2:"Ö";s:5:"times";s:2:"×";s:6:"Oslash";s:2:"Ø";s:6:"Ugrave";s:2:"Ù";s:6:"Uacute";s:2:"Ú";s:5:"Ucirc";s:2:"Û";s:4:"Uuml";s:2:"Ü";s:6:"Yacute";s:2:"Ý";s:5:"THORN";s:2:"Þ";s:5:"szlig";s:2:"ß";s:6:"agrave";s:2:"à";s:6:"aacute";s:2:"á";s:5:"acirc";s:2:"â";s:6:"atilde";s:2:"ã";s:4:"auml";s:2:"ä";s:5:"aring";s:2:"å";s:5:"aelig";s:2:"æ";s:6:"ccedil";s:2:"ç";s:6:"egrave";s:2:"è";s:6:"eacute";s:2:"é";s:5:"ecirc";s:2:"ê";s:4:"euml";s:2:"ë";s:6:"igrave";s:2:"ì";s:6:"iacute";s:2:"í";s:5:"icirc";s:2:"î";s:4:"iuml";s:2:"ï";s:3:"eth";s:2:"ð";s:6:"ntilde";s:2:"ñ";s:6:"ograve";s:2:"ò";s:6:"oacute";s:2:"ó";s:5:"ocirc";s:2:"ô";s:6:"otilde";s:2:"õ";s:4:"ouml";s:2:"ö";s:6:"divide";s:2:"÷";s:6:"oslash";s:2:"ø";s:6:"ugrave";s:2:"ù";s:6:"uacute";s:2:"ú";s:5:"ucirc";s:2:"û";s:4:"uuml";s:2:"ü";s:6:"yacute";s:2:"ý";s:5:"thorn";s:2:"þ";s:4:"yuml";s:2:"ÿ";s:4:"quot";s:1:""";s:3:"amp";s:1:"&";s:2:"lt";s:1:"<";s:2:"gt";s:1:">";s:4:"apos";s:1:"'";s:5:"OElig";s:2:"Œ";s:5:"oelig";s:2:"œ";s:6:"Scaron";s:2:"Š";s:6:"scaron";s:2:"š";s:4:"Yuml";s:2:"Ÿ";s:4:"circ";s:2:"ˆ";s:5:"tilde";s:2:"˜";s:4:"ensp";s:3:" ";s:4:"emsp";s:3:" ";s:6:"thinsp";s:3:" ";s:4:"zwnj";s:3:"‌";s:3:"zwj";s:3:"‍";s:3:"lrm";s:3:"‎";s:3:"rlm";s:3:"‏";s:5:"ndash";s:3:"–";s:5:"mdash";s:3:"—";s:5:"lsquo";s:3:"‘";s:5:"rsquo";s:3:"’";s:5:"sbquo";s:3:"‚";s:5:"ldquo";s:3:"“";s:5:"rdquo";s:3:"”";s:5:"bdquo";s:3:"„";s:6:"dagger";s:3:"†";s:6:"Dagger";s:3:"‡";s:6:"permil";s:3:"‰";s:6:"lsaquo";s:3:"‹";s:6:"rsaquo";s:3:"›";s:4:"euro";s:3:"€";s:4:"fnof";s:2:"ƒ";s:5:"Alpha";s:2:"Α";s:4:"Beta";s:2:"Β";s:5:"Gamma";s:2:"Γ";s:5:"Delta";s:2:"Δ";s:7:"Epsilon";s:2:"Ε";s:4:"Zeta";s:2:"Ζ";s:3:"Eta";s:2:"Η";s:5:"Theta";s:2:"Θ";s:4:"Iota";s:2:"Ι";s:5:"Kappa";s:2:"Κ";s:6:"Lambda";s:2:"Λ";s:2:"Mu";s:2:"Μ";s:2:"Nu";s:2:"Ν";s:2:"Xi";s:2:"Ξ";s:7:"Omicron";s:2:"Ο";s:2:"Pi";s:2:"Π";s:3:"Rho";s:2:"Ρ";s:5:"Sigma";s:2:"Σ";s:3:"Tau";s:2:"Τ";s:7:"Upsilon";s:2:"Υ";s:3:"Phi";s:2:"Φ";s:3:"Chi";s:2:"Χ";s:3:"Psi";s:2:"Ψ";s:5:"Omega";s:2:"Ω";s:5:"alpha";s:2:"α";s:4:"beta";s:2:"β";s:5:"gamma";s:2:"γ";s:5:"delta";s:2:"δ";s:7:"epsilon";s:2:"ε";s:4:"zeta";s:2:"ζ";s:3:"eta";s:2:"η";s:5:"theta";s:2:"θ";s:4:"iota";s:2:"ι";s:5:"kappa";s:2:"κ";s:6:"lambda";s:2:"λ";s:2:"mu";s:2:"μ";s:2:"nu";s:2:"ν";s:2:"xi";s:2:"ξ";s:7:"omicron";s:2:"ο";s:2:"pi";s:2:"π";s:3:"rho";s:2:"ρ";s:6:"sigmaf";s:2:"ς";s:5:"sigma";s:2:"σ";s:3:"tau";s:2:"τ";s:7:"upsilon";s:2:"υ";s:3:"phi";s:2:"φ";s:3:"chi";s:2:"χ";s:3:"psi";s:2:"ψ";s:5:"omega";s:2:"ω";s:8:"thetasym";s:2:"ϑ";s:5:"upsih";s:2:"ϒ";s:3:"piv";s:2:"ϖ";s:4:"bull";s:3:"•";s:6:"hellip";s:3:"…";s:5:"prime";s:3:"′";s:5:"Prime";s:3:"″";s:5:"oline";s:3:"‾";s:5:"frasl";s:3:"⁄";s:6:"weierp";s:3:"℘";s:5:"image";s:3:"ℑ";s:4:"real";s:3:"ℜ";s:5:"trade";s:3:"™";s:7:"alefsym";s:3:"ℵ";s:4:"larr";s:3:"←";s:4:"uarr";s:3:"↑";s:4:"rarr";s:3:"→";s:4:"darr";s:3:"↓";s:4:"harr";s:3:"↔";s:5:"crarr";s:3:"↵";s:4:"lArr";s:3:"⇐";s:4:"uArr";s:3:"⇑";s:4:"rArr";s:3:"⇒";s:4:"dArr";s:3:"⇓";s:4:"hArr";s:3:"⇔";s:6:"forall";s:3:"∀";s:4:"part";s:3:"∂";s:5:"exist";s:3:"∃";s:5:"empty";s:3:"∅";s:5:"nabla";s:3:"∇";s:4:"isin";s:3:"∈";s:5:"notin";s:3:"∉";s:2:"ni";s:3:"∋";s:4:"prod";s:3:"∏";s:3:"sum";s:3:"∑";s:5:"minus";s:3:"−";s:6:"lowast";s:3:"∗";s:5:"radic";s:3:"√";s:4:"prop";s:3:"∝";s:5:"infin";s:3:"∞";s:3:"ang";s:3:"∠";s:3:"and";s:3:"∧";s:2:"or";s:3:"∨";s:3:"cap";s:3:"∩";s:3:"cup";s:3:"∪";s:3:"int";s:3:"∫";s:3:"sim";s:3:"∼";s:4:"cong";s:3:"≅";s:5:"asymp";s:3:"≈";s:2:"ne";s:3:"≠";s:5:"equiv";s:3:"≡";s:2:"le";s:3:"≤";s:2:"ge";s:3:"≥";s:3:"sub";s:3:"⊂";s:3:"sup";s:3:"⊃";s:4:"nsub";s:3:"⊄";s:4:"sube";s:3:"⊆";s:4:"supe";s:3:"⊇";s:5:"oplus";s:3:"⊕";s:6:"otimes";s:3:"⊗";s:4:"perp";s:3:"⊥";s:4:"sdot";s:3:"⋅";s:5:"lceil";s:3:"⌈";s:5:"rceil";s:3:"⌉";s:6:"lfloor";s:3:"⌊";s:6:"rfloor";s:3:"⌋";s:4:"lang";s:3:"〈";s:4:"rang";s:3:"〉";s:3:"loz";s:3:"◊";s:6:"spades";s:3:"♠";s:5:"clubs";s:3:"♣";s:6:"hearts";s:3:"♥";s:5:"diams";s:3:"♦";} -------------------------------------------------------------------------------- /extend-clean.php: -------------------------------------------------------------------------------- 1 | \d+){(.*?)font-weight:bold(.*?)}#', $contents[ 'contents' ], $boldmatches ); 17 | preg_match_all('#.c(?P\d+){(.*?)font-style:italic(.*?)}#', $contents[ 'contents' ], $italicmatches); 18 | 19 | if( !empty( $boldmatches[ 'digit' ] ) ) { 20 | 21 | foreach( $boldmatches[ 'digit' ] as $boldclass ) { 22 | $contents[ 'contents' ] = preg_replace( '#(.*?)#s', '$3', $contents[ 'contents' ] ); 23 | } 24 | 25 | } 26 | 27 | if( !empty( $italicmatches[ 'digit' ] ) ) { 28 | 29 | foreach( $italicmatches[ 'digit' ] as $italicclass ) { 30 | $contents[ 'contents' ] = preg_replace( '#(.*?)#s', '$3', $contents[ 'contents' ] ); 31 | } 32 | 33 | } 34 | 35 | return $contents; 36 | 37 | } 38 | 39 | 40 | add_filter( 'pre_docs_to_wp_insert', 'dtwp_clean_content_filter', 10, 1 ); 41 | function dtwp_clean_content_filter( $post_array ) { 42 | global $dtwp_comments; 43 | 44 | $post_array['custom_fields'] = array_merge( $post_array['custom_fields'], array( '_gdocs_comments' => $dtwp_comments[ 'comments' ] ) ); 45 | 46 | return $post_array; 47 | 48 | } 49 | 50 | add_filter( 'pre_docs_to_wp_purify', 'dtwp_grab_comments', 10, 1 ); 51 | function dtwp_grab_comments( $post_content ){ 52 | global $dtwp_comments; 53 | $array = dtwp_clean_content( $post_content ); 54 | $dtwp_comments['comments'] = $array['comments']; 55 | return $array['content']; 56 | } 57 | 58 | function dtwp_clean_content($post_content) { 59 | $post_content = str_replace( array( "\r\n", "\n\n", "\r\r", "\n\r" ), "\n", $post_content ); 60 | $post_content = preg_replace('//', '
', $post_content); 61 | $post_content = preg_replace('//', '

', $post_content); 62 | 63 | //Match all the comments into an array. We're doing this before anything else because the

is importqnt 64 | preg_match_all( '/

\[[\w]\]<\/a>(.*?)<\/div>/', $post_content, $comments, PREG_PATTERN_ORDER); 65 | $comments = implode( "\r\n\r\n", $comments[1] ); 66 | 67 | //Take out the comments 68 | $post_content = preg_replace( '/

/', '', $post_content ); 71 | 72 | $post_content = str_replace( '

', '

',$post_content ); 74 | $post_content = strip_tags($post_content, '

    • ' ); 75 | $post_content = str_replace( '--','—',$post_content ); 76 | $post_content = str_replace( '

      ','

      ',$post_content ); 77 | $post_content = str_replace( '
         ', '\n\n', $post_content ); 78 | $post_content = str_replace( '
      79 |    ','\n\n',$post_content); 80 | $post_content = str_replace( '

      ', '\n\n', $post_content ); 81 | $post_content = trim( $post_content ); 82 | $pees = explode( '

      ', $post_content ); 83 | $trimmed = array(); 84 | foreach( $pees as $p ) 85 | $trimmed[] = trim( $p ); 86 | $post_content = implode( '

      ', $trimmed ); 87 | $post_content = preg_replace( "/

      <\/p>/", '', $post_content ); 88 | 89 | return array( 'content' => $post_content, 'comments' => $comments ); 90 | } 91 | 92 | 93 | //Add the comments meta box 94 | add_action( 'add_meta_boxes', 'dtwp_add_comments_meta_box' ); 95 | function dtwp_add_comments_meta_box( ) { 96 | add_meta_box( 'dtwp_comments_meta_box', __( 'Comments from gDocs', 'dtwp' ), 'dtwp_comments_meta_box', 'post' ); 97 | } 98 | 99 | //Display the comments meta box 100 | function dtwp_comments_meta_box( $post ) { 101 | $gdocID = get_post_meta( $post->ID, '_gdocID', true ); 102 | if( !empty( $gdocID ) ) { 103 | ?> 104 |

      Edit this doc
      105 | 107 |
      No doc attached.
      108 | ID, '_gdocs_comments', true ); 111 | $comments = apply_filters( 'the_content', $comments ); 112 | return $comments; 113 | 114 | } 115 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Lexer/PEARSax3.php: -------------------------------------------------------------------------------- 1 | tokens = array(); 37 | $this->last_token_was_empty = false; 38 | 39 | $string = $this->normalize($string, $config, $context); 40 | 41 | $this->parent_handler = set_error_handler(array($this, 'muteStrictErrorHandler')); 42 | 43 | $parser = new XML_HTMLSax3(); 44 | $parser->set_object($this); 45 | $parser->set_element_handler('openHandler','closeHandler'); 46 | $parser->set_data_handler('dataHandler'); 47 | $parser->set_escape_handler('escapeHandler'); 48 | 49 | // doesn't seem to work correctly for attributes 50 | $parser->set_option('XML_OPTION_ENTITIES_PARSED', 1); 51 | 52 | $parser->parse($string); 53 | 54 | restore_error_handler(); 55 | 56 | return $this->tokens; 57 | 58 | } 59 | 60 | /** 61 | * Open tag event handler, interface is defined by PEAR package. 62 | */ 63 | public function openHandler(&$parser, $name, $attrs, $closed) { 64 | // entities are not resolved in attrs 65 | foreach ($attrs as $key => $attr) { 66 | $attrs[$key] = $this->parseData($attr); 67 | } 68 | if ($closed) { 69 | $this->tokens[] = new HTMLPurifier_Token_Empty($name, $attrs); 70 | $this->last_token_was_empty = true; 71 | } else { 72 | $this->tokens[] = new HTMLPurifier_Token_Start($name, $attrs); 73 | } 74 | $this->stack[] = $name; 75 | return true; 76 | } 77 | 78 | /** 79 | * Close tag event handler, interface is defined by PEAR package. 80 | */ 81 | public function closeHandler(&$parser, $name) { 82 | // HTMLSax3 seems to always send empty tags an extra close tag 83 | // check and ignore if you see it: 84 | // [TESTME] to make sure it doesn't overreach 85 | if ($this->last_token_was_empty) { 86 | $this->last_token_was_empty = false; 87 | return true; 88 | } 89 | $this->tokens[] = new HTMLPurifier_Token_End($name); 90 | if (!empty($this->stack)) array_pop($this->stack); 91 | return true; 92 | } 93 | 94 | /** 95 | * Data event handler, interface is defined by PEAR package. 96 | */ 97 | public function dataHandler(&$parser, $data) { 98 | $this->last_token_was_empty = false; 99 | $this->tokens[] = new HTMLPurifier_Token_Text($data); 100 | return true; 101 | } 102 | 103 | /** 104 | * Escaped text handler, interface is defined by PEAR package. 105 | */ 106 | public function escapeHandler(&$parser, $data) { 107 | if (strpos($data, '--') === 0) { 108 | // remove trailing and leading double-dashes 109 | $data = substr($data, 2); 110 | if (strlen($data) >= 2 && substr($data, -2) == "--") { 111 | $data = substr($data, 0, -2); 112 | } 113 | if (isset($this->stack[sizeof($this->stack) - 1]) && 114 | $this->stack[sizeof($this->stack) - 1] == "style") { 115 | $this->tokens[] = new HTMLPurifier_Token_Text($data); 116 | } else { 117 | $this->tokens[] = new HTMLPurifier_Token_Comment($data); 118 | } 119 | $this->last_token_was_empty = false; 120 | } 121 | // CDATA is handled elsewhere, but if it was handled here: 122 | //if (strpos($data, '[CDATA[') === 0) { 123 | // $this->tokens[] = new HTMLPurifier_Token_Text( 124 | // substr($data, 7, strlen($data) - 9) ); 125 | //} 126 | return true; 127 | } 128 | 129 | /** 130 | * An error handler that mutes strict errors 131 | */ 132 | public function muteStrictErrorHandler($errno, $errstr, $errfile=null, $errline=null, $errcontext=null) { 133 | if ($errno == E_STRICT) return; 134 | return call_user_func($this->parent_handler, $errno, $errstr, $errfile, $errline, $errcontext); 135 | } 136 | 137 | } 138 | 139 | // vim: et sw=4 sts=4 140 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Filter/ExtractStyleBlocks.php: -------------------------------------------------------------------------------- 1 | blocks from input HTML, cleans them up 5 | * using CSSTidy, and then places them in $purifier->context->get('StyleBlocks') 6 | * so they can be used elsewhere in the document. 7 | * 8 | * @note 9 | * See tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php for 10 | * sample usage. 11 | * 12 | * @note 13 | * This filter can also be used on stylesheets not included in the 14 | * document--something purists would probably prefer. Just directly 15 | * call HTMLPurifier_Filter_ExtractStyleBlocks->cleanCSS() 16 | */ 17 | class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter 18 | { 19 | 20 | public $name = 'ExtractStyleBlocks'; 21 | private $_styleMatches = array(); 22 | private $_tidy; 23 | 24 | public function __construct() { 25 | $this->_tidy = new csstidy(); 26 | } 27 | 28 | /** 29 | * Save the contents of CSS blocks to style matches 30 | * @param $matches preg_replace style $matches array 31 | */ 32 | protected function styleCallback($matches) { 33 | $this->_styleMatches[] = $matches[1]; 34 | } 35 | 36 | /** 37 | * Removes inline #isU', array($this, 'styleCallback'), $html); 44 | $style_blocks = $this->_styleMatches; 45 | $this->_styleMatches = array(); // reset 46 | $context->register('StyleBlocks', $style_blocks); // $context must not be reused 47 | if ($this->_tidy) { 48 | foreach ($style_blocks as &$style) { 49 | $style = $this->cleanCSS($style, $config, $context); 50 | } 51 | } 52 | return $html; 53 | } 54 | 55 | /** 56 | * Takes CSS (the stuff found in in a font-family prop). 123 | if ($config->get('Filter.ExtractStyleBlocks.Escaping')) { 124 | $css = str_replace( 125 | array('<', '>', '&'), 126 | array('\3C ', '\3E ', '\26 '), 127 | $css 128 | ); 129 | } 130 | return $css; 131 | } 132 | 133 | } 134 | 135 | // vim: et sw=4 sts=4 136 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Printer.php: -------------------------------------------------------------------------------- 1 | getAll(); 30 | $context = new HTMLPurifier_Context(); 31 | $this->generator = new HTMLPurifier_Generator($config, $context); 32 | } 33 | 34 | /** 35 | * Main function that renders object or aspect of that object 36 | * @note Parameters vary depending on printer 37 | */ 38 | // function render() {} 39 | 40 | /** 41 | * Returns a start tag 42 | * @param $tag Tag name 43 | * @param $attr Attribute array 44 | */ 45 | protected function start($tag, $attr = array()) { 46 | return $this->generator->generateFromToken( 47 | new HTMLPurifier_Token_Start($tag, $attr ? $attr : array()) 48 | ); 49 | } 50 | 51 | /** 52 | * Returns an end teg 53 | * @param $tag Tag name 54 | */ 55 | protected function end($tag) { 56 | return $this->generator->generateFromToken( 57 | new HTMLPurifier_Token_End($tag) 58 | ); 59 | } 60 | 61 | /** 62 | * Prints a complete element with content inside 63 | * @param $tag Tag name 64 | * @param $contents Element contents 65 | * @param $attr Tag attributes 66 | * @param $escape Bool whether or not to escape contents 67 | */ 68 | protected function element($tag, $contents, $attr = array(), $escape = true) { 69 | return $this->start($tag, $attr) . 70 | ($escape ? $this->escape($contents) : $contents) . 71 | $this->end($tag); 72 | } 73 | 74 | protected function elementEmpty($tag, $attr = array()) { 75 | return $this->generator->generateFromToken( 76 | new HTMLPurifier_Token_Empty($tag, $attr) 77 | ); 78 | } 79 | 80 | protected function text($text) { 81 | return $this->generator->generateFromToken( 82 | new HTMLPurifier_Token_Text($text) 83 | ); 84 | } 85 | 86 | /** 87 | * Prints a simple key/value row in a table. 88 | * @param $name Key 89 | * @param $value Value 90 | */ 91 | protected function row($name, $value) { 92 | if (is_bool($value)) $value = $value ? 'On' : 'Off'; 93 | return 94 | $this->start('tr') . "\n" . 95 | $this->element('th', $name) . "\n" . 96 | $this->element('td', $value) . "\n" . 97 | $this->end('tr') 98 | ; 99 | } 100 | 101 | /** 102 | * Escapes a string for HTML output. 103 | * @param $string String to escape 104 | */ 105 | protected function escape($string) { 106 | $string = HTMLPurifier_Encoder::cleanUTF8($string); 107 | $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8'); 108 | return $string; 109 | } 110 | 111 | /** 112 | * Takes a list of strings and turns them into a single list 113 | * @param $array List of strings 114 | * @param $polite Bool whether or not to add an end before the last 115 | */ 116 | protected function listify($array, $polite = false) { 117 | if (empty($array)) return 'None'; 118 | $ret = ''; 119 | $i = count($array); 120 | foreach ($array as $value) { 121 | $i--; 122 | $ret .= $value; 123 | if ($i > 0 && !($polite && $i == 1)) $ret .= ', '; 124 | if ($polite && $i == 1) $ret .= 'and '; 125 | } 126 | return $ret; 127 | } 128 | 129 | /** 130 | * Retrieves the class of an object without prefixes, as well as metadata 131 | * @param $obj Object to determine class of 132 | * @param $prefix Further prefix to remove 133 | */ 134 | protected function getClass($obj, $sec_prefix = '') { 135 | static $five = null; 136 | if ($five === null) $five = version_compare(PHP_VERSION, '5', '>='); 137 | $prefix = 'HTMLPurifier_' . $sec_prefix; 138 | if (!$five) $prefix = strtolower($prefix); 139 | $class = str_replace($prefix, '', get_class($obj)); 140 | $lclass = strtolower($class); 141 | $class .= '('; 142 | switch ($lclass) { 143 | case 'enum': 144 | $values = array(); 145 | foreach ($obj->valid_values as $value => $bool) { 146 | $values[] = $value; 147 | } 148 | $class .= implode(', ', $values); 149 | break; 150 | case 'css_composite': 151 | $values = array(); 152 | foreach ($obj->defs as $def) { 153 | $values[] = $this->getClass($def, $sec_prefix); 154 | } 155 | $class .= implode(', ', $values); 156 | break; 157 | case 'css_multiple': 158 | $class .= $this->getClass($obj->single, $sec_prefix) . ', '; 159 | $class .= $obj->max; 160 | break; 161 | case 'css_denyelementdecorator': 162 | $class .= $this->getClass($obj->def, $sec_prefix) . ', '; 163 | $class .= $obj->element; 164 | break; 165 | case 'css_importantdecorator': 166 | $class .= $this->getClass($obj->def, $sec_prefix); 167 | if ($obj->allow) $class .= ', !important'; 168 | break; 169 | } 170 | $class .= ')'; 171 | return $class; 172 | } 173 | 174 | } 175 | 176 | // vim: et sw=4 sts=4 177 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/InterchangeBuilder.php: -------------------------------------------------------------------------------- 1 | varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native(); 13 | } 14 | 15 | public static function buildFromDirectory($dir = null) { 16 | $builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder(); 17 | $interchange = new HTMLPurifier_ConfigSchema_Interchange(); 18 | return $builder->buildDir($interchange, $dir); 19 | } 20 | 21 | public function buildDir($interchange, $dir = null) { 22 | if (!$dir) $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema'; 23 | if (file_exists($dir . '/info.ini')) { 24 | $info = parse_ini_file($dir . '/info.ini'); 25 | $interchange->name = $info['name']; 26 | } 27 | 28 | $files = array(); 29 | $dh = opendir($dir); 30 | while (false !== ($file = readdir($dh))) { 31 | if (!$file || $file[0] == '.' || strrchr($file, '.') !== '.txt') { 32 | continue; 33 | } 34 | $files[] = $file; 35 | } 36 | closedir($dh); 37 | 38 | sort($files); 39 | foreach ($files as $file) { 40 | $this->buildFile($interchange, $dir . '/' . $file); 41 | } 42 | 43 | return $interchange; 44 | } 45 | 46 | public function buildFile($interchange, $file) { 47 | $parser = new HTMLPurifier_StringHashParser(); 48 | $this->build( 49 | $interchange, 50 | new HTMLPurifier_StringHash( $parser->parseFile($file) ) 51 | ); 52 | } 53 | 54 | /** 55 | * Builds an interchange object based on a hash. 56 | * @param $interchange HTMLPurifier_ConfigSchema_Interchange object to build 57 | * @param $hash HTMLPurifier_ConfigSchema_StringHash source data 58 | */ 59 | public function build($interchange, $hash) { 60 | if (!$hash instanceof HTMLPurifier_StringHash) { 61 | $hash = new HTMLPurifier_StringHash($hash); 62 | } 63 | if (!isset($hash['ID'])) { 64 | throw new HTMLPurifier_ConfigSchema_Exception('Hash does not have any ID'); 65 | } 66 | if (strpos($hash['ID'], '.') === false) { 67 | if (count($hash) == 2 && isset($hash['DESCRIPTION'])) { 68 | $hash->offsetGet('DESCRIPTION'); // prevent complaining 69 | } else { 70 | throw new HTMLPurifier_ConfigSchema_Exception('All directives must have a namespace'); 71 | } 72 | } else { 73 | $this->buildDirective($interchange, $hash); 74 | } 75 | $this->_findUnused($hash); 76 | } 77 | 78 | public function buildDirective($interchange, $hash) { 79 | $directive = new HTMLPurifier_ConfigSchema_Interchange_Directive(); 80 | 81 | // These are required elements: 82 | $directive->id = $this->id($hash->offsetGet('ID')); 83 | $id = $directive->id->toString(); // convenience 84 | 85 | if (isset($hash['TYPE'])) { 86 | $type = explode('/', $hash->offsetGet('TYPE')); 87 | if (isset($type[1])) $directive->typeAllowsNull = true; 88 | $directive->type = $type[0]; 89 | } else { 90 | throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined"); 91 | } 92 | 93 | if (isset($hash['DEFAULT'])) { 94 | try { 95 | $directive->default = $this->varParser->parse($hash->offsetGet('DEFAULT'), $directive->type, $directive->typeAllowsNull); 96 | } catch (HTMLPurifier_VarParserException $e) { 97 | throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'"); 98 | } 99 | } 100 | 101 | if (isset($hash['DESCRIPTION'])) { 102 | $directive->description = $hash->offsetGet('DESCRIPTION'); 103 | } 104 | 105 | if (isset($hash['ALLOWED'])) { 106 | $directive->allowed = $this->lookup($this->evalArray($hash->offsetGet('ALLOWED'))); 107 | } 108 | 109 | if (isset($hash['VALUE-ALIASES'])) { 110 | $directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES')); 111 | } 112 | 113 | if (isset($hash['ALIASES'])) { 114 | $raw_aliases = trim($hash->offsetGet('ALIASES')); 115 | $aliases = preg_split('/\s*,\s*/', $raw_aliases); 116 | foreach ($aliases as $alias) { 117 | $directive->aliases[] = $this->id($alias); 118 | } 119 | } 120 | 121 | if (isset($hash['VERSION'])) { 122 | $directive->version = $hash->offsetGet('VERSION'); 123 | } 124 | 125 | if (isset($hash['DEPRECATED-USE'])) { 126 | $directive->deprecatedUse = $this->id($hash->offsetGet('DEPRECATED-USE')); 127 | } 128 | 129 | if (isset($hash['DEPRECATED-VERSION'])) { 130 | $directive->deprecatedVersion = $hash->offsetGet('DEPRECATED-VERSION'); 131 | } 132 | 133 | if (isset($hash['EXTERNAL'])) { 134 | $directive->external = preg_split('/\s*,\s*/', trim($hash->offsetGet('EXTERNAL'))); 135 | } 136 | 137 | $interchange->addDirective($directive); 138 | } 139 | 140 | /** 141 | * Evaluates an array PHP code string without array() wrapper 142 | */ 143 | protected function evalArray($contents) { 144 | return eval('return array('. $contents .');'); 145 | } 146 | 147 | /** 148 | * Converts an array list into a lookup array. 149 | */ 150 | protected function lookup($array) { 151 | $ret = array(); 152 | foreach ($array as $val) $ret[$val] = true; 153 | return $ret; 154 | } 155 | 156 | /** 157 | * Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id 158 | * object based on a string Id. 159 | */ 160 | protected function id($id) { 161 | return HTMLPurifier_ConfigSchema_Interchange_Id::make($id); 162 | } 163 | 164 | /** 165 | * Triggers errors for any unused keys passed in the hash; such keys 166 | * may indicate typos, missing values, etc. 167 | * @param $hash Instance of ConfigSchema_StringHash to check. 168 | */ 169 | protected function _findUnused($hash) { 170 | $accessed = $hash->getAccessed(); 171 | foreach ($hash as $k => $v) { 172 | if (!isset($accessed[$k])) { 173 | trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE); 174 | } 175 | } 176 | } 177 | 178 | } 179 | 180 | // vim: et sw=4 sts=4 181 | -------------------------------------------------------------------------------- /options.php: -------------------------------------------------------------------------------- 1 | _auth = &$auth; 15 | $this->_drive = &$drive; 16 | 17 | $hook = add_options_page( 'Docs To WP', 'Docs To WP', 'manage_options', 'docs_to_wp', array( $this, 'settingsPage' ) ); 18 | add_action( 'load-' . $hook, array( $this, 'verifyAuth') ); 19 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueueScripts' ) ); 20 | 21 | do_action( 'post_docs_to_wp_options_init' ); 22 | 23 | } 24 | 25 | public function enqueueScripts( $hook ) { 26 | 27 | if( strpos( $hook, "docs_to_wp" ) === false ) 28 | return; 29 | 30 | do_action( 'pre_docs_to_wp_enqueue_scripts' ); 31 | 32 | wp_enqueue_script('jquery'); 33 | 34 | wp_register_script( 'd2woptions', plugins_url('/js/options.js', __FILE__) ); 35 | wp_enqueue_script('d2woptions'); 36 | 37 | do_action( 'post_docs_to_wp_enqueue_scripts' ); 38 | 39 | } 40 | 41 | 42 | public function settingsPage() { 43 | 44 | do_action( 'pre_docs_to_wp_options_page' ); 45 | ?> 46 | 47 |
      48 |
      49 | 50 | 51 |
      52 |
      53 | 54 | 55 |
      56 | 57 | 60 |
      61 | 62 | 63 |
      64 |
      65 | 66 | 67 |
      68 | 71 |
      72 | 73 | /> 74 |
      75 |
      76 | 77 | /> 78 |
      79 |
      80 | Connection Status: 81 | _verifyConnection()) ? 'Connected' : 'Error! Reconnect'; ?> 82 |
      83 |
      84 | 85 |
      86 | 87 |
      88 | _initAuth(); 105 | 106 | 107 | if( isset( $_GET['code'] ) ){ 108 | $result = $this->_auth->post( 109 | '/token', 110 | array( 111 | 'code' => $_GET['code'], 112 | 'client_id' => get_option( 'docs_to_wp_client_id' ), 113 | 'client_secret' => get_option( 'docs_to_wp_client_secret' ), 114 | 'redirect_uri' => admin_url( 'options-general.php?page=docs_to_wp' ), 115 | 'grant_type' => 'authorization_code' 116 | ) 117 | ); 118 | 119 | update_option( 'docs_to_wp_auth_token', $result->access_token ); 120 | update_option( 'docs_to_wp_refresh_token', $result->refresh_token ); 121 | 122 | } 123 | 124 | if( get_option( 'docs_to_wp_refresh_token' ) ) 125 | return $this->_reAuth(); 126 | 127 | $this->_initAuth(); 128 | 129 | } 130 | 131 | private function _initAuth() { 132 | 133 | $this->_auth->connect( 134 | array( 135 | 'response_type' => 'code', 136 | 'client_id' => get_option( 'docs_to_wp_client_id' ), 137 | 'redirect_uri' => admin_url( 'options-general.php?page=docs_to_wp' ), 138 | 'access_type' => 'offline', // We're looking for the refresh token, so require offline access. 139 | 'approval_prompt' => 'force', // We're going to walk through ALL the steps, so force the consent screen. 140 | 'scope' => 'https://www.googleapis.com/auth/drive' // ONE SCOPE TO RULE THEM ALL! 141 | ) 142 | ); 143 | 144 | } 145 | 146 | private function _reAuth() { 147 | 148 | $response = $this->_auth->refresh( get_option( 'docs_to_wp_refresh_token' ), get_option( 'docs_to_wp_client_id' ), get_option( 'docs_to_wp_client_secret' ) ); 149 | update_option( 'docs_to_wp_auth_token', $response->access_token ); 150 | 151 | } 152 | 153 | private function _verifyConnection() { 154 | 155 | $this->_drive->connect( 156 | array( 157 | 'access_token' => get_option( 'docs_to_wp_auth_token' ), 158 | 'token_type' => 'Bearer' 159 | ) 160 | ); 161 | 162 | $response = $this->_drive->get( '/about' ); 163 | return !isset($response->error); 164 | 165 | } 166 | 167 | } 168 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/Validator.php: -------------------------------------------------------------------------------- 1 | parser = new HTMLPurifier_VarParser(); 31 | } 32 | 33 | /** 34 | * Validates a fully-formed interchange object. Throws an 35 | * HTMLPurifier_ConfigSchema_Exception if there's a problem. 36 | */ 37 | public function validate($interchange) { 38 | $this->interchange = $interchange; 39 | $this->aliases = array(); 40 | // PHP is a bit lax with integer <=> string conversions in 41 | // arrays, so we don't use the identical !== comparison 42 | foreach ($interchange->directives as $i => $directive) { 43 | $id = $directive->id->toString(); 44 | if ($i != $id) $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'"); 45 | $this->validateDirective($directive); 46 | } 47 | return true; 48 | } 49 | 50 | /** 51 | * Validates a HTMLPurifier_ConfigSchema_Interchange_Id object. 52 | */ 53 | public function validateId($id) { 54 | $id_string = $id->toString(); 55 | $this->context[] = "id '$id_string'"; 56 | if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) { 57 | // handled by InterchangeBuilder 58 | $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id'); 59 | } 60 | // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.) 61 | // we probably should check that it has at least one namespace 62 | $this->with($id, 'key') 63 | ->assertNotEmpty() 64 | ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder 65 | array_pop($this->context); 66 | } 67 | 68 | /** 69 | * Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object. 70 | */ 71 | public function validateDirective($d) { 72 | $id = $d->id->toString(); 73 | $this->context[] = "directive '$id'"; 74 | $this->validateId($d->id); 75 | 76 | $this->with($d, 'description') 77 | ->assertNotEmpty(); 78 | 79 | // BEGIN - handled by InterchangeBuilder 80 | $this->with($d, 'type') 81 | ->assertNotEmpty(); 82 | $this->with($d, 'typeAllowsNull') 83 | ->assertIsBool(); 84 | try { 85 | // This also tests validity of $d->type 86 | $this->parser->parse($d->default, $d->type, $d->typeAllowsNull); 87 | } catch (HTMLPurifier_VarParserException $e) { 88 | $this->error('default', 'had error: ' . $e->getMessage()); 89 | } 90 | // END - handled by InterchangeBuilder 91 | 92 | if (!is_null($d->allowed) || !empty($d->valueAliases)) { 93 | // allowed and valueAliases require that we be dealing with 94 | // strings, so check for that early. 95 | $d_int = HTMLPurifier_VarParser::$types[$d->type]; 96 | if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) { 97 | $this->error('type', 'must be a string type when used with allowed or value aliases'); 98 | } 99 | } 100 | 101 | $this->validateDirectiveAllowed($d); 102 | $this->validateDirectiveValueAliases($d); 103 | $this->validateDirectiveAliases($d); 104 | 105 | array_pop($this->context); 106 | } 107 | 108 | /** 109 | * Extra validation if $allowed member variable of 110 | * HTMLPurifier_ConfigSchema_Interchange_Directive is defined. 111 | */ 112 | public function validateDirectiveAllowed($d) { 113 | if (is_null($d->allowed)) return; 114 | $this->with($d, 'allowed') 115 | ->assertNotEmpty() 116 | ->assertIsLookup(); // handled by InterchangeBuilder 117 | if (is_string($d->default) && !isset($d->allowed[$d->default])) { 118 | $this->error('default', 'must be an allowed value'); 119 | } 120 | $this->context[] = 'allowed'; 121 | foreach ($d->allowed as $val => $x) { 122 | if (!is_string($val)) $this->error("value $val", 'must be a string'); 123 | } 124 | array_pop($this->context); 125 | } 126 | 127 | /** 128 | * Extra validation if $valueAliases member variable of 129 | * HTMLPurifier_ConfigSchema_Interchange_Directive is defined. 130 | */ 131 | public function validateDirectiveValueAliases($d) { 132 | if (is_null($d->valueAliases)) return; 133 | $this->with($d, 'valueAliases') 134 | ->assertIsArray(); // handled by InterchangeBuilder 135 | $this->context[] = 'valueAliases'; 136 | foreach ($d->valueAliases as $alias => $real) { 137 | if (!is_string($alias)) $this->error("alias $alias", 'must be a string'); 138 | if (!is_string($real)) $this->error("alias target $real from alias '$alias'", 'must be a string'); 139 | if ($alias === $real) { 140 | $this->error("alias '$alias'", "must not be an alias to itself"); 141 | } 142 | } 143 | if (!is_null($d->allowed)) { 144 | foreach ($d->valueAliases as $alias => $real) { 145 | if (isset($d->allowed[$alias])) { 146 | $this->error("alias '$alias'", 'must not be an allowed value'); 147 | } elseif (!isset($d->allowed[$real])) { 148 | $this->error("alias '$alias'", 'must be an alias to an allowed value'); 149 | } 150 | } 151 | } 152 | array_pop($this->context); 153 | } 154 | 155 | /** 156 | * Extra validation if $aliases member variable of 157 | * HTMLPurifier_ConfigSchema_Interchange_Directive is defined. 158 | */ 159 | public function validateDirectiveAliases($d) { 160 | $this->with($d, 'aliases') 161 | ->assertIsArray(); // handled by InterchangeBuilder 162 | $this->context[] = 'aliases'; 163 | foreach ($d->aliases as $alias) { 164 | $this->validateId($alias); 165 | $s = $alias->toString(); 166 | if (isset($this->interchange->directives[$s])) { 167 | $this->error("alias '$s'", 'collides with another directive'); 168 | } 169 | if (isset($this->aliases[$s])) { 170 | $other_directive = $this->aliases[$s]; 171 | $this->error("alias '$s'", "collides with alias for directive '$other_directive'"); 172 | } 173 | $this->aliases[$s] = $d->id->toString(); 174 | } 175 | array_pop($this->context); 176 | } 177 | 178 | // protected helper functions 179 | 180 | /** 181 | * Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom 182 | * for validating simple member variables of objects. 183 | */ 184 | protected function with($obj, $member) { 185 | return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member); 186 | } 187 | 188 | /** 189 | * Emits an error, providing helpful context. 190 | */ 191 | protected function error($target, $msg) { 192 | if ($target !== false) $prefix = ucfirst($target) . ' in ' . $this->getFormattedContext(); 193 | else $prefix = ucfirst($this->getFormattedContext()); 194 | throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg)); 195 | } 196 | 197 | /** 198 | * Returns a formatted context string. 199 | */ 200 | protected function getFormattedContext() { 201 | return implode(' in ', array_reverse($this->context)); 202 | } 203 | 204 | } 205 | 206 | // vim: et sw=4 sts=4 207 | -------------------------------------------------------------------------------- /docs-to-wp.php: -------------------------------------------------------------------------------- 1 | _drive = wrAPI::create('Google_Drive'); 24 | $this->_auth = wrAPI::create('Google_Auth'); 25 | 26 | /* If you have a hardcoded origin and destination, force that here, and update options page to reflect as much. */ 27 | if( defined('DOCSTOWP_ORIGIN') ) 28 | update_option('docs_to_wp_origin', DOCSTOWP_ORIGIN); 29 | 30 | if( defined('DOCSTOWP_DESTINATION') ) 31 | update_option('docs_to_wp_target', DOCSTOWP_DESTINATION); 32 | 33 | $this->_register_hooks(); 34 | 35 | do_action('post_docs_to_wp_construct'); 36 | 37 | } 38 | 39 | public function registerMenu(){ 40 | 41 | $this->_options = new Docs_To_WP_Options( $this->_auth, $this->_drive ); 42 | 43 | } 44 | 45 | public function startTransfer() { 46 | 47 | $files = $this->_getFilesFromFolder(); 48 | if( !is_array( $files ) ) 49 | return array(); 50 | 51 | $posts = array(); 52 | 53 | foreach( $files as $file ) { 54 | 55 | $file = $this->_getFile( $file->id ); 56 | $html = $this->_getHTML( $file ); 57 | 58 | if( $html === false ) 59 | continue; 60 | 61 | $content = $this->_cleanDoc( $html ); 62 | 63 | $post_array = $this->_insertToWP( $file->title, $content, $this->_getParentName( $file->id ), $this->_getAuthorUsername( $file->owners ), $file->id ); 64 | 65 | if( $post_array === false ) 66 | continue; 67 | 68 | $posts[] = $post_array; 69 | 70 | $this->_moveToDestination( $file->id ); 71 | 72 | } 73 | 74 | return $posts; 75 | 76 | } 77 | 78 | public function setupNotice() { 79 | 80 | if( get_option( 'docs_to_wp_client_id' ) && get_option( 'docs_to_wp_client_secret' ) ) 81 | return; 82 | 83 | echo '

      Docs To WP Requires you to Create a Google API Project and enter the details in the options page.

      '; 84 | 85 | } 86 | 87 | /* 88 | Cloned from get_user_by 89 | */ 90 | private function _getWPUser( $id ){ 91 | 92 | $userdata = WP_User::get_data_by( 'login', $id ); 93 | 94 | if ( !$userdata ) 95 | return false; 96 | 97 | $user = new WP_User; 98 | 99 | $user->init( $userdata ); 100 | 101 | return $user; 102 | 103 | } 104 | 105 | private function _moveToDestination( $id ){ 106 | 107 | $this->_auth(); 108 | $this->_drive->put('/files/' . $id, array( 109 | 'parents' => array( 110 | array( 111 | 'id' => get_option( 'docs_to_wp_target' ) 112 | ) 113 | ) 114 | ) 115 | ); 116 | 117 | } 118 | 119 | private function _cleanDoc( $raw ) { 120 | 121 | $purifier = $this->_initPurifier(); 122 | 123 | //New domDocument and xPath to get the content 124 | $dom= new DOMDocument(); 125 | $dom->loadHTML( $raw ); 126 | 127 | $xpath = new DOMXPath($dom); 128 | 129 | //Strip away the headers 130 | $dirty_html = $dom->saveXml( $xpath->query('/html/body')->item(0) ); 131 | $dirty_html = apply_filters( 'pre_docs_to_wp_purify', $dirty_html ); 132 | 133 | //Run that through the purifier 134 | if( $purifier instanceof HTMLPurifier ) 135 | $clean_html = $purifier->purify( $dirty_html ); 136 | else 137 | $clean_html = $dirty_html; 138 | 139 | /* 140 | If you overrode the instance type in docs_to_wp_purifier_filter, 141 | you will need to activate it in docs_to_wp_custom_purifier. 142 | */ 143 | return apply_filters( 'docs_to_wp_custom_purifier', $clean_html ); 144 | 145 | } 146 | 147 | private function _getParentName( $id ){ 148 | 149 | $this->_auth(); 150 | $response = $this->_drive->get('/files/' . $id); 151 | 152 | $this->_auth(); 153 | $response = $this->_drive->get('/files/' . $response->id ); 154 | 155 | return $response->title; 156 | 157 | } 158 | 159 | private function _getAuthorUsername( $owners ){ 160 | 161 | $owner = $owners[0]; 162 | list( $owner, $devnull ) = explode('@', $owner->emailAddress); 163 | return $owner; 164 | 165 | } 166 | 167 | private function _insertToWP( $title, $content, $parentName, $author, $docID ) { 168 | 169 | $cats = array( $parentName ); 170 | $post_id = $this->_publish( $title, $content, $author, $cats, array( '_gdocID' => $docID ) ); 171 | 172 | if( $post_id === false ) 173 | return false; 174 | 175 | return array( 'post_id' => $post_id, 'gdoc_id' => $docID ); 176 | 177 | } 178 | 179 | private function _publish( $title, $content, $author = false, $categories = false, $custom_fields = false ) { 180 | 181 | //Find out if we are creating a draft or updating a doc 182 | $post_id = $this->_postExistsByMeta( '_gdocID', $custom_fields[ '_gdocID' ] ); 183 | 184 | //Find out if the collections the doc is in matches any categories 185 | $cats = array(); 186 | foreach ( $categories as $category ) { 187 | $cat = term_exists( $category, 'category' ); 188 | if( !empty( $cat ) ) 189 | $cats[] = $cat['term_id']; 190 | if( empty( $cats ) ) 191 | $cats[] = get_option('default_link_category'); 192 | } 193 | 194 | //If the username in gdocs matches the username in WordPress, it will automatically apply the correct username 195 | $author_data = $this->_getWPUser( 'login', $author ); 196 | 197 | $author = $author_data->ID; 198 | 199 | // Array filter removes anything that is False, so if this is not an update, ID will auto-remove itself. 200 | // http://php.net/manual/en/function.array-filter.php 201 | $post_array = array_filter( 202 | array( 203 | 'ID' => $post_id, 204 | 'post_title' => $title, 205 | 'post_content' => $content, 206 | 'custom_fields' => $custom_fields, 207 | 'post_author' => $author, 208 | 'post_category' => $cats 209 | ) 210 | ); 211 | 212 | 213 | //If you want all posts to be auto-published, for example, you can add a filter here 214 | $post_array = apply_filters( 'pre_docs_to_wp_insert', $post_array ); 215 | 216 | // wp_update_post returns 0 if post ID isn't there. 217 | if( !( $post_id = wp_update_post( $post_array, false ) ) ) 218 | $post_id = wp_insert_post( $post_array ); 219 | 220 | //Update post meta, including the _gdocID field 221 | foreach( $post_array['custom_fields'] as $key => $value ) 222 | update_post_meta( $post_id, $key, $value ); 223 | 224 | return $post_id; 225 | 226 | } 227 | 228 | private function _initPurifier() { 229 | 230 | $purifier = new HTMLPurifier(); // Create default Purifier. 231 | return apply_filters( 'docs_to_wp_purifier_filter', $purifier ); // Allow customization of purifier 232 | 233 | } 234 | 235 | private function _getFile( $id ) { 236 | 237 | $this->_auth(); 238 | $response = $this->_drive->get('/files/' . $id); 239 | 240 | if( isset( $response->labels->trashed ) && !empty( $response->labels->trashed ) ) 241 | return false; 242 | 243 | return $response; 244 | 245 | } 246 | 247 | private function _getHTML( $response ){ 248 | 249 | $this->_auth(); 250 | $page = $this->_drive->downloadFile( $response->exportLinks->{"text/html"} ); 251 | 252 | return $page; 253 | 254 | } 255 | 256 | private function _getFilesFromFolder() { 257 | 258 | $this->_auth(); 259 | $response = $this->_drive->get(( $geturl = '/files/' . get_option( 'docs_to_wp_origin' ) . '/children')); 260 | 261 | return is_array( $response->items ) ? $response->items : false; 262 | 263 | } 264 | 265 | private function _auth() { 266 | 267 | $response = $this->_auth->refresh( 268 | get_option( 'docs_to_wp_refresh_token' ), 269 | get_option( 'docs_to_wp_client_id' ), 270 | get_option( 'docs_to_wp_client_secret' ) 271 | ); 272 | 273 | update_option( 'docs_to_wp_auth_token', $response->access_token ); 274 | 275 | $this->_drive->connect( array( 276 | 'access_token' => get_option( 'docs_to_wp_auth_token' ), 277 | 'token_type' => 'Bearer' 278 | )); 279 | 280 | } 281 | 282 | private function _register_hooks(){ 283 | 284 | do_action('pre_docs_to_wp_register_hooks'); 285 | 286 | add_action( 'admin_notices', array( $this, 'setupNotice' ) ); 287 | add_action( 'admin_menu', array( $this, 'registerMenu' ) ); 288 | 289 | do_action('post_docs_to_wp_register_hooks'); 290 | 291 | } 292 | 293 | private function _postExistsByMeta( $key, $value ) { 294 | global $wpdb; 295 | 296 | $query = "SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key = %s AND meta_value = %s"; 297 | $return = $wpdb->get_var( $wpdb->prepare( $query, $key, $value ) ); 298 | return !empty( $return ) ? $return : false; 299 | 300 | } 301 | 302 | } 303 | 304 | $docs_to_wp = new Docs_To_WP(); 305 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/Printer/HTMLDefinition.php: -------------------------------------------------------------------------------- 1 | config =& $config; 14 | 15 | $this->def = $config->getHTMLDefinition(); 16 | 17 | $ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer')); 18 | 19 | $ret .= $this->renderDoctype(); 20 | $ret .= $this->renderEnvironment(); 21 | $ret .= $this->renderContentSets(); 22 | $ret .= $this->renderInfo(); 23 | 24 | $ret .= $this->end('div'); 25 | 26 | return $ret; 27 | } 28 | 29 | /** 30 | * Renders the Doctype table 31 | */ 32 | protected function renderDoctype() { 33 | $doctype = $this->def->doctype; 34 | $ret = ''; 35 | $ret .= $this->start('table'); 36 | $ret .= $this->element('caption', 'Doctype'); 37 | $ret .= $this->row('Name', $doctype->name); 38 | $ret .= $this->row('XML', $doctype->xml ? 'Yes' : 'No'); 39 | $ret .= $this->row('Default Modules', implode($doctype->modules, ', ')); 40 | $ret .= $this->row('Default Tidy Modules', implode($doctype->tidyModules, ', ')); 41 | $ret .= $this->end('table'); 42 | return $ret; 43 | } 44 | 45 | 46 | /** 47 | * Renders environment table, which is miscellaneous info 48 | */ 49 | protected function renderEnvironment() { 50 | $def = $this->def; 51 | 52 | $ret = ''; 53 | 54 | $ret .= $this->start('table'); 55 | $ret .= $this->element('caption', 'Environment'); 56 | 57 | $ret .= $this->row('Parent of fragment', $def->info_parent); 58 | $ret .= $this->renderChildren($def->info_parent_def->child); 59 | $ret .= $this->row('Block wrap name', $def->info_block_wrapper); 60 | 61 | $ret .= $this->start('tr'); 62 | $ret .= $this->element('th', 'Global attributes'); 63 | $ret .= $this->element('td', $this->listifyAttr($def->info_global_attr),0,0); 64 | $ret .= $this->end('tr'); 65 | 66 | $ret .= $this->start('tr'); 67 | $ret .= $this->element('th', 'Tag transforms'); 68 | $list = array(); 69 | foreach ($def->info_tag_transform as $old => $new) { 70 | $new = $this->getClass($new, 'TagTransform_'); 71 | $list[] = "<$old> with $new"; 72 | } 73 | $ret .= $this->element('td', $this->listify($list)); 74 | $ret .= $this->end('tr'); 75 | 76 | $ret .= $this->start('tr'); 77 | $ret .= $this->element('th', 'Pre-AttrTransform'); 78 | $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_pre)); 79 | $ret .= $this->end('tr'); 80 | 81 | $ret .= $this->start('tr'); 82 | $ret .= $this->element('th', 'Post-AttrTransform'); 83 | $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_post)); 84 | $ret .= $this->end('tr'); 85 | 86 | $ret .= $this->end('table'); 87 | return $ret; 88 | } 89 | 90 | /** 91 | * Renders the Content Sets table 92 | */ 93 | protected function renderContentSets() { 94 | $ret = ''; 95 | $ret .= $this->start('table'); 96 | $ret .= $this->element('caption', 'Content Sets'); 97 | foreach ($this->def->info_content_sets as $name => $lookup) { 98 | $ret .= $this->heavyHeader($name); 99 | $ret .= $this->start('tr'); 100 | $ret .= $this->element('td', $this->listifyTagLookup($lookup)); 101 | $ret .= $this->end('tr'); 102 | } 103 | $ret .= $this->end('table'); 104 | return $ret; 105 | } 106 | 107 | /** 108 | * Renders the Elements ($info) table 109 | */ 110 | protected function renderInfo() { 111 | $ret = ''; 112 | $ret .= $this->start('table'); 113 | $ret .= $this->element('caption', 'Elements ($info)'); 114 | ksort($this->def->info); 115 | $ret .= $this->heavyHeader('Allowed tags', 2); 116 | $ret .= $this->start('tr'); 117 | $ret .= $this->element('td', $this->listifyTagLookup($this->def->info), array('colspan' => 2)); 118 | $ret .= $this->end('tr'); 119 | foreach ($this->def->info as $name => $def) { 120 | $ret .= $this->start('tr'); 121 | $ret .= $this->element('th', "<$name>", array('class'=>'heavy', 'colspan' => 2)); 122 | $ret .= $this->end('tr'); 123 | $ret .= $this->start('tr'); 124 | $ret .= $this->element('th', 'Inline content'); 125 | $ret .= $this->element('td', $def->descendants_are_inline ? 'Yes' : 'No'); 126 | $ret .= $this->end('tr'); 127 | if (!empty($def->excludes)) { 128 | $ret .= $this->start('tr'); 129 | $ret .= $this->element('th', 'Excludes'); 130 | $ret .= $this->element('td', $this->listifyTagLookup($def->excludes)); 131 | $ret .= $this->end('tr'); 132 | } 133 | if (!empty($def->attr_transform_pre)) { 134 | $ret .= $this->start('tr'); 135 | $ret .= $this->element('th', 'Pre-AttrTransform'); 136 | $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre)); 137 | $ret .= $this->end('tr'); 138 | } 139 | if (!empty($def->attr_transform_post)) { 140 | $ret .= $this->start('tr'); 141 | $ret .= $this->element('th', 'Post-AttrTransform'); 142 | $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post)); 143 | $ret .= $this->end('tr'); 144 | } 145 | if (!empty($def->auto_close)) { 146 | $ret .= $this->start('tr'); 147 | $ret .= $this->element('th', 'Auto closed by'); 148 | $ret .= $this->element('td', $this->listifyTagLookup($def->auto_close)); 149 | $ret .= $this->end('tr'); 150 | } 151 | $ret .= $this->start('tr'); 152 | $ret .= $this->element('th', 'Allowed attributes'); 153 | $ret .= $this->element('td',$this->listifyAttr($def->attr), array(), 0); 154 | $ret .= $this->end('tr'); 155 | 156 | if (!empty($def->required_attr)) { 157 | $ret .= $this->row('Required attributes', $this->listify($def->required_attr)); 158 | } 159 | 160 | $ret .= $this->renderChildren($def->child); 161 | } 162 | $ret .= $this->end('table'); 163 | return $ret; 164 | } 165 | 166 | /** 167 | * Renders a row describing the allowed children of an element 168 | * @param $def HTMLPurifier_ChildDef of pertinent element 169 | */ 170 | protected function renderChildren($def) { 171 | $context = new HTMLPurifier_Context(); 172 | $ret = ''; 173 | $ret .= $this->start('tr'); 174 | $elements = array(); 175 | $attr = array(); 176 | if (isset($def->elements)) { 177 | if ($def->type == 'strictblockquote') { 178 | $def->validateChildren(array(), $this->config, $context); 179 | } 180 | $elements = $def->elements; 181 | } 182 | if ($def->type == 'chameleon') { 183 | $attr['rowspan'] = 2; 184 | } elseif ($def->type == 'empty') { 185 | $elements = array(); 186 | } elseif ($def->type == 'table') { 187 | $elements = array_flip(array('col', 'caption', 'colgroup', 'thead', 188 | 'tfoot', 'tbody', 'tr')); 189 | } 190 | $ret .= $this->element('th', 'Allowed children', $attr); 191 | 192 | if ($def->type == 'chameleon') { 193 | 194 | $ret .= $this->element('td', 195 | 'Block: ' . 196 | $this->escape($this->listifyTagLookup($def->block->elements)),0,0); 197 | $ret .= $this->end('tr'); 198 | $ret .= $this->start('tr'); 199 | $ret .= $this->element('td', 200 | 'Inline: ' . 201 | $this->escape($this->listifyTagLookup($def->inline->elements)),0,0); 202 | 203 | } elseif ($def->type == 'custom') { 204 | 205 | $ret .= $this->element('td', ''.ucfirst($def->type).': ' . 206 | $def->dtd_regex); 207 | 208 | } else { 209 | $ret .= $this->element('td', 210 | ''.ucfirst($def->type).': ' . 211 | $this->escape($this->listifyTagLookup($elements)),0,0); 212 | } 213 | $ret .= $this->end('tr'); 214 | return $ret; 215 | } 216 | 217 | /** 218 | * Listifies a tag lookup table. 219 | * @param $array Tag lookup array in form of array('tagname' => true) 220 | */ 221 | protected function listifyTagLookup($array) { 222 | ksort($array); 223 | $list = array(); 224 | foreach ($array as $name => $discard) { 225 | if ($name !== '#PCDATA' && !isset($this->def->info[$name])) continue; 226 | $list[] = $name; 227 | } 228 | return $this->listify($list); 229 | } 230 | 231 | /** 232 | * Listifies a list of objects by retrieving class names and internal state 233 | * @param $array List of objects 234 | * @todo Also add information about internal state 235 | */ 236 | protected function listifyObjectList($array) { 237 | ksort($array); 238 | $list = array(); 239 | foreach ($array as $discard => $obj) { 240 | $list[] = $this->getClass($obj, 'AttrTransform_'); 241 | } 242 | return $this->listify($list); 243 | } 244 | 245 | /** 246 | * Listifies a hash of attributes to AttrDef classes 247 | * @param $array Array hash in form of array('attrname' => HTMLPurifier_AttrDef) 248 | */ 249 | protected function listifyAttr($array) { 250 | ksort($array); 251 | $list = array(); 252 | foreach ($array as $name => $obj) { 253 | if ($obj === false) continue; 254 | $list[] = "$name = " . $this->getClass($obj, 'AttrDef_') . ''; 255 | } 256 | return $this->listify($list); 257 | } 258 | 259 | /** 260 | * Creates a heavy header row 261 | */ 262 | protected function heavyHeader($text, $num = 1) { 263 | $ret = ''; 264 | $ret .= $this->start('tr'); 265 | $ret .= $this->element('th', $text, array('colspan' => $num, 'class' => 'heavy')); 266 | $ret .= $this->end('tr'); 267 | return $ret; 268 | } 269 | 270 | } 271 | 272 | // vim: et sw=4 sts=4 273 | -------------------------------------------------------------------------------- /purifier/standalone/HTMLPurifier/ConfigSchema/schema.ser: -------------------------------------------------------------------------------- 1 | O:25:"HTMLPurifier_ConfigSchema":3:{s:8:"defaults";a:104:{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: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: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:18:"CSS.AllowImportant";b:0;s:15:"CSS.AllowTricky";b:0;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:20:"Cache.DefinitionImpl";s:10:"Serializer";s:20:"Cache.SerializerPath";N;s:22:"Core.AggressivelyFixLt";b:1;s:18:"Core.CollectErrors";b:0;s:18:"Core.ColorKeywords";a:17:{s:6:"maroon";s:7:"#800000";s:3:"red";s:7:"#FF0000";s:6:"orange";s:7:"#FFA500";s:6:"yellow";s:7:"#FFFF00";s:5:"olive";s:7:"#808000";s:6:"purple";s:7:"#800080";s:7:"fuchsia";s:7:"#FF00FF";s:5:"white";s:7:"#FFFFFF";s:4:"lime";s:7:"#00FF00";s:5:"green";s:7:"#008000";s:4:"navy";s:7:"#000080";s:4:"blue";s:7:"#0000FF";s:4:"aqua";s:7:"#00FFFF";s:4:"teal";s:7:"#008080";s:5:"black";s:7:"#000000";s:6:"silver";s:7:"#C0C0C0";s:4:"gray";s:7:"#808080";}s:30:"Core.ConvertDocumentToFragment";b:1;s:36:"Core.DirectLexLineNumberSyncInterval";i: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: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.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:17:"HTML.MaxImgLength";i:1200;s:11:"HTML.Parent";s:3:"div";s:16:"HTML.Proprietary";b:0;s:14:"HTML.SafeEmbed";b:0;s:15:"HTML.SafeObject";b:0;s:11:"HTML.Strict";b:0;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: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:6:{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: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:12:"defaultPlist";O:25:"HTMLPurifier_PropertyList":3:{s:7:"*data";a:104:{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: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: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:18:"CSS.AllowImportant";b:0;s:15:"CSS.AllowTricky";b:0;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:20:"Cache.DefinitionImpl";s:10:"Serializer";s:20:"Cache.SerializerPath";N;s:22:"Core.AggressivelyFixLt";b:1;s:18:"Core.CollectErrors";b:0;s:18:"Core.ColorKeywords";a:17:{s:6:"maroon";s:7:"#800000";s:3:"red";s:7:"#FF0000";s:6:"orange";s:7:"#FFA500";s:6:"yellow";s:7:"#FFFF00";s:5:"olive";s:7:"#808000";s:6:"purple";s:7:"#800080";s:7:"fuchsia";s:7:"#FF00FF";s:5:"white";s:7:"#FFFFFF";s:4:"lime";s:7:"#00FF00";s:5:"green";s:7:"#008000";s:4:"navy";s:7:"#000080";s:4:"blue";s:7:"#0000FF";s:4:"aqua";s:7:"#00FFFF";s:4:"teal";s:7:"#008080";s:5:"black";s:7:"#000000";s:6:"silver";s:7:"#C0C0C0";s:4:"gray";s:7:"#808080";}s:30:"Core.ConvertDocumentToFragment";b:1;s:36:"Core.DirectLexLineNumberSyncInterval";i: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: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.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:17:"HTML.MaxImgLength";i:1200;s:11:"HTML.Parent";s:3:"div";s:16:"HTML.Proprietary";b:0;s:14:"HTML.SafeEmbed";b:0;s:15:"HTML.SafeObject";b:0;s:11:"HTML.Strict";b:0;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: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:6:{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: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:9:"*parent";N;s:8:"*cache";N;}s:4:"info";a:117:{s:19:"Attr.AllowedClasses";i:-8;s:24:"Attr.AllowedFrameTargets";i:8;s:15:"Attr.AllowedRel";i:8;s:15:"Attr.AllowedRev";i:8;s:18:"Attr.ClassUseCDATA";i:-7;s:20:"Attr.DefaultImageAlt";i:-1;s:24:"Attr.DefaultInvalidImage";i:1;s:27:"Attr.DefaultInvalidImageAlt";i:1;s:19:"Attr.DefaultTextDir";O:8:"stdClass":2:{s:4:"type";i:1;s:7:"allowed";a:2:{s:3:"ltr";b:1;s:3:"rtl";b:1;}}s:13:"Attr.EnableID";i:7;s:17:"HTML.EnableAttrID";O:8:"stdClass":2:{s:3:"key";s:13:"Attr.EnableID";s:7:"isAlias";b:1;}s:21:"Attr.ForbiddenClasses";i:8;s:16:"Attr.IDBlacklist";i:9;s:22:"Attr.IDBlacklistRegexp";i:-1;s:13:"Attr.IDPrefix";i:1;s:18:"Attr.IDPrefixLocal";i:1;s:24:"AutoFormat.AutoParagraph";i:7;s:17:"AutoFormat.Custom";i:9;s:25:"AutoFormat.DisplayLinkURI";i:7;s:18:"AutoFormat.Linkify";i:7;s:33:"AutoFormat.PurifierLinkify.DocURL";i:1;s:37:"AutoFormatParam.PurifierLinkifyDocURL";O:8:"stdClass":2:{s:3:"key";s:33:"AutoFormat.PurifierLinkify.DocURL";s:7:"isAlias";b:1;}s:26:"AutoFormat.PurifierLinkify";i:7;s:44:"AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions";i:8;s:33:"AutoFormat.RemoveEmpty.RemoveNbsp";i:7;s:22:"AutoFormat.RemoveEmpty";i:7;s:39:"AutoFormat.RemoveSpansWithoutAttributes";i:7;s:18:"CSS.AllowImportant";i:7;s:15:"CSS.AllowTricky";i:7;s:21:"CSS.AllowedProperties";i:-8;s:17:"CSS.DefinitionRev";i:5;s:23:"CSS.ForbiddenProperties";i:8;s:16:"CSS.MaxImgLength";i:-1;s:15:"CSS.Proprietary";i:7;s:20:"Cache.DefinitionImpl";i:-1;s:20:"Core.DefinitionCache";O:8:"stdClass":2:{s:3:"key";s:20:"Cache.DefinitionImpl";s:7:"isAlias";b:1;}s:20:"Cache.SerializerPath";i:-1;s:22:"Core.AggressivelyFixLt";i:7;s:18:"Core.CollectErrors";i:7;s:18:"Core.ColorKeywords";i:10;s:30:"Core.ConvertDocumentToFragment";i:7;s:24:"Core.AcceptFullDocuments";O:8:"stdClass":2:{s:3:"key";s:30:"Core.ConvertDocumentToFragment";s:7:"isAlias";b:1;}s:36:"Core.DirectLexLineNumberSyncInterval";i:5;s:13:"Core.Encoding";i:2;s:26:"Core.EscapeInvalidChildren";i:7;s:22:"Core.EscapeInvalidTags";i:7;s:29:"Core.EscapeNonASCIICharacters";i:7;s:19:"Core.HiddenElements";i:8;s:13:"Core.Language";i:1;s:14:"Core.LexerImpl";i:-11;s:24:"Core.MaintainLineNumbers";i:-7;s:22:"Core.NormalizeNewlines";i:7;s:21:"Core.RemoveInvalidImg";i:7;s:33:"Core.RemoveProcessingInstructions";i:7;s:25:"Core.RemoveScriptContents";i:-7;s:13:"Filter.Custom";i:9;s:34:"Filter.ExtractStyleBlocks.Escaping";i:7;s:33:"Filter.ExtractStyleBlocksEscaping";O:8:"stdClass":2:{s:3:"key";s:34:"Filter.ExtractStyleBlocks.Escaping";s:7:"isAlias";b:1;}s:38:"FilterParam.ExtractStyleBlocksEscaping";O:8:"stdClass":2:{s:3:"key";s:34:"Filter.ExtractStyleBlocks.Escaping";s:7:"isAlias";b:1;}s:31:"Filter.ExtractStyleBlocks.Scope";i:-1;s:30:"Filter.ExtractStyleBlocksScope";O:8:"stdClass":2:{s:3:"key";s:31:"Filter.ExtractStyleBlocks.Scope";s:7:"isAlias";b:1;}s:35:"FilterParam.ExtractStyleBlocksScope";O:8:"stdClass":2:{s:3:"key";s:31:"Filter.ExtractStyleBlocks.Scope";s:7:"isAlias";b:1;}s:34:"Filter.ExtractStyleBlocks.TidyImpl";i:-11;s:38:"FilterParam.ExtractStyleBlocksTidyImpl";O:8:"stdClass":2:{s:3:"key";s:34:"Filter.ExtractStyleBlocks.TidyImpl";s:7:"isAlias";b:1;}s:25:"Filter.ExtractStyleBlocks";i:7;s:14:"Filter.YouTube";i:7;s:12:"HTML.Allowed";i:-4;s:22:"HTML.AllowedAttributes";i:-8;s:20:"HTML.AllowedElements";i:-8;s:19:"HTML.AllowedModules";i:-8;s:23:"HTML.Attr.Name.UseCDATA";i:7;s:17:"HTML.BlockWrapper";i:1;s:16:"HTML.CoreModules";i:8;s:18:"HTML.CustomDoctype";i:-1;s:17:"HTML.DefinitionID";i:-1;s:18:"HTML.DefinitionRev";i:5;s:12:"HTML.Doctype";O:8:"stdClass":3:{s:4:"type";i:1;s:10:"allow_null";b:1;s:7:"allowed";a:5:{s:22:"HTML 4.01 Transitional";b:1;s:16:"HTML 4.01 Strict";b:1;s:22:"XHTML 1.0 Transitional";b:1;s:16:"XHTML 1.0 Strict";b:1;s:9:"XHTML 1.1";b:1;}}s:25:"HTML.FlashAllowFullScreen";i:7;s:24:"HTML.ForbiddenAttributes";i:8;s:22:"HTML.ForbiddenElements";i:8;s:17:"HTML.MaxImgLength";i:-5;s:11:"HTML.Parent";i:1;s:16:"HTML.Proprietary";i:7;s:14:"HTML.SafeEmbed";i:7;s:15:"HTML.SafeObject";i:7;s:11:"HTML.Strict";i:7;s:12:"HTML.TidyAdd";i:8;s:14:"HTML.TidyLevel";O:8:"stdClass":2:{s:4:"type";i:1;s:7:"allowed";a:4:{s:4:"none";b:1;s:5:"light";b:1;s:6:"medium";b:1;s:5:"heavy";b:1;}}s:15:"HTML.TidyRemove";i:8;s:12:"HTML.Trusted";i:7;s:10:"HTML.XHTML";i:7;s:10:"Core.XHTML";O:8:"stdClass":2:{s:3:"key";s:10:"HTML.XHTML";s:7:"isAlias";b:1;}s:28:"Output.CommentScriptContents";i:7;s:26:"Core.CommentScriptContents";O:8:"stdClass":2:{s:3:"key";s:28:"Output.CommentScriptContents";s:7:"isAlias";b:1;}s:18:"Output.FlashCompat";i:7;s:14:"Output.Newline";i:-1;s:15:"Output.SortAttr";i:7;s:17:"Output.TidyFormat";i:7;s:15:"Core.TidyFormat";O:8:"stdClass":2:{s:3:"key";s:17:"Output.TidyFormat";s:7:"isAlias";b:1;}s:17:"Test.ForceNoIconv";i:7;s:18:"URI.AllowedSchemes";i:8;s:8:"URI.Base";i:-1;s:17:"URI.DefaultScheme";i:1;s:16:"URI.DefinitionID";i:-1;s:17:"URI.DefinitionRev";i:5;s:11:"URI.Disable";i:7;s:15:"Attr.DisableURI";O:8:"stdClass":2:{s:3:"key";s:11:"URI.Disable";s:7:"isAlias";b:1;}s:19:"URI.DisableExternal";i:7;s:28:"URI.DisableExternalResources";i:7;s:20:"URI.DisableResources";i:7;s:8:"URI.Host";i:-1;s:17:"URI.HostBlacklist";i:9;s:16:"URI.MakeAbsolute";i:7;s:9:"URI.Munge";i:-1;s:18:"URI.MungeResources";i:7;s:18:"URI.MungeSecretKey";i:-1;s:26:"URI.OverrideAllowedSchemes";i:7;}} --------------------------------------------------------------------------------