Skip to content

Commit

Permalink
Bugfix in composer.json, controllers and view
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-wdmg committed Jul 28, 2019
1 parent d718845 commit 5d3ac60
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=========

## 1.1.2 (2019-07-29)
* Bugfix in composer.json, controllers and view

## 1.1.1 (2019-07-28)
* Added support of redirects
* Fixing route detection
Expand Down
4 changes: 2 additions & 2 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Yii2 Pages
*
* @category Module
* @version 1.1.1
* @version 1.1.2
* @author Alexsander Vyshnyvetskyy <[email protected]>
* @link https://github.com/wdmg/yii2-pages
* @copyright Copyright (c) 2019 W.D.M.Group, Ukraine
Expand Down Expand Up @@ -46,7 +46,7 @@ class Module extends BaseModule
/**
* @var string the module version
*/
private $version = "1.1.1";
private $version = "1.1.2";

/**
* @var integer, priority of initialization
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ Use the `Module::dashboardNavItems()` method of the module to generate a navigat
?>

# Status and version [in progress development]
* v.1.1.2 - Bugfix in composer.json, controllers and view
* v.1.1.1 - Added support of redirects, fixing route detection and added sluggable behavior for aliases
* v.1.1.0 - Added routing functionality
* v.1.0.1 - Added default route and layout for rendered page
* v.1.1.0 - Added routing functionality
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": ["yii2", "yii2-pages", "static", "pages", "wdmg"],
"type": "yii2-extension",
"license": "MIT",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/wdmg/yii2-pages",
"support": {
"source": "https://github.com/wdmg/yii2-pages",
Expand All @@ -24,7 +24,7 @@
"yiisoft/yii2": "^2.0.20",
"wdmg/yii2-base": "^1.0.1",
"wdmg/yii2-selectinput": "^1.0.5",
"wdmg/yii2-editor": "^1.0.6",
"wdmg/yii2-editor": "^1.0.6"
},
"minimum-stability": "dev",
"autoload": {
Expand Down
6 changes: 4 additions & 2 deletions controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ public function actionIndex($page, $route = null)
{

// Check probably need redirect to new page URL
if (Yii::$app->redirects->check(Yii::$app->request->getUrl()))
return Yii::$app->redirects->check(Yii::$app->request->getUrl());
if (isset(Yii::$app->redirects)) {
if (Yii::$app->redirects->check(Yii::$app->request->getUrl()))
return Yii::$app->redirects->check(Yii::$app->request->getUrl());
}

// Separate route from page alias from request URL
if (is_null($route) && preg_match('/^([\/]+[A-Za-z0-9_\-\_\/]+[\/])*([A-Za-z0-9_\-\_]*)/i', Yii::$app->request->url,$matches)) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function actionUpdate($id)
if($model->save()) {

// Set 301-redirect from old URL to new
if (($oldPageUrl !== $newPageUrl) && ($model->status == $model::PAGE_STATUS_PUBLISHED)) {
if (isset(Yii::$app->redirects) && ($oldPageUrl !== $newPageUrl) && ($model->status == $model::PAGE_STATUS_PUBLISHED)) {
// @TODO: remove old redirects
Yii::$app->redirects->set('pages', $oldPageUrl, $newPageUrl, 301);
}
Expand Down
2 changes: 1 addition & 1 deletion views/default/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* @var $this yii\web\View */
/* @var $model wdmg\pages\models\Pages */

if (empty($model->title))
if (!empty($model->title))
$this->title = $model->title;
else
$this->title = $model->name;
Expand Down

0 comments on commit 5d3ac60

Please sign in to comment.