Code Duplication    Length = 82-86 lines in 7 locations

themes/writesdown/post/index.php 1 location

@@ 34-115 (lines=82) @@
31
        <?php endif ?>
32
    </header>
33
34
    <?php if ($posts): ?>
35
        <?php foreach ($posts as $post) : ?>
36
            <article class="hentry">
37
                <header class="entry-header">
38
                    <h2 class="entry-title"><?= Html::a(Html::encode($post->title), $post->url) ?></h2>
39
40
                    <?php $updated = new \DateTime($post->modified, new DateTimeZone(Yii::$app->timeZone)) ?>
41
                    <div class="entry-meta">
42
                        <span class="entry-date">
43
                            <a rel="bookmark" href="<?= $post->url ?>">
44
                                <time datetime="<?= $updated->format('c') ?>" class="entry-date">
45
                                    <?= Yii::$app->formatter->asDate($post->date) ?>
46
                                </time>
47
                            </a>
48
                        </span>
49
                        <span class="byline">
50
                            <span class="author vcard">
51
                                <a rel="author" href="<?= $post->postAuthor->url ?>"
52
                                   class="url fn"><?= $post->postAuthor->display_name ?>
53
                                </a>
54
                            </span>
55
                        </span>
56
                        <span class="comments-link">
57
                            <a title="<?= Yii::t(
58
                                'writesdown', 'Comment on {post}',
59
                                ['post' => $post->title]
60
                            ) ?>" href="<?= $post->url ?>#respond"><?= Yii::t('writesdown', 'Leave a comment') ?></a>
61
                        </span>
62
                    </div>
63
                </header>
64
65
                <div class="media">
66
                    <?php $image = $post->getMedia()->where(['like', 'mime_type', 'image/'])->one() ?>
67
68
                    <?php if ($image): ?>
69
                        <?= Html::a($image->getThumbnail(
70
                            'thumbnail',
71
                            ['class' => 'post-thumbnail']), $post->url,
72
                            ['class' => 'media-left entry-thumbnail']
73
                        ) ?>
74
                    <?php endif ?>
75
76
                    <div class="media-body">
77
                        <p class="entry-summary">
78
                            <?= $post->excerpt ?>...
79
80
                        </p>
81
                        <footer class="footer-meta">
82
                            <?php $tags = $post->getTerms()
83
                                ->innerJoinWith([
84
                                    'taxonomy' => function ($query) {
85
                                        /** @var $query \yii\db\ActiveQuery */
86
                                        return $query->from(['taxonomy' => Taxonomy::tableName()]);
87
                                    },
88
                                ])
89
                                ->where(['taxonomy.name' => 'tag'])
90
                                ->all() ?>
91
92
                            <?php if ($tags): ?>
93
                                <h3>
94
                                    <?php foreach ($tags as $tag): ?>
95
                                        <?= Html::a($tag->name, $tag->url, ['class' => 'badge']) . "\n" ?>
96
                                    <?php endforeach ?>
97
                                </h3>
98
                            <?php endif ?>
99
100
                        </footer>
101
                    </div>
102
                </div>
103
            </article>
104
        <?php endforeach ?>
105
        <nav id="archive-pagination">
106
            <?= LinkPager::widget([
107
                'pagination' => $pages,
108
                'activePageCssClass' => 'active',
109
                'disabledPageCssClass' => 'disabled',
110
                'options' => ['class' => 'pagination'],
111
            ]);
112
            ?>
113
        </nav>
114
    <?php endif ?>
115
116
</div>
117

themes/writesdown/site/index.php 1 location

@@ 25-106 (lines=82) @@
22
?>
23
<div class="archive site-index">
24
25
    <?php if ($posts): ?>
26
        <?php foreach ($posts as $post) : ?>
27
            <article class="hentry">
28
                <header class="entry-header">
29
                    <h2 class="entry-title"><?= Html::a(Html::encode($post->title), $post->url) ?></h2>
30
31
                    <?php $updated = new \DateTime($post->modified, new DateTimeZone(Yii::$app->timeZone)) ?>
