mirror of
https://github.com/friendica/friendica
synced 2025-04-21 01:50:17 +00:00
Replace $parameters
argument per method with static::$parameters
This commit is contained in:
parent
018275919c
commit
714f0febc4
249 changed files with 710 additions and 775 deletions
|
@ -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]);
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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.'));
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue