Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: akiraz2/yii2-blog
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3
Choose a base ref
...
head repository: akiraz2/yii2-blog
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 17 commits
  • 8 files changed
  • 5 contributors

Commits on Sep 21, 2018

  1. Update composer.json

    akiraz2 authored Sep 21, 2018
    Copy the full SHA
    39e246f View commit details
  2. Update composer.json

    akiraz2 authored Sep 21, 2018
    Copy the full SHA
    c608980 View commit details
  3. Update composer.json

    akiraz2 authored Sep 21, 2018
    Copy the full SHA
    fd9e087 View commit details
  4. Update composer.json

    akiraz2 authored Sep 21, 2018
    Copy the full SHA
    7b6089a View commit details

Commits on Oct 20, 2018

  1. Update issue templates

    akiraz2 committed Oct 20, 2018
    Copy the full SHA
    1590cb0 View commit details

Commits on Nov 3, 2018

  1. Update README.md

    akiraz2 authored Nov 3, 2018
    Copy the full SHA
    bd546d1 View commit details

Commits on May 13, 2019

  1. Update composer.json

    wirwolf authored May 13, 2019
    Copy the full SHA
    3fdd780 View commit details

Commits on May 22, 2019

  1. Copy the full SHA
    75aa4ed View commit details

Commits on May 23, 2019

  1. Merge pull request #13 from varp/master

    mount yii2-redactor module if the blog module enabled
    akiraz2 authored May 23, 2019
    Copy the full SHA
    dd61d68 View commit details

Commits on May 31, 2019

  1. Merge pull request #12 from wirwolf/patch-1

    Update composer.json
    akiraz2 authored May 31, 2019
    Copy the full SHA
    d7e8123 View commit details

Commits on Oct 12, 2019

  1. Add Brazilian portuguese language

    pt-BR
    gugoan committed Oct 12, 2019
    Copy the full SHA
    2c4b171 View commit details

Commits on Oct 26, 2019

  1. Merge pull request #14 from gugoan/master

    Add Brazilian portuguese language
    akiraz2 authored Oct 26, 2019
    Copy the full SHA
    aef5271 View commit details

Commits on Apr 13, 2020

  1. Allow iframes for popular video sites like YouTube

    HtmlPurifier needs extra elements to allow video iframes to be passed.
    moggiex authored Apr 13, 2020
    Copy the full SHA
    3781d5f View commit details

Commits on May 27, 2020

  1. Merge pull request #15 from moggiex/master

    Allow iframes for popular video sites like YouTube
    akiraz2 authored May 27, 2020
    Copy the full SHA
    7533e09 View commit details

Commits on Jan 22, 2021

  1. add info to readme, fix err

    akiraz2 committed Jan 22, 2021
    Copy the full SHA
    fd376d5 View commit details
  2. Update composer.json

    akiraz2 authored Jan 22, 2021
    Copy the full SHA
    2ed9d40 View commit details

Commits on Feb 10, 2021

  1. fix i18n, bug on missing user

    akiraz2 committed Feb 10, 2021
    Copy the full SHA
    5474adc View commit details
