| | |
| | | * @return string Localized text |
| | | * @see rcmail::gettext() |
| | | */ |
| | | function rcube_label($p) |
| | | function rcube_label($p, $domain=null) |
| | | { |
| | | return rcmail::get_instance()->gettext($p); |
| | | return rcmail::get_instance()->gettext($p, $domain); |
| | | } |
| | | |
| | | |
| | |
| | | if ($to == 'UNICODE-1-1-UTF-7') |
| | | $to = 'UTF-7'; |
| | | |
| | | if ($from==$to || $str=='' || empty($from)) |
| | | if ($from == $to || empty($str) || empty($from)) |
| | | return $str; |
| | | |
| | | $aliases = array( |
| | |
| | | if ($from == 'UTF-7') { |
| | | if ($_str = utf7_to_utf8($str)) |
| | | $str = $_str; |
| | | else |
| | | $error = true; |
| | | } |
| | | else if (($from == 'ISO-8859-1') && function_exists('utf8_encode')) { |
| | | $str = utf8_encode($str); |
| | |
| | | $conv->loadCharset($from); |
| | | $str = $conv->strToUtf8($str); |
| | | } |
| | | else if ($from != 'UTF-8') {} |
| | | else if ($from != 'UTF-8') |
| | | $error = true; |
| | | |
| | | // encode string for output |
| | |
| | | 'code' => 500, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, |
| | | 'message' => "Could not convert string charset. Make sure iconv is installed or lib/utf8.class is available" |
| | | 'message' => "Could not convert string from $from to $to. Make sure iconv is installed or lib/utf8.class is available" |
| | | ), true, false); |
| | | |
| | | $convert_warning = true; |
| | |
| | | */ |
| | | function rep_specialchars_output($str, $enctype='', $mode='', $newlines=TRUE) |
| | | { |
| | | global $OUTPUT; |
| | | static $html_encode_arr = false; |
| | | static $js_rep_table = false; |
| | | static $xml_rep_table = false; |
| | | |
| | | $charset = $OUTPUT->get_charset(); |
| | | $charset = rcmail::get_instance()->config->get('charset', RCMAIL_CHARSET); |
| | | $is_iso_8859_1 = false; |
| | | if ($charset == 'ISO-8859-1') { |
| | | $is_iso_8859_1 = true; |
| | |
| | | preg_match_all('/\s*([-_a-z]+)=(["\'])??(?(2)([^\2]*)\2|(\S+?))/Ui', stripslashes($str), $regs, PREG_SET_ORDER); |
| | | |
| | | // convert attributes to an associative array (name => value) |
| | | if ($regs) |
| | | foreach ($regs as $attr) |
| | | { |
| | | $attrib[strtolower($attr[1])] = $attr[3] . $attr[4]; |
| | | } |
| | | if ($regs) { |
| | | foreach ($regs as $attr) { |
| | | $attrib[strtolower($attr[1])] = html_entity_decode($attr[3] . $attr[4]); |
| | | } |
| | | } |
| | | |
| | | return $attrib; |
| | | } |
| | |
| | | */ |
| | | function console() |
| | | { |
| | | $args = func_get_args(); |
| | | |
| | | if (class_exists('rcmail', false)) |
| | | rcmail::get_instance()->plugins->exec_hook('console', $args); |
| | | |
| | | $msg = array(); |
| | | foreach (func_get_args() as $arg) |
| | | foreach ($args as $arg) |
| | | $msg[] = !is_string($arg) ? var_export($arg, true) : $arg; |
| | | |
| | | if (!($GLOBALS['CONFIG']['debug_level'] & 4)) |
| | |
| | | |
| | | if (!is_string($line)) |
| | | $line = var_export($line, true); |
| | | |
| | | $log_entry = sprintf("[%s]: %s\n", |
| | | date("d-M-Y H:i:s O", mktime()), |
| | | $line); |
| | | |
| | | if (empty($CONFIG['log_date_format'])) |
| | | $CONFIG['log_date_format'] = 'd-M-Y H:i:s O'; |
| | | |
| | | $log_entry = sprintf("[%s]: %s\n", date($CONFIG['log_date_format']), $line); |
| | | |
| | | if ($CONFIG['log_driver'] == 'syslog') { |
| | | if ($name == 'errors') |