32
                    <div class="entry-meta">
33
                        <span class="entry-date">
34
                            <a rel="bookmark" href="<?= $post->url ?>">
35
                                <time datetime="<?= $updated->format('c') ?>" class="entry-date">
36
                                    <?= Yii::$app->formatter->asDate($post->date) ?>
37
                                </time>
38
                            </a>
39
                        </span>
40
                        <span class="byline">
41
                            <span class="author vcard">
42
                                <a rel="author" href="<?= $post->postAuthor->url ?>"
43
                                   class="url fn"><?= $post->postAuthor->display_name ?>
44
                                </a>
45
                            </span>
46
                        </span>
47
                        <span class="comments-link">
48
                            <a title="<?= Yii::t(
49
                                'writesdown', 'Comment on {post}',
50
                                ['post' => $post->title])
51
                            ?>" href="<?= $post->url ?>#respond"><?= Yii::t('writesdown', 'Leave a comment') ?></a>
52
                        </span>
53
                    </div>
54
                </header>
55
56
                <div class="media">
57
                    <?php $image = $post->getMedia()->where(['like', 'mime_type', 'image/'])->one() ?>
58
59
                    <?php if ($image): ?>
60
                        <?= Html::a($image->getThumbnail(
61
                            'thumbnail',
62
                            ['class' => 'post-thumbnail']), $post->url,
63
                            ['class' => 'media-left entry-thumbnail']
64
                        ) ?>
65
                    <?php endif ?>
66
67
                    <div class="media-body">
68
                        <p class="entry-summary">
69
                            <?= $post->excerpt ?>...
70
71
                        </p>
72
                        <footer class="footer-meta">
73
                            <?php $tags = $post->getTerms()
74
                                ->innerJoinWith([
75
                                    'taxonomy' => function ($query) {
76
                                        /** @var $query \yii\db\ActiveQuery */
77
                                        return $query->from(['taxonomy' => Taxonomy::tableName()]);
78
                                    },
79
                                ])
80
                                ->where(['taxonomy.name' => 'tag'])
81
                                ->all() ?>
82
83
                            <?php if ($tags): ?>
84
                                <h3>
85
                                    <?php foreach ($tags as $tag): ?>
86
                                        <?= Html::a($tag->name, $tag->url, ['class' => 'badge']) . "\n" ?>
87
                                    <?php endforeach ?>
88
                                </h3>
89
                            <?php endif ?>
90
91
                        </footer>
92
                    </div>
93
                </div>
94
            </article>
95
        <?php endforeach ?>
96
        <nav id="archive-pagination">
97
            <?= LinkPager::widget([
98
                'pagination' => $pages,
99
                'activePageCssClass' => 'active',
100
                'disabledPageCssClass' => 'disabled',
101
                'options' => ['class' => 'pagination'],
102
            ]);
103
            ?>
104
        </nav>
105
    <?php endif ?>
106
107
</div>
108

themes/writesdown/site/search.php 1 location

@@ 34-119 (lines=86) @@
31
        <h1><?= Html::encode(Yii::t('writesdown', 'Search Result: {s}', ['s' => $s])) ?></h1>
32
33
    </header>
34
    <?php if ($posts): ?>
35
        <?php foreach ($posts as $post): ?>
36
            <article class="hentry">
37
                <header class="entry-header">
38
                    <h2 class="entry-title"><?= Html::a(Html::encode($post->title), $post->url) ?></h2>
39
40
                    <?php $updated = new \DateTime($post->modified, new DateTimeZone(Yii::$app->timeZone)) ?>
41
                    <div class="entry-meta">
42
                        <span class="entry-date">
43
                            <a rel="bookmark" href="<?= $post->url ?>">
44
                                <time datetime="<?= $updated->format('c') ?>" class="entry-date">
45
                                    <?= Yii::$app->formatter->asDate($post->date) ?>
46
                                </time>
47
                            </a>
48
                        </span>
49
                        <span class="byline">
50
                            <span class="author vcard">
51
                                <a rel="author" href="<?= $post->postAuthor->url ?>"
52
                                   class="url fn"><?= $post->postAuthor->display_name ?>
53
                                </a>
54
                            </span>
55
                        </span>
56
                        <span class="comments-link">
57
                            <a title="<?= Yii::t(
58
                                'writesdown',
59
                                'Comment on {post}',
60
                                ['post' => $post->title]
61
                            ) ?>" href="<?= $post->url ?>#respond"><?= Yii::t('writesdown', 'Leave a comment') ?></a>
62
                        </span>
63
                    </div>
64
                </header>
65
66
                <div class="media">
67
                    <?php $image = $post->getMedia()->where(['like', 'mime_type', 'image/'])->one() ?>
68
69
                    <?php if ($image): ?>
70
                        <?= Html::a($image->getThumbnail(
71
                            'thumbnail',
72
                            ['class' => 'post-thumbnail']),
73
                            $post->url,
74
                            ['class' => 'media-left entry-thumbnail']
75
                        ) ?>
76
                    <?php endif ?>
77
78
                    <div class="media-body">
79
                        <p class="entry-summary">
80
                            <?= $post->excerpt ?>...
81
82
                        </p>
83
                        <footer class="footer-meta">
84
                            <?php $tags = $post->getTerms()
85
                                ->innerJoinWith([
86
                                    'taxonomy' => function ($query) {
87
                                        /** @var $query \yii\db\ActiveQuery */
88
                                        return $query->from(['taxonomy' => Taxonomy::tableName()]);
89
                                    },
90
                                ])
91
                                ->where(['taxonomy.name' => 'tag'])
92
                                ->all() ?>
93
94
                            <?php if ($tags): ?>
95
                                <h3>
96
                                    <?php foreach ($tags as $tag): ?>
97
                                        <?= Html::a($tag->name, $tag->url, ['class' => 'badge']) . "\n" ?>
98
                                    <?php endforeach ?>
99
                                </h3>
100
                            <?php endif ?>
101
102
                        </footer>
103
                    </div>
104
                </div>
105
            </article>
106
        <?php endforeach ?>
107
        <nav id="archive-pagination">
108
            <?= LinkPager::widget([
109
                'pagination' => $pages,
110
                'activePageCssClass' => 'active',
111
                'disabledPageCssClass' => 'disabled',
112
                'options' => [
113
                    'class' => 'pagination',
114
                ],
115
            ]);
116
            ?>
117
        </nav>
118
    <?php endif ?>
119
120
</div>
121

themes/writesdown/term/view-category.php 1 location

@@ 34-116 (lines=83) @@
31
        <?php endif ?>
32
    </header>
33
34
    <?php if ($posts): ?>
35
        <?php foreach ($posts as $post) : ?>
36
            <article class="hentry">
37
                <header class="entry-header">
38
                    <h2 class="entry-title"><?= Html::a(Html::encode($post->title), $post->url) ?></h2>
39
40
                    <?php $updated = new \DateTime($post->modified, new DateTimeZone(Yii::$app->timeZone)) ?>
41
                    <div class="entry-meta">
42
                        <span class="entry-date">
43
                            <a rel="bookmark" href="<?= $post->url ?>">
44
                                <time datetime="<?= $updated->format('c') ?>" class="entry-date">
45
                                    <?= Yii::$app->formatter->asDate($post->date) ?>
46
                                </time>
47
                            </a>
48
                        </span>
49
                        <span class="byline">
50
                            <span class="author vcard">
51
                                <a rel="author" href="<?= $post->postAuthor->url ?>"
52
                                   class="url fn"><?= $post->postAuthor->display_name ?>
53
                                </a>
54
                            </span>
55
                        </span>
56
                        <span class="comments-link">
57
                            <a title="<?= Yii::t(
58
                                'writesdown',
59
                                'Comment on {post}',
60
                                ['post' => $post->title]
61
                            ) ?>" href="<?= $post->url ?>#respond"><?= Yii::t('writesdown', 'Leave a comment') ?></a>
62
                        </span>
63
                    </div>
64
                </header>
65
66
                <div class="media">
