| | |
| | | $rcube->load_language($lang, $add); |
| | | |
| | | // add labels to client |
| | | if ($add2client) { |
| | | if ($add2client && method_exists($rcube->output, 'add_label')) { |
| | | if (is_array($add2client)) { |
| | | $js_labels = array_map(array($this, 'label_map_callback'), $add2client); |
| | | } |
| | |
| | | } |
| | | $rcube->output->add_label($js_labels); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Wrapper for add_label() adding the plugin ID as domain |
| | | */ |
| | | public function add_label() |
| | | { |
| | | $rcube = rcube::get_instance(); |
| | | |
| | | if (method_exists($rcube->output, 'add_label')) { |
| | | $args = func_get_args(); |
| | | if (count($args) == 1 && is_array($args[0])) { |
| | | $args = $args[0]; |
| | | } |
| | | |
| | | $args = array_map(array($this, 'label_map_callback'), $args); |
| | | $rcube->output->add_label($args); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | private function label_map_callback($key) |
| | | { |
| | | if (strpos($key, $this->ID.'.') === 0) { |
| | | return $key; |
| | | } |
| | | |
| | | return $this->ID.'.'.$key; |
| | | } |
| | | } |