Skip to content

Commit 23a1b8e

Browse files
committed
Fixed PHP 5.6 incompatibility
1 parent 4a72260 commit 23a1b8e

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# v2.0.2
2+
## 02/21/2019
3+
4+
1. [](#improved)
5+
* Fixed InitCommand spelling (#132, thanks @alex-mohemian)
6+
1. [](#bugfix)
7+
* Fixed PHP 5.6 incompatibility introduced by latest release.
8+
19
# v2.0.1
210
## 02/19/2019
311

blueprints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Git Sync
2-
version: 2.0.1
2+
version: 2.0.2
33
description: Allows to synchronize portions of Grav with Git Repositories (GitHub, BitBucket, GitLab)
44
icon: git
55
author:

classes/GitSync.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,23 @@ public function commit($message = '(Grav GitSync) Automatic Commit')
218218
if (defined('GRAV_CLI') && in_array($authorType, ['gravuser', 'gravfull'])) {
219219
$authorType = 'gituser';
220220
}
221-
221+
222+
// @TODO: After 1.6 it should be changed to `$configMessage ?? $message`
222223
// get message from config, it any, or stick to the default one
223-
$message = $this->getConfig('git', null)['message'] ?? $message;
224+
$configMessage = $this->getConfig('git', null)['message'];
225+
$message = $configMessage ? $configMessage : $message;
224226

225227
// get Page Title and Route from Post
226-
$pageTitle = $_POST['data']['header']['title']??'NO TITLE FOUND';
227-
$pageRoute = $_POST['data']['route']??'NO ROUTE FOUND';
228+
$uri = $this->grav['uri'];
229+
$page_title = $uri->post('data.header.title');
230+
$page_route = $uri->post('data.route');
231+
232+
$pageTitle = $page_title ? $page_title : 'NO TITLE FOUND';
233+
$pageRoute = $page_route ? $page_route : 'NO ROUTE FOUND';
228234

229235
// include page title and route in the message, if placeholders exist
230-
$message = str_replace( '{{pageTitle}}', $pageTitle, $message );
231-
$message = str_replace( '{{pageRoute}}', $pageRoute, $message );
236+
$message = str_replace('{{pageTitle}}', $pageTitle, $message);
237+
$message = str_replace('{{pageRoute}}', $pageRoute, $message);
232238

233239
switch ($authorType) {
234240
case 'gitsync':

0 commit comments

Comments
 (0)