Replace $parameters argument per method with static::$parameters

This commit is contained in:
Philipp 2021-11-14 20:46:25 +01:00
parent 018275919c
commit 714f0febc4
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
249 changed files with 710 additions and 775 deletions

View file

@ -35,7 +35,7 @@ use Friendica\Network\HTTPException;
class Common extends BaseProfile
{
public static function content(array $parameters = [])
public static function content()
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
@ -45,7 +45,7 @@ class Common extends BaseProfile
Nav::setSelected('home');
$nickname = $parameters['nickname'];
$nickname = static::$parameters['nickname'];
$profile = Profile::load($a, $nickname);
if (empty($profile)) {

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
class Contacts extends Module\BaseProfile
{
public static function content(array $parameters = [])
public static function content()
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
@ -42,8 +42,8 @@ class Contacts extends Module\BaseProfile
$a = DI::app();
$nickname = $parameters['nickname'];
$type = $parameters['type'] ?? 'all';
$nickname = static::$parameters['nickname'];
$type = static::$parameters['type'] ?? 'all';
$profile = Model\Profile::load($a, $nickname);
if (empty($profile)) {

View file

@ -34,13 +34,13 @@ use Friendica\BaseModule;
*/
class Index extends BaseModule
{
public static function rawContent(array $parameters = [])
public static function rawContent()
{
Profile::rawContent($parameters);
Profile::rawContent();
}
public static function content(array $parameters = [])
public static function content()
{
return Status::content($parameters);
return Status::content();
}
}

View file

@ -29,11 +29,11 @@ use Friendica\Network\HTTPException;
class Media extends BaseProfile
{
public static function content(array $parameters = [])
public static function content()
{
$a = DI::app();
$profile = ProfileModel::load($a, $parameters['nickname']);
$profile = ProfileModel::load($a, static::$parameters['nickname']);
if (empty($profile)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}

View file

@ -46,10 +46,10 @@ use Friendica\Util\Temporal;
class Profile extends BaseProfile
{
public static function rawContent(array $parameters = [])
public static function rawContent()
{
if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $parameters['nickname']]);
$user = DBA::selectFirst('user', ['uid'], ['nickname' => static::$parameters['nickname']]);
if (DBA::isResult($user)) {
try {
$data = ActivityPub\Transmitter::getProfile($user['uid']);
@ -61,9 +61,9 @@ class Profile extends BaseProfile
}
}
if (DBA::exists('userd', ['username' => $parameters['nickname']])) {
if (DBA::exists('userd', ['username' => static::$parameters['nickname']])) {
// Known deleted user
$data = ActivityPub\Transmitter::getDeletedUser($parameters['nickname']);
$data = ActivityPub\Transmitter::getDeletedUser(static::$parameters['nickname']);
System::jsonError(410, $data);
} else {
@ -73,11 +73,11 @@ class Profile extends BaseProfile
}
}
public static function content(array $parameters = [])
public static function content()
{
$a = DI::app();
$profile = ProfileModel::load($a, $parameters['nickname']);
$profile = ProfileModel::load($a, static::$parameters['nickname']);
if (!$profile) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Profile not found.'));
}
@ -98,7 +98,7 @@ class Profile extends BaseProfile
DI::page()['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n";
}
DI::page()['htmlhead'] .= self::buildHtmlHead($profile, $parameters['nickname'], $remote_contact_id);
DI::page()['htmlhead'] .= self::buildHtmlHead($profile, static::$parameters['nickname'], $remote_contact_id);
Nav::setSelected('home');
@ -134,7 +134,7 @@ class Profile extends BaseProfile
$view_as_contact_alert = DI::l10n()->t(
'You\'re currently viewing your profile as <b>%s</b> <a href="%s" class="btn btn-sm pull-right">Cancel</a>',
htmlentities($view_as_contacts[$key]['name'], ENT_COMPAT, 'UTF-8'),
'profile/' . $parameters['nickname'] . '/profile'
'profile/' . static::$parameters['nickname'] . '/profile'
);
}
}

View file

@ -33,7 +33,7 @@ use Friendica\Util\DateTimeFormat;
class Schedule extends BaseProfile
{
public static function post(array $parameters = [])
public static function post()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
@ -50,7 +50,7 @@ class Schedule extends BaseProfile
Post\Delayed::deleteById($_REQUEST['delete']);
}
public static function content(array $parameters = [])
public static function content()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
@ -80,7 +80,7 @@ class Schedule extends BaseProfile
'$form_security_token' => BaseModule::getFormSecurityToken("profile_schedule"),
'$baseurl' => DI::baseUrl()->get(true),
'$title' => DI::l10n()->t('Scheduled Posts'),
'$nickname' => $parameters['nickname'] ?? '',
'$nickname' => static::$parameters['nickname'] ?? '',
'$scheduled_at' => DI::l10n()->t('Scheduled'),
'$content' => DI::l10n()->t('Content'),
'$delete' => DI::l10n()->t('Remove post'),

View file

@ -46,13 +46,13 @@ use Friendica\Util\XML;
class Status extends BaseProfile
{
public static function content(array $parameters = [])
public static function content()
{
$args = DI::args();
$a = DI::app();
$profile = ProfileModel::load($a, $parameters['nickname']);
$profile = ProfileModel::load($a, static::$parameters['nickname']);
if (empty($profile)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
@ -62,10 +62,10 @@ class Status extends BaseProfile
DI::page()['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
}
DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . $parameters['nickname'] . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/" title="' . DI::l10n()->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/comments" title="' . DI::l10n()->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . static::$parameters['nickname'] . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/" title="' . DI::l10n()->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/comments" title="' . DI::l10n()->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
$category = $datequery = $datequery2 = '';