Replaced PHP 5.5 deprecated calls
This commit is contained in:
parent
50ce834dd0
commit
9636e1aafc
@ -962,7 +962,21 @@ class CMailFile
|
|||||||
$this->html_images[$i]["name"] = $img;
|
$this->html_images[$i]["name"] = $img;
|
||||||
|
|
||||||
// Content type
|
// Content type
|
||||||
|
/*
|
||||||
|
* preg_replace /e modifier is deprecated in PHP 5.5
|
||||||
|
* but anonymous functions for use in preg_replace_callback are only available from 5.3.0
|
||||||
|
*/
|
||||||
|
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||||
|
$ext = preg_replace_callback(
|
||||||
|
'/^.*\.(\w{3,4})$/',
|
||||||
|
function ($m) {
|
||||||
|
return strtolower($m[1]);
|
||||||
|
},
|
||||||
|
$img
|
||||||
|
);
|
||||||
|
} else {
|
||||||
$ext = preg_replace('/^.*\.(\w{3,4})$/e', 'strtolower("$1")', $img);
|
$ext = preg_replace('/^.*\.(\w{3,4})$/e', 'strtolower("$1")', $img);
|
||||||
|
}
|
||||||
$this->html_images[$i]["content_type"] = $this->image_types[$ext];
|
$this->html_images[$i]["content_type"] = $this->image_types[$ext];
|
||||||
|
|
||||||
// cid
|
// cid
|
||||||
|
|||||||
@ -515,7 +515,21 @@ function quotedPrintEncode($str,$forcal=0)
|
|||||||
function quotedPrintDecode($str)
|
function quotedPrintDecode($str)
|
||||||
{
|
{
|
||||||
$out = preg_replace('/=\r?\n/', '', $str);
|
$out = preg_replace('/=\r?\n/', '', $str);
|
||||||
|
/*
|
||||||
|
* preg_replace /e modifier is deprecated in PHP 5.5
|
||||||
|
* but anonymous functions for use in preg_replace_callback are only available from 5.3.0
|
||||||
|
*/
|
||||||
|
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||||
|
$out = preg_replace_callback(
|
||||||
|
'/=([A-F0-9]{2})/',
|
||||||
|
function ($m) {
|
||||||
|
return chr(hexdec($m[1]));
|
||||||
|
},
|
||||||
|
$out
|
||||||
|
);
|
||||||
|
} else {
|
||||||
$out = preg_replace('/=([A-F0-9]{2})/e', chr(hexdec('\\1')), $out);
|
$out = preg_replace('/=([A-F0-9]{2})/e', chr(hexdec('\\1')), $out);
|
||||||
|
}
|
||||||
|
|
||||||
return trim($out);
|
return trim($out);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user