Explorar o código

Function creation with create_function converted to inline functions

Andy %!s(int64=7) %!d(string=hai) anos
pai
achega
fb2160130a
Modificáronse 3 ficheiros con 13 adicións e 13 borrados
  1. 3 3
      functions/decode/utf_8.php
  2. 9 9
      functions/imap_messages.php
  3. 1 1
      functions/mime.php

+ 3 - 3
functions/decode/utf_8.php

@@ -74,17 +74,17 @@ function charset_decode_utf_8 ($string) {
     
     // decode four byte unicode characters
     $string = preg_replace_callback("/([\360-\367])([\200-\277])([\200-\277])([\200-\277])/",
-    create_function ('$matches', 'return \'&#\'.((ord($matches[1])-240)*262144+(ord($matches[2])-128)*4096+(ord($matches[3])-128)*64+(ord($matches[4])-128)).\';\';'),
+    function ($matches){ return '&#'.((ord($matches[1])-240)*262144+(ord($matches[2])-128)*4096+(ord($matches[3])-128)*64+(ord($matches[4])-128)).';';},
     $string);
 
     // decode three byte unicode characters
     $string = preg_replace_callback("/([\340-\357])([\200-\277])([\200-\277])/",
-    create_function ('$matches', 'return \'&#\'.((ord($matches[1])-224)*4096+(ord($matches[2])-128)*64+(ord($matches[3])-128)).\';\';'),
+    function ($matches) {return '&#'.((ord($matches[1])-224)*4096+(ord($matches[2])-128)*64+(ord($matches[3])-128)).';';},
     $string);
 
     // decode two byte unicode characters
     $string = preg_replace_callback("/([\300-\337])([\200-\277])/",
-    create_function ('$matches', 'return \'&#\'.((ord($matches[1])-192)*64+(ord($matches[2])-128)).\';\';'),
+    function ($matches) {return '&#'.((ord($matches[1])-192)*64+(ord($matches[2])-128)).';';},
     $string);
 
     // remove broken unicode

+ 9 - 9
functions/imap_messages.php

@@ -246,25 +246,25 @@ function get_squirrel_sort($imap_stream, $sSortField, $reverse = false, $aUid =
       case 'TO':
       case 'CC':
         if(!$walk) {
-            array_walk($msgs, create_function('&$v,&$k,$f',
-                '$v[$f] = (isset($v[$f])) ? $v[$f] : "";
+            array_walk($msgs, function(&$v,&$k,$f){
+                 $v[$f] = (isset($v[$f])) ? $v[$f] : "";
                  $addr = reset(parseRFC822Address($v[$f],1));
                  $sPersonal = (isset($addr[SQM_ADDR_PERSONAL]) && $addr[SQM_ADDR_PERSONAL]) ?
                    $addr[SQM_ADDR_PERSONAL] : "";
                  $sEmail = ($addr[SQM_ADDR_HOST]) ?
                       $addr[SQM_ADDR_MAILBOX] . "@".$addr[SQM_ADDR_HOST] :
                       $addr[SQM_ADDR_HOST];
-                 $v[$f] = ($sPersonal) ? decodeHeader($sPersonal, true, false):$sEmail;'),$sSortField);
+                 $v[$f] = ($sPersonal) ? decodeHeader($sPersonal, true, false):$sEmail;},$sSortField);
             $walk = true;
         }
         // nobreak
       case 'SUBJECT':
         if(!$walk) {
-            array_walk($msgs, create_function('&$v,&$k,$f',
-                '$v[$f] = (isset($v[$f])) ? $v[$f] : "";
+            array_walk($msgs, function(&$v,&$k,$f) {
+                 $v[$f] = (isset($v[$f])) ? $v[$f] : "";
                  $v[$f] = strtolower(decodeHeader(trim($v[$f]), true, false));
                  $v[$f] = (preg_match("/^(?:(?:vedr|sv|re|aw|fw|fwd|\[\w\]):\s*)*\s*(.*)$/si", $v[$f], $matches)) ?
-                                    $matches[1] : $v[$f];'),$sSortField);
+                 $matches[1] : $v[$f];},$sSortField);
             $walk = true;
         }
         foreach ($msgs as $item) {
@@ -281,9 +281,9 @@ function get_squirrel_sort($imap_stream, $sSortField, $reverse = false, $aUid =
       case 'DATE':
       case 'INTERNALDATE':
         if(!$walk) {
-            array_walk($msgs, create_function('&$v,$k,$f',
-                '$v[$f] = (isset($v[$f])) ? $v[$f] : "";
-                 $v[$f] = getTimeStamp(explode(" ",$v[$f]));'),$sSortField);
+            array_walk($msgs, function(&$v,$k,$f) {
+                 $v[$f] = (isset($v[$f])) ? $v[$f] : "";
+                 $v[$f] = getTimeStamp(explode(" ",$v[$f]));},$sSortField);
             $walk = true;
         }
         // nobreak;

+ 1 - 1
functions/mime.php

@@ -869,7 +869,7 @@ function decodeHeader ($string, $utfencode=true,$htmlsafe=true,$decide=false) {
                 case 'Q':
                     $replace = str_replace('_', ' ', $res[4]);
                     $replace = preg_replace_callback('/=([0-9a-f]{2})/i',
-                            create_function ('$matches', 'return chr(hexdec($matches[1]));'),
+                            function ($matches) {return chr(hexdec($matches[1]));},
                             $replace);
                     if ($utfencode) {
                         if ($can_be_encoded) {