123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- class Salmon
- {
- const REL_SALMON = 'salmon';
- const REL_MENTIONED = 'mentioned';
-
- const NS_REPLIES = "http://salmon-protocol.org/ns/salmon-replies";
- const NS_MENTIONS = "http://salmon-protocol.org/ns/salmon-mention";
-
- public static function post($endpoint_uri, $xml, Profile $actor, Profile $target=null)
- {
- if (empty($endpoint_uri)) {
- common_debug('No endpoint URI for Salmon post to '.$actor->getUri());
- return false;
- }
- try {
- $magic_env = MagicEnvelope::signAsUser($xml, $actor->getUser());
- } catch (Exception $e) {
- common_log(LOG_ERR, "Salmon unable to sign: " . $e->getMessage());
- return false;
- }
-
- if (Event::handle('SalmonSlap', array($endpoint_uri, $magic_env, $target))) {
- return false;
-
- }
- return true;
- }
- }
|