X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp.php;h=9b6f6a5a296eea138749891e8b93c320caeeeee0;hb=05bd0d0b671ad509465fa6cddabc3c2a07c796a7;hp=d3b7125090b61f91b0a0f168e6220cb59767e812;hpb=956439a9f22c3a79f95e73b283ebd585f2c41301;p=friendica.git diff --git a/src/App.php b/src/App.php index d3b7125090..9b6f6a5a29 100644 --- a/src/App.php +++ b/src/App.php @@ -1,24 +1,38 @@ . + * */ + namespace Friendica; -use Detection\MobileDetect; -use DOMDocument; -use DOMXPath; use Exception; use Friendica\App\Arguments; use Friendica\App\BaseURL; -use Friendica\Core\Config\Cache\ConfigCache; -use Friendica\Core\Config\Configuration; -use Friendica\Core\Config\PConfiguration; -use Friendica\Core\L10n\L10n; +use Friendica\App\Authentication; +use Friendica\Core\Config\Cache; +use Friendica\Core\Config\IConfig; +use Friendica\Core\PConfig\IPConfig; +use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Theme; use Friendica\Database\Database; use Friendica\Model\Profile; -use Friendica\Module\Login; use Friendica\Module\Special\HTTPException as ModuleHTTPException; use Friendica\Network\HTTPException; use Friendica\Util\ConfigFileLoader; @@ -28,10 +42,7 @@ use Friendica\Util\Strings; use Psr\Log\LoggerInterface; /** - * - * class: App - * - * @brief Our main application structure for the life of this page. + * Our main application structure for the life of this page. * * Primarily deals with the URL that got us here * and tries to make some sense of it, and @@ -42,9 +53,6 @@ use Psr\Log\LoggerInterface; */ class App { - /** @deprecated 2019.09 - use App\Arguments->getQueryString() */ - public $query_string; - public $page; public $profile; public $profile_uid; public $user; @@ -54,20 +62,14 @@ class App public $page_contact; public $content; public $data = []; - /** @deprecated 2019.09 - use App\Arguments->getCommand() */ - public $cmd = ''; /** @deprecated 2019.09 - use App\Arguments->getArgv() or Arguments->get() */ public $argv; /** @deprecated 2019.09 - use App\Arguments->getArgc() */ public $argc; - /** @deprecated 2019.09 - Use App\Module->getName() instead */ - public $module; public $timezone; public $interactive = true; public $identities; - public $is_mobile = false; - public $is_tablet = false; - public $theme_info = []; + public $theme_info = []; public $category; // Allow themes to control internal parameters // by changing App values in theme.php @@ -77,42 +79,25 @@ class App public $videoheight = 350; public $force_max_items = 0; public $theme_events_in_profile = true; - - public $stylesheets = []; - public $footerScripts = []; + public $queue; /** * @var App\Mode The Mode of the Application */ private $mode; - /** - * @var App\Router - */ - private $router; - /** * @var BaseURL */ private $baseURL; - /** - * @var string The name of the current theme - */ + /** @var string The name of the current theme */ private $currentTheme; + /** @var string The name of the current mobile theme */ + private $currentMobileTheme; /** - * @var bool check if request was an AJAX (xmlhttprequest) request - */ - private $isAjax; - - /** - * @var MobileDetect - */ - public $mobileDetect; - - /** - * @var Configuration The config + * @var IConfig The config */ private $config; @@ -142,23 +127,23 @@ class App private $args; /** - * Returns the current config cache of this node - * - * @return ConfigCache + * @var Core\Process The process methods */ - public function getConfigCache() - { - return $this->config->getCache(); - } + private $process; /** - * Returns the current config of this node + * @var IPConfig + */ + private $pConfig; + + /** + * Returns the current config cache of this node * - * @return Configuration + * @return Cache */ - public function getConfig() + public function getConfigCache() { - return $this->config; + return $this->config->getCache(); } /** @@ -173,130 +158,32 @@ class App } /** - * The Logger of this app - * - * @return LoggerInterface + * @param Database $database The Friendica Database + * @param IConfig $config The Configuration + * @param App\Mode $mode The mode of this Friendica app + * @param BaseURL $baseURL The full base URL of this Friendica app + * @param LoggerInterface $logger The current app logger + * @param Profiler $profiler The profiler of this application + * @param L10n $l10n The translator instance + * @param App\Arguments $args The Friendica Arguments of the call + * @param Core\Process $process The process methods + * @param IPConfig $pConfig Personal configuration */ - public function getLogger() + public function __construct(Database $database, IConfig $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\Process $process, IPConfig $pConfig) { - return $this->logger; - } + $this->database = $database; + $this->config = $config; + $this->mode = $mode; + $this->baseURL = $baseURL; + $this->profiler = $profiler; + $this->logger = $logger; + $this->l10n = $l10n; + $this->args = $args; + $this->process = $process; + $this->pConfig = $pConfig; - /** - * The profiler of this app - * - * @return Profiler - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Returns the Mode of the Application - * - * @return App\Mode The Application Mode - */ - public function getMode() - { - return $this->mode; - } - - /** - * Returns the Database of the Application - * - * @return Database - */ - public function getDBA() - { - return $this->database; - } - - /** - * Register a stylesheet file path to be included in the tag of every page. - * Inclusion is done in App->initHead(). - * The path can be absolute or relative to the Friendica installation base folder. - * - * @param string $path - * - * @see initHead() - * - */ - public function registerStylesheet($path) - { - if (mb_strpos($path, $this->getBasePath() . DIRECTORY_SEPARATOR) === 0) { - $path = mb_substr($path, mb_strlen($this->getBasePath() . DIRECTORY_SEPARATOR)); - } - - $this->stylesheets[] = trim($path, '/'); - } - - /** - * Register a javascript file path to be included in the