Permalink
Browse files

Moving back to official yii2-bootstrap4

  • Loading branch information...
Thoulah committed Jun 18, 2018
1 parent d426946 commit 9586fb7e0d1d10814fc048c68c10cb9880b36b5b
View
@@ -34,10 +34,6 @@
{
"type": "composer",
"url": "https://asset-packagist.org"
},
{
"type": "vcs",
"url": "https://github.com/simialbi/yii2-bootstrap4"
}
]
}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -73,7 +73,7 @@ public function actionLastfmWeeklyArtist(): int {
/**
* Retrieves and stores an Atom or RSS feed.
*/
public function actionWebfeed(string $type, string $name, string $url): int {
public function actionWebfeed(string $type, string $name, string $url, string $desc): int {
$count = 0;
$response = Webrequest::getUrl('', $url);
if (!$response->isOK) :
@@ -87,7 +87,7 @@ public function actionWebfeed(string $type, string $name, string $url): int {
$feedItem->feed = $name;
$feedItem->title = (string) trim(ArrayHelper::getValue($item, 'title'));
$feedItem->url = (string) ArrayHelper::getValue($item, $type === 'rss' ? 'link' : 'link.@attributes.href');
$feedItem->description = Yii::$app->formatter->cleanInput(ArrayHelper::getValue($item, $type === 'rss' ? 'description' : 'content'), false);
$feedItem->description = Yii::$app->formatter->cleanInput(ArrayHelper::getValue($item, $desc), false);
$feedItem->time = strtotime(ArrayHelper::getValue($item, 'pubDate') ?? ArrayHelper::getValue($item, 'updated'));
$feedItem->save();
@@ -3,7 +3,6 @@
use Yii;
use app\models\Webrequest;
use app\widgets\{Item, RecentTracks as RecentTracksWidget};
use yii\bootstrap4\Html;
use yii\helpers\ArrayHelper;
class RecentTracks extends \yii\db\ActiveRecord {
@@ -13,7 +13,7 @@
foreach ($article['comments'] as $comment) :
$lastUpdate = max($lastUpdate, $comment['created']);
endforeach;
Sitemap::lineItem($doc, ['permalink/articles', 'id' => $article->id], ['age' => $lastUpdate, 'locale' => true]);
Sitemap::lineItem($doc, ['articles/index', 'id' => $article->id, 'title' => $article->title], ['age' => $lastUpdate, 'locale' => true]);
if ($article['pdf']) :
Sitemap::lineItem($doc, ['articles/pdf', 'id' => $article->id, 'title' => $article->url], ['age' => $lastUpdate]);
endif;
@@ -18,9 +18,11 @@
$this->registerMetaTag(['name' => 'description', 'content' => Yii::$app->params['description']]);
$this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, shrink-to-fit=no']);
$this->registerLinkTag(['rel' => 'dns-prefetch', 'href' => Yii::getAlias('@assets')]);
if (Yii::$app->controller->id !== 'articles' || Yii::$app->controller->action->id !== 'index') :
$this->registerLinkTag(['rel' => 'canonical', 'href' => Url::current([], true)]);
endif;
$this->registerLinkTag(['rel' => 'canonical', 'href' => Url::current([], true)]);
$this->registerLinkTag(['rel' => 'alternate', 'href' => Url::current(['language' => ''], true), 'hreflang' => 'x-default']);
foreach (array_keys(Yii::$app->params['languages']) as $lng) :
$this->registerLinkTag(['rel' => 'alternate', 'href' => Url::current(['language' => $lng], true), 'hreflang' => $lng]);
endforeach;
$this->registerLinkTag(['rel' => 'alternate', 'href' => Url::to(['/feed/rss'], true), 'type' => 'application/rss+xml', 'title' => Yii::$app->name]);
$this->registerLinkTag(['rel' => 'icon', 'sizes' => '64x64 48x48 32x32 16x16', 'type' => 'image/x-icon', 'href' => Url::to('@assets/images/favicon.ico')]);
$this->registerLinkTag(['rel' => 'mask-icon', 'color' => Yii::$app->params['themeColor'], 'type' => 'image/x-icon', 'href' => Url::to('@assets/images/safari-pinned-tab.svg')]);
@@ -7,7 +7,7 @@ class RecentTracks extends Widget {
public $tracks;
public function run(): string {
return empty($this->tracks) ? Html::tag('div', 'No Items to Display.', ['class' => 'ml-2']) : self::renderFeed($this->tracks);
return empty($this->tracks) ? Html::tag('div', 'No Items to Display.', ['class' => 'ml-2']) : $this->renderFeed($this->tracks);
}
private function renderFeed(array $items): string {
@@ -11,7 +11,7 @@ class WeeklyArtistChart extends Widget {
public function run(): string {
$user = User::find()->where(['username' => $this->profile])->one();
$items = WeeklyArtist::find()->where(['userid' => $user->id])->orderBy('rank')->all();
return empty($items) ? Html::tag('div', 'No Items to Display.', ['class' => 'ml-2']) : self::renderFeed($items);
return empty($items) ? Html::tag('div', 'No Items to Display.', ['class' => 'ml-2']) : $this->renderFeed($items);
}
private function renderFeed(array $items): string {

0 comments on commit 9586fb7

Please sign in to comment.