summaryrefslogtreecommitdiff
path: root/plugins/legacy_browser/legacy_browser.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/legacy_browser/legacy_browser.php')
-rw-r--r--plugins/legacy_browser/legacy_browser.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/plugins/legacy_browser/legacy_browser.php b/plugins/legacy_browser/legacy_browser.php
index a26167710..346a0ed8e 100644
--- a/plugins/legacy_browser/legacy_browser.php
+++ b/plugins/legacy_browser/legacy_browser.php
@@ -28,14 +28,26 @@ class legacy_browser extends rcube_plugin
function send_page($args)
{
+ $p1 = $this->rc->output->asset_url('program/js');
+ $p2 = $this->rc->output->asset_url('plugins/legacy_browser/js');
+
+ $assets_dir = $this->rc->config->get('assets_dir');
+
$ts1 = filemtime($this->home . '/js/jquery.min.js');
$ts2 = filemtime($this->home . '/js/iehacks.js');
+ if (!$ts1 && $assets_dir) {
+ $ts1 = filemtime($assets_dir . '/plugins/legacy_browser/js/jquery.min.js');
+ }
+ if (!$ts2 && $assets_dir) {
+ $ts2 = filemtime($assets_dir . '/plugins/legacy_browser/js/iehacks.js');
+ }
+
// put iehacks.js after app.js
if ($this->rc->output->browser->ie) {
$args['content'] = preg_replace(
- '|(<script src="program/js/app(\.min)?\.js\?s=[0-9]+" type="text/javascript"></script>)|',
- '\\1<script src="plugins/legacy_browser/js/iehacks.js?s=' . $ts2 . '" type="text/javascript"></script>',
+ '|(<script src="' . preg_quote($p1, '|') . '/app(\.min)?\.js(\?s=[0-9]+)?" type="text/javascript"></script>)|',
+ '\\1<script src="' . $p2 . '/iehacks.js?s=' . $ts2 . '" type="text/javascript"></script>',
$args['content'], 1, $count);
}
else {
@@ -44,10 +56,10 @@ class legacy_browser extends rcube_plugin
// replace jQuery 2.x with 1.x
$args['content'] = preg_replace(
- '|<script src="program/js/jquery\.min\.js\?s=[0-9]+" type="text/javascript"></script>|',
- '<script src="plugins/legacy_browser/js/jquery.min.js?s=' . $ts1 . '" type="text/javascript"></script>'
+ '|<script src="' . preg_quote($p1, '|') . '/jquery\.min\.js(\?s=[0-9]+)?" type="text/javascript"></script>|',
+ '<script src="' . $p2 . '/jquery.min.js?s=' . $ts1 . '" type="text/javascript"></script>'
// add iehacks.js if it is IE and it wasn't added yet
- . ($count ? '' : "\n".'<script src="plugins/legacy_browser/js/iehacks.js?s=' . $ts2 . '" type="text/javascript"></script>'),
+ . ($count ? '' : "\n".'<script src="' . $p2 . '/iehacks.js?s=' . $ts2 . '" type="text/javascript"></script>'),
$args['content'], 1);
return $args;