1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?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;
- }
- }
|