From 99f904adcc37d93c90defcd8ce898598e25be212 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 11 Mar 2015 16:55:04 +0100 Subject: Lot of plugins --- myrc_sprites/myrc_sprites.php | 91 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 myrc_sprites/myrc_sprites.php (limited to 'myrc_sprites/myrc_sprites.php') diff --git a/myrc_sprites/myrc_sprites.php b/myrc_sprites/myrc_sprites.php new file mode 100644 index 0000000..e153166 --- /dev/null +++ b/myrc_sprites/myrc_sprites.php @@ -0,0 +1,91 @@ +Documentation'; + static private $version = '1.0.7'; + static private $date = '18-01-2015'; + static private $licence = 'GPL'; + static private $requirements = array( + 'Roundcube' => '1.0.3', + 'PHP' => '5.3' + ); + + private $images = array( + 'myrc_sprites' => 'png', + 'myrc_loading' => 'gif', + 'myrc_loading_samll' => 'gif', + 'myrc_ajax_loading' => 'gif', + ); + + function init(){ + $skin = rcube::get_instance()->config->get('skin', 'larry'); + if(file_exists(INSTALL_PATH . 'plugins/myrc_sprites/skins/' . $skin . '/myrc_sprites.css')){ + $this->include_stylesheet('skins/' . $skin . '/myrc_sprites.css'); + } + $this->add_hook('render_page', array($this, 'render_page')); + } + + static public function about($keys = false){ + $requirements = self::$requirements; + foreach(array('required_', 'recommended_') as $prefix){ + if(is_array($requirements[$prefix.'plugins'])){ + foreach($requirements[$prefix.'plugins'] as $plugin => $method){ + if(class_exists($plugin) && method_exists($plugin, 'about')){ + /* PHP 5.2.x workaround for $plugin::about() */ + $class = new $plugin(false); + $requirements[$prefix.'plugins'][$plugin] = array( + 'method' => $method, + 'plugin' => $class->about($keys), + ); + } + else{ + $requirements[$prefix.'plugins'][$plugin] = array( + 'method' => $method, + 'plugin' => $plugin, + ); + } + } + } + } + return array( + 'plugin' => self::$plugin, + 'version' => self::$version, + 'date' => self::$date, + 'author' => self::$author, + 'comments' => self::$authors_comments, + 'licence' => self::$licence, + 'requirements' => $requirements, + ); + } + + function render_page($p){ + $rcmail = rcube::get_instance(); + if($p['template'] == 'login'){ + $skin = $rcmail->config->get('skin', 'larry'); + $rcmail->output->add_script('/***************************************************/', 'foot'); + $rcmail->output->add_script('/* MyRoundcube myrc_sprites plugin images pre-load */', 'foot'); + $rcmail->output->add_script('/***************************************************/', 'foot'); + foreach($this->images as $name => $type){ + if(file_exists(INSTALL_PATH . 'plugins/myrc_sprites/skins/' . $skin . '/images/' . $name . '.' . $type)){ + $rcmail->output->add_script('var ' . $name . ' = new Image(); ' . $name . '.src = "./plugins/myrc_sprites/skins/' . $skin . '/images/' . $name . '.' . $type . '";', 'foot'); + } + } + $rcmail->output->add_script('/***************************************************/', 'foot'); + } + } +} +?> \ No newline at end of file -- cgit v1.2.3