Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  /**
   3   * Copyright 2014-2017 Horde LLC (http://www.horde.org/)
   4   *
   5   * See the enclosed file LICENSE for license information (LGPL). If you
   6   * did not receive this file, see http://www.horde.org/licenses/lgpl21.
   7   *
   8   * @category  Horde
   9   * @copyright 2014-2017 Horde LLC
  10   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  11   * @package   Mime
  12   */
  13  
  14  /**
  15   * Interface representing a single named header element that can only appear
  16   * once in a message part.
  17   *
  18   * @author    Michael Slusarz <slusarz@horde.org>
  19   * @category  Horde
  20   * @copyright 2014-2017 Horde LLC
  21   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  22   * @package   Mime
  23   * @since     2.5.0
  24   *
  25   * @property-read string $full_value  Full header value.
  26   * @property-read string $value  Header value.
  27   */
  28  class Horde_Mime_Headers_Element_Single
  29  extends Horde_Mime_Headers_Element
  30  {
  31      /**
  32       */
  33      public function __get($name)
  34      {
  35          switch ($name) {
  36          case 'full_value':
  37          case 'value':
  38              return reset($this->_values);
  39          }
  40  
  41          return parent::__get($name);
  42      }
  43  
  44      /**
  45       */
  46      public function __toString()
  47      {
  48          return $this->value;
  49      }
  50  
  51      /**
  52       */
  53      protected function _setValue($value)
  54      {
  55          if ($value instanceof Horde_Mime_Headers_Element) {
  56              $value = $value->value;
  57          } elseif (is_array($value)) {
  58              $value = reset($value);
  59          }
  60  
  61          $this->_values = array(
  62              $this->_sanityCheck(Horde_Mime::decode($value))
  63          );
  64      }
  65  
  66      /**
  67       */
  68      public static function getHandles()
  69      {
  70          return array(
  71              // Mail: RFC 3798
  72              'disposition-notification-options',
  73              'original-recipient',
  74              // Lists: RFC 2369
  75              'list-help',
  76              'list-unsubscribe',
  77              'list-subscribe',
  78              'list-owner',
  79              'list-post',
  80              'list-archive',
  81              // Lists: RFC 2919
  82              'list-id',
  83              // Importance: See, e.g., RFC 4356 [2.1.3.3.1]
  84              'importance',
  85              // OTHER: X-Priority
  86              // See: http://kb.mozillazine.org/Emulate_Microsoft_email_clients
  87              'x-priority'
  88          );
  89      }
  90  
  91  }