diff --git a/mod/cal.php b/mod/cal.php
index e6570018b..9e32b87d6 100644
--- a/mod/cal.php
+++ b/mod/cal.php
@@ -19,6 +19,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Event;
use Friendica\Model\Item;
use Friendica\Model\Profile;
+use Friendica\Module\BaseProfile;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
@@ -121,7 +122,7 @@ function cal_content(App $a)
$sql_extra = " AND `event`.`cid` = 0 " . $sql_perms;
// get the tab navigation bar
- $tabs = Profile::getTabs($a, 'cal', false, $a->data['user']['nickname']);
+ $tabs = BaseProfile::getTabsHTML($a, 'cal', false, $a->data['user']['nickname']);
// The view mode part is similiar to /mod/events.php
if ($mode == 'view') {
diff --git a/mod/events.php b/mod/events.php
index 5601c4449..ffe67f67f 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -16,8 +16,8 @@ use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Event;
use Friendica\Model\Item;
-use Friendica\Model\Profile;
use Friendica\Model\User;
+use Friendica\Module\BaseProfile;
use Friendica\Module\Security\Login;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
@@ -251,7 +251,7 @@ function events_content(App $a)
$tabs = '';
// tabs
if ($a->theme_events_in_profile) {
- $tabs = Profile::getTabs($a, 'events', true);
+ $tabs = BaseProfile::getTabsHTML($a, 'events', true);
}
$mode = 'view';
diff --git a/mod/notes.php b/mod/notes.php
index 536029338..38a72a741 100644
--- a/mod/notes.php
+++ b/mod/notes.php
@@ -9,7 +9,7 @@ use Friendica\Content\Pager;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
-use Friendica\Model\Profile;
+use Friendica\Module\BaseProfile;
function notes_init(App $a)
{
@@ -28,7 +28,7 @@ function notes_content(App $a, $update = false)
return;
}
- $o = Profile::getTabs($a, 'notes', true);
+ $o = BaseProfile::getTabsHTML($a, 'notes', true);
if (!$update) {
$o .= '
' . DI::l10n()->t('Personal Notes') . '
';
diff --git a/mod/photos.php b/mod/photos.php
index 5b8d22b65..0733bbc96 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -21,6 +21,7 @@ use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
use Friendica\Model\User;
+use Friendica\Module\BaseProfile;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Protocol\Activity;
@@ -914,7 +915,7 @@ function photos_content(App $a)
// tabs
$is_owner = (local_user() && (local_user() == $owner_uid));
- $o .= Profile::getTabs($a, 'photos', $is_owner, $a->data['user']['nickname']);
+ $o .= BaseProfile::getTabsHTML($a, 'photos', $is_owner, $a->data['user']['nickname']);
// Display upload form
if ($datatype === 'upload') {
diff --git a/mod/videos.php b/mod/videos.php
index a7181d4e7..36ddef681 100644
--- a/mod/videos.php
+++ b/mod/videos.php
@@ -15,6 +15,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Model\User;
+use Friendica\Module\BaseProfile;
use Friendica\Util\Security;
function videos_init(App $a)
@@ -171,7 +172,7 @@ function videos_content(App $a)
// tabs
$_is_owner = (local_user() && (local_user() == $owner_uid));
- $o .= Profile::getTabs($a, 'videos', $_is_owner, $a->data['user']['nickname']);
+ $o .= BaseProfile::getTabsHTML($a, 'videos', $_is_owner, $a->data['user']['nickname']);
//
// dispatch request
diff --git a/src/Model/Profile.php b/src/Model/Profile.php
index 86fb1a94c..18b09225e 100644
--- a/src/Model/Profile.php
+++ b/src/Model/Profile.php
@@ -675,121 +675,6 @@ class Profile
]);
}
- /**
- * @param App $a
- * @param string $current
- * @param bool $is_owner
- * @param string $nickname
- * @return string
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- */
- public static function getTabs(App $a, string $current, bool $is_owner, string $nickname = null)
- {
- if (is_null($nickname)) {
- $nickname = $a->user['nickname'];
- }
-
- $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
-
- $tabs = [
- [
- 'label' => DI::l10n()->t('Profile'),
- 'url' => $baseProfileUrl,
- 'sel' => $current == 'profile' ? 'active' : '',
- 'title' => DI::l10n()->t('Profile Details'),
- 'id' => 'profile-tab',
- 'accesskey' => 'r',
- ],
- [
- 'label' => DI::l10n()->t('Status'),
- 'url' => $baseProfileUrl . '/status',
- 'sel' => $current == 'status' ? 'active' : '',
- 'title' => DI::l10n()->t('Status Messages and Posts'),
- 'id' => 'status-tab',
- 'accesskey' => 'm',
- ],
- [
- 'label' => DI::l10n()->t('Photos'),
- 'url' => DI::baseUrl() . '/photos/' . $nickname,
- 'sel' => $current == 'photos' ? 'active' : '',
- 'title' => DI::l10n()->t('Photo Albums'),
- 'id' => 'photo-tab',
- 'accesskey' => 'h',
- ],
- [
- 'label' => DI::l10n()->t('Videos'),
- 'url' => DI::baseUrl() . '/videos/' . $nickname,
- 'sel' => $current == 'videos' ? 'active' : '',
- 'title' => DI::l10n()->t('Videos'),
- 'id' => 'video-tab',
- 'accesskey' => 'v',
- ],
- ];
-
- // the calendar link for the full featured events calendar
- if ($is_owner && $a->theme_events_in_profile) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Events'),
- 'url' => DI::baseUrl() . '/events',
- 'sel' => $current == 'events' ? 'active' : '',
- 'title' => DI::l10n()->t('Events and Calendar'),
- 'id' => 'events-tab',
- 'accesskey' => 'e',
- ];
- // if the user is not the owner of the calendar we only show a calendar
- // with the public events of the calendar owner
- } elseif (!$is_owner) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Events'),
- 'url' => DI::baseUrl() . '/cal/' . $nickname,
- 'sel' => $current == 'cal' ? 'active' : '',
- 'title' => DI::l10n()->t('Events and Calendar'),
- 'id' => 'events-tab',
- 'accesskey' => 'e',
- ];
- }
-
- if ($is_owner) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Personal Notes'),
- 'url' => DI::baseUrl() . '/notes',
- 'sel' => $current == 'notes' ? 'active' : '',
- 'title' => DI::l10n()->t('Only You Can See This'),
- 'id' => 'notes-tab',
- 'accesskey' => 't',
- ];
- }
-
- if (empty($a->profile['hide-friends'])) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Contacts'),
- 'url' => $baseProfileUrl . '/contacts',
- 'sel' => $current == 'contacts' ? 'active' : '',
- 'title' => DI::l10n()->t('Contacts'),
- 'id' => 'viewcontacts-tab',
- 'accesskey' => 'k',
- ];
- }
-
- if (!empty($_SESSION['new_member']) && $is_owner) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Tips for New Members'),
- 'url' => DI::baseUrl() . '/newmember',
- 'sel' => false,
- 'title' => DI::l10n()->t('Tips for New Members'),
- 'id' => 'newmember-tab',
- ];
- }
-
- $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $current, 'tabs' => $tabs];
-
- Hook::callAll('profile_tabs', $arr);
-
- $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
-
- return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);
- }
-
/**
* Retrieves the my_url session variable
*
diff --git a/src/Module/BaseProfile.php b/src/Module/BaseProfile.php
new file mode 100644
index 000000000..c6ef1c354
--- /dev/null
+++ b/src/Module/BaseProfile.php
@@ -0,0 +1,129 @@
+user['nickname'];
+ }
+
+ $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
+
+ $tabs = [
+ [
+ 'label' => DI::l10n()->t('Profile'),
+ 'url' => $baseProfileUrl,
+ 'sel' => $current == 'profile' ? 'active' : '',
+ 'title' => DI::l10n()->t('Profile Details'),
+ 'id' => 'profile-tab',
+ 'accesskey' => 'r',
+ ],
+ [
+ 'label' => DI::l10n()->t('Status'),
+ 'url' => $baseProfileUrl . '/status',
+ 'sel' => $current == 'status' ? 'active' : '',
+ 'title' => DI::l10n()->t('Status Messages and Posts'),
+ 'id' => 'status-tab',
+ 'accesskey' => 'm',
+ ],
+ [
+ 'label' => DI::l10n()->t('Photos'),
+ 'url' => DI::baseUrl() . '/photos/' . $nickname,
+ 'sel' => $current == 'photos' ? 'active' : '',
+ 'title' => DI::l10n()->t('Photo Albums'),
+ 'id' => 'photo-tab',
+ 'accesskey' => 'h',
+ ],
+ [
+ 'label' => DI::l10n()->t('Videos'),
+ 'url' => DI::baseUrl() . '/videos/' . $nickname,
+ 'sel' => $current == 'videos' ? 'active' : '',
+ 'title' => DI::l10n()->t('Videos'),
+ 'id' => 'video-tab',
+ 'accesskey' => 'v',
+ ],
+ ];
+
+ // the calendar link for the full featured events calendar
+ if ($is_owner && $a->theme_events_in_profile) {
+ $tabs[] = [
+ 'label' => DI::l10n()->t('Events'),
+ 'url' => DI::baseUrl() . '/events',
+ 'sel' => $current == 'events' ? 'active' : '',
+ 'title' => DI::l10n()->t('Events and Calendar'),
+ 'id' => 'events-tab',
+ 'accesskey' => 'e',
+ ];
+ // if the user is not the owner of the calendar we only show a calendar
+ // with the public events of the calendar owner
+ } elseif (!$is_owner) {
+ $tabs[] = [
+ 'label' => DI::l10n()->t('Events'),
+ 'url' => DI::baseUrl() . '/cal/' . $nickname,
+ 'sel' => $current == 'cal' ? 'active' : '',
+ 'title' => DI::l10n()->t('Events and Calendar'),
+ 'id' => 'events-tab',
+ 'accesskey' => 'e',
+ ];
+ }
+
+ if ($is_owner) {
+ $tabs[] = [
+ 'label' => DI::l10n()->t('Personal Notes'),
+ 'url' => DI::baseUrl() . '/notes',
+ 'sel' => $current == 'notes' ? 'active' : '',
+ 'title' => DI::l10n()->t('Only You Can See This'),
+ 'id' => 'notes-tab',
+ 'accesskey' => 't',
+ ];
+ }
+
+ if (empty($a->profile['hide-friends'])) {
+ $tabs[] = [
+ 'label' => DI::l10n()->t('Contacts'),
+ 'url' => $baseProfileUrl . '/contacts',
+ 'sel' => $current == 'contacts' ? 'active' : '',
+ 'title' => DI::l10n()->t('Contacts'),
+ 'id' => 'viewcontacts-tab',
+ 'accesskey' => 'k',
+ ];
+ }
+
+ if (DI::session()->get('new_member') && $is_owner) {
+ $tabs[] = [
+ 'label' => DI::l10n()->t('Tips for New Members'),
+ 'url' => DI::baseUrl() . '/newmember',
+ 'sel' => false,
+ 'title' => DI::l10n()->t('Tips for New Members'),
+ 'id' => 'newmember-tab',
+ ];
+ }
+
+ $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $current, 'tabs' => $tabs];
+
+ Hook::callAll('profile_tabs', $arr);
+
+ $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
+
+ return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);
+ }
+}
diff --git a/src/Module/Profile/Contacts.php b/src/Module/Profile/Contacts.php
index 1a21df0ec..122681c17 100644
--- a/src/Module/Profile/Contacts.php
+++ b/src/Module/Profile/Contacts.php
@@ -2,7 +2,6 @@
namespace Friendica\Module\Profile;
-use Friendica\BaseModule;
use Friendica\Content\ContactSelector;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
@@ -13,9 +12,10 @@ use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
+use Friendica\Module\BaseProfile;
use Friendica\Util\Proxy as ProxyUtils;
-class Contacts extends BaseModule
+class Contacts extends BaseProfile
{
public static function content(array $parameters = [])
{
@@ -42,8 +42,7 @@ class Contacts extends BaseModule
$is_owner = $a->profile['uid'] == local_user();
- // tabs
- $o = Profile::getTabs($a, 'contacts', $is_owner, $nickname);
+ $o = self::getTabsHTML($a, 'contacts', $is_owner, $nickname);
if (!count($a->profile) || $a->profile['hide-friends']) {
notice(DI::l10n()->t('Permission denied.') . EOL);
diff --git a/src/Module/Profile/Index.php b/src/Module/Profile/Index.php
index 521a682dc..176bc84e2 100644
--- a/src/Module/Profile/Index.php
+++ b/src/Module/Profile/Index.php
@@ -2,7 +2,6 @@
namespace Friendica\Module\Profile;
-use Friendica\BaseModule;
use Friendica\Content\Feature;
use Friendica\Content\ForumManager;
use Friendica\Content\Nav;
@@ -19,13 +18,14 @@ use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Model\Term;
use Friendica\Model\User;
+use Friendica\Module\BaseProfile;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
-class Index extends BaseModule
+class Index extends BaseProfile
{
public static function rawContent(array $parameters = [])
{
@@ -82,7 +82,7 @@ class Index extends BaseModule
Nav::setSelected('home');
$is_owner = local_user() == $a->profile['uid'];
- $o = Profile::getTabs($a, 'profile', $is_owner, $a->profile['nickname']);
+ $o = self::getTabsHTML($a, 'profile', $is_owner, $a->profile['nickname']);
if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact_id) {
notice(DI::l10n()->t('Access to this profile has been restricted.'));
diff --git a/src/Module/Profile/Status.php b/src/Module/Profile/Status.php
index 0047f27ed..5e1ec2538 100644
--- a/src/Module/Profile/Status.php
+++ b/src/Module/Profile/Status.php
@@ -2,7 +2,6 @@
namespace Friendica\Module\Profile;
-use Friendica\BaseModule;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Widget;
@@ -13,13 +12,14 @@ use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Profile as ProfileModel;
use Friendica\Model\User;
+use Friendica\Module\BaseProfile;
use Friendica\Module\Security\Login;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Security;
use Friendica\Util\Strings;
use Friendica\Util\XML;
-class Status extends BaseModule
+class Status extends BaseProfile
{
public static function content(array $parameters = [])
{
@@ -81,7 +81,7 @@ class Status extends BaseModule
return '';
}
- $o .= ProfileModel::getTabs($a, 'status', $is_owner, $a->profile['nickname']);
+ $o .= self::getTabsHTML($a, 'status', $is_owner, $a->profile['nickname']);
$o .= Widget::commonFriendsVisitor($a->profile['uid']);