Skip to content

Commit 5474adc

Browse files
committed
fix i18n, bug on missing user
1 parent 2ed9d40 commit 5474adc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Bootstrap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function bootstrap($app)
3737
$app->i18n->translations['akiraz2/blog'] = [
3838
'class' => PhpMessageSource::class,
3939
'basePath' => __DIR__ . '/messages',
40-
'forceTranslation' => true,
40+
//'forceTranslation' => true,
4141
'fileMap' => [
4242
'akiraz2/blog' => 'blog.php',
4343
]

views/frontend/default/view.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
?>
4343
<div class="container">
4444
<article class="blog-post" itemscope itemtype="http://schema.org/Article">
45-
<meta itemprop="author" content="<?= $post_user->{$username_attribute}; ?>">
45+
<meta itemprop="author" content="<?= $post_user ? $post_user->{$username_attribute} : ''; ?>">
4646
<meta itemprop="dateModified" content="<?= date_format(date_timestamp_set(new DateTime(), $post->updated_at), 'c') ?>"/>
4747
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="<?= $post->getAbsoluteUrl(); ?>"/>
4848
<meta itemprop="commentCount" content="<?= $dataProvider->getTotalCount(); ?>">
@@ -83,10 +83,10 @@
8383
</h1>
8484

8585
<div class="blog-post__content" itemprop="articleBody">
86-
<?php echo HtmlPurifier::process($post->content, [
87-
'HTML.AllowedElements' => 'iframe,p,strong,b,i,br,ul,ol,li',
86+
<?php echo \yii\helpers\HtmlPurifier::process($post->content, [
87+
'HTML.AllowedElements' => 'iframe,p,strong,b,i,br,ul,ol,li',
8888
"HTML.SafeIframe" => true,
89-
"URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/|api.soundcloud.com/tracks/|www.youtube-nocookie.com/embed/)%",
89+
"URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/|api.soundcloud.com/tracks/|www.youtube-nocookie.com/embed/)%",
9090
]); ?>
9191
</div>
9292
<?php if (isset($post->module->schemaOrg) && isset($post->module->schemaOrg['publisher'])) : ?>

0 commit comments

Comments
 (0)