1 | <?php |
||
2 | |||
3 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
4 | /** @var \Apps\Model\Admin\Main\FormYandexToken $model */ |
||
5 | |||
6 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
7 | |||
8 | $this->layout('_layouts/default', [ |
||
9 | 'title' => __('Yandex.Metrika - token'), |
||
10 | 'breadcrumbs' => [ |
||
11 | Url::to('main/index') => __('Main'), |
||
12 | __('Yandex metrika - step 2') |
||
13 | ] |
||
14 | ]); |
||
15 | ?> |
||
16 | |||
17 | <?php $this->start('body') ?> |
||
18 | <h1><?= __('Yandex token') ?></h1> |
||
19 | <p><?= __('This is callback form - you are successfully got a new yandex token! Save it!') ?></p> |
||
20 | |||
21 | <?php $form = $this->form($model) ?> |
||
22 | |||
23 | <?= $form->start() ?> |
||
24 | |||
25 | <?= $form->fieldset()->text('token', ['readonly' => 'readonly']) ?> |
||
26 | <?= $form->fieldset()->text('expires', ['readonly' => 'readonly']) ?> |
||
27 | |||
28 | <?= $form->button()->submit(__('Save'), ['class' => 'btn btn-primary']) ?> |
||
29 | |||
30 | <?= $form->stop() ?> |
||
31 | |||
32 | <?php $this->stop() ?> |
||
33 | |||
34 | <?php $this->push('javascript') ?> |
||
35 | <script type="text/javascript"> |
||
36 | $(document).ready(function(){ |
||
37 | var reqHash = window.location.hash.substring(1); |
||
38 | var params = {}; |
||
39 | reqHash.split('&').map(hk => { |
||
40 | let temp = hk.split('='); |
||
41 | params[temp[0]] = temp[1] |
||
42 | }); |
||
43 | |||
44 | if (!params.access_token || params.access_token.length < 20) { |
||
45 | alert('No access token exist! Error!'); |
||
46 | return false; |
||
47 | } else { |
||
48 | $('#yaTokenForm-token').val(params.access_token); |
||
49 | } |
||
50 | |||
51 | $('#yaTokenForm-expires').val(params.expires_in); |
||
52 | }); |
||
53 | </script> |
||
54 | <?php $this->stop() ?> |
||
55 |
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: