Skip to content

Commit

Permalink
Fixed PHP 5.6 incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
w00fz committed Feb 22, 2019
1 parent 4a72260 commit 23a1b8e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v2.0.2
## 02/21/2019

1. [](#improved)
* Fixed InitCommand spelling (#132, thanks @alex-mohemian)
1. [](#bugfix)
* Fixed PHP 5.6 incompatibility introduced by latest release.

# v2.0.1
## 02/19/2019

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Git Sync
version: 2.0.1
version: 2.0.2
description: Allows to synchronize portions of Grav with Git Repositories (GitHub, BitBucket, GitLab)
icon: git
author:
Expand Down
18 changes: 12 additions & 6 deletions classes/GitSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,23 @@ public function commit($message = '(Grav GitSync) Automatic Commit')
if (defined('GRAV_CLI') && in_array($authorType, ['gravuser', 'gravfull'])) {
$authorType = 'gituser';
}


// @TODO: After 1.6 it should be changed to `$configMessage ?? $message`
// get message from config, it any, or stick to the default one
$message = $this->getConfig('git', null)['message'] ?? $message;
$configMessage = $this->getConfig('git', null)['message'];
$message = $configMessage ? $configMessage : $message;

// get Page Title and Route from Post
$pageTitle = $_POST['data']['header']['title']??'NO TITLE FOUND';
$pageRoute = $_POST['data']['route']??'NO ROUTE FOUND';
$uri = $this->grav['uri'];
$page_title = $uri->post('data.header.title');
$page_route = $uri->post('data.route');

$pageTitle = $page_title ? $page_title : 'NO TITLE FOUND';
$pageRoute = $page_route ? $page_route : 'NO ROUTE FOUND';

// include page title and route in the message, if placeholders exist
$message = str_replace( '{{pageTitle}}', $pageTitle, $message );
$message = str_replace( '{{pageRoute}}', $pageRoute, $message );
$message = str_replace('{{pageTitle}}', $pageTitle, $message);
$message = str_replace('{{pageRoute}}', $pageRoute, $message);

switch ($authorType) {
case 'gitsync':
Expand Down

0 comments on commit 23a1b8e

Please sign in to comment.