/** * Allows to get pad content from etherpad API * @param {PadComponent} $pad The pad to get content * @retunr {string} content returned by the API */ private function exportPadContent($pad) { $cdatas = array('padID' => $pad->pad_name, 'apikey' => $this->etherpadApiKey); $result = RestUtilities::callAPI($this->etherpadURLApi . 'getHTML', RestMethods::GET, $cdatas); if ($result) { if (isset($result->error)) { throw new RestException($result->error); } else { if ($result->code == 0) { return $result->data->html; } } } }
/** * Allows to know if etherpad is avaibable * @return boolean Ture if available, false otherwhise */ public static function isEtherpadAvailable() { $apiUrl = Config::get('etherpad-url'); $apiKey = Config::get('etherpad-apikey'); $available = false; if ($apiUrl && $apiKey && self::getByApiKey($apiKey)) { $cdatas = array('apikey' => $apiKey); $result = RestUtilities::callAPI($apiUrl . 'listAllPads', RestMethods::GET, $cdatas); if ($result && isset($result->code) && $result->code === 0) { $available = true; } } return $available; }