Use Dice instantiation to access App\Arguments

- Remove App->args accessors
This commit is contained in:
Hypolite Petovan 2019-10-07 16:16:42 -04:00
parent 1e737ae888
commit c8316bfe57
5 changed files with 14 additions and 22 deletions

View file

@ -132,16 +132,6 @@ class App
*/ */
private $process; private $process;
/**
* Returns the arguments of the query
*
* @return Arguments
*/
public function getArgs()
{
return $this->args;
}
/** /**
* Returns the current config cache of this node * Returns the current config cache of this node
* *

View file

@ -155,12 +155,4 @@ abstract class BaseModule extends BaseObject
throw new \Friendica\Network\HTTPException\ForbiddenException(); throw new \Friendica\Network\HTTPException\ForbiddenException();
} }
} }
/**
* @return App\Arguments
*/
protected static function getArgs()
{
return self::getApp()->getArgs();
}
} }

View file

@ -2,6 +2,7 @@
namespace Friendica\Module; namespace Friendica\Module;
use Friendica\App\Arguments;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Content\Pager; use Friendica\Content\Pager;
@ -63,7 +64,9 @@ class BaseSearchModule extends BaseModule
$header = L10n::t('Forum Search - %s', $search); $header = L10n::t('Forum Search - %s', $search);
} }
$pager = new Pager(self::getArgs()->getQueryString()); /** @var Arguments $args */
$args = self::getClass(Arguments::class);
$pager = new Pager($args->getQueryString());
if ($localSearch && empty($results)) { if ($localSearch && empty($results)) {
$pager->setItemsPerPage(80); $pager->setItemsPerPage(80);

View file

@ -2,6 +2,7 @@
namespace Friendica\Module\Search; namespace Friendica\Module\Search;
use Friendica\App\Arguments;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Pager; use Friendica\Content\Pager;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
@ -125,7 +126,9 @@ class Index extends BaseSearchModule
// OR your own posts if you are a logged in member // OR your own posts if you are a logged in member
// No items will be shown if the member has a blocked profile wall. // No items will be shown if the member has a blocked profile wall.
$pager = new Pager(self::getArgs()->getQueryString()); /** @var Arguments $args */
$args = self::getClass(Arguments::class);
$pager = new Pager($args->getQueryString());
if ($tag) { if ($tag) {
Logger::info('Start tag search for "' . $search . '"'); Logger::info('Start tag search for "' . $search . '"');

View file

@ -2,6 +2,7 @@
namespace Friendica\Module\Search; namespace Friendica\Module\Search;
use Friendica\App\Arguments;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -11,8 +12,11 @@ class Saved extends BaseModule
{ {
public static function rawContent() public static function rawContent()
{ {
$action = self::getArgs()->get(2, 'none'); /** @var Arguments $args */
$search = Strings::escapeTags(trim(rawurldecode(self::getArgs()->get(3, '')))); $args = self::getClass(Arguments::class);
$action = $args->get(2, 'none');
$search = Strings::escapeTags(trim(rawurldecode($args->get(3, ''))));
$return_url = $_GET['return_url'] ?? 'search?q=' . urlencode($search); $return_url = $_GET['return_url'] ?? 'search?q=' . urlencode($search);