<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,7 @@
 tags
 conf/
 test-settings.php
+config-schema.php
 library/HTMLPurifier/DefinitionCache/Serializer/*/
 library/standalone/
 library/HTMLPurifier.standalone.php</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -37,6 +37,9 @@ NEWS ( CHANGELOG and HISTORY )                                     HTMLPurifier
 ! Implement %Attr.AllowedClasses, which allows administrators to restrict
   classes users can use to a specified finite set of classes, and
   %Attr.ForbiddenClasses, which is the logical inverse.
+! You can now maintain your own configuration schema directories by
+  creating a config-schema.php file or passing an extra argument. Check
+  docs/dev-config-schema.html for more details.
 - Fix bug where URIDefinition would not get cleared if it's directives got
   changed.
 - Fix fatal error in HTMLPurifier_Encoder on certain platforms (probably NetBSD 5.0)</diff>
      <filename>NEWS</filename>
    </modified>
    <modified>
      <diff>@@ -26,7 +26,6 @@ afraid to cast your vote for the next feature to be implemented!
 - Make it easy for people to cache their entire configuration (so that
   they have one script they run to change configuration, and then a stub
   loader to get that configuration)
- - Implement &lt;area&gt;
 
 FUTURE VERSIONS
 ---------------
@@ -35,6 +34,8 @@ FUTURE VERSIONS
  # Implement untrusted, dangerous elements/attributes
  # Implement IDREF support (harder than it seems, since you cannot have
    IDREFs to non-existent IDs)
+     - Implement &lt;area&gt; (client and server side image maps are blocking
+       on IDREF support)
  # Frameset XHTML 1.0 and HTML 4.01 doctypes
  - Figure out how to simultaneously set %CSS.Trusted and %HTML.Trusted (?)
 </diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -18,22 +18,24 @@ TODO:
 if (version_compare(PHP_VERSION, '5.2', '&lt;')) exit('PHP 5.2+ required.');
 error_reporting(E_ALL | E_STRICT);
 
-chdir(dirname(__FILE__));
-
 // load dual-libraries
-require_once '../extras/HTMLPurifierExtras.auto.php';
-require_once '../library/HTMLPurifier.auto.php';
+require_once dirname(__FILE__) . '/../extras/HTMLPurifierExtras.auto.php';
+require_once dirname(__FILE__) . '/../library/HTMLPurifier.auto.php';
 
 // setup HTML Purifier singleton
 HTMLPurifier::getInstance(array(
     'AutoFormat.PurifierLinkify' =&gt; true
 ));
 
-$interchange = HTMLPurifier_ConfigSchema_InterchangeBuilder::buildFromDirectory();
+$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
+$interchange = new HTMLPurifier_ConfigSchema_Interchange();
+$builder-&gt;buildDir($interchange);
+$loader = dirname(__FILE__) . '/../config-schema.php';
+if (file_exists($loader)) include $loader;
 $interchange-&gt;validate();
 
 $style = 'plain'; // use $_GET in the future, careful to validate!
-$configdoc_xml = 'configdoc.xml';
+$configdoc_xml = dirname(__FILE__) . '/configdoc.xml';
 
 $xml_builder = new HTMLPurifier_ConfigSchema_Builder_Xml();
 $xml_builder-&gt;openURI($configdoc_xml);
@@ -50,13 +52,13 @@ if (!$output) {
 }
 
 // write out
-file_put_contents(&quot;$style.html&quot;, $output);
+file_put_contents(dirname(__FILE__) . &quot;/$style.html&quot;, $output);
 
 if (php_sapi_name() != 'cli') {
     // output (instant feedback if it's a browser)
     echo $output;
 } else {
-    echo 'Files generated successfully.';
+    echo &quot;Files generated successfully.\n&quot;;
 }
 
 // vim: et sw=4 sts=4</diff>
      <filename>configdoc/generate.php</filename>
    </modified>
    <modified>
      <diff>@@ -114,7 +114,7 @@ Test.Example&lt;/pre&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
           &lt;td&gt;VALUE-ALIASES&lt;/td&gt;
-          &lt;td&gt;'baz' =&gt; 'bar'&lt;/td&gt;
+          &lt;td&gt;'baz' =&amp;gt; 'bar'&lt;/td&gt;
           &lt;td&gt;&lt;em&gt;Optional&lt;/em&gt;. Mapping of one value to another, and
           should be a comma separated list of keypair duples. This
           is only allowed string, istring, text and itext TYPEs.&lt;/td&gt;
@@ -213,7 +213,7 @@ Test.Example&lt;/pre&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
           &lt;td&gt;lookup&lt;/td&gt;
-          &lt;td&gt;array('key' =&gt; true)&lt;/td&gt;
+          &lt;td&gt;array('key' =&amp;gt; true)&lt;/td&gt;
           &lt;td&gt;Lookup array, used with &lt;code&gt;isset($var[$key])&lt;/code&gt;&lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
@@ -223,7 +223,7 @@ Test.Example&lt;/pre&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
           &lt;td&gt;hash&lt;/td&gt;
-          &lt;td&gt;array('key' =&gt; 'val')&lt;/td&gt;
+          &lt;td&gt;array('key' =&amp;gt; 'val')&lt;/td&gt;
           &lt;td&gt;Associative array of keys to values&lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
@@ -267,6 +267,41 @@ Test.Example&lt;/pre&gt;
       If you ever make changes to your configuration directives, you
       will need to run this script again.
     &lt;/p&gt;
+    &lt;h2&gt;Adding in-house schema definitions&lt;/h2&gt;
+
+    &lt;p&gt;
+      Placing stuff directly in HTML Purifier's source tree is generally not a
+      good idea, so HTML Purifier 4.0.0+ has some facilities in place to make your
+      life easier.
+    &lt;/p&gt;
+
+    &lt;p&gt;
+      The first is to pass an extra parameter to &lt;code&gt;maintenance/generate-schema-cache.php&lt;/code&gt;
+      with the location of your directory (relative or absolute path will do). For example,
+      if I'm storing my custom definitions in &lt;em&gt;/var/htmlpurifier/myschema&lt;/em&gt;, run:
+      &lt;code&gt;php maintenance/generate-schema-cache.php /var/htmlpurifier/myschema&lt;/code&gt;.
+    &lt;/p&gt;
+
+    &lt;p&gt;
+      Alternatively, you can create a small loader PHP file in the HTML Purifier base
+      directory named &lt;code&gt;config-schema.php&lt;/code&gt; (this is the same directory
+      you would place a &lt;code&gt;test-settings.php&lt;/code&gt; file).  In this file, add
+      the following line for each directory you want to load:
+    &lt;/p&gt;
+
+&lt;pre&gt;$builder-&amp;gt;buildDir($interchange, '/var/htmlpurifier/myschema');&lt;/pre&gt;
+
+    &lt;p&gt;You can even load a single file using:&lt;/p&gt;
+
+&lt;pre&gt;$builder-&amp;gt;buildFile($interchange, '/var/htmlpurifier/myschema/MyApp.Directive.txt');&lt;/pre&gt;
+
+    &lt;p&gt;Storing custom definitions that you don't plan on sending back upstream in
+    a separate directory is &lt;em&gt;definitely&lt;/em&gt; a good idea! Additionally, picking
+    a good namespace can go a long way to saving you grief if you want to use
+    someone else's change, but they picked the same name, or if HTML Purifier
+    decides to add support for a configuration directive that has the same name.&lt;/p&gt;
+
+    &lt;!-- TODO: how to name directives that rely on naming conventions --&gt;
 
     &lt;h2&gt;Errors&lt;/h2&gt;
 </diff>
      <filename>docs/dev-config-schema.html</filename>
    </modified>
    <modified>
      <diff>@@ -18,12 +18,11 @@
 &lt;div id=&quot;home&quot;&gt;&lt;a href=&quot;http://htmlpurifier.org/&quot;&gt;HTML Purifier&lt;/a&gt; End-User Documentation&lt;/div&gt;
 
 &lt;p&gt;
-  You may have heard of the &lt;a href=&quot;dev-advanced-api.html&quot;&gt;Advanced API&lt;/a&gt;.
-  If you're interested in reading dry prose and boring functional
-  specifications, feel free to click that link to get a no-nonsense overview
-  on the Advanced API. For the rest of us, there's this tutorial. By the time
-  you're finished reading this, you should have a pretty good idea on
-  how to implement custom tags and attributes that HTML Purifier may not have.
+  HTML Purifier has this quirk where if you try to allow certain elements or
+  attributes, HTML Purifier will tell you that it's not supported, and that
+  you should go to the forums to find out how to implement it. Well, this
+  document is how to implement elements and attributes which HTML Purifier
+  doesn't support out of the box.
 &lt;/p&gt;
 
 &lt;h2&gt;Is it necessary?&lt;/h2&gt;</diff>
      <filename>docs/enduser-customize.html</filename>
    </modified>
    <modified>
      <diff>@@ -216,6 +216,7 @@ class HTMLPurifier_Config
 
     /**
      * Retrieves all directives, organized by namespace
+     * @warning This is a pretty inefficient function, avoid if you can
      */
     public function getAll() {
         if (!$this-&gt;finalized) $this-&gt;autoFinalize();</diff>
      <filename>library/HTMLPurifier/Config.php</filename>
    </modified>
    <modified>
      <diff>@@ -15,10 +15,15 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
     public static function buildFromDirectory($dir = null) {
         $builder     = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
         $interchange = new HTMLPurifier_ConfigSchema_Interchange();
+        return $builder-&gt;buildDir($interchange, $dir);
+    }
 
-        if (!$dir) $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema/';
-        $info = parse_ini_file($dir . 'info.ini');
-        $interchange-&gt;name = $info['name'];
+    public function buildDir($interchange, $dir = null) {
+        if (!$dir) $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema';
+        if (file_exists($dir . '/info.ini')) {
+            $info = parse_ini_file($dir . '/info.ini');
+            $interchange-&gt;name = $info['name'];
+        }
 
         $files = array();
         $dh = opendir($dir);
@@ -32,7 +37,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
 
         sort($files);
         foreach ($files as $file) {
-            $builder-&gt;buildFile($interchange, $dir . $file);
+            $this-&gt;buildFile($interchange, $dir . '/' . $file);
         }
 
         return $interchange;</diff>
      <filename>library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php</filename>
    </modified>
    <modified>
      <diff>@@ -17,6 +17,6 @@ function postfix_is($comp, $subject) {
 }
 
 // Load useful stuff like FSTools
-require_once '../extras/HTMLPurifierExtras.auto.php';
+require_once dirname(__FILE__) . '/../extras/HTMLPurifierExtras.auto.php';
 
 // vim: et sw=4 sts=4</diff>
      <filename>maintenance/common.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,8 @@
 #!/usr/bin/php
 &lt;?php
 
-chdir(dirname(__FILE__));
-require_once 'common.php';
-require_once '../library/HTMLPurifier.auto.php';
+require_once dirname(__FILE__) . '/common.php';
+require_once dirname(__FILE__) . '/../library/HTMLPurifier.auto.php';
 assertCli();
 
 /**
@@ -12,13 +11,28 @@ assertCli();
  * library/HTMLPurifier/ConfigSchema/schema.ser.
  *
  * This should be run when new configuration options are added to
- * HTML Purifier. A cached version is available via SVN so this does not
- * normally have to be regenerated.
+ * HTML Purifier. A cached version is available via the repository
+ * so this does not normally have to be regenerated.
+ *
+ * If you have a directory containing custom configuration schema files,
+ * you can simple add a path to that directory as a parameter to
+ * this, and they will get included.
  */
 
-$target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
+$target = dirname(__FILE__) . '/../library/HTMLPurifier/ConfigSchema/schema.ser';
+
+$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
+$interchange = new HTMLPurifier_ConfigSchema_Interchange();
+
+$builder-&gt;buildDir($interchange);
+
+$loader = dirname(__FILE__) . '/../config-schema.php';
+if (file_exists($loader)) include $loader;
+foreach ($_SERVER['argv'] as $i =&gt; $dir) {
+    if ($i === 0) continue;
+    $builder-&gt;buildDir($interchange, realpath($dir));
+}
 
-$interchange = HTMLPurifier_ConfigSchema_InterchangeBuilder::buildFromDirectory();
 $interchange-&gt;validate();
 
 $schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();</diff>
      <filename>maintenance/generate-schema-cache.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a025203b180fcf53fdd1489844a45bc91e9c1faf</id>
    </parent>
  </parents>
  <author>
    <name>Edward Z. Yang</name>
    <email>edwardzyang@thewritingpot.com</email>
  </author>
  <url>http://github.com/ezyang/htmlpurifier/commit/5bf7ac4e9f1798ab6c7bcc9ce299c5bbbb23396f</url>
  <id>5bf7ac4e9f1798ab6c7bcc9ce299c5bbbb23396f</id>
  <committed-date>2009-05-29T19:16:35-07:00</committed-date>
  <authored-date>2009-05-29T19:10:47-07:00</authored-date>
  <message>Add docs and facilities for having separate directories of schemas.
Signed-off-by: Edward Z. Yang &lt;edwardzyang@thewritingpot.com&gt;</message>
  <tree>aaa733ca17e108cad8661e3c4ab691c302198025</tree>
  <committer>
    <name>Edward Z. Yang</name>
    <email>edwardzyang@thewritingpot.com</email>
  </committer>
</commit>
