1 | <?php |
||
2 | |||
3 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
4 | /** @var \Apps\Model\Admin\Main\FormYandexConnect $model */ |
||
5 | |||
6 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
7 | |||
8 | $this->layout('_layouts/default', [ |
||
9 | 'title' => __('Yandex.metrika - connection'), |
||
10 | 'breadcrumbs' => [ |
||
11 | Url::to('main/index') => __('Main'), |
||
12 | __('Yandex metrika - step 1') |
||
13 | ] |
||
14 | ]); |
||
15 | |||
16 | ?> |
||
17 | |||
18 | <?php $this->start('body'); ?> |
||
19 | |||
20 | <h1><?= __('Connect yandex metrika - step 1') ?></h1> |
||
21 | <p><?= __('To make successful connection to yandex.api you should follow next steps:') ?></p> |
||
22 | <?php $form = $this->form($model) ?> |
||
23 | <?= $form->start() ?> |
||
24 | <ol class="ml-2"> |
||
25 | <li><?= __('Create yandex metrika counter') ?>. <?= Url::a(['https://metrika.yandex.ru'], 'Yandex metrika', ['target' => '_blank']) ?></li> |
||
26 | <li> |
||
27 | <?= __('Create yandex oauth application and put application ID in form down') ?>. |
||
28 | <?= __('On yandex website in section general check "Web-service", in section "Yandex.Metrika" check option "Get statistics, read params".') ?>. |
||
29 | <?= Url::a(['https://oauth.yandex.ru/client/new'], __('Create new yandex oauth app'), ['target' => '_blank']) ?> <br /> |
||
30 | <?= __('Set callback uri #1 to (use https or fail):') ?> |
||
31 | <?= $form->fieldset()->text('callback', ['disabled' => 'disabled']) ?> |
||
32 | </li> |
||
33 | <li> |
||
34 | <?= __('Input created application ID (name) there (not a secret password)') ?>: |
||
35 | <?= $form->fieldset()->text('appid') ?> |
||
36 | <div class="col-md-9 offset-md-3"><?= $form->button()->submit(__('Update'), ['class' => 'btn btn-primary']) ?></div> |
||
37 | </li> |
||
38 | <li><?= __('After create application - initialize token click button below') ?>.</li> |
||
39 | </ol> |
||
40 | |||
41 | <?php if ($model->appid && !\Ffcms\Core\Helper\Type\Any::isEmpty($model->appid)): ?> |
||
42 | <?= $this->bootstrap()->button('a', __('Get Yandex.Metrika token'), [ |
||
43 | 'href' => 'https://oauth.yandex.ru/authorize?response_type=token&client_id=' . $model->appid . '&redirect_uri=' . Url::to('main/yandextoken'), |
||
44 | 'class' => 'btn-success' |
||
45 | ]) ?> |
||
46 | <?php else: ?> |
||
47 | <?= $this->bootstrap()->alert('warning', __('Create oauth application before get token')) ?> |
||
48 | <?php endif; ?> |
||
49 | |||
50 | <?= $form->stop() ?> |
||
51 | |||
52 | <?php $this->stop(); |
||
53 | |||
54 | |||
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: