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 * This class represents the Date header value (RFC 5322). 16 * 17 * @author Michael Slusarz <slusarz@horde.org> 18 * @category Horde 19 * @copyright 2014-2017 Horde LLC 20 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 21 * @package Mime 22 * @since 2.5.0 23 */ 24 class Horde_Mime_Headers_Date 25 extends Horde_Mime_Headers_Element_Single 26 { 27 /** 28 * Generate a 'Date' header for the current time. 29 * 30 * @return Horde_Mime_Headers_Date Date header object. 31 */ 32 public static function create() 33 { 34 return new self(null, date('r')); 35 } 36 37 /** 38 */ 39 public function __construct($name, $value) 40 { 41 parent::__construct('Date', $value); 42 } 43 44 /** 45 */ 46 public static function getHandles() 47 { 48 return array( 49 // Mail: RFC 5322 50 'date' 51 ); 52 } 53 54 /** 55 * Perform sanity checking on a header value. 56 * 57 * @param string $data The header data. 58 * 59 * @return string The cleaned header data. 60 */ 61 protected function _sanityCheck($data) 62 { 63 $date = parent::_sanityCheck($data); 64 if (substr(rtrim($date), -5) === ' 0000') { 65 $date = substr(trim($date), 0, strlen(trim($date)) - 5) . ' +0000'; 66 } 67 68 /* Check for malformed day-of-week parts */ 69 if (!preg_match("/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun),/", $date)) { 70 $date = trim(preg_replace("/^(\S*,)/", '', $date)); 71 } 72 73 return $date; 74 } 75 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body