浏览代码

replace preg_split without a regular expression with the
faster and less complicated explode()

Thijs Kinkhorst 18 年之前
父节点
当前提交
dfbdae5943
共有 5 个文件被更改,包括 6 次插入6 次删除
  1. 1 1
      functions/imap_messages.php
  2. 1 1
      functions/plugin.php
  3. 1 1
      include/init.php
  4. 2 2
      plugins/filters/filters.php
  5. 1 1
      src/configtest.php

+ 1 - 1
functions/imap_messages.php

@@ -203,7 +203,7 @@ function parseUidList($aData,$sCommand) {
         for ($i=0,$iCnt=count($aData);$i<$iCnt;++$i) {
             for ($j=0,$jCnt=count($aData[$i]);$j<$jCnt;++$j) {
                 if (preg_match("/^\* $sCommand (.+)$/", $aData[$i][$j], $aMatch)) {
-                    $aUid += preg_split("/ /", trim($aMatch[1]));
+                    $aUid += explode(' ', trim($aMatch[1]));
                 }
             }
         }

+ 1 - 1
functions/plugin.php

@@ -913,7 +913,7 @@ function check_plugin_dependencies($plugin_name, $force_inclusion = FALSE)
 
    foreach ($dependencies as $depend_name => $depend_requirements)
    {
-      $version = preg_split('/\./', $depend_requirements['version'], 3);
+      $version = explode('.', $depend_requirements['version'], 3);
       $version[0] = intval($version[0]);
       $version[1] = intval($version[1]);
       $version[2] = intval($version[2]);

+ 1 - 1
include/init.php

@@ -227,7 +227,7 @@ sqsession_is_active();
  * SquirrelMail internal version number -- DO NOT CHANGE
  * $sm_internal_version = array (release, major, minor)
  */
-$SQM_INTERNAL_VERSION = preg_split('/\./', SM_VERSION, 3);
+$SQM_INTERNAL_VERSION = explode('.', SM_VERSION, 3);
 $SQM_INTERNAL_VERSION[2] = intval($SQM_INTERNAL_VERSION[2]);
 
 

+ 2 - 2
plugins/filters/filters.php

@@ -381,7 +381,7 @@ function filter_search_and_delete($imap_stream, $where, $what, $where_to, $user_
         $ids = array();
         for ($i = 0, $iCnt = count($read); $i < $iCnt; ++$i) {
             if (preg_match("/^\* SEARCH (.+)$/", $read[$i], $regs)) {
-                $ids += preg_split("/ /", trim($regs[1]));
+                $ids += explode(' ', trim($regs[1]));
             }
         }
         if ($response == 'OK' && count($ids)) {
@@ -450,7 +450,7 @@ function spam_filters($imap_stream) {
         if (isset($read[0])) {
             for ($i = 0, $iCnt = count($read); $i < $iCnt; ++$i) {
                 if (preg_match("/^\* SEARCH (.+)$/", $read[$i], $regs)) {
-                    $search_array = preg_split("/ /", trim($regs[1]));
+                    $search_array = explode(' ', trim($regs[1]));
                 break;
                 }
             }

+ 1 - 1
src/configtest.php

@@ -84,7 +84,7 @@ define('SM_PATH', '../');
 require(SM_PATH . 'include/constants.php');
 require(SM_PATH . 'functions/global.php');
 require(SM_PATH . 'functions/strings.php');
-$SQM_INTERNAL_VERSION = preg_split('/\./', SM_VERSION, 3);
+$SQM_INTERNAL_VERSION = explode('.', SM_VERSION, 3);
 $SQM_INTERNAL_VERSION[2] = intval($SQM_INTERNAL_VERSION[2]);
 
 /** set default value in order to block remote access */