X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FBaseSearchModule.php;h=42bb943da0a5c54f6b31fcd40697e12bd99c261a;hb=1fc1989f93ee9a8a6014f4db6b4c260443f813d2;hp=9766c000cca8b4926d87de07b038b3a3df5f04fd;hpb=0c4ab89bc3ba01c1e816ac191efcaba31b80c9f3;p=friendica.git diff --git a/src/Module/BaseSearchModule.php b/src/Module/BaseSearchModule.php index 9766c000cc..42bb943da0 100644 --- a/src/Module/BaseSearchModule.php +++ b/src/Module/BaseSearchModule.php @@ -2,19 +2,17 @@ namespace Friendica\Module; -use Friendica\App\Arguments; use Friendica\BaseModule; use Friendica\Content\ContactSelector; use Friendica\Content\Pager; -use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Core\Search; +use Friendica\DI; use Friendica\Model; use Friendica\Network\HTTPException; use Friendica\Object\Search\ContactResult; use Friendica\Object\Search\ResultList; use Friendica\Util\Proxy as ProxyUtils; -use Friendica\Util\Strings; /** * Base class for search modules @@ -22,7 +20,7 @@ use Friendica\Util\Strings; class BaseSearchModule extends BaseModule { /** - * Performs a search with an optional prefix + * Performs a contact search with an optional prefix * * @param string $search Search query * @param string $prefix A optional prefix (e.g. @ or !) for searching @@ -31,10 +29,10 @@ class BaseSearchModule extends BaseModule * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ - public static function performSearch($search, $prefix = '') + public static function performContactSearch($search, $prefix = '') { - $a = self::getApp(); - $config = $a->getConfig(); + $a = DI::app(); + $config = DI::config(); $type = Search::TYPE_ALL; @@ -51,7 +49,7 @@ class BaseSearchModule extends BaseModule if (strpos($search, '@') === 0) { $search = substr($search, 1); $type = Search::TYPE_PEOPLE; - $header = L10n::t('People Search - %s', $search); + $header = DI::l10n()->t('People Search - %s', $search); if (strrpos($search, '@') > 0) { $results = Search::getContactsFromProbe($search); @@ -61,11 +59,10 @@ class BaseSearchModule extends BaseModule if (strpos($search, '!') === 0) { $search = substr($search, 1); $type = Search::TYPE_FORUM; - $header = L10n::t('Forum Search - %s', $search); + $header = DI::l10n()->t('Forum Search - %s', $search); } - /** @var Arguments $args */ - $args = self::getClass(Arguments::class); + $args = DI::args(); $pager = new Pager($args->getQueryString()); if ($localSearch && empty($results)) { @@ -93,12 +90,10 @@ class BaseSearchModule extends BaseModule protected static function printResult(ResultList $results, Pager $pager, $header = '') { if ($results->getTotal() == 0) { - info(L10n::t('No matches')); + info(DI::l10n()->t('No matches')); return ''; } - $a = self::getApp(); - $id = 0; $entries = []; foreach ($results->getResults() as $result) { @@ -131,14 +126,14 @@ class BaseSearchModule extends BaseModule $photo_menu = []; } } else { - $connLink = $a->getBaseURL() . '/follow/?url=' . $result->getUrl(); - $connTxt = L10n::t('Connect'); + $connLink = DI::baseUrl()->get() . '/follow/?url=' . $result->getUrl(); + $connTxt = DI::l10n()->t('Connect'); - $photo_menu['profile'] = [L10n::t("View Profile"), Model\Contact::magicLink($result->getUrl())]; - $photo_menu['follow'] = [L10n::t("Connect/Follow"), $connLink]; + $photo_menu['profile'] = [DI::l10n()->t("View Profile"), Model\Contact::magicLink($result->getUrl())]; + $photo_menu['follow'] = [DI::l10n()->t("Connect/Follow"), $connLink]; } - $photo = str_replace("http:///photo/", get_server() . "/photo/", $result->getPhoto()); + $photo = str_replace("http:///photo/", Search::getGlobalDirectory() . "/photo/", $result->getPhoto()); $entry = [ 'alt_text' => $alt_text,