return true;
}
- /**
- * Automatically load the actions and libraries used by the plugin
- *
- * @param Class $cls the class
- *
- * @return boolean hook return
- *
- */
- function onAutoload($cls)
- {
- $base = dirname(__FILE__);
- $lower = strtolower($cls);
- $map = array('activityverb' => 'activity',
- 'activityobject' => 'activity',
- 'activityutils' => 'activity');
- if (isset($map[$lower])) {
- $lower = $map[$lower];
- }
- $files = array("$base/classes/$cls.php",
- "$base/lib/$lower.php");
- if (substr($lower, -6) == 'action') {
- $files[] = "$base/actions/" . substr($lower, 0, -6) . ".php";
- }
- foreach ($files as $file) {
- if (file_exists($file)) {
- include_once $file;
- return false;
- }
- }
- return true;
- }
-
/**
* Add in an OStatus subscribe button
*/
*/
function onStartFeedSubReceive($feedsub, $feed)
{
- $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
+ $oprofile = Ostatus_profile::getKV('feeduri', $feedsub->uri);
if ($oprofile) {
$oprofile->processFeed($feed, 'push');
} else {
*/
function onFeedSubSubscriberCount($feedsub, &$count)
{
- $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
+ $oprofile = Ostatus_profile::getKV('feeduri', $feedsub->uri);
if ($oprofile) {
$count += $oprofile->subscriberCount();
}
*/
function onStartSubscribe($subscriber, $other)
{
- $user = User::staticGet('id', $subscriber->id);
+ $user = User::getKV('id', $subscriber->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
*/
function onEndSubscribe($subscriber, $other)
{
- $user = User::staticGet('id', $subscriber->id);
+ $user = User::getKV('id', $subscriber->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
*/
function onEndUnsubscribe($profile, $other)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
*/
function onStartJoinGroup($group, $profile)
{
- $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
+ $oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
// TRANS: Exception thrown when setup of remote group membership fails.
*/
function onEndLeaveGroup($group, $profile)
{
- $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
+ $oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
// Drop the PuSH subscription if there are no other subscribers.
$oprofile->garbageCollect();
function onStartSubscribePeopletag($peopletag, $user)
{
- $oprofile = Ostatus_profile::staticGet('peopletag_id', $peopletag->id);
+ $oprofile = Ostatus_profile::getKV('peopletag_id', $peopletag->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
// TRANS: Exception thrown when setup of remote list subscription fails.
}
$sub = $user->getProfile();
- $tagger = Profile::staticGet($peopletag->tagger);
+ $tagger = Profile::getKV($peopletag->tagger);
$act = new Activity();
$act->id = TagURI::mint('subscribe_peopletag:%d:%d:%s',
function onEndUnsubscribePeopletag($peopletag, $user)
{
- $oprofile = Ostatus_profile::staticGet('peopletag_id', $peopletag->id);
+ $oprofile = Ostatus_profile::getKV('peopletag_id', $peopletag->id);
if ($oprofile) {
// Drop the PuSH subscription if there are no other subscribers.
$oprofile->garbageCollect();
- $sub = Profile::staticGet($user->id);
- $tagger = Profile::staticGet($peopletag->tagger);
+ $sub = Profile::getKV($user->id);
+ $tagger = Profile::getKV($peopletag->tagger);
$act = new Activity();
$act->id = TagURI::mint('unsubscribe_peopletag:%d:%d:%s',
*/
function onEndFavorNotice(Profile $profile, Notice $notice)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $notice->profile_id);
if (empty($oprofile)) {
return true;
*/
function onEndTagProfile($ptag)
{
- $oprofile = Ostatus_profile::staticGet('profile_id', $ptag->tagged);
+ $oprofile = Ostatus_profile::getKV('profile_id', $ptag->tagged);
if (empty($oprofile)) {
return true;
$act = new Activity();
$tagger = $plist->getTagger();
- $tagged = Profile::staticGet('id', $ptag->tagged);
+ $tagged = Profile::getKV('id', $ptag->tagged);
$act->verb = ActivityVerb::TAG;
$act->id = TagURI::mint('tag_profile:%d:%d:%s',
*/
function onEndUntagProfile($ptag)
{
- $oprofile = Ostatus_profile::staticGet('profile_id', $ptag->tagged);
+ $oprofile = Ostatus_profile::getKV('profile_id', $ptag->tagged);
if (empty($oprofile)) {
return true;
$act = new Activity();
$tagger = $plist->getTagger();
- $tagged = Profile::staticGet('id', $ptag->tagged);
+ $tagged = Profile::getKV('id', $ptag->tagged);
$act->verb = ActivityVerb::UNTAG;
$act->id = TagURI::mint('untag_profile:%d:%d:%s',
*/
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $notice->profile_id);
if (empty($oprofile)) {
return true;
function onStartGetProfileUri($profile, &$uri)
{
- $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if (!empty($oprofile)) {
$uri = $oprofile->uri;
return false;
function onStartUserGroupPermalink($group, &$url)
{
- $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
+ $oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
// @fixme this should probably be in the user_group table
// @fixme this uri not guaranteed to be a profile page
*/
function onEndBroadcastProfile(Profile $profile)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
// Find foreign accounts I'm subscribed to that support Salmon pings.
//
{
if (!common_logged_in()) {
- $profileUser = User::staticGet('id', $item->profile->id);
+ $profileUser = User::getKV('id', $item->profile->id);
if (!empty($profileUser)) {
*/
public static function localGroupFromUrl($url)
{
- $group = User_group::staticGet('uri', $url);
+ $group = User_group::getKV('uri', $url);
if ($group) {
- $local = Local_group::staticGet('group_id', $group->id);
+ $local = Local_group::getKV('group_id', $group->id);
if ($local) {
return $group->id;
}
public function onStartProfileGetAtomFeed($profile, &$feed)
{
- $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if (empty($oprofile)) {
return true;
// Don't want to do Web-based discovery on our own server,
// so we check locally first.
- $user = User::staticGet('uri', $uri);
+ $user = User::getKV('uri', $uri);
if (!empty($user)) {
$profile = $user->getProfile();
'href' => $salmon_url);
// Get this user's keypair
- $magickey = Magicsig::staticGet('user_id', $user->id);
+ $magickey = Magicsig::getKV('user_id', $user->id);
if (!$magickey) {
// No keypair yet, let's generate one.
$magickey = new Magicsig();