Signed-off-by: Roland Haeder <roland@mxchange.org>
* Record the given set of hash tags in the db for this notice.
* Given tag strings will be normalized and checked for dupes.
*/
* Record the given set of hash tags in the db for this notice.
* Given tag strings will be normalized and checked for dupes.
*/
- function saveKnownTags($hashtags)
+ function saveKnownTags(array $hashtags)
{
//turn each into their canonical tag
//this is needed to remove dupes before saving e.g. #hash.tag = #hashtag
{
//turn each into their canonical tag
//this is needed to remove dupes before saving e.g. #hash.tag = #hashtag
*
* @return boolean hook value
*/
*
* @return boolean hook value
*/
- function onPluginVersion(&$versions)
+ function onPluginVersion(array &$versions)
{
$url = 'http://status.net/wiki/Plugin:ForceGroup';
{
$url = 'http://status.net/wiki/Plugin:ForceGroup';
*
* @result boolean hook value
*/
*
* @result boolean hook value
*/
- function onEndGroupSave($group)
+ function onEndGroupSave(User_group $group)
{
$gps = new Group_privacy_settings();
{
$gps = new Group_privacy_settings();
foreach (array_unique($match[1]) as $nickname) {
$group = User_group::getForNickname($nickname, $profile);
foreach (array_unique($match[1]) as $nickname) {
$group = User_group::getForNickname($nickname, $profile);
+ if (!$group instanceof User_group) {
* send immediately but won't get the return value.
*
* @param mixed $entry XML string, Notice, or Activity
* send immediately but won't get the return value.
*
* @param mixed $entry XML string, Notice, or Activity
+ * @param Profile $actor Acting profile
* @return boolean success
*/
* @return boolean success
*/
- public function notifyDeferred($entry, $actor)
+ public function notifyDeferred($entry, Profile $actor)
{
if ($this->salmonuri) {
$data = array('salmonuri' => $this->salmonuri,
{
if ($this->salmonuri) {
$data = array('salmonuri' => $this->salmonuri,
*
* @return Notice Notice representing the new (or existing) activity
*/
*
* @return Notice Notice representing the new (or existing) activity
*/
- public function processEntry($entry, $feed, $source)
+ public function processEntry(DOMElement $entry, DOMElement $feed, $source)
{
$activity = new Activity($entry, $feed);
return $this->processActivity($activity, $source);
}
// TODO: Make this throw an exception
{
$activity = new Activity($entry, $feed);
return $this->processActivity($activity, $source);
}
// TODO: Make this throw an exception
- public function processActivity($activity, $source)
+ public function processActivity(Activity $activity, $source)
- public function processShare($activity, $method)
+ public function processShare(Activity $activity, $method)
* @return mixed saved Notice or false
* @todo FIXME: Break up this function, it's getting nasty long
*/
* @return mixed saved Notice or false
* @todo FIXME: Break up this function, it's getting nasty long
*/
- public function processPost($activity, $method)
+ public function processPost(Activity $activity, $method)
* @throws Exception on various error conditions
* @throws OStatusShadowException if this reference would obscure a local user/group
*/
* @throws Exception on various error conditions
* @throws OStatusShadowException if this reference would obscure a local user/group
*/
- public static function ensureProfileURL($profile_url, $hints=array())
+ public static function ensureProfileURL($profile_url, array $hints=array())
{
$oprofile = self::getFromProfileURL($profile_url);
{
$oprofile = self::getFromProfileURL($profile_url);
* @return Ostatus_profile
* @throws Exception
*/
* @return Ostatus_profile
* @throws Exception
*/
- public static function ensureAtomFeed($feedEl, $hints)
+ public static function ensureAtomFeed(DOMElement $feedEl, array $hints)
{
$author = ActivityUtils::getFeedAuthor($feedEl);
{
$author = ActivityUtils::getFeedAuthor($feedEl);
* @param array $hints
* @return mixed URL string or false
*/
* @param array $hints
* @return mixed URL string or false
*/
- public static function getActivityObjectAvatar($object, $hints=array())
+ public static function getActivityObjectAvatar(ActivityObject $object, array $hints=array())
{
if ($object->avatarLinks) {
$best = false;
{
if ($object->avatarLinks) {
$best = false;
* @param DOMElement $feed
* @return string
*/
* @param DOMElement $feed
* @return string
*/
- protected static function getAvatar($actor, $feed)
+ protected static function getAvatar(ActivityObject $actor, DOMElement $feed)
* @return Ostatus_profile
* @throws Exception
*/
* @return Ostatus_profile
* @throws Exception
*/
- public static function ensureActorProfile($activity, $hints=array())
+ public static function ensureActorProfile(Activity $activity, array $hints=array())
{
return self::ensureActivityObjectProfile($activity->actor, $hints);
}
{
return self::ensureActivityObjectProfile($activity->actor, $hints);
}
* @return Ostatus_profile
* @throws Exception
*/
* @return Ostatus_profile
* @throws Exception
*/
- public static function ensureActivityObjectProfile($object, $hints=array())
+ public static function ensureActivityObjectProfile(ActivityObject $object, array $hints=array())
{
$profile = self::getActivityObjectProfile($object);
if ($profile instanceof Ostatus_profile) {
{
$profile = self::getActivityObjectProfile($object);
if ($profile instanceof Ostatus_profile) {
* @return mixed matching Ostatus_profile or false if none known
* @throws ServerException if feed info invalid
*/
* @return mixed matching Ostatus_profile or false if none known
* @throws ServerException if feed info invalid
*/
- public static function getActorProfile($activity)
+ public static function getActorProfile(Activity $activity)
{
return self::getActivityObjectProfile($activity->actor);
}
{
return self::getActivityObjectProfile($activity->actor);
}
* @return mixed matching Ostatus_profile or false if none known
* @throws ServerException if feed info invalid
*/
* @return mixed matching Ostatus_profile or false if none known
* @throws ServerException if feed info invalid
*/
- protected static function getActivityObjectProfile($object)
+ protected static function getActivityObjectProfile(ActivityObject $object)
{
$uri = self::getActivityObjectProfileURI($object);
return Ostatus_profile::getKV('uri', $uri);
{
$uri = self::getActivityObjectProfileURI($object);
return Ostatus_profile::getKV('uri', $uri);
* @return string
* @throws ServerException if feed info invalid
*/
* @return string
* @throws ServerException if feed info invalid
*/
- protected static function getActivityObjectProfileURI($object)
+ protected static function getActivityObjectProfileURI(ActivityObject $object)
{
if ($object->id) {
if (ActivityUtils::validateUri($object->id)) {
{
if ($object->id) {
if (ActivityUtils::validateUri($object->id)) {
*
* @return Ostatus_profile
*/
*
* @return Ostatus_profile
*/
- protected static function createActivityObjectProfile($object, $hints=array())
+ protected static function createActivityObjectProfile(ActivityObject $object, array $hints=array())
{
$homeuri = $object->id;
$discover = false;
{
$homeuri = $object->id;
$discover = false;
* @param ActivityObject $object
* @param array $hints
*/
* @param ActivityObject $object
* @param array $hints
*/
- public function updateFromActivityObject($object, $hints=array())
+ public function updateFromActivityObject(ActivityObject $object, array $hints=array())
{
if ($this->isGroup()) {
$group = $this->localGroup();
{
if ($this->isGroup()) {
$group = $this->localGroup();
- public static function updateProfile($profile, $object, $hints=array())
+ public static function updateProfile(Profile $profile, ActivityObject $object, array $hints=array())
{
$orig = clone($profile);
{
$orig = clone($profile);
- protected static function updateGroup(User_group $group, $object, $hints=array())
+ protected static function updateGroup(User_group $group, ActivityObject $object, array $hints=array())
- protected static function updatePeopletag($tag, $object, $hints=array()) {
+ protected static function updatePeopletag(Peopletag $tag, ActivityObject $object, array $hints=array()) {
$orig = clone($tag);
$tag->tag = $object->title;
$orig = clone($tag);
$tag->tag = $object->title;
} else {
$actor = $activity->actor;
} else {
$actor = $activity->actor;
+ if (!$actor instanceof Profile) {
// OK here! assume the default
} else if ($actor->id == $this->getUri() || $actor->link == $this->getUri()) {
$this->updateFromActivityObject($actor);
// OK here! assume the default
} else if ($actor->id == $this->getUri() || $actor->link == $this->getUri()) {
$this->updateFromActivityObject($actor);