mirror of
https://github.com/YunoHost-Apps/rainloop_ynh.git
synced 2024-09-03 20:16:18 +02:00
38 lines
805 B
PHP
38 lines
805 B
PHP
|
<?php
|
||
|
class YnhLdapAddressbooksPlugin extends \RainLoop\Plugins\AbstractPlugin {
|
||
|
public function Init() {
|
||
|
$this->addHook ( 'main.fabrica', 'MainFabrica' );
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* test if ldap is supported (but with ynh it nead ;) )
|
||
|
*
|
||
|
* @return string
|
||
|
*/
|
||
|
public function Supported() {
|
||
|
if (! \function_exists ( 'ldap_connect' )) {
|
||
|
return 'The LDAP PHP exention must be installed to use this plugin';
|
||
|
}
|
||
|
return '';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* @param string $sName
|
||
|
* @param mixed $mResult
|
||
|
*/
|
||
|
public function MainFabrica($sName, &$mResult) {
|
||
|
if ($sName === 'suggestions') {
|
||
|
include_once __DIR__ . '/YnhLdapAddressbooks.php';
|
||
|
|
||
|
if (! \is_array ( $mResult )) {
|
||
|
$mResult = array ();
|
||
|
}
|
||
|
|
||
|
$oProvider = new YnhLdapAddressbooks ();
|
||
|
$mResult [] = $oProvider;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
?>
|