- Small performance improvements
| | |
| | | */ |
| | | function strip_quotes($str) |
| | | { |
| | | return preg_replace('/[\'"]/', '', $str); |
| | | return str_replace(array("'", '"'), '', $str); |
| | | } |
| | | |
| | | |
| | |
| | | if (($attrib['uppercase'] && strtolower($attrib['uppercase']=='first')) || $attrib['ucfirst']) |
| | | return ucfirst($text); |
| | | else if ($attrib['uppercase']) |
| | | return strtoupper($text); |
| | | return mb_strtoupper($text); |
| | | else if ($attrib['lowercase']) |
| | | return strtolower($text); |
| | | return mb_strtolower($text); |
| | | |
| | | return $text; |
| | | } |
| | |
| | | |
| | | if ($dh = @opendir(INSTALL_PATH . 'program/localization')) { |
| | | while (($name = readdir($dh)) !== false) { |
| | | if ($name{0}=='.' || !is_dir(INSTALL_PATH . 'program/localization/' . $name)) |
| | | if ($name[0] == '.' || !is_dir(INSTALL_PATH . 'program/localization/' . $name)) |
| | | continue; |
| | | |
| | | if ($label = $rcube_languages[$name]) |
| | |
| | | { |
| | | function __construct() |
| | | { |
| | | $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; |
| | | $HTTP_USER_AGENT = strtolower($_SERVER['HTTP_USER_AGENT']); |
| | | |
| | | $this->ver = 0; |
| | | $this->win = stristr($HTTP_USER_AGENT, 'win'); |
| | | $this->mac = stristr($HTTP_USER_AGENT, 'mac'); |
| | | $this->linux = stristr($HTTP_USER_AGENT, 'linux'); |
| | | $this->unix = stristr($HTTP_USER_AGENT, 'unix'); |
| | | $this->win = strstr($HTTP_USER_AGENT, 'win'); |
| | | $this->mac = strstr($HTTP_USER_AGENT, 'mac'); |
| | | $this->linux = strstr($HTTP_USER_AGENT, 'linux'); |
| | | $this->unix = strstr($HTTP_USER_AGENT, 'unix'); |
| | | |
| | | $this->opera = stristr($HTTP_USER_AGENT, 'opera'); |
| | | $this->ns4 = stristr($HTTP_USER_AGENT, 'mozilla/4') && !stristr($HTTP_USER_AGENT, 'msie'); |
| | | $this->ns = ($this->ns4 || stristr($HTTP_USER_AGENT, 'netscape')); |
| | | $this->ie = stristr($HTTP_USER_AGENT, 'compatible; msie') && !$this->opera; |
| | | $this->mz = stristr($HTTP_USER_AGENT, 'mozilla/5'); |
| | | $this->chrome = stristr($HTTP_USER_AGENT, 'chrome'); |
| | | $this->khtml = stristr($HTTP_USER_AGENT, 'khtml'); |
| | | $this->safari = !$this->chrome && ($this->khtml || stristr($HTTP_USER_AGENT, 'safari')); |
| | | $this->opera = strstr($HTTP_USER_AGENT, 'opera'); |
| | | $this->ns4 = strstr($HTTP_USER_AGENT, 'mozilla/4') && !strstr($HTTP_USER_AGENT, 'msie'); |
| | | $this->ns = ($this->ns4 || strstr($HTTP_USER_AGENT, 'netscape')); |
| | | $this->ie = !$this->opera && strstr($HTTP_USER_AGENT, 'compatible; msie'); |
| | | $this->mz = strstr($HTTP_USER_AGENT, 'mozilla/5'); |
| | | $this->chrome = strstr($HTTP_USER_AGENT, 'chrome'); |
| | | $this->khtml = strstr($HTTP_USER_AGENT, 'khtml'); |
| | | $this->safari = !$this->chrome && ($this->khtml || strstr($HTTP_USER_AGENT, 'safari')); |
| | | |
| | | if ($this->ns || $this->chrome) { |
| | | $test = preg_match('/(mozilla|chrome)\/([0-9.]+)/i', $HTTP_USER_AGENT, $regs); |
| | | $test = preg_match('/(mozilla|chrome)\/([0-9.]+)/', $HTTP_USER_AGENT, $regs); |
| | | $this->ver = $test ? (float)$regs[2] : 0; |
| | | } |
| | | else if ($this->mz) { |
| | |
| | | $this->ver = $test ? (float)$regs[1] : 0; |
| | | } |
| | | else if ($this->ie || $this->opera) { |
| | | $test = preg_match('/(msie|opera) ([0-9.]+)/i', $HTTP_USER_AGENT, $regs); |
| | | $test = preg_match('/(msie|opera) ([0-9.]+)/', $HTTP_USER_AGENT, $regs); |
| | | $this->ver = $test ? (float)$regs[2] : 0; |
| | | } |
| | | |
| | | if (preg_match('/ ([a-z]{2})-([a-z]{2})/i', $HTTP_USER_AGENT, $regs)) |
| | | if (preg_match('/ ([a-z]{2})-([a-z]{2})/', $HTTP_USER_AGENT, $regs)) |
| | | $this->lang = $regs[1]; |
| | | else |
| | | $this->lang = 'en'; |
| | |
| | | $name = trim($val['name']); |
| | | |
| | | if (preg_match('/^[\'"]/', $name) && preg_match('/[\'"]$/', $name)) |
| | | $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', $name); |
| | | $name = trim($name, '\'"'); |
| | | |
| | | if ($name && $address && $name != $address) |
| | | $string = sprintf('%s <%s>', preg_match("/$special_chars/", $name) ? '"'.addcslashes($name, '"').'"' : $name, $address); |
| | |
| | | function decode_header($input, $remove_quotes=false) |
| | | { |
| | | $str = rcube_imap::decode_mime_string((string)$input, $this->default_charset); |
| | | if ($str{0}=='"' && $remove_quotes) |
| | | if ($str[0] == '"' && $remove_quotes) |
| | | $str = str_replace('"', '', $str); |
| | | |
| | | return $str; |
| | |
| | | } |
| | | break; |
| | | case 'in-reply-to': |
| | | $result[$id]->in_reply_to = preg_replace('/[\n<>]/', '', $string); |
| | | $result[$id]->in_reply_to = str_replace(array("\n", '<', '>'), '', $string); |
| | | break; |
| | | case 'references': |
| | | $result[$id]->references = $string; |
| | |
| | | // return false if not found, parse if found |
| | | $min_free = PHP_INT_MAX; |
| | | foreach ($quota_lines as $key => $quota_line) { |
| | | $quota_line = preg_replace('/[()]/', '', $quota_line); |
| | | $quota_line = str_replace(array('(', ')'), '', $quota_line); |
| | | $parts = explode(' ', $quota_line); |
| | | $storage_part = array_search('STORAGE', $parts); |
| | | |
| | |
| | | */ |
| | | public function abs_url($str) |
| | | { |
| | | return preg_replace('/^\//', $this->config['skin_path'].'/', $str); |
| | | if ($str[0] == '/') |
| | | return $this->config['skin_path'] . $str; |
| | | else |
| | | return $str; |
| | | } |
| | | |
| | | |