]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/BaseSearchModule.php
Remove superfluous includes in profile modules
[friendica.git] / src / Module / BaseSearchModule.php
index 96692b0b2d68c355e8cf9ed41a999b224d6c4f20..42bb943da0a5c54f6b31fcd40697e12bd99c261a 100644 (file)
@@ -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
@@ -33,8 +31,8 @@ class BaseSearchModule extends BaseModule
         */
        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,