Passed
Push — master ( ef8807...c1ca83 )
by Mihail
05:17
created

Apps/View/Install/default/_layouts/default.php (1 issue)

Labels
Severity
1
<?php
2
3
/** @var Ffcms\Templex\Template\Template $this */
4
5
use Ffcms\Templex\Url\Url;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Url. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/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 before OtherDir/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:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
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="robots" content="noindex">
14
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
15
    <link rel="shortcut icon" href="<?= \App::$Alias->currentViewUrl ?>/assets/img/favicon.ico" type="image/x-icon">
16
    <link rel="icon" href="<?= \App::$Alias->currentViewUrl ?>/assets/img/favicon.ico" type="image/x-icon">
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
    <link rel="stylesheet" href="<?= \App::$Alias->currentViewUrl ?>/assets/css/style.css" />
20
    <?= $this->section('css') ?>
21
    <!-- jquery usage after-load logic -->
22
    <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>
23
    <script>
24
        var script_url = '<?= \App::$Alias->scriptUrl ?>';
25
        var script_lang = '<?= \App::$Request->getLanguage() ?>';
26
        var site_url = '<?= \App::$Alias->baseUrl ?>';
27
    </script>
28
    <?php if (!isset($fullgrid)){ $fullgrid = false; } ?>
29
</head>
30
31
<body>
32
33
<header class="container">
34
    <div class="row">
35
        <div class="col-md-2">
36
            <img src="<?= \App::$Alias->currentViewUrl ?>/assets/img/logo.png" alt="logo" class="img-responsive" />
37
        </div>
38
        <div class="col-md-10">
39
            <h1>FFCMS 3</h1>
40
            <small><?= __('Fast, flexibility content management system with MVC framework inside!') ?></small>
41
        </div>
42
    </div>
43
</header>
44
45
<main role="main" class="container body-container">
46
    <div class="row">
47
        <div class="col-12">
48
            <?php
49
            if ($this->section('body')) {
50
                // display notifications if exist
51
                $notifyMessages = \App::$Session->getFlashBag()->all();
52
                if (\Ffcms\Core\Helper\Type\Any::isArray($notifyMessages) && count($notifyMessages) > 0) {
53
                    foreach ($notifyMessages as $mType => $mArray) {
54
                        if ($mType === 'error') {
55
                            $mType = 'danger';
56
                        }
57
                        foreach ($mArray as $mText) {
58
                            echo $this->bootstrap()->alert($mType, $mText);
59
                        }
60
                    }
61
                }
62
                echo $this->section('body');
63
            } else {
64
                echo '<p>Page not found!</p>';
65
            }
66
            ?>
67
        </div>
68
    </div>
69
</main>
70
71
<footer class="container mt-md-3">
72
    <div class="row">
73
        <div class="col-md-12">
74
            <p>&copy; <?= date('Y') ?> website. Powered on <a href="https://ffcms.org">ffcms.org</a>.</p>
75
        </div>
76
    </div>
77
</footer>
78
79
<?= $this->section('javascript') ?>
80
81
<script src="<?= \App::$Alias->scriptUrl ?>/vendor/components/jquery/jquery.min.js"></script>
82
<script src="<?= \App::$Alias->scriptUrl ?>/vendor/phpffcms/ffcms-assets/node_modules/popper.js/dist/umd/popper.min.js"></script>
83
<script src="<?= \App::$Alias->scriptUrl ?>/vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>
84
85
<!-- jQuery code interprier after library loaded -->
86
<script>(function($,d){$.each(readyQ,function(i,f){$(f)});$.each(bindReadyQ,function(i,f){$(d).bind("ready",f)})})(jQuery,document)</script>
87
</body>
88
</html>