67
                    <?php $image = $post->getMedia()->where(['like', 'mime_type', 'image/'])->one() ?>
68
69
                    <?php if ($image): ?>
70
                        <?= Html::a($image->getThumbnail(
71
                            'thumbnail',
72
                            ['class' => 'post-thumbnail']),
73
                            $post->url, ['class' => 'media-left entry-thumbnail']
74
                        ) ?>
75
                    <?php endif ?>
76
77
                    <div class="media-body">
78
                        <p class="entry-summary">
79
                            <?= $post->excerpt ?>...
80
81
                        </p>
82
                        <footer class="footer-meta">
83
                            <?php $tags = $post->getTerms()
84
                                ->innerJoinWith([
85
                                    'taxonomy' => function ($query) {
86
                                        /** @var $query \yii\db\ActiveQuery */
87
                                        return $query->from(['taxonomy' => Taxonomy::tableName()]);
88
                                    },
89
                                ])
90
                                ->where(['taxonomy.name' => 'tag'])
91
                                ->all() ?>
92
93
                            <?php if ($tags): ?>
94
                                <h3>
95
                                    <?php foreach ($tags as $tag): ?>
96
                                        <?= Html::a($tag->name, $tag->url, ['class' => 'badge']) . "\n" ?>
97
                                    <?php endforeach ?>
98
                                </h3>
99
                            <?php endif ?>
100
101
                        </footer>
102
                    </div>
103
                </div>
104
            </article>
105
        <?php endforeach ?>
106
        <nav id="archive-pagination">
107
            <?= LinkPager::widget([
108
                'pagination' => $pages,
109
                'activePageCssClass' => 'active',
110
                'disabledPageCssClass' => 'disabled',
111
                'options' => ['class' => 'pagination'],
112
            ]);
113
            ?>
114
        </nav>
115
    <?php endif ?>
116
117
</div>
118

themes/writesdown/term/view-tag.php 1 location

@@ 34-116 (lines=83) @@
31
        <?php endif ?>
32
    </header>
33
34
    <?php if ($posts): ?>
35
        <?php foreach ($posts as $post) : ?>
36
            <article class="hentry">
37
                <header class="entry-header">
38
                    <h2 class="entry-title"><?= Html::a(Html::encode($post->title), $post->url) ?></h2>
39
40
                    <?php $updated = new \DateTime($post->modified, new DateTimeZone(Yii::$app->timeZone)) ?>
41
                    <div class="entry-meta">
42
                        <span class="entry-date">
43
                            <a rel="bookmark" href="<?= $post->url ?>">
44
                                <time datetime="<?= $updated->format('c') ?>" class="entry-date">
45
                                    <?= Yii::$app->formatter->asDate($post->date) ?>
46
                                </time>
47
                            </a>
48
                        </span>
49
                        <span class="byline">
50
                            <span class="author vcard">
51
                                <a rel="author" href="<?= $post->postAuthor->url ?>"
52
                                   class="url fn"><?= $post->postAuthor->display_name ?>
53
                                </a>
54
                            </span>
55
                        </span>
56
                        <span class="comments-link">
57
                            <a title="<?= Yii::t(
58
                                'writesdown',
59
                                'Comment on {post}',
60
                                ['post' => $post->title]
61
                            ) ?>" href="<?= $post->url ?>#respond"><?= Yii::t('writesdown', 'Leave a comment') ?></a>
62
                        </span>
63
                    </div>
64
                </header>
65
66
                <div class="media">
67
                    <?php $image = $post->getMedia()->where(['like', 'mime_type', 'image/'])->one() ?>
68
69
                    <?php if ($image): ?>
70
                        <?= Html::a($image->getThumbnail(
71
                            'thumbnail',
72
                            ['class' => 'post-thumbnail']),
73
                            $post->url, ['class' => 'media-left entry-thumbnail']
74
                        ) ?>
75
                    <?php endif ?>
76
77
                    <div class="media-body">
78
                        <p class="entry-summary">
79
                            <?= $post->excerpt ?>...
80
81
                        </p>
82
                        <footer class="footer-meta">
