contactimporter/php/plugin.contactimporter.php

93 lines
2.8 KiB
PHP
Raw Permalink Normal View History

<?php
2016-11-30 12:46:19 +01:00
/**
2016-11-29 15:24:22 +01:00
* plugin.contactimporter.php, Kopano Webapp contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
2018-03-08 10:33:06 +01:00
* Copyright (C) 2012-2018 Christoph Haas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
2016-11-30 12:46:19 +01:00
require_once(__DIR__ . "/download.php");
2016-06-13 15:51:19 +02:00
/**
* contactimporter Plugin
*
* With this plugin you can import a vcf file to your zarafa addressbook
*
*/
2016-06-13 22:59:05 +02:00
class Plugincontactimporter extends Plugin
{
2016-11-29 15:24:22 +01:00
/**
* Constructor
*/
function __construct()
{
}
2016-11-29 15:24:22 +01:00
/**
* Function initializes the Plugin and registers all hooks
*
* @return void
*/
function init()
{
$this->registerHook('server.core.settings.init.before');
$this->registerHook('server.index.load.custom');
}
2016-11-29 15:24:22 +01:00
/**
* Function is executed when a hook is triggered by the PluginManager
*
* @param string $eventID the id of the triggered hook
* @param mixed $data object(s) related to the hook
* @return void
*/
function execute($eventID, &$data)
{
switch ($eventID) {
case 'server.core.settings.init.before' :
$this->injectPluginSettings($data);
break;
case 'server.index.load.custom':
if ($data['name'] == 'download_vcf') {
DownloadHandler::doDownload();
}
break;
}
}
2016-11-29 15:24:22 +01:00
/**
* Called when the core Settings class is initialized and ready to accept sysadmin default
* settings.
* @param [] $data Reference to the data of the triggered hook
*/
function injectPluginSettings(&$data)
{
$data['settingsObj']->addSysAdminDefaults(Array(
'zarafa' => Array(
'v1' => Array(
'plugins' => Array(
'contactimporter' => Array(
'enable' => PLUGIN_CONTACTIMPORTER_USER_DEFAULT_ENABLE,
'default_addressbook' => PLUGIN_CONTACTIMPORTER_DEFAULT
)
)
)
)
));
}
}