forked from GNUsocial/gnu-social
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 1.0.x
This commit is contained in:
@@ -198,8 +198,7 @@ class Action extends HTMLOutputter // lawsuit
|
||||
|
||||
if (Event::handle('StartShowStatusNetStyles', array($this)) &&
|
||||
Event::handle('StartShowLaconicaStyles', array($this))) {
|
||||
$this->cssLink('css/display.css',null,'screen, projection, tv');
|
||||
$this->cssLink('css/print.css','base','print');
|
||||
$this->cssLink('css/display.css',null, 'screen, projection, tv, print');
|
||||
Event::handle('EndShowStatusNetStyles', array($this));
|
||||
Event::handle('EndShowLaconicaStyles', array($this));
|
||||
}
|
||||
|
@@ -53,6 +53,7 @@ class Activity
|
||||
{
|
||||
const SPEC = 'http://activitystrea.ms/spec/1.0/';
|
||||
const SCHEMA = 'http://activitystrea.ms/schema/1.0/';
|
||||
const MEDIA = 'http://purl.org/syndication/atommedia';
|
||||
|
||||
const VERB = 'verb';
|
||||
const OBJECT = 'object';
|
||||
@@ -85,7 +86,7 @@ class Activity
|
||||
|
||||
public $actor; // an ActivityObject
|
||||
public $verb; // a string (the URL)
|
||||
public $object; // an ActivityObject
|
||||
public $objects = array(); // an array of ActivityObjects
|
||||
public $target; // an ActivityObject
|
||||
public $context; // an ActivityObject
|
||||
public $time; // Time of the activity
|
||||
@@ -161,12 +162,15 @@ class Activity
|
||||
// XXX: do other implied stuff here
|
||||
}
|
||||
|
||||
$objectEl = $this->_child($entry, self::OBJECT);
|
||||
$objectEls = $entry->getElementsByTagNameNS(self::SPEC, self::OBJECT);
|
||||
|
||||
if (!empty($objectEl)) {
|
||||
$this->object = new ActivityObject($objectEl);
|
||||
if ($objectEls->length > 0) {
|
||||
for ($i = 0; $i < $objectEls->length; $i++) {
|
||||
$objectEl = $objectEls->item($i);
|
||||
$this->objects[] = new ActivityObject($objectEl);
|
||||
}
|
||||
} else {
|
||||
$this->object = new ActivityObject($entry);
|
||||
$this->objects[] = new ActivityObject($entry);
|
||||
}
|
||||
|
||||
$actorEl = $this->_child($entry, self::ACTOR);
|
||||
@@ -280,8 +284,8 @@ class Activity
|
||||
}
|
||||
}
|
||||
|
||||
$this->object = new ActivityObject($item);
|
||||
$this->context = new ActivityContext($item);
|
||||
$this->objects[] = new ActivityObject($item);
|
||||
$this->context = new ActivityContext($item);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,8 +343,10 @@ class Activity
|
||||
|
||||
$xs->element('activity:verb', null, $this->verb);
|
||||
|
||||
if ($this->object) {
|
||||
$xs->raw($this->object->asString());
|
||||
if (!empty($this->objects)) {
|
||||
foreach($this->objects as $object) {
|
||||
$xs->raw($object->asString());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->target) {
|
||||
|
@@ -100,6 +100,13 @@ class ActivityObject
|
||||
public $poco;
|
||||
public $displayName;
|
||||
|
||||
// @todo move this stuff to it's own PHOTO activity object
|
||||
const MEDIA_DESCRIPTION = 'description';
|
||||
|
||||
public $thumbnail;
|
||||
public $largerImage;
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -150,6 +157,19 @@ class ActivityObject
|
||||
|
||||
$this->poco = new PoCo($element);
|
||||
}
|
||||
|
||||
if ($this->type == self::PHOTO) {
|
||||
|
||||
$this->thumbnail = ActivityUtils::getLink($element, 'preview');
|
||||
$this->largerImage = ActivityUtils::getLink($element, 'enclosure');
|
||||
|
||||
$this->description = ActivityUtils::childContent(
|
||||
$element,
|
||||
ActivityObject::MEDIA_DESCRIPTION,
|
||||
Activity::MEDIA
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function _fromAuthor($element)
|
||||
|
@@ -1273,7 +1273,7 @@ class ApiAction extends Action
|
||||
if (empty($local)) {
|
||||
return null;
|
||||
} else {
|
||||
return User_group::staticGet('id', $local->id);
|
||||
return User_group::staticGet('id', $local->group_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -273,7 +273,7 @@ class FavCommand extends Command
|
||||
function handle($channel)
|
||||
{
|
||||
$notice = $this->getNotice($this->other);
|
||||
$fave = Fave::addNew($this->user, $notice);
|
||||
$fave = Fave::addNew($this->user->getProfile(), $notice);
|
||||
|
||||
if (!$fave) {
|
||||
$channel->error($this->user, _('Could not create favorite.'));
|
||||
|
@@ -171,7 +171,7 @@ class MediaFile
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MediaFile::respectsQuota($user, $_FILES['attach']['size'])) {
|
||||
if (!MediaFile::respectsQuota($user, $_FILES[$param]['size'])) {
|
||||
|
||||
// Should never actually get here
|
||||
|
||||
|
@@ -169,6 +169,12 @@ class ProfileAction extends OwnerDesignAction
|
||||
$subbed_count = $this->profile->subscriberCount();
|
||||
$notice_count = $this->profile->noticeCount();
|
||||
$group_count = $this->user->getGroups()->N;
|
||||
$age_days = (time() - strtotime($this->profile->created)) / 86400;
|
||||
if ($age_days < 1) {
|
||||
// Rather than extrapolating out to a bajillion...
|
||||
$age_days = 1;
|
||||
}
|
||||
$daily_count = round($notice_count / $age_days);
|
||||
|
||||
$this->elementStart('div', array('id' => 'entity_statistics',
|
||||
'class' => 'section'));
|
||||
@@ -219,6 +225,12 @@ class ProfileAction extends OwnerDesignAction
|
||||
$this->element('dd', null, $notice_count);
|
||||
$this->elementEnd('dl');
|
||||
|
||||
$this->elementStart('dl', 'entity_daily_notices');
|
||||
// TRANS: Average count of posts made per day since account registration
|
||||
$this->element('dt', null, _('Daily average'));
|
||||
$this->element('dd', null, $daily_count);
|
||||
$this->elementEnd('dl');
|
||||
|
||||
$this->elementEnd('div');
|
||||
}
|
||||
|
||||
|
@@ -213,7 +213,7 @@ class ProfileListItem extends Widget
|
||||
{
|
||||
if (!empty($this->profile->location)) {
|
||||
$this->out->text(' ');
|
||||
$this->out->elementStart('span', 'location');
|
||||
$this->out->elementStart('span', 'label');
|
||||
$this->out->raw($this->highlight($this->profile->location));
|
||||
$this->out->elementEnd('span');
|
||||
}
|
||||
|
@@ -113,12 +113,13 @@ class SubscriptionListItem extends ProfileListItem
|
||||
$this->out->elementStart('ul', 'tags xoxo');
|
||||
foreach ($tags as $tag) {
|
||||
$this->out->elementStart('li');
|
||||
$this->out->element('span', 'mark_hash', '#');
|
||||
$this->out->element('a', array('rel' => 'tag',
|
||||
'href' => common_local_url($this->action->trimmed('action'),
|
||||
array('nickname' => $this->owner->nickname,
|
||||
'tag' => $tag))),
|
||||
$tag);
|
||||
// Avoid space by using raw output.
|
||||
$pt = '<span class="mark_hash">#</span><a rel="tag" href="' .
|
||||
common_local_url($this->action->trimmed('action'),
|
||||
array('nickname' => $this->owner->nickname,
|
||||
'tag' => $tag)) .
|
||||
'">' . $tag . '</a>';
|
||||
$this->out->raw($pt);
|
||||
$this->out->elementEnd('li');
|
||||
}
|
||||
$this->out->elementEnd('ul');
|
||||
|
@@ -1520,7 +1520,8 @@ function common_user_uri(&$user)
|
||||
function common_notice_uri(&$notice)
|
||||
{
|
||||
return common_local_url('shownotice',
|
||||
array('notice' => $notice->id));
|
||||
array('notice' => $notice->id),
|
||||
null, null, false);
|
||||
}
|
||||
|
||||
// 36 alphanums - lookalikes (0, O, 1, I) = 32 chars = 5 bits
|
||||
|
Reference in New Issue
Block a user