1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rainloop_ynh.git synced 2024-09-03 20:16:18 +02:00
rainloop_ynh/sources/plugins/ynh-ldap-suggestions/index.php

38 lines
802 B
PHP
Raw Normal View History

2015-10-24 14:24:50 +02:00
<?php
2015-10-24 23:51:26 +02:00
class YnhLdapSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin {
2015-10-24 14:24:50 +02:00
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') {
2015-10-24 23:51:26 +02:00
include_once __DIR__ . '/YnhLdapSuggestions.php';
2015-10-24 14:24:50 +02:00
if (! \is_array ( $mResult )) {
$mResult = array ();
}
2015-10-24 23:51:26 +02:00
$oProvider = new YnhLdapSuggestions ();
2015-10-24 14:24:50 +02:00
$mResult [] = $oProvider;
}
}
}
?>