- $relLinkEls = ActivityUtils::getLinks($actobj->element, 'related');
-
- if (count($relLinkEls) !== 1) {
+ common_debug('saving bookmark activity object: '.var_export($actobj,true));
+ $url = null;
+ // each extra element is array('tagname', array('attr'=>'val', ...), 'content')
+ foreach ($actobj->extra as $extra) {
+ common_debug('bookmark extra: '.var_export($extra,true));
+ if ($extra[1]['rel'] !== 'related') {
+ continue;
+ }
+ if ($url===null && strlen($extra[1]['href'])>0) {
+ $url = $extra[1]['href'];
+ } elseif ($url !== null) {
+ // TRANS: Client exception thrown when a bookmark is formatted incorrectly.
+ throw new ClientException(sprintf(_m('Expected exactly 1 link rel=related in a Bookmark, got %1$d.'), count($relLinkEls)));
+ }
+ }
+ if (is_null($url)) {