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   * Represents a directive ID in the interchange format.

   5   */
   6  class HTMLPurifier_ConfigSchema_Interchange_Id
   7  {
   8  
   9      /**

  10       * @type string

  11       */
  12      public $key;
  13  
  14      /**

  15       * @param string $key

  16       */
  17      public function __construct($key)
  18      {
  19          $this->key = $key;
  20      }
  21  
  22      /**

  23       * @return string

  24       * @warning This is NOT magic, to ensure that people don't abuse SPL and

  25       *          cause problems for PHP 5.0 support.

  26       */
  27      public function toString()
  28      {
  29          return $this->key;
  30      }
  31  
  32      /**

  33       * @return string

  34       */
  35      public function getRootNamespace()
  36      {
  37          return substr($this->key, 0, strpos($this->key, "."));
  38      }
  39  
  40      /**

  41       * @return string

  42       */
  43      public function getDirective()
  44      {
  45          return substr($this->key, strpos($this->key, ".") + 1);
  46      }
  47  
  48      /**

  49       * @param string $id

  50       * @return HTMLPurifier_ConfigSchema_Interchange_Id

  51       */
  52      public static function make($id)
  53      {
  54          return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
  55      }
  56  }
  57  
  58  // vim: et sw=4 sts=4