Add fallback to default skin if the selected one is not available in plugin directory

release-0.6
thomascube 15 years ago
parent 2b96b67e8c
commit 01accaff5b

@ -24,8 +24,8 @@ class archive extends rcube_plugin
if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show')
&& ($archive_folder = $rcmail->config->get('archive_mbox'))) {
$skin_path = 'skins/'.$rcmail->output->config['skin'];
$skin_path = $this->local_skin_path();
$this->include_script('archive.js');
$this->add_texts('localization', true);
$this->add_button(

@ -19,7 +19,7 @@ class markasjunk extends rcube_plugin
$rcmail = rcmail::get_instance();
if ($rcmail->action == '' || $rcmail->action == 'show') {
$skin_path = 'skins/'.$rcmail->output->config['skin'];
$skin_path = $this->local_skin_path();;
$this->include_script('markasjunk.js');
$this->add_texts('localization', true);
$this->add_button(array(

@ -231,6 +231,20 @@ abstract class rcube_plugin
else
return $fn;
}
/**
* Provide path to the currently selected skin folder within the plugin directory
* with a fallback to the default skin folder.
*
* @return string Skin path relative to plugins directory
*/
protected function local_skin_path()
{
$skin_path = 'skins/'.$this->api->output->config['skin'];
if (!is_dir(realpath(slashify($this->home) . $skin_path)))
$skin_path = 'skins/default';
return $skin_path;
}
/**
* Callback function for array_map

Loading…
Cancel
Save