diff --git a/LICENSE b/LICENSE index ef1f044..e68ad2d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2014 HimikLab - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +The MIT License (MIT) + +Copyright (c) 2014 HimikLab + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 925e0a5..67cb4e5 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,94 @@ -XML Sitemap Module for Yii2 -======================== -Yii2 module for automatically generation [XML Sitemap](http://www.sitemaps.org/protocol.html). - -Installation ------------- -The preferred way to install this extension is through [composer](http://getcomposer.org/download/). - -* Either run - -``` -php composer.phar require "himiklab/yii2-sitemap-module" "*" -``` - -or add - -```json -"himiklab/yii2-sitemap-module" : "*" -``` - -to the require section of your application's `composer.json` file. - -* Configure the `cache` component of your application's configuration file, for example: - -```php -'components' => [ - ... - 'cache' => [ - 'class' => 'yii\caching\FileCache', - ], - ... -] -``` - -* Add a new module in `modules` section of your application's configuration file. - -```php -'modules' => [ - ... - 'sitemap' => [ - 'class' => 'himiklab\sitemap\Sitemap', - 'models' => [ - 'app\modules\page\models\Page', - 'app\modules\news\models\News', - ... - ], - 'urls'=> [ - [ - 'loc'=>'/news/index', - 'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY, - 'priority' => 0.8 - ], - ], - 'enableGzip' => true, - ], - ... -], -``` - -* Add behavior in the AR models: - -```php -use himiklab\sitemap\SitemapBehavior; - -public function behaviors() -{ - return [ - 'sitemap' => [ - 'class' => SitemapBehavior::className(), - 'dataClosure' => function ($model) { - /** @var self $model */ - return [ - 'loc' => Url::to(model->url, true), - 'lastmod' => strtotime($model->lastmod), - 'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY, - 'priority' => 0.8 - ]; - } - ], - ]; -} -``` - -* Add a new rule for `urlManager` of your application's configuration file. - -```php -'urlManager' => [ - 'rules' => [ - '/' => 'sitemap/default/index', - ... - ], - ... -], -``` +XML Sitemap Module for Yii2 +======================== +Yii2 module for automatically generation [XML Sitemap](http://www.sitemaps.org/protocol.html). + +Installation +------------ +The preferred way to install this extension is through [composer](http://getcomposer.org/download/). + +* Either run + +``` +php composer.phar require "himiklab/yii2-sitemap-module" "*" +``` + +or add + +```json +"himiklab/yii2-sitemap-module" : "*" +``` + +to the require section of your application's `composer.json` file. + +* Configure the `cache` component of your application's configuration file, for example: + +```php +'components' => [ + ... + 'cache' => [ + 'class' => 'yii\caching\FileCache', + ], + ... +] +``` + +* Add a new module in `modules` section of your application's configuration file. + +```php +'modules' => [ + ... + 'sitemap' => [ + 'class' => 'himiklab\sitemap\Sitemap', + 'models' => [ + 'app\modules\page\models\Page', + 'app\modules\news\models\News', + ... + ], + 'urls'=> [ + [ + 'loc'=>'/news/index', + 'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY, + 'priority' => 0.8 + ], + ], + 'enableGzip' => true, + ], + ... +], +``` + +* Add behavior in the AR models: + +```php +use himiklab\sitemap\SitemapBehavior; + +public function behaviors() +{ + return [ + 'sitemap' => [ + 'class' => SitemapBehavior::className(), + 'dataClosure' => function ($model) { + /** @var self $model */ + return [ + 'loc' => Url::to(model->url, true), + 'lastmod' => strtotime($model->lastmod), + 'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY, + 'priority' => 0.8 + ]; + } + ], + ]; +} +``` + +* Add a new rule for `urlManager` of your application's configuration file. + +```php +'urlManager' => [ + 'rules' => [ + '/' => 'sitemap/default/index', + ... + ], + ... +], +``` diff --git a/Sitemap.php b/Sitemap.php index 158a1c1..e4e350a 100644 --- a/Sitemap.php +++ b/Sitemap.php @@ -2,7 +2,7 @@ /** * @link https://github.com/himiklab/yii2-sitemap-module * @copyright Copyright (c) 2014 HimikLab - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT MIT */ namespace himiklab\sitemap; diff --git a/behaviors/SitemapBehavior.php b/behaviors/SitemapBehavior.php index 0c14589..8f321fb 100644 --- a/behaviors/SitemapBehavior.php +++ b/behaviors/SitemapBehavior.php @@ -2,7 +2,7 @@ /** * @link https://github.com/himiklab/yii2-sitemap-module * @copyright Copyright (c) 2014 HimikLab - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT MIT */ namespace himiklab\sitemap\behaviors; diff --git a/controllers/DefaultController.php b/controllers/DefaultController.php index bb99b3d..898b53a 100644 --- a/controllers/DefaultController.php +++ b/controllers/DefaultController.php @@ -2,7 +2,7 @@ /** * @link https://github.com/himiklab/yii2-sitemap-module * @copyright Copyright (c) 2014 HimikLab - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT MIT */ namespace himiklab\sitemap\controllers; diff --git a/views/default/index.php b/views/default/index.php index f6fc61a..2a6ba14 100644 --- a/views/default/index.php +++ b/views/default/index.php @@ -2,7 +2,7 @@ /** * @link https://github.com/himiklab/yii2-sitemap-module * @copyright Copyright (c) 2014 HimikLab - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT MIT * * @var array $urls */ @@ -24,4 +24,4 @@ - \ No newline at end of file +