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

@ -38,18 +38,18 @@ use Friendica\Network\HTTPException;
*/
class Activity extends BaseModule
{
public static function rawContent(array $parameters = [])
public static function rawContent()
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();
}
if (empty($parameters['id']) || empty($parameters['verb'])) {
if (empty(static::$parameters['id']) || empty(static::$parameters['verb'])) {
throw new HTTPException\BadRequestException();
}
$verb = $parameters['verb'];
$itemId = $parameters['id'];
$verb = static::$parameters['verb'];
$itemId = static::$parameters['id'];
if (in_array($verb, ['announce', 'unannounce'])) {
$item = Post::selectFirst(['network'], ['id' => $itemId]);

View file

@ -40,7 +40,7 @@ use Friendica\Util\Temporal;
class Compose extends BaseModule
{
public static function post(array $parameters = [])
public static function post()
{
if (!empty($_REQUEST['body'])) {
$_REQUEST['return'] = 'network';
@ -51,7 +51,7 @@ class Compose extends BaseModule
}
}
public static function content(array $parameters = [])
public static function content()
{
if (!local_user()) {
return Login::form('compose', false);
@ -64,7 +64,7 @@ class Compose extends BaseModule
}
/// @TODO Retrieve parameter from router
$posttype = $parameters['type'] ?? Item::PT_ARTICLE;
$posttype = static::$parameters['type'] ?? Item::PT_ARTICLE;
if (!in_array($posttype, [Item::PT_ARTICLE, Item::PT_PERSONAL_NOTE])) {
switch ($posttype) {
case 'note':

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/
class Follow extends BaseModule
{
public static function rawContent(array $parameters = [])
public static function rawContent()
{
$l10n = DI::l10n();
@ -42,11 +42,11 @@ class Follow extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
if (empty($parameters['id'])) {
if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException();
}
$itemId = intval($parameters['id']);
$itemId = intval(static::$parameters['id']);
if (!Item::performActivity($itemId, 'follow', local_user())) {
throw new HTTPException\BadRequestException($l10n->t('Unable to follow this item.'));

View file

@ -33,7 +33,7 @@ use Friendica\Network\HTTPException;
*/
class Ignore extends BaseModule
{
public static function rawContent(array $parameters = [])
public static function rawContent()
{
$l10n = DI::l10n();
@ -41,11 +41,11 @@ class Ignore extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
if (empty($parameters['id'])) {
if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException();
}
$itemId = intval($parameters['id']);
$itemId = intval(static::$parameters['id']);
$dba = DI::dba();

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/
class Pin extends BaseModule
{
public static function rawContent(array $parameters = [])
public static function rawContent()
{
$l10n = DI::l10n();
@ -42,11 +42,11 @@ class Pin extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
if (empty($parameters['id'])) {
if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException();
}
$itemId = intval($parameters['id']);
$itemId = intval(static::$parameters['id']);
$item = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId]);
if (!DBA::isResult($item)) {

View file

@ -35,7 +35,7 @@ use Friendica\Network\HTTPException;
*/
class Star extends BaseModule
{
public static function rawContent(array $parameters = [])
public static function rawContent()
{
$l10n = DI::l10n();
@ -43,11 +43,11 @@ class Star extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
if (empty($parameters['id'])) {
if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException();
}
$itemId = intval($parameters['id']);
$itemId = intval(static::$parameters['id']);
$item = Post::selectFirstForUser(local_user(), ['uid', 'uri-id', 'starred'], ['uid' => [0, local_user()], 'id' => $itemId]);