6 * @author Aleksander 'A.L.E.C' Machniak
9 * Configuration (see config.inc.php.dist)
13 class help extends rcube_plugin
17 $this->add_texts('localization/', false);
20 $this->register_action('plugin.help', array($this, 'action'));
21 $this->register_action('plugin.helpabout', array($this, 'action'));
22 $this->register_action('plugin.helplicense', array($this, 'action'));
25 $this->add_button(array(
27 'class' => 'button-help',
28 'label' => 'help.help',
29 'href' => './?_task=dummy&_action=plugin.help',
32 $skin = rcmail::get_instance()->config->get('skin');
33 if (!file_exists($this->home."/skins/$skin/help.css"))
36 // add style for taskbar button (must be here) and Help UI
37 $this->include_stylesheet("skins/$skin/help.css");
42 $rcmail = rcmail::get_instance();
46 // register UI objects
47 $rcmail->output->add_handlers(array(
48 'helpcontent' => array($this, 'content'),
51 if ($rcmail->action == 'plugin.helpabout')
52 $rcmail->output->set_pagetitle($this->gettext('about'));
53 else if ($rcmail->action == 'plugin.helplicense')
54 $rcmail->output->set_pagetitle($this->gettext('license'));
56 $rcmail->output->set_pagetitle($this->gettext('help'));
58 $rcmail->output->send('help.help');
61 function content($attrib)
63 $rcmail = rcmail::get_instance();
65 if ($rcmail->action == 'plugin.helpabout') {
66 return @file_get_contents($this->home.'/content/about.html');
68 else if ($rcmail->action == 'plugin.helplicense') {
69 return @file_get_contents($this->home.'/content/license.html');
72 // default content: iframe
74 if ($src = $rcmail->config->get('help_source'))
75 $attrib['src'] = $src;
77 if (empty($attrib['id']))
78 $attrib['id'] = 'rcmailhelpcontent';
80 // allow the following attributes to be added to the <iframe> tag
81 $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'src', 'width', 'height', 'frameborder'));
82 $framename = $attrib['id'];
84 $out = sprintf('<iframe name="%s"%s></iframe>'."\n", $framename, $attrib_str);