Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
HeaderName.php
Go to the documentation of this file.
1 <?php
30 {
34  private function __construct()
35  {
36  }
37 
45  public static function filter($name)
46  {
47  $result = '';
48  $tot = strlen($name);
49  for ($i = 0; $i < $tot; $i += 1) {
50  $ord = ord($name[$i]);
51  if ($ord > 32 && $ord < 127 && $ord !== 58) {
52  $result .= $name[$i];
53  }
54  }
55  return $result;
56  }
57 
64  public static function isValid($name)
65  {
66  $tot = strlen($name);
67  for ($i = 0; $i < $tot; $i += 1) {
68  $ord = ord($name[$i]);
69  if ($ord < 33 || $ord > 126 || $ord === 58) {
70  return false;
71  }
72  }
73  return true;
74  }
75 
85  public static function assertValid($name)
86  {
87  if (! self::isValid($name)) {
88  #require_once 'Zend/Mail/Exception.php';
89  throw new Zend_Mail_Exception('Invalid header name detected');
90  }
91  }
92 }
$i
Definition: gallery.phtml:31
if(!isset($_GET['name'])) $name
Definition: log.php:14