X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp.php;h=c6ed818dd1a8ec23f932a1ef4eb826e8c45f7117;hb=1baa4d48afdc90a551afe381ee2798b9a827e920;hp=0f0c0537e4d98ae5538fda12993c2734c49e6d4f;hpb=bd604d1cfb07fe43016f07a6d1f82877dd910b4c;p=friendica.git diff --git a/src/App.php b/src/App.php index 0f0c0537e4..c6ed818dd1 100644 --- a/src/App.php +++ b/src/App.php @@ -4,19 +4,22 @@ */ namespace Friendica; -use Detection\MobileDetect; -use DOMDocument; -use DOMXPath; use Exception; -use Friendica\Core\Config\Cache\IConfigCache; +use Friendica\App\Arguments; +use Friendica\App\BaseURL; +use Friendica\App\Page; +use Friendica\Core\Config\Cache\ConfigCache; use Friendica\Core\Config\Configuration; -use Friendica\Core\Hook; +use Friendica\Core\Config\PConfiguration; +use Friendica\Core\L10n\L10n; +use Friendica\Core\System; use Friendica\Core\Theme; -use Friendica\Database\DBA; +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\BaseURL; -use Friendica\Util\Config\ConfigFileLoader; +use Friendica\Util\ConfigFileLoader; use Friendica\Util\HTTPSignature; use Friendica\Util\Profiler; use Friendica\Util\Strings; @@ -37,9 +40,12 @@ use Psr\Log\LoggerInterface; */ class App { - public $module_class = null; - public $query_string = ''; - public $page = []; + /** @deprecated 2019.09 - use App\Arguments->getQueryString() */ + public $query_string; + /** + * @var Page The current page environment + */ + public $page; public $profile; public $profile_uid; public $user; @@ -49,83 +55,87 @@ 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; + /** @deprecated 2019.09 - Use App\Mode->isMobile() instead */ + public $is_mobile; + /** @deprecated 2019.09 - Use App\Mode->isTable() instead */ + public $is_tablet; public $theme_info = []; public $category; // Allow themes to control internal parameters // by changing App values in theme.php - public $sourcename = ''; - public $videowidth = 425; - public $videoheight = 350; - public $force_max_items = 0; + public $sourcename = ''; + public $videowidth = 425; + 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 */ + private $currentTheme; + /** @var string The name of the current mobile theme */ + private $currentMobileTheme; + /** - * @var bool true, if the call is from an backend node (f.e. worker) + * @var Configuration The config */ - private $isBackend; + private $config; /** - * @var string The name of the current theme + * @var LoggerInterface The logger */ - private $currentTheme; + private $logger; /** - * @var bool check if request was an AJAX (xmlhttprequest) request + * @var Profiler The profiler of this app */ - private $isAjax; + private $profiler; /** - * @var MobileDetect + * @var Database The Friendica database connection */ - public $mobileDetect; + private $database; /** - * @var Configuration The config + * @var L10n The translator */ - private $config; + private $l10n; /** - * @var LoggerInterface The logger + * @var App\Arguments */ - private $logger; + private $args; /** - * @var Profiler The profiler of this app + * @var Core\Process The process methods */ - private $profiler; + private $process; /** * Returns the current config cache of this node * - * @return IConfigCache + * @return ConfigCache */ public function getConfigCache() { @@ -149,7 +159,8 @@ class App */ public function getBasePath() { - return $this->config->get('system', 'basepath'); + // Don't use the basepath of the config table for basepath (it should always be the config-file one) + return $this->config->getCache()->get('system', 'basepath'); } /** @@ -183,79 +194,74 @@ class App } /** - * Returns the router of the Application + * Returns the Database of the Application * - * @return App\Router + * @return Database */ - public function getRouter() + public function getDBA() { - return $this->router; + 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. - * - * @see initHead() - * - * @param string $path + * @deprecated 2019.09 - use Page->registerStylesheet instead + * @see Page::registerStylesheet() */ 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, '/'); + $this->page->registerStylesheet($path); } /** - * Register a javascript file path to be included in the