83
                            <?php $tags = $post->getTerms()
84
                                ->innerJoinWith([
85
                                    'taxonomy' => function ($query) {
86
                                        /** @var $query \yii\db\ActiveQuery */
87
                                        return $query->from(['taxonomy' => Taxonomy::tableName()]);
88
                                    },
89
                                ])
90
                                ->where(['taxonomy.name' => 'tag'])
91
                                ->all() ?>
92
93
                            <?php if ($tags): ?>
94
                                <h3>
95
                                    <?php foreach ($tags as $tag): ?>
96
                                        <?= Html::a($tag->name, $tag->url, ['class' => 'badge']) . "\n" ?>
97
                                    <?php endforeach ?>
98
                                </h3>
99
                            <?php endif ?>
100
101
                        </footer>
102
                    </div>
103
                </div>
104
            </article>
105
        <?php endforeach ?>
106
        <nav id="archive-pagination">
107
            <?= LinkPager::widget([
108
                'pagination' => $pages,
109
                'activePageCssClass' => 'active',
110
                'disabledPageCssClass' => 'disabled',
111
                'options' => ['class' => 'pagination'],
112
            ]);
113
            ?>
114
        </nav>
115
    <?php endif ?>
116
117
</div>
118

themes/writesdown/term/view.php 1 location

@@ 34-116 (lines=83) @@
31
        <?php endif ?>
32
    </header>
33
34
    <?php if ($posts): ?>
35
        <?php foreach ($posts as $post) : ?>
36
            <article class="hentry">
37
                <header class="entry-header">
38
                    <h2 class="entry-title"><?= Html::a(Html::encode($post->title), $post->url) ?></h2>
39
40
                    <?php $updated = new \DateTime($post->modified, new DateTimeZone(Yii::$app->timeZone)) ?>
41
                    <div class="entry-meta">
42
                        <span class="entry-date">
43
                            <a rel="bookmark" href="<?= $post->url ?>">
44
                                <time datetime="<?= $updated->format('c') ?>" class="entry-date">
45
                                    <?= Yii::$app->formatter->asDate($post->date) ?>
46
                                </time>
47
                            </a>
48
                        </span>
49
                        <span class="byline">
50
                            <span class="author vcard">
51
                                <a rel="author" href="<?= $post->postAuthor->url ?>"
52
                                   class="url fn"><?= $post->postAuthor->display_name ?>
53
                                </a>
54
                            </span>
55
                        </span>
56
                        <span class="comments-link">
57
                            <a title="<?= Yii::t(
58
                                'writesdown',
59
                                'Comment on {post}',
60
                                ['post' => $post->title]
61
                            ) ?>" href="<?= $post->url ?>#respond"><?= Yii::t('writesdown', 'Leave a comment') ?></a>
62
                        </span>
63
                    </div>
64
                </header>
65
66
                <div class="media">
67
                    <?php $image = $post->getMedia()->where(['like', 'mime_type', 'image/'])->one() ?>
68
69
                    <?php if ($image): ?>
70
                        <?= Html::a($image->getThumbnail(
71
                            'thumbnail',
72
                            ['class' => 'post-thumbnail']),
73
                            $post->url, ['class' => 'media-left entry-thumbnail']
74
                        ) ?>
75
                    <?php endif ?>
76
77
                    <div class="media-body">
78
                        <p class="entry-summary">
79
                            <?= $post->excerpt ?>...
80
81
                        </p>
82
                        <footer class="footer-meta">
83
                            <?php $tags = $post->getTerms()
84
                                ->innerJoinWith([
85
                                    'taxonomy' => function ($query) {
86
                                        /** @var $query \yii\db\ActiveQuery */
87
                                        return $query->from(['taxonomy' => Taxonomy::tableName()]);
88
                                    },
89
                                ])
90
                                ->where(['taxonomy.name' => 'tag'])
91
                                ->all() ?>
92
93
                            <?php if ($tags): ?>
94
                                <h3>
95
                                    <?php foreach ($tags as $tag): ?>
96
                                        <?= Html::a($tag->name, $tag->url, ['class' => 'badge']) . "\n" ?>
