Page MenuHomePhorge

kolab.php
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

kolab.php

<?php
/*
* Kolab integration plugin for Roundcube webmail.
*
* @author Aleksander Machniak <machniak@apheleia-it.ch>
*
* Copyright (C) Apheleia IT AG <contact@apheleia-it.ch>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class kolab extends rcube_plugin
{
private $features = [
'Kolab\Addresses',
'Kolab\Configuration',
'Kolab\Contacts',
'Kolab\Delegation',
'Kolab\Helpdesk',
'Kolab\Users',
];
/**
* Plugin initialization
*/
public function init()
{
// register autoloader for included classes
spl_autoload_register([$this, 'autoloader']);
$this->add_hook('startup', [$this, 'startupHook']);
$this->add_hook('login_after', [$this, 'loginAfterHook']);
// Load features and let them do the whole work
foreach ($this->features as $feature_class) {
$feature = new $feature_class($this);
$feature->init();
}
}
/**
* PHP5 autoloader routine for dynamic class loading
*/
public function autoloader(string $classname): bool
{
if (str_starts_with($classname, "Kolab\\")) {
$classname = str_replace("\\", '/', $classname);
$filepath = "{$this->home}/{$classname}.php";
if (is_readable($filepath)) {
include_once $filepath;
return true;
}
}
return false;
}
/**
* Handler for 'startup' hook
*/
public function startupHook($args): array
{
// Read the plugin config, we try to not do this in init()
$this->load_config();
return $args;
}
/**
* Handler for 'login_after' hook
*/
public function loginAfterHook($args): array
{
// This is the best moment to clear the client cache
Kolab\Client::cacheClear();
return $args;
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Apr 4, 5:37 AM (5 d, 3 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18791469
Default Alt Text
kolab.php (2 KB)

Event Timeline