1 | <?php |
||||
2 | |||||
3 | /** @var Ffcms\Templex\Template\Template $this */ |
||||
4 | |||||
5 | use Ffcms\Templex\Url\Url; |
||||
0 ignored issues
–
show
|
|||||
6 | |||||
7 | ?> |
||||
8 | <!DOCTYPE html> |
||||
9 | <html lang="en"> |
||||
10 | <head> |
||||
11 | <title><?= $title ?? 'no title'; ?></title> |
||||
12 | <meta charset="utf-8"> |
||||
13 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
||||
14 | <link rel="shortcut icon" href="<?= \App::$Alias->currentViewUrl ?>/assets/img/favicon.ico" type="image/x-icon"> |
||||
15 | <link rel="icon" href="<?= \App::$Alias->currentViewUrl ?>/assets/img/favicon.ico" type="image/x-icon"> |
||||
16 | <link rel="stylesheet" href="<?= \App::$Alias->currentViewUrl ?>/assets/css/style.css" /> |
||||
17 | <link rel="stylesheet" href="<?= \App::$Alias->scriptUrl ?>/vendor/twbs/bootstrap/dist/css/bootstrap.min.css" /> |
||||
18 | <link rel="stylesheet" href="<?= \App::$Alias->scriptUrl ?>/vendor/components/font-awesome/css/font-awesome.min.css" /> |
||||
19 | <?php if (\App::$Properties->get('multiLanguage') && count(\App::$Properties->get('languages')) > 1): ?> |
||||
0 ignored issues
–
show
It seems like
App::Properties->get('languages') can also be of type false ; however, parameter $var of count() does only seem to accept Countable|array , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
20 | <link rel="stylesheet" href="<?= \App::$Alias->scriptUrl ?>/vendor/phpffcms/language-flags/flags.css" /> |
||||
21 | <?php endif; ?> |
||||
22 | <?= $this->section('css') ?> |
||||
23 | <!-- jquery usage after-load logic --> |
||||
24 | <script>(function(w,d,u){w.readyQ=[];w.bindReadyQ=[];function p(x,y){if(x=="ready"){w.bindReadyQ.push(y);}else{w.readyQ.push(x);}};var a={ready:p,bind:p};w.$=w.jQuery=function(f){if(f===d||f===u){return a}else{p(f)}}})(window,document)</script> |
||||
25 | <script> |
||||
26 | var script_url = '<?= \App::$Alias->scriptUrl ?>'; |
||||
27 | var script_lang = '<?= \App::$Request->getLanguage() ?>'; |
||||
28 | var site_url = '<?= \App::$Alias->baseUrl ?>'; |
||||
29 | </script> |
||||
30 | <?php if (\App::$Debug): ?> |
||||
31 | <?= \App::$Debug->renderHead() ?> |
||||
32 | <?php endif; ?> |
||||
33 | <?php if (!isset($fullgrid)){ $fullgrid = false; } ?> |
||||
34 | </head> |
||||
35 | <body class="bg-light"> |
||||
36 | |||||
37 | <?php |
||||
38 | $navbar = $this->bootstrap()->navbar(['class' => 'navbar-expand-md navbar-dark bg-dark fixed-top'], true); |
||||
39 | $navbar->brand(['text' => __('Home'), 'link' => ['/']]); |
||||
40 | $navbar->menu('left', ['text' => __('News'), 'link' => ['content/list', ['news']]]); |
||||
41 | $navbar->menu('left', ['text' => __('About'), 'link' => ['content/read', ['page', 'about-page']]]); |
||||
42 | $navbar->menu('left', ['text' => __('Feedback'), 'link' => ['feedback/create']]); |
||||
43 | $navbar->menu('left', ['text' => __('Users'), 'link' => ['profile/index', ['all']]]); |
||||
44 | // language change flags if enabled |
||||
45 | if (\App::$Properties->get('multiLanguage') && count(\App::$Properties->get('languages')) > 1) { |
||||
46 | foreach (\App::$Properties->get('languages') as $lang) { |
||||
47 | $navbar->menu('left', [ |
||||
48 | 'text' => '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="flag flag-' . $lang . '" alt="' . $lang . '">', |
||||
49 | 'link' => App::$Alias->baseUrlNoLang . '/' . $lang . App::$Request->getPathInfo(), |
||||
50 | 'html' => true |
||||
51 | ]); |
||||
52 | } |
||||
53 | } |
||||
54 | if (\App::$User->isAuth()) { |
||||
55 | $userId = \App::$User->identity()->getId(); |
||||
56 | $navbar->menu('right', ['text' => __('Account') . ' <span class="badge" id="summary-count-block">0</span>', 'dropdown' => [ |
||||
57 | ['text' => __('My profile'), 'link' => ['profile/show', [$userId]]], |
||||
58 | ['text' => __('Messages') . ' <span class="badge" id="pm-count-block">0</span>', 'link' => ['profile/messages'], 'class' => 'dropdown-item', 'html' => true], |
||||
59 | ['text' => __('Feed'), 'link' => ['profile/feed'], 'class' => 'dropdown-item'], |
||||
60 | ['text' => __('Notifications') . ' <span class="badge" id="notify-count-block">0</span>', 'link' => ['profile/notifications'], 'class' => 'dropdown-item', 'html' => true], |
||||
61 | ['text' => __('Settings'), 'link' => ['profile/settings'], 'class' => 'dropdown-item'], |
||||
62 | ], 'properties' => ['html' => true]]); |
||||
63 | if (\App::$User->identity()->role->can('Admin/Main/Index')) { |
||||
64 | $navbar->menu('right', ['text' => __('Admin'), 'link' => \App::$Alias->scriptUrl . '/admin']); |
||||
65 | } |
||||
66 | $navbar->menu('right', ['text' => __('Logout'), 'link' => ['user/logout']]); |
||||
67 | } else { |
||||
68 | $navbar->menu('right', ['text' => __('Sign in'), 'link' => ['user/login']]); |
||||
69 | $navbar->menu('right', ['text' => __('Sign up'), 'link' => ['user/signup']]); |
||||
70 | } |
||||
71 | |||||
72 | echo $navbar->display(); |
||||
73 | ?> |
||||
74 | |||||
75 | <header class="container"> |
||||
76 | <div class="row"> |
||||
77 | <div class="col-md-1"> |
||||
78 | <img src="<?= \App::$Alias->currentViewUrl ?>/assets/img/logo.png" alt="logo" class="img-fluid" /> |
||||
79 | </div> |
||||
80 | <div class="col-md-7"> |
||||
81 | <div class="h1 mb-0">FFCMS Demo</div> |
||||
82 | <small class="text-secondary">Some website description text</small> |
||||
83 | </div> |
||||
84 | <div class="col"> |
||||
85 | <form class="form-inline" action="<?= Url::to('search/index') ?>" method="GET"> |
||||
86 | <input type="text" name="query" class="form-control col-md-9 mr-md-1" id="searchInput" value="<?= isset($query) ? $query : null ?>"> |
||||
87 | <button type="submit" class="btn btn-primary col-md"><?= __('Search') ?></button> |
||||
88 | </form> |
||||
89 | </div> |
||||
90 | </div> |
||||
91 | </header> |
||||
92 | |||||
93 | <main role="main" class="container"> |
||||
94 | <?php if (isset($breadcrumbs) && is_array($breadcrumbs)): ?> |
||||
95 | <div class="row"> |
||||
96 | <div class="col"> |
||||
97 | <nav aria-label="breadcrumb"> |
||||
98 | <?php |
||||
99 | $crumbs = $this->listing('ol', ['class' => 'breadcrumb']); |
||||
100 | foreach ($breadcrumbs as $url => $text) { |
||||
101 | if (\Ffcms\Core\Helper\Type\Any::isInt($url)) { |
||||
102 | $crumbs->li($text, ['class' => 'breadcrumb-item active']); |
||||
103 | } else { |
||||
104 | $crumbs->li(['link' => $url, 'text' => $text], ['class' => 'breadcrumb-item']); |
||||
105 | } |
||||
106 | } |
||||
107 | echo $crumbs->display(); |
||||
108 | ?> |
||||
109 | </nav> |
||||
110 | </div> |
||||
111 | </div> |
||||
112 | <?php endif; ?> |
||||
113 | <div class="row"> |
||||
114 | <div class="<?= ($fullgrid ? 'col-md-12' : 'col-md-8') ?>"> |
||||
115 | <?php |
||||
116 | if ($this->section('body')) { |
||||
117 | // display notifications if exist |
||||
118 | $notifyMessages = \App::$Session->getFlashBag()->all(); |
||||
119 | if (\Ffcms\Core\Helper\Type\Any::isArray($notifyMessages) && count($notifyMessages) > 0) { |
||||
120 | foreach ($notifyMessages as $mType => $mArray) { |
||||
121 | if ($mType === 'error') { |
||||
122 | $mType = 'danger'; |
||||
123 | } |
||||
124 | foreach ($mArray as $mText) { |
||||
125 | echo $this->bootstrap()->alert($mType, $mText); |
||||
126 | } |
||||
127 | } |
||||
128 | } |
||||
129 | echo $this->section('body'); |
||||
130 | } else { |
||||
131 | echo '<p>Page not found!</p>'; |
||||
132 | } |
||||
133 | ?> |
||||
134 | </div> |
||||
135 | <?php if (!$fullgrid): ?> |
||||
136 | <div class="col-md"> |
||||
137 | <?php if (\Widgets\Front\Newcontent\Newcontent::enabled()): ?> |
||||
138 | <div class="card"> |
||||
139 | <div class="card-header"><?= __('New content') ?></div> |
||||
140 | <div class="card-body"> |
||||
141 | <?= \Widgets\Front\Newcontent\Newcontent::widget() ?> |
||||
142 | </div> |
||||
143 | </div> |
||||
144 | <?php endif; ?> |
||||
145 | <?php if (\Widgets\Front\Contenttag\Contenttag::enabled()): ?> |
||||
146 | <div class="card mt-1"> |
||||
147 | <div class="card-header"><?= __('Content tags') ?></div> |
||||
148 | <div class="card-body"> |
||||
149 | <?= \Widgets\Front\Contenttag\Contenttag::widget() ?> |
||||
150 | </div> |
||||
151 | </div> |
||||
152 | <?php endif; ?> |
||||
153 | <?php if (Widgets\Front\Newcomment\Newcomment::enabled()): ?> |
||||
154 | <div class="card mt-1"> |
||||
155 | <div class="card-header"><?= __('New comments') ?></div> |
||||
156 | <div class="card-body"> |
||||
157 | <?= \Widgets\Front\Newcomment\Newcomment::widget() ?> |
||||
158 | </div> |
||||
159 | </div> |
||||
160 | <?php endif; ?> |
||||
161 | </div> |
||||
162 | <?php endif; ?> |
||||
163 | </div> |
||||
164 | </main> |
||||
165 | |||||
166 | <footer class="container mt-md-3"> |
||||
167 | <div class="row"> |
||||
168 | <div class="col-md-12"> |
||||
169 | <p>© <?= date('Y') ?> website. Powered by <a href="https://ffcms.org">ffcms.org</a>.</p> |
||||
170 | </div> |
||||
171 | </div> |
||||
172 | </footer> |
||||
173 | |||||
174 | <script src="<?= \App::$Alias->scriptUrl ?>/vendor/components/jquery/jquery.min.js"></script> |
||||
175 | <script src="<?= \App::$Alias->scriptUrl ?>/vendor/phpffcms/ffcms-assets/node_modules/popper.js/dist/umd/popper.min.js"></script> |
||||
176 | <script src="<?= \App::$Alias->scriptUrl ?>/vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script> |
||||
177 | <script src="<?= \App::$Alias->currentViewUrl ?>/assets/js/global.js"></script> |
||||
178 | |||||
179 | <!-- jQuery code interprier after library loaded --> |
||||
180 | <script>(function($,d){$.each(readyQ,function(i,f){$(f)});$.each(bindReadyQ,function(i,f){$(d).bind("ready",f)})})(jQuery,document)</script> |
||||
181 | |||||
182 | <?= $this->section('javascript') ?> |
||||
183 | |||||
184 | <?php if (\App::$Debug): ?> |
||||
185 | <?= \App::$Debug->renderOut() ?> |
||||
186 | <?php endif; ?> |
||||
187 | </body> |
||||
188 | </html> |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: