diff options
author | thomascube <thomas@roundcube.net> | 2009-10-29 01:53:40 +0300 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2009-10-29 01:53:40 +0300 |
commit | 01accaff5b52d8fa53a1821d452f265aef67cef1 (patch) | |
tree | 80769e6d5f0ed1aa7bf3659fa3d538ae0fa12ca4 | |
parent | 2b96b67e8cdb96c7106c76bed307e0b2413379ba (diff) |
Add fallback to default skin if the selected one is not available in plugin directory
-rw-r--r-- | plugins/archive/archive.php | 4 | ||||
-rw-r--r-- | plugins/markasjunk/markasjunk.php | 2 | ||||
-rw-r--r-- | program/include/rcube_plugin.php | 14 |
3 files changed, 17 insertions, 3 deletions
diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index 8c855fea7..27887cef3 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -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( diff --git a/plugins/markasjunk/markasjunk.php b/plugins/markasjunk/markasjunk.php index f3e652d89..4f41a7eed 100644 --- a/plugins/markasjunk/markasjunk.php +++ b/plugins/markasjunk/markasjunk.php @@ -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( diff --git a/program/include/rcube_plugin.php b/program/include/rcube_plugin.php index 5e37764c4..ed30e8f17 100644 --- a/program/include/rcube_plugin.php +++ b/program/include/rcube_plugin.php @@ -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 |