Showing with 222 additions and 25 deletions.
  1. +35 −0 .github/ISSUE_TEMPLATE/bug_report.md
  2. +17 −0 .github/ISSUE_TEMPLATE/feature_request.md
  3. +15 −11 Bootstrap.php
  4. +1 −1 Module.php
  5. +8 −3 README.md
  6. +48 −6 composer.json
  7. +92 −0 messages/pt-BR/blog.php
  8. +6 −4 views/frontend/default/view.php
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
26 changes: 15 additions & 11 deletions Bootstrap.php
Original file line number Diff line number Diff line change
@@ -37,24 +37,28 @@ public function bootstrap($app)
$app->i18n->translations['akiraz2/blog'] = [
'class' => PhpMessageSource::class,
'basePath' => __DIR__ . '/messages',
'forceTranslation' => true,
//'forceTranslation' => true,
'fileMap' => [
'akiraz2/blog' => 'blog.php',
]
];
}
// Add redactor module if not exist (in my case - only in backend)
$redactorModule = $this->getModule()->redactorModule;
if ($this->getModule()->getIsBackend() && !$app->hasModule($redactorModule)) {
$app->setModule($redactorModule, [
'class' => 'yii\redactor\RedactorModule',
'imageUploadRoute' => ['/blog/upload/image'],
'uploadDir' => $this->getModule()->imgFilePath . '/upload/',
'uploadUrl' => $this->getModule()->getImgFullPathUrl() . '/upload',
'imageAllowExtensions' => ['jpg', 'png', 'gif', 'svg']
]);

// Add redactor module if not exist (in my case - only in backend) and if the blog module enabled
if ($this->getModule()) {
$redactorModule = $this->getModule()->redactorModule;
if ($this->getModule()->getIsBackend() && !$app->hasModule($redactorModule)) {
$app->setModule($redactorModule, [
'class' => 'yii\redactor\RedactorModule',
'imageUploadRoute' => ['/blog/upload/image'],
'uploadDir' => $this->getModule()->imgFilePath . '/upload/',
'uploadUrl' => $this->getModule()->getImgFullPathUrl() . '/upload',
'imageAllowExtensions' => ['jpg', 'png', 'gif', 'svg']
]);
}
}


\Yii::setAlias('@akiraz2', \Yii::getAlias('@vendor') . '/akiraz2');
}
}
2 changes: 1 addition & 1 deletion Module.php
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ public function init()
$this->setViewPath('@akiraz2/blog/views/backend');
} else {
$this->setViewPath('@akiraz2/blog/views/frontend');
$this->setLayoutPath('@akiraz2/blog/views/frontend/layouts');
//$this->setLayoutPath('@akiraz2/blog/views/frontend/layouts');
}
}

11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -21,7 +21,8 @@ Yii2 Super Blog is simple, configured yii2 Module with frontend and backend, clo
* frontend and backend are translated (i18n)
* url rules with slug (for seo)

> **NOTE:** Module is in initial development. Anything may change at any time.
> **NOTE:** Module is in initial development. Anything may change at any time. Currently develop new version v2.0 with many improvements and for yii2basic template. @develop branch


