mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-09 19:13:26 +00:00
Add new feed entry web hook when creating a new feed entry
This commit is contained in:
@@ -14,6 +14,8 @@ use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
|
||||
class API_Webhook
|
||||
{
|
||||
const NEW_FEED_ENTRY = "new_feed_entry";
|
||||
|
||||
protected $appbox;
|
||||
protected $id;
|
||||
protected $type;
|
||||
|
@@ -50,7 +50,6 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
|
||||
);
|
||||
|
||||
$dom_xml = new DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
$dom_xml->preserveWhiteSpace = false;
|
||||
$dom_xml->formatOutput = true;
|
||||
|
||||
@@ -64,7 +63,9 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
|
||||
|
||||
$dom_xml->appendChild($root);
|
||||
|
||||
$datas = $dom_xml->saveXml();
|
||||
$data = $dom_xml->saveXml();
|
||||
|
||||
API_Webhook::create($this->app['phraseanet.appbox'], API_Webhook::NEW_FEED_ENTRY, $params);
|
||||
|
||||
$Query = new \User_Query($this->app);
|
||||
|
||||
@@ -121,7 +122,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
|
||||
}
|
||||
}
|
||||
|
||||
$this->broker->notify($user_to_notif->get_id(), __CLASS__, $datas, $mailed);
|
||||
$this->broker->notify($user_to_notif->get_id(), __CLASS__, $data, $mailed);
|
||||
}
|
||||
$start += $perLoop;
|
||||
} while (count($results) > 0);
|
||||
@@ -131,13 +132,13 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Array $datas
|
||||
* @param Array $data
|
||||
* @param boolean $unread
|
||||
* @return Array
|
||||
*/
|
||||
public function datas($datas, $unread)
|
||||
public function datas($data, $unread)
|
||||
{
|
||||
$sx = simplexml_load_string($datas);
|
||||
$sx = simplexml_load_string($data);
|
||||
|
||||
try {
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($this->app, (int) $sx->entry_id);
|
||||
|
Reference in New Issue
Block a user