Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/View/Front/default/profile/wall_delete.php (1 issue)

Labels
1
<?php
2
3
use Ffcms\Core\Helper\Date;
4
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...
5
6
/** @var $post \Apps\ActiveRecord\WallPost */
7
/** @var $model \Apps\Model\Front\Profile\FormWallPostDelete */
8
/** @var \Ffcms\Templex\Template\Template $this */
9
10
11
$this->layout('_layouts/default', [
12
    'title' => __('Delete post'),
13
    'breadcrumbs' => [
14
        Url::to('/') => __('Home'),
15
        Url::to('profile/show', [App::$User->identity()->getId()]) => __('Profile'),
16
        __('Delete post')
17
    ]
18
]);
19
?>
20
21
<?php $this->start('body') ?>
22
<h1><?= __('Delete wall post') ?></h1>
23
<hr />
24
<p><?= __('Are you sure to delete this post? No more attention will be displayed!') ?></p>
25
<div class="row" id="wall-post-<?= $post->id ?>">
26
    <div class="col-md-2">
27
        <div class="text-center">
28
            <img class="img-fluid img-rounded" alt="Avatar of <?= $post->senderUser->profile->getNickname() ?>" src="<?= $post->senderUser->profile->getAvatarUrl('small') ?>" />
29
        </div>
30
    </div>
31
    <div class="col-md-10">
32
        <h5 style="margin-top: 0;">
33
            <i class="fa fa-pencil"></i> <?= Url::a(['profile/show', [$post->sender_id]], $post->senderUser->profile->getNickname()) ?>
34
            <small class="float-right"><?= Date::convertToDatetime($post->updated_at, Date::FORMAT_TO_SECONDS); ?></small>
35
        </h5>
36
        <div class="wall-post-text">
37
            <?= \App::$Security->strip_tags($post->message); ?>
38
        </div>
39
     </div>
40
</div>
41
42
<?php $form = $this->form($model); ?>
43
<?= $form->start() ?>
44
<?= $form->field()->hidden('id'); ?>
45
<div class="row mt-1">
46
    <div class="col-md-12">
47
        <input type="submit" name="<?= $model->getFormName() ?>[submit]" value="<?=__('Delete')?>" class="btn btn-danger" />
48
    </div>
49
</div>
50
<?= $form->stop() ?>
51
52
<?php $this->stop() ?>
53