97
                                    <?php endforeach ?>
98
                                </h3>
99
                            <?php endif ?>
100
101
                        </footer>
102
                    </div>
103
                </div>
104
            </article>
105
        <?php endforeach ?>
106
        <nav id="archive-pagination">
107
            <?= LinkPager::widget([
108
                'pagination' => $pages,
109
                'activePageCssClass' => 'active',
110
                'disabledPageCssClass' => 'disabled',
111
                'options' => ['class' => 'pagination'],
112
            ]);
113
            ?>
114
        </nav>
115
    <?php endif ?>
116
117
</div>
118

themes/writesdown/user/view.php 1 location

@@ 32-114 (lines=83) @@
29
30
    </header>
31
32
    <?php if ($posts): ?>
33
        <?php foreach ($posts as $post) : ?>
34
            <article class="hentry">
35
                <header class="entry-header">
36
                    <h2 class="entry-title"><?= Html::a(Html::encode($post->title), $post->url) ?></h2>
37
38
                    <?php $updated = new \DateTime($post->modified, new DateTimeZone(Yii::$app->timeZone)) ?>
39
                    <div class="entry-meta">
40
                        <span class="entry-date">
41
                            <a rel="bookmark" href="<?= $post->url ?>">
42
                                <time datetime="<?= $updated->format('c') ?>" class="entry-date">
43
                                    <?= Yii::$app->formatter->asDate($post->date) ?>
44
                                </time>
45
                            </a>
46
                        </span>
47
                        <span class="byline">
48
                            <span class="author vcard">
49
                                <a rel="author" href="<?= $post->postAuthor->url ?>"
50
                                   class="url fn"><?= $post->postAuthor->display_name ?>
51
                                </a>
52
                            </span>
53
                        </span>
54
                        <span class="comments-link">
55
                            <a title="<?= Yii::t(
56
                                'writesdown', 'Comment on {post}',
57
                                ['post' => $post->title]
58
                            ) ?>" href="<?= $post->url ?>#respond"><?= Yii::t('writesdown', 'Leave a comment') ?></a>
59
                        </span>
60
                    </div>
61
                </header>
62
                <div class="media">
63
                    <?php $image = $post->getMedia()->where(['like', 'mime_type', 'image/'])->one() ?>
64
65
                    <?php if ($image): ?>
66
                        <?= Html::a($image->getThumbnail(
67
                            'thumbnail',
68
                            ['class' => 'post-thumbnail']),
69
                            $post->url,
70
                            ['class' => 'media-left entry-thumbnail']
71
                        ) ?>
72
                    <?php endif ?>
73
74
                    <div class="media-body">
75
                        <p class="entry-summary">
76
                            <?= $post->excerpt ?>...
77
78
                        </p>
79
80
                        <footer class="footer-meta">
81
                            <?php $tags = $post->getTerms()
82
                                ->innerJoinWith([
83
                                    'taxonomy' => function ($query) {
84
                                        /** @var $query \yii\db\ActiveQuery */
85
                                        return $query->from(['taxonomy' => Taxonomy::tableName()]);
86
                                    },
87
                                ])
88
                                ->where(['taxonomy.name' => 'tag'])
89
                                ->all() ?>
90
91
                            <?php if ($tags): ?>
92
                                <h3>
93
                                    <?php foreach ($tags as $tag): ?>
94
                                        <?= Html::a($tag->name, $tag->url, ['class' => 'badge']) . "\n" ?>
95
                                    <?php endforeach ?>
96
                                </h3>
97
                            <?php endif ?>
98
99
                        </footer>
100
                    </div>
101
                </div>
102
            </article>
103
        <?php endforeach ?>
104
        <nav id="archive-pagination">
105
            <?= LinkPager::widget([
106
                'pagination' => $pages,
107
                'activePageCssClass' => 'active',
108
                'disabledPageCssClass' => 'disabled',
109
                'options' => ['class' => 'pagination'],
110
            ]);
111
            ?>
112
        </nav>
113
    <?php endif ?>
114
115
</div>
116