. /** * The event handler. * * @package local_webhooks * @copyright 2017 "Valentin Popov" * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace local_webhooks; defined('MOODLE_INTERNAL') || die(); class events { public static function handler($event) { $enabled = boolval(get_config('local_webhooks', 'enabled')); $url = get_config('local_webhooks', 'url'); if ($enabled && !empty($url)) { $data = $event->get_data(); $json = json_encode($data); $curl = new curl(); $curl::request($url, $json); } } }