Checks if a non-static method is called statically.
1 | <?php |
||
2 | /** |
||
3 | * Controller.php |
||
4 | * Copyright (c) 2017 [email protected] |
||
5 | * |
||
6 | * This file is part of Firefly III. |
||
7 | * |
||
8 | * Firefly III is free software: you can redistribute it and/or modify |
||
9 | * it under the terms of the GNU General Public License as published by |
||
10 | * the Free Software Foundation, either version 3 of the License, or |
||
11 | * (at your option) any later version. |
||
12 | * |
||
13 | * Firefly III is distributed in the hope that it will be useful, |
||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
16 | * GNU General Public License for more details. |
||
17 | * |
||
18 | * You should have received a copy of the GNU General Public License |
||
19 | * along with Firefly III. If not, see <http://www.gnu.org/licenses/>. |
||
20 | */ |
||
21 | declare(strict_types=1); |
||
22 | |||
23 | namespace FireflyIII\Http\Controllers; |
||
24 | |||
25 | use FireflyConfig; |
||
26 | use FireflyIII\Support\Http\Controllers\RequestInformation; |
||
27 | use FireflyIII\Support\Http\Controllers\UserNavigation; |
||
28 | use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
||
29 | use Illuminate\Foundation\Bus\DispatchesJobs; |
||
30 | use Illuminate\Foundation\Validation\ValidatesRequests; |
||
31 | use Illuminate\Routing\Controller as BaseController; |
||
32 | use Route; |
||
33 | |||
34 | /** |
||
35 | * Class Controller. |
||
36 | * |
||
37 | * @SuppressWarnings(PHPMD.NumberOfChildren) |
||
38 | */ |
||
39 | class Controller extends BaseController |
||
40 | { |
||
41 | use AuthorizesRequests, DispatchesJobs, ValidatesRequests, UserNavigation, RequestInformation; |
||
42 | |||
43 | /** @var string Format for date and time. */ |
||
44 | protected $dateTimeFormat; |
||
45 | /** @var string Format for "23 Feb, 2016". */ |
||
46 | protected $monthAndDayFormat; |
||
47 | /** @var string Format for "March 2018" */ |
||
48 | protected $monthFormat; |
||
49 | /** @var string Redirect user */ |
||
50 | protected $redirectUri = '/'; |
||
51 | |||
52 | /** |
||
53 | * Controller constructor. |
||
54 | */ |
||
55 | public function __construct() |
||
56 | { |
||
57 | // for transaction lists: |
||
58 | app('view')->share('hideBudgets', false); |
||
59 | app('view')->share('hideCategories', false); |
||
60 | app('view')->share('hideBills', false); |
||
61 | app('view')->share('hideTags', false); |
||
62 | |||
63 | // is site a demo site? |
||
64 | $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
65 | app('view')->share('IS_DEMO_SITE', $isDemoSite); |
||
66 | app('view')->share('DEMO_USERNAME', config('firefly.demo_username')); |
||
67 | app('view')->share('DEMO_PASSWORD', config('firefly.demo_password')); |
||
68 | app('view')->share('FF_VERSION', config('firefly.version')); |
||
69 | |||
70 | $this->middleware( |
||
71 | function ($request, $next) { |
||
72 | // translations for specific strings: |
||
73 | $this->monthFormat = (string)trans('config.month'); |
||
74 | $this->monthAndDayFormat = (string)trans('config.month_and_day'); |
||
75 | $this->dateTimeFormat = (string)trans('config.date_time'); |
||
76 | |||
77 | // get shown-intro-preference: |
||
78 | if (auth()->check()) { |
||
79 | $language = $this->getLanguage(); |
||
80 | $page = $this->getPageName(); |
||
81 | $shownDemo = $this->hasSeenDemo(); |
||
82 | app('view')->share('language', $language); |
||
83 | app('view')->share('shownDemo', $shownDemo); |
||
84 | app('view')->share('current_route_name', $page); |
||
85 | app('view')->share('original_route_name', Route::currentRouteName()); |
||
86 | } |
||
87 | |||
88 | return $next($request); |
||
89 | } |
||
90 | ); |
||
91 | } |
||
92 | |||
93 | } |
||
94 |