// 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();
}
* @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
$p = Profile::current();
- $pop = new PopularNoticeSection($this, $p);
- $pop->show();
if (!common_config('performance', 'high')) {
$cloud = new PublicTagCloudSection($this);
$cloud->show();
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.
*
* @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
*
* @return boolean hook flag
*/
- function onStartShowAside($action)
+ function onStartShowAside(Action $action)
{
if (!is_null($this->mediumRectangle)) {
*
* @return boolean hook flag
*/
- function onStartShowSections($action)
+ function onStartShowSections(Action $action)
{
if (!is_null($this->rectangle)) {
$action->elementStart('div',
*
* @return boolean hook flag
*/
- function onEndShowAside($action)
+ function onEndShowAside(Action $action)
{
if (!is_null($this->wideSkyscraper)) {
$action->elementStart('div',
}
}
+ 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',
* @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
return true;
}
- function onEndShowSections($action)
+ function onEndShowSections(Action $action)
{
$actionName = $action->trimmed('action');
// These are the ones that have maps on 'em
return true;
}
- function onEndShowSections($action)
+ function onEndShowSections(Action $action)
{
if ($action->arg('action') != 'showstream') {
return true;
return false;
}
- function onStartShowSections($action)
+ function onStartShowSections(Action $action)
{
$text = common_config('site', 'notice');
if (!empty($text)) {
parent::__construct();
}
- function onStartShowSections($action)
+ function onStartShowSections(Action $action)
{
$name = $action->trimmed('action');