From 01accaff5b52d8fa53a1821d452f265aef67cef1 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 28 Oct 2009 18:53:40 -0400
Subject: [PATCH] Add fallback to default skin if the selected one is not available in plugin directory
---
program/include/rcube_plugin.php | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/program/include/rcube_plugin.php b/program/include/rcube_plugin.php
index d3ab7af..ed30e8f 100644
--- a/program/include/rcube_plugin.php
+++ b/program/include/rcube_plugin.php
@@ -208,6 +208,18 @@
$this->api->add_content($this->api->output->button($p), $container);
}
}
+
+ /**
+ * Generate an absolute URL to the given resource within the current
+ * plugin directory
+ *
+ * @param string The file name
+ * @return string Absolute URL to the given resource
+ */
+ public function url($fn)
+ {
+ return $this->api->url . $this->resource_url($fn);
+ }
/**
* Make the given file name link into the plugin directory
@@ -219,6 +231,20 @@
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
--
Gitblit v1.9.1