Changeset 2aa2b33 in github


Ignore:
Timestamp:
Sep 8, 2010 5:40:39 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
860678e
Parents:
ec581c1
Message:
  • Small performance improvements
Location:
program/include
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • program/include/main.inc

    r1fb718ca r2aa2b33  
    701701function strip_quotes($str) 
    702702{ 
    703   return preg_replace('/[\'"]/', '', $str); 
     703  return str_replace(array("'", '"'), '', $str); 
    704704} 
    705705 
  • program/include/rcmail.php

    r564741f r2aa2b33  
    811811      return ucfirst($text); 
    812812    else if ($attrib['uppercase']) 
    813       return strtoupper($text); 
     813      return mb_strtoupper($text); 
    814814    else if ($attrib['lowercase']) 
    815       return strtolower($text); 
     815      return mb_strtolower($text); 
    816816 
    817817    return $text; 
     
    875875      if ($dh = @opendir(INSTALL_PATH . 'program/localization')) { 
    876876        while (($name = readdir($dh)) !== false) { 
    877           if ($name{0}=='.' || !is_dir(INSTALL_PATH . 'program/localization/' . $name)) 
     877          if ($name[0] == '.' || !is_dir(INSTALL_PATH . 'program/localization/' . $name)) 
    878878            continue; 
    879879 
  • program/include/rcube_browser.php

    r372d3bf r2aa2b33  
    3131    function __construct() 
    3232    { 
    33         $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; 
     33        $HTTP_USER_AGENT = strtolower($_SERVER['HTTP_USER_AGENT']); 
    3434 
    3535        $this->ver = 0; 
    36         $this->win = stristr($HTTP_USER_AGENT, 'win'); 
    37         $this->mac = stristr($HTTP_USER_AGENT, 'mac'); 
    38         $this->linux = stristr($HTTP_USER_AGENT, 'linux'); 
    39         $this->unix  = stristr($HTTP_USER_AGENT, 'unix'); 
     36        $this->win = strstr($HTTP_USER_AGENT, 'win'); 
     37        $this->mac = strstr($HTTP_USER_AGENT, 'mac'); 
     38        $this->linux = strstr($HTTP_USER_AGENT, 'linux'); 
     39        $this->unix  = strstr($HTTP_USER_AGENT, 'unix'); 
    4040 
    41         $this->opera = stristr($HTTP_USER_AGENT, 'opera'); 
    42         $this->ns4 = stristr($HTTP_USER_AGENT, 'mozilla/4') && !stristr($HTTP_USER_AGENT, 'msie'); 
    43         $this->ns  = ($this->ns4 || stristr($HTTP_USER_AGENT, 'netscape')); 
    44         $this->ie  = stristr($HTTP_USER_AGENT, 'compatible; msie') && !$this->opera; 
    45         $this->mz  = stristr($HTTP_USER_AGENT, 'mozilla/5'); 
    46         $this->chrome = stristr($HTTP_USER_AGENT, 'chrome'); 
    47         $this->khtml = stristr($HTTP_USER_AGENT, 'khtml'); 
    48         $this->safari = !$this->chrome && ($this->khtml || stristr($HTTP_USER_AGENT, 'safari')); 
     41        $this->opera = strstr($HTTP_USER_AGENT, 'opera'); 
     42        $this->ns4 = strstr($HTTP_USER_AGENT, 'mozilla/4') && !strstr($HTTP_USER_AGENT, 'msie'); 
     43        $this->ns  = ($this->ns4 || strstr($HTTP_USER_AGENT, 'netscape')); 
     44        $this->ie  = !$this->opera && strstr($HTTP_USER_AGENT, 'compatible; msie'); 
     45        $this->mz  = strstr($HTTP_USER_AGENT, 'mozilla/5'); 
     46        $this->chrome = strstr($HTTP_USER_AGENT, 'chrome'); 
     47        $this->khtml = strstr($HTTP_USER_AGENT, 'khtml'); 
     48        $this->safari = !$this->chrome && ($this->khtml || strstr($HTTP_USER_AGENT, 'safari')); 
    4949 
    5050        if ($this->ns || $this->chrome) { 
    51             $test = preg_match('/(mozilla|chrome)\/([0-9.]+)/i', $HTTP_USER_AGENT, $regs); 
     51            $test = preg_match('/(mozilla|chrome)\/([0-9.]+)/', $HTTP_USER_AGENT, $regs); 
    5252            $this->ver = $test ? (float)$regs[2] : 0; 
    5353        } 
     
    5757        } 
    5858        else if ($this->ie || $this->opera) { 
    59             $test = preg_match('/(msie|opera) ([0-9.]+)/i', $HTTP_USER_AGENT, $regs); 
     59            $test = preg_match('/(msie|opera) ([0-9.]+)/', $HTTP_USER_AGENT, $regs); 
    6060            $this->ver = $test ? (float)$regs[2] : 0; 
    6161        } 
    6262 
    63         if (preg_match('/ ([a-z]{2})-([a-z]{2})/i', $HTTP_USER_AGENT, $regs)) 
     63        if (preg_match('/ ([a-z]{2})-([a-z]{2})/', $HTTP_USER_AGENT, $regs)) 
    6464            $this->lang =  $regs[1]; 
    6565        else 
  • program/include/rcube_imap.php

    r272a7e5 r2aa2b33  
    34273427 
    34283428            if (preg_match('/^[\'"]/', $name) && preg_match('/[\'"]$/', $name)) 
    3429                 $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', $name); 
     3429                $name = trim($name, '\'"'); 
    34303430 
    34313431            if ($name && $address && $name != $address) 
     
    34593459    { 
    34603460        $str = rcube_imap::decode_mime_string((string)$input, $this->default_charset); 
    3461         if ($str{0}=='"' && $remove_quotes) 
     3461        if ($str[0] == '"' && $remove_quotes) 
    34623462            $str = str_replace('"', '', $str); 
    34633463 
  • program/include/rcube_imap_generic.php

    r272a7e5 r2aa2b33  
    12591259                                                break; 
    12601260                                            case 'in-reply-to': 
    1261                                                 $result[$id]->in_reply_to = preg_replace('/[\n<>]/', '', $string); 
     1261                                                $result[$id]->in_reply_to = str_replace(array("\n", '<', '>'), '', $string); 
    12621262                                                break; 
    12631263                                        case 'references': 
     
    21162116            $min_free = PHP_INT_MAX; 
    21172117            foreach ($quota_lines as $key => $quota_line) { 
    2118                     $quota_line   = preg_replace('/[()]/', '', $quota_line); 
     2118                    $quota_line   = str_replace(array('(', ')'), '', $quota_line); 
    21192119                    $parts        = explode(' ', $quota_line); 
    21202120                    $storage_part = array_search('STORAGE', $parts); 
  • program/include/rcube_template.php

    raf3cf8a0 r2aa2b33  
    445445    public function abs_url($str) 
    446446    { 
    447         return preg_replace('/^\//', $this->config['skin_path'].'/', $str); 
     447        if ($str[0] == '/') 
     448            return $this->config['skin_path'] . $str; 
     449        else 
     450            return $str; 
    448451    } 
    449452 
Note: See TracChangeset for help on using the changeset viewer.