Code Duplication    Length = 20-23 lines in 4 locations

frontend/views/media-comment/comments.php 1 location

@@ 32-54 (lines=23) @@
29
30
    <?php endif ?>
31
32
    <?php if ($media->comment_status == 'open'): ?>
33
        <?php $dateInterval = date_diff(new DateTime($media->date), new DateTime('now')) ?>
34
        <?php if (Option::get('comment_registration') && Yii::$app->user->isGuest): ?>
35
            <h3>
36
                <?= Yii::t('writesdown', 'You must login to leave a reply, ') ?>
37
38
                <?= Html::a(Yii::t('writesdown', 'Login'), Yii::$app->urlManagerBack->createUrl(['site/login'])); ?>
39
40
            </h3>
41
        <?php elseif (Option::get('close_comments_for_old_posts')
42
            && $dateInterval->d >= Option::get('close_comments_days_old')
43
        ): ?>
44
            <h3><?= Yii::t('writesdown', 'Comments are closed') ?></h3>;
45
        <?php else: ?>
46
            <?= $this->render('_form', [
47
                'model' => $comment,
48
                'media' => $media,
49
            ]) ?>
50
        <?php endif ?>
51
    <?php elseif ($media->comment_count && $media->comment_status === 'close'): ?>
52
        <h3><?= Yii::t('writesdown', 'Comments are closed') ?></h3>;
53
    <?php endif ?>
54
55
</div>
56

frontend/views/post-comment/comments.php 1 location

@@ 32-51 (lines=20) @@
29
30
    <?php endif ?>
31
32
    <?php if ($post->comment_status === 'open'): ?>
33
        <?php $dateInterval = date_diff(new DateTime($post->date), new DateTime('now')) ?>
34
        <?php if (Option::get('comment_registration') && Yii::$app->user->isGuest): ?>
35
            <h3>
36
                <?= Yii::t('writesdown', 'You must login to leave a reply, ') ?>
37
38
                <?= Html::a(Yii::t('writesdown', 'Login'), Yii::$app->urlManagerBack->createUrl(['site/login'])) ?>
39
40
            </h3>
41
        <?php elseif (Option::get('close_comments_for_old_posts')
42
            && $dateInterval->d >= Option::get('close_comments_days_old')
43
        ): ?>
44
            <h3><?= Yii::t('writesdown', 'Comments are closed') ?></h3>
45
        <?php else: ?>
46
            <?= $this->render('_form', ['model' => $comment, 'post' => $post]) ?>
47
        <?php endif ?>
48
    <?php elseif ($post->comment_count && $post->comment_status === 'close'): ?>
49
        <h3><?= Yii::t('writesdown', 'Comments are closed') ?></h3>
50
    <?php endif ?>
51
52
</div>
53

themes/writesdown/media-comment/comments.php 1 location

@@ 33-55 (lines=23) @@
30
31
    <?php endif ?>
32
33
    <?php if ($media->comment_status == 'open'): ?>
34
        <?php $dateInterval = date_diff(new DateTime($media->date), new DateTime('now')) ?>
35
        <?php if (Option::get('comment_registration') && Yii::$app->user->isGuest): ?>
36
            <h3>
37
                <?= Yii::t('writesdown', 'You must login to leave a reply, ') ?>
38
39
                <?= Html::a(Yii::t('writesdown', 'Login'), Yii::$app->urlManagerBack->createUrl(['site/login'])) ?>
40
41
            </h3>
42
        <?php elseif (Option::get('close_comments_for_old_posts')
43
            && $dateInterval->d >= Option::get('close_comments_days_old')
44
        ): ?>
45
            <h3><?= Yii::t('writesdown', 'Comments are closed') ?></h3>;
46
        <?php else: ?>
47
            <?= $this->render('_form', [
48
                'model' => $comment,
49
                'media' => $media,
50
            ]) ?>
51
        <?php endif ?>
52
    <?php elseif ($media->comment_count && $media->comment_status === 'close'): ?>
53
        <h3><?= Yii::t('writesdown', 'Comments are closed') ?></h3>;
54
    <?php endif ?>
55
56
</div>
57

themes/writesdown/post-comment/comments.php 1 location

@@ 31-50 (lines=20) @@
28
29
    <?php endif ?>
30
31
    <?php if ($post->comment_status == 'open'): ?>
32
        <?php $dateInterval = date_diff(new DateTime($post->date), new DateTime('now')) ?>
33
        <?php if (Option::get('comment_registration') && Yii::$app->user->isGuest): ?>
34
            <h3>
35
                <?= Yii::t('writesdown', 'You must login to leave a reply, ') ?>
36
37
                <?= Html::a(Yii::t('writesdown', 'Login'), Yii::$app->urlManagerBack->createUrl(['site/login'])) ?>
38
39
            </h3>
40
        <?php elseif (Option::get('close_comments_for_old_posts')
41
            && $dateInterval->d >= Option::get('close_comments_days_old')
42
        ): ?>
43
            <h3><?= Yii::t('writesdown', 'Comments are closed') ?></h3>
44
        <?php else: ?>
45
            <?= $this->render('_form', ['model' => $comment, 'post' => $post]) ?>
46
        <?php endif ?>
47
    <?php elseif ($post->comment_count && $post->comment_status === 'close'): ?>
48
        <h3><?= Yii::t('writesdown', 'Comments are closed') ?></h3>
49
    <?php endif ?>
50
51
</div>
52