Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   1  <?php
   2  
   3  /**

   4   * Converts HTMLPurifier_ConfigSchema_Interchange to our runtime

   5   * representation used to perform checks on user configuration.

   6   */
   7  class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
   8  {
   9  
  10      /**

  11       * @param HTMLPurifier_ConfigSchema_Interchange $interchange

  12       * @return HTMLPurifier_ConfigSchema

  13       */
  14      public function build($interchange)
  15      {
  16          $schema = new HTMLPurifier_ConfigSchema();
  17          foreach ($interchange->directives as $d) {
  18              $schema->add(
  19                  $d->id->key,
  20                  $d->default,
  21                  $d->type,
  22                  $d->typeAllowsNull
  23              );
  24              if ($d->allowed !== null) {
  25                  $schema->addAllowedValues(
  26                      $d->id->key,
  27                      $d->allowed
  28                  );
  29              }
  30              foreach ($d->aliases as $alias) {
  31                  $schema->addAlias(
  32                      $alias->key,
  33                      $d->id->key
  34                  );
  35              }
  36              if ($d->valueAliases !== null) {
  37                  $schema->addValueAliases(
  38                      $d->id->key,
  39                      $d->valueAliases
  40                  );
  41              }
  42          }
  43          $schema->postProcess();
  44          return $schema;
  45      }
  46  }
  47  
  48  // vim: et sw=4 sts=4