1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link http://www.writesdown.com/ |
4
|
|
|
* @author Agiel K. Saputra <[email protected]> |
5
|
|
|
* @copyright Copyright (c) 2015 WritesDown |
6
|
|
|
* @license http://www.writesdown.com/license/ |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
use common\models\Option; |
10
|
|
|
use yii\helpers\Html; |
11
|
|
|
use yii\widgets\ActiveForm; |
12
|
|
|
|
13
|
|
|
/* @var $media common\models\Media */ |
14
|
|
|
|
15
|
|
|
$this->title = Html::encode($media->title . ' - ' . Option::get('sitetitle')); |
16
|
|
|
|
17
|
|
View Code Duplication |
if ($media->mediaPost) { |
|
|
|
|
18
|
|
|
$this->params['breadcrumbs'][] = [ |
19
|
|
|
'label' => Html::encode($media->mediaPost->title), |
20
|
|
|
'url' => $media->mediaPost->url, |
21
|
|
|
]; |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
$this->params['breadcrumbs'][] = Html::encode($media->title); |
25
|
|
|
?> |
26
|
|
|
<div class="single media-protected"> |
27
|
|
|
<article class="hentry"> |
28
|
|
|
<header class="entry-header page-header"> |
29
|
|
|
<h1 class="entry-title"><?= Html::encode($media->title) ?></h1> |
30
|
|
|
|
31
|
|
|
</header> |
32
|
|
|
<div class="entry-content"> |
33
|
|
|
<?php $form = ActiveForm::begin() ?> |
34
|
|
|
|
35
|
|
|
<p> |
36
|
|
|
<?= Yii::t( |
37
|
|
|
'writesdown', |
38
|
|
|
'{title} is protected, please submit the right password to view the Media.', |
39
|
|
|
['title' => Html::encode($media->title)] |
40
|
|
|
) ?> |
41
|
|
|
|
42
|
|
|
</p> |
43
|
|
|
<div class="form-group field-media-password required"> |
44
|
|
|
<?= Html::label( |
45
|
|
|
Yii::t('writesdown', 'Password'), |
46
|
|
|
'media-password', |
47
|
|
|
['class' => 'control-label'] |
48
|
|
|
) ?> |
49
|
|
|
|
50
|
|
|
<?= Html::passwordInput('password', null, [ |
51
|
|
|
'class' => 'form-control', |
52
|
|
|
'id' => 'media-password', |
53
|
|
|
]) ?> |
54
|
|
|
|
55
|
|
|
</div> |
56
|
|
|
<div class="form-group"> |
57
|
|
|
<?= Html::submitButton( |
58
|
|
|
Yii::t('writesdown', 'Submit Password'), |
59
|
|
|
['class' => 'btn btn-flat btn-primary'] |
60
|
|
|
) ?> |
61
|
|
|
|
62
|
|
|
</div> |
63
|
|
|
<?php ActiveForm::end() ?> |
64
|
|
|
|
65
|
|
|
</div> |
66
|
|
|
</article> |
67
|
|
|
</div> |
68
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.