# Table of Contents
@@ -41,22 +42,26 @@ The preferred way to install this extension is through [composer](http://getcomp
Either run

```
php composer.phar require --prefer-dist akiraz2/yii2-blog "dev-master"
php composer.phar require --prefer-dist akiraz2/yii2-blog "~1.3"
```

or add

```
"akiraz2/yii2-blog": "dev-master"
"akiraz2/yii2-blog": "~1.3"
```

to the require section of your `composer.json` file.

> ** Note ** If you got composer Error `it does not match your minimum-stability`, please change your composer settings to `"minimum-stability": "dev",`
## Configuration

By default, all images from Imperavi-widget module are uploaded to dir `@frontend/web/img/blog/upload`.
Be sure, this directory is created manually with proper file permissions (chmod).

Add `'bootstrap' => [\akiraz2\blog\Bootstrap::class],` to your config (common/config/main.php)

Config *common* modules in `common/config/main.php`

```php
54 changes: 48 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -24,22 +24,64 @@
"require": {
"yiisoft/yii2": "*",
"yiidoc/yii2-redactor": "*",
"yii-dream-team/yii2-upload-behavior": "dev-master",
"yii-dream-team/yii2-upload-behavior": "*",
"lesha724/yii2-math-captcha": "*",
"rmrevin/yii2-fontawesome": "~2.17"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/akiraz2/yii2-translateable"
"type": "package",
"package": {
"name": "yii-dream-team/yii2-upload-behavior",
"type": "yii2-extension",
"description": "Yii2 file/image upload behavior for ActiveRecord",
"keywords": [
"file",
"image",
"upload",
"behavior",
"resize",
"thumb"
],
"license": "MIT",
"homepage": "http://yiidreamteam.com/yii2/upload-behavior",
"authors": [
{
"name": "Alexey Samoylov",
"email": "alexey.samoylov@gmail.com",
"homepage": "http://yiidreamteam.com/team/alexey",
"role": "Developer"
}
],
"require": {
"php": ">=7.1.0",
"yiisoft/yii2": "*",
"masterexploder/phpthumb": "*"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/yii-dream-team/PHPThumb"
}
],
"autoload": {
"psr-4": {
"yiidreamteam\\upload\\": "./src"
}
},
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/akiraz2/yii2-upload-behavior",
"reference": "master"
}
}
}
],
"autoload": {
"psr-4": {
"akiraz2\\blog\\": ""
}
},
"extra": {
"bootstrap": "akiraz2\\blog\\Bootstrap"
}
"extra": {}
}
92 changes: 92 additions & 0 deletions messages/pt-BR/blog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yii message/extract' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
'Welcome to Blog Module' => 'Bem-vindo ao módulo blog',
'A comment has been added and is awaiting validation' => 'Um comentário foi adicionado e aguarda validação',
'Action not found' => 'Ação não encontrada',
'Actions' => 'Ações',
'Add Sub Catelog' => 'Adicionar Sub Catálogo',
'Add comments' => 'Adicionar Comentários',
'Are you sure you want to delete this item?' => 'Tem certeza de que deseja excluir este item?',
'Author' => 'Autor',
'Banner' => 'Banner',
'Blog' => 'Blog',
'Blog Category' => 'Categoria do blog',
'Blog Categorys' => 'Categorias de blog',
'Blog Comment' => 'Comentário do blog',
'Blog Comments' => 'Comentários do blog',
'Blog Post' => 'Postagem do blog',
'Blog Posts' => 'Postagens do blog',
'Blog Tag' => 'Tag',
'Blog Tags' => 'Tags',
'Brief' => 'Resumo',
'CONSTANT_NO' => 'CONSTANT_NO',
'CONSTANT_YES' => 'CONSTANT_YES',
'Category' => 'Categoria',
'Category ID' => 'ID da categoria',
'Click' => 'Clique',
'Comments' => 'Comentários',
'Comments Count' => 'Contagem de comentários',
'Confirm' => 'Confirmar',
'Content' => 'Conteúdo',
'Create' => 'Criar',
'Create ' => 'Criar ',
'Create Time' => 'Hora de criação',
'Created At' => 'Criado em',
'Delete' => 'Excluir',
'Email' => 'Email',
'Frequency' => 'Frequência',
'ID' => 'ID',
'Is Nav' => 'Navegação',
'Math, for example, 45-12 = 33' => 'Matemática, por exemplo, 45-12 = 33',
'NO' => 'NÃO',
'Name' => 'Nome',
'PAGE_TYPE_LIST' => 'PAGE_TYPE_LIST',
'PAGE_TYPE_PAGE' => 'PAGE_TYPE_PAGE',
'PROMPT_STATUS' => 'PROMPT_STATUS',
'Page Size' => 'Tamanho da página',
'Parent ID' => 'ID Pai',
'Please Filter' => 'Filtrar',
'Post ID' => 'ID da Postagem',
'Redirect Url' => 'URL de redirecionamento',
'Reset' => 'Resetar',
'Root Category' => 'Categoria raiz',
'STATUS_ACTIVE' => 'STATUS_ACTIVE',
'STATUS_DELETED' => 'STATUS_DELETED',
'STATUS_INACTIVE' => 'STATUS_INACTIVE',
'Search' => 'Pesquisa',
'Send' => 'Enviar',
'Slug' => 'Slug',
'Sort Order' => 'Classificação',
'Status' => 'Status',
'Successfully confirm' => 'Confirmado com sucesso',
'Successfully delete' => 'Excluído com sucesso',
'Tags' => 'Tags',
'Template' => 'Modelo',
'Title' => 'Título',
'Update' => 'Alterar',
'Update ' => 'Alterar ',
'Updated At' => 'Alterado em',
'Url' => 'Url',
'User ID' => 'ID do usuário',
'Verify code' => 'Verificar código',
'View' => 'Ver',
'Write comments' => 'Escrever comentárioй',
'YES' => 'SIM',
];
10 changes: 6 additions & 4 deletions views/frontend/default/view.php
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
?>
<div class="container">
<article class="blog-post" itemscope itemtype="http://schema.org/Article">
<meta itemprop="author" content="<?= $post_user->{$username_attribute}; ?>">
<meta itemprop="author" content="<?= $post_user ? $post_user->{$username_attribute} : ''; ?>">
<meta itemprop="dateModified" content="<?= date_format(date_timestamp_set(new DateTime(), $post->updated_at), 'c') ?>"/>
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="<?= $post->getAbsoluteUrl(); ?>"/>
<meta itemprop="commentCount" content="<?= $dataProvider->getTotalCount(); ?>">
@@ -83,9 +83,11 @@
</h1>

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