Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
PSR-2 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
himiklab committed Sep 29, 2014
1 parent 5fc68b6 commit 37b5017
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 119 deletions.
40 changes: 20 additions & 20 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
188 changes: 94 additions & 94 deletions README.md
Original file line number Diff line number Diff line change
@@ -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' => [
'/<id:sitemap.xml>' => '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' => [
'/<id:sitemap.xml>' => 'sitemap/default/index',
...
],
...
],
```
2 changes: 1 addition & 1 deletion Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion behaviors/SitemapBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions views/default/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -24,4 +24,4 @@
<?php endif; ?>
</url>
<?php endforeach; ?>
</urlset>
</urlset>

0 comments on commit 37b5017

Please sign in to comment.