@@ 10296-10344 (lines=49) @@ | ||
10293 | return $decoder->parse(); |
|
10294 | } |
|
10295 | ||
10296 | public static function uncomment_rfc822($string) |
|
10297 | { |
|
10298 | $string = (string) $string; |
|
10299 | $position = 0; |
|
10300 | $length = strlen($string); |
|
10301 | $depth = 0; |
|
10302 | $output = ''; |
|
10303 | while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) |
|
10304 | { |
|
10305 | $output .= substr($string, $position, $pos - $position); |
|
10306 | $position = $pos + 1; |
|
10307 | if ($string[$pos - 1] !== '\\') |
|
10308 | { |
|
10309 | $depth++; |
|
10310 | while ($depth && $position < $length) |
|
10311 | { |
|
10312 | $position += strcspn($string, '()', $position); |
|
10313 | if ($string[$position - 1] === '\\') |
|
10314 | { |
|
10315 | $position++; |
|
10316 | continue; |
|
10317 | } |
|
10318 | elseif (isset($string[$position])) |
|
10319 | { |
|
10320 | switch ($string[$position]) |
|
10321 | { |
|
10322 | case '(': |
|
10323 | $depth++; |
|
10324 | break; |
|
10325 | case ')': |
|
10326 | $depth--; |
|
10327 | break; |
|
10328 | } |
|
10329 | $position++; |
|
10330 | } |
|
10331 | else |
|
10332 | { |
|
10333 | break; |
|
10334 | } |
|
10335 | } |
|
10336 | } |
|
10337 | else |
|
10338 | { |
|
10339 | $output .= '('; |
|
10340 | } |
|
10341 | } |
|
10342 | $output .= substr($string, $position); |
|
10343 | return $output; |
|
10344 | } |
|
10345 | public static function parse_mime($mime) |
|
10346 | { |
|
10347 | if (($pos = strpos($mime, ';')) === false) |
|
@@ 11423-11471 (lines=49) @@ | ||
11420 | } |
|
11421 | } |
|
11422 | ||
11423 | public function remove_rfc2822_comments($string) |
|
11424 | { |
|
11425 | $string = (string) $string; |
|
11426 | $position = 0; |
|
11427 | $length = strlen($string); |
|
11428 | $depth = 0; |
|
11429 | $output = ''; |
|
11430 | while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) |
|
11431 | { |
|
11432 | $output .= substr($string, $position, $pos - $position); |
|
11433 | $position = $pos + 1; |
|
11434 | if ($string[$pos - 1] !== '\\') |
|
11435 | { |
|
11436 | $depth++; |
|
11437 | while ($depth && $position < $length) |
|
11438 | { |
|
11439 | $position += strcspn($string, '()', $position); |
|
11440 | if ($string[$position - 1] === '\\') |
|
11441 | { |
|
11442 | $position++; |
|
11443 | continue; |
|
11444 | } |
|
11445 | elseif (isset($string[$position])) |
|
11446 | { |
|
11447 | switch ($string[$position]) |
|
11448 | { |
|
11449 | case '(': |
|
11450 | $depth++; |
|
11451 | break; |
|
11452 | case ')': |
|
11453 | $depth--; |
|
11454 | break; |
|
11455 | } |
|
11456 | $position++; |
|
11457 | } |
|
11458 | else |
|
11459 | { |
|
11460 | break; |
|
11461 | } |
|
11462 | } |
|
11463 | } |
|
11464 | else |
|
11465 | { |
|
11466 | $output .= '('; |
|
11467 | } |
|
11468 | } |
|
11469 | $output .= substr($string, $position); |
|
11470 | return $output; |
|
11471 | } |
|
11472 | ||
11473 | public function date_rfc2822($date) |
|
11474 | { |