Commit 138d26d4 authored by mmn's avatar mmn

Favorite "aside"-sections moved, also small fixes left from before

Action now has 'isAction' which compares the loaded Action with names
of classes in an array (added without the 'Action') to its own type.
parent 7e597ea7
......@@ -196,8 +196,6 @@ class AllAction extends ProfileAction
// XXX: make this a little more convenient
if (!common_config('performance', 'high')) {
$pop = new PopularNoticeSection($this, $this->scoped);
$pop->show();
$pop = new InboxTagCloudSection($this, $this->target);
$pop->show();
}
......
......@@ -27,13 +27,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/publicgroupnav.php';
require_once INSTALLDIR.'/lib/noticelist.php';
require_once INSTALLDIR.'/lib/feedlist.php';
if (!defined('GNUSOCIAL')) { exit(1); }
// Farther than any human will go
......@@ -261,8 +255,6 @@ class PublicAction extends Action
$p = Profile::current();
$pop = new PopularNoticeSection($this, $p);
$pop->show();
if (!common_config('performance', 'high')) {
$cloud = new PublicTagCloudSection($this);
$cloud->show();
......
......@@ -169,17 +169,36 @@ class Action extends HTMLOutputter // lawsuit
return true;
}
function updateScopedProfile() {
public function updateScopedProfile()
{
$this->scoped = Profile::current();
return $this->scoped;
}
public function getScoped()
{
return ($this->scoped instanceof Profile) ? $this-scoped : null;
}
// Must be run _after_ prepare
public function getActionName()
{
return $this->action;
}
public function isAction(array $names)
{
foreach ($names as $class) {
// PHP is case insensitive, and we have stuff like ApiUpperCaseAction,
// but we at least make a point out of wanting to do stuff case-sensitive.
$class = ucfirst($class) . 'Action';
if ($this instanceof $class) {
return true;
}
}
return false;
}
/**
* Show page, a template method.
*
......
......@@ -27,11 +27,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/widget.php';
if (!defined('GNUSOCIAL')) { exit(1); }
/**
* Menu for public group of actions
......
......@@ -79,7 +79,7 @@ abstract class UAPPlugin extends Plugin
*
* @return boolean hook flag
*/
function onStartShowAside($action)
function onStartShowAside(Action $action)
{
if (!is_null($this->mediumRectangle)) {
......@@ -141,7 +141,7 @@ abstract class UAPPlugin extends Plugin
*
* @return boolean hook flag
*/
function onStartShowSections($action)
function onStartShowSections(Action $action)
{
if (!is_null($this->rectangle)) {
$action->elementStart('div',
......@@ -161,7 +161,7 @@ abstract class UAPPlugin extends Plugin
*
* @return boolean hook flag
*/
function onEndShowAside($action)
function onEndShowAside(Action $action)
{
if (!is_null($this->wideSkyscraper)) {
$action->elementStart('div',
......
......@@ -338,6 +338,18 @@ class FavoritePlugin extends ActivityHandlerPlugin
}
}
public function onEndShowSections(Action $action)
{
if (!$action->isAction(array('all', 'public'))) {
return true;
}
if (!common_config('performance', 'high')) {
$section = new PopularNoticeSection($action, $action->getScoped());
$section->show();
}
}
public function onPluginVersion(array &$versions)
{
$versions[] = array('name' => 'Favorite',
......
......@@ -28,12 +28,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/publicgroupnav.php';
require_once INSTALLDIR.'/lib/noticelist.php';
if (!defined('GNUSOCIAL')) { exit(1); }
/**
* List of popular notices
......
......@@ -139,7 +139,7 @@ class MapstractionPlugin extends Plugin
return true;
}
function onEndShowSections($action)
function onEndShowSections(Action $action)
{
$actionName = $action->trimmed('action');
// These are the ones that have maps on 'em
......
......@@ -116,7 +116,7 @@ class ModLogPlugin extends Plugin
return true;
}
function onEndShowSections($action)
function onEndShowSections(Action $action)
{
if ($action->arg('action') != 'showstream') {
return true;
......
......@@ -60,7 +60,7 @@ class SiteNoticeInSidebarPlugin extends Plugin
return false;
}
function onStartShowSections($action)
function onStartShowSections(Action $action)
{
$text = common_config('site', 'notice');
if (!empty($text)) {
......
......@@ -51,7 +51,7 @@ class WikiHashtagsPlugin extends Plugin
parent::__construct();
}
function onStartShowSections($action)
function onStartShowSections(Action $action)
{
$name = $action->trimmed('action');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment