function notice_to_omb_notice($notice) { /* Create an OMB_Notice for $notice. */ $user = User::staticGet('id', $notice->profile_id); if (!$user) { return null; } $profile = $user->getProfile(); $omb_notice = new OMB_Notice(profile_to_omb_profile($user->uri, $profile), $notice->uri, $notice->content); $omb_notice->setURL(common_local_url('shownotice', array('notice' => $notice->id))); $omb_notice->setLicenseURL(common_config('license', 'url')); return $omb_notice; }
/** * Builds an OMB_Notice object from array * * The method builds an OMB_Notice object from the passed parameters array. * The array MUST provide a notice URI and content. The array fields HAVE TO * be named according to the OMB standard, i. e. omb_notice_* and * omb_seealso_*. Values are handled as not passed if the corresponding array * fields are not set or the empty string. * * @param object $author An OMB_Profile object representing the author of * the notice. * @param string $parameters An array containing the notice parameters. * * @access public * * @returns OMB_Notice The built OMB_Notice. */ public static function fromParameters($author, $parameters) { $notice = new OMB_Notice($author, $parameters['omb_notice'], $parameters['omb_notice_content']); if (isset($parameters['omb_notice_url'])) { $notice->setURL($parameters['omb_notice_url']); } if (isset($parameters['omb_notice_license'])) { $notice->setLicenseURL($parameters['omb_notice_license']); } if (isset($parameters['omb_seealso'])) { $notice->setSeealsoURL($parameters['omb_seealso']); } if (isset($parameters['omb_seealso_disposition'])) { $notice->setSeealsoDisposition($parameters['omb_seealso_disposition']); } if (isset($parameters['omb_seealso_mediatype'])) { $notice->setSeealsoMediatype($parameters['omb_seealso_mediatype']); } if (isset($parameters['omb_seealso_license'])) { $notice->setSeealsoLicenseURL($parameters['omb_seealso_license']); } return $notice; }