Thomas Bruederli
2014-05-01 b0ce5c62aff3c99e4e0bf09eae9a933f57b1f103
Make skin meta/hierarchy information accessible for plugins (#1488831)
3 files modified
30 ■■■■ changed files
program/include/rcmail_output_html.php 10 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_output.php 12 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_plugin.php 8 ●●●● patch | view | raw | blame | history
program/include/rcmail_output_html.php
@@ -5,7 +5,7 @@
 | program/include/rcmail_output_html.php                                |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2006-2013, The Roundcube Dev Team                       |
 | Copyright (C) 2006-2014, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -209,6 +209,14 @@
        // read meta file and check for dependecies
        $meta = @file_get_contents(RCUBE_INSTALL_PATH . $skin_path . '/meta.json');
        $meta = @json_decode($meta, true);
        $meta['path'] = $skin_path;
        $skin_id = end(explode('/', $skin_path));
        if (!$meta['name']) {
            $meta['name'] = $skin_id;
        }
        $this->skins[$skin_id] = $meta;
        if ($meta['extends']) {
            $path = RCUBE_INSTALL_PATH . 'skins/';
            if (is_dir($path . $meta['extends']) && is_readable($path . $meta['extends'])) {
program/lib/Roundcube/rcube_output.php
@@ -3,7 +3,7 @@
/*
 +-----------------------------------------------------------------------+
 | This file is part of the Roundcube PHP suite                          |
 | Copyright (C) 2005-2012 The Roundcube Dev Team                        |
 | Copyright (C) 2005-2014 The Roundcube Dev Team                        |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -31,6 +31,7 @@
    protected $config;
    protected $charset = RCUBE_CHARSET;
    protected $env = array();
    protected $skins = array();
    /**
@@ -49,9 +50,12 @@
     */
    public function __get($var)
    {
        // allow read-only access to $env
        if ($var == 'env')
            return $this->env;
        // allow read-only access to some members
        switch ($var) {
            case 'env':     return $this->env;
            case 'skins':   return $this->skins;
            case 'charset': return $this->charset;
        }
        return null;
    }
program/lib/Roundcube/rcube_plugin.php
@@ -3,7 +3,7 @@
/*
 +-----------------------------------------------------------------------+
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2008-2012, The Roundcube Dev Team                       |
 | Copyright (C) 2008-2014, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -394,7 +394,11 @@
    public function local_skin_path()
    {
        $rcube = rcube::get_instance();
        foreach (array($rcube->config->get('skin'), 'larry') as $skin) {
        $skins = array_keys((array)$rcube->output->skins);
        if (empty($skins)) {
            $skins = array($rcube->config->get('skin'));
        }
        foreach ($skins as $skin) {
            $skin_path = 'skins/' . $skin;
            if (is_dir(realpath(slashify($this->home) . $skin_path))) {
                break;