From b1b0d6013d334777408cfe96179a643ece023ac2 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Wed, 28 Jun 2017 22:27:17 +0200 Subject: [PATCH] Plugin version --- bl-plugins/version/languages/en_US.json | 4 +-- bl-plugins/version/plugin.php | 43 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/bl-plugins/version/languages/en_US.json b/bl-plugins/version/languages/en_US.json index 1bcab5c5..0671a39a 100644 --- a/bl-plugins/version/languages/en_US.json +++ b/bl-plugins/version/languages/en_US.json @@ -1,7 +1,7 @@ { "plugin-data": { - "name": "About", - "description": "Little description about your site or yourself." + "name": "Version", + "description": "Show the current version and check for new updates" } } \ No newline at end of file diff --git a/bl-plugins/version/plugin.php b/bl-plugins/version/plugin.php index 0298c169..81198104 100644 --- a/bl-plugins/version/plugin.php +++ b/bl-plugins/version/plugin.php @@ -2,6 +2,49 @@ class pluginVersion extends Plugin { + public function adminHead() + { + $html = ''; + + return $html; + } + + public function adminBodyEnd() + { + global $ADMIN_CONTROLLER; + + $timeToCheck = time() + 10; + if( ($ADMIN_CONTROLLER=='dashboard') && (Session::get('timeToCheck')>$timeToCheck) ) { + //$versions = $this->getVersion(); + $versions = array('latest'=>'2.1'); + Session::set('timeToCheck', $timeToCheck); + Session::set('latestVersion', $versions['latest']); + } + + if( version_compare(Session::get('latestVersion'), BLUDIT_VERSION, '>') ) { + $html = '
New version available
'; + } else { + $html = '
Bludit v'.BLUDIT_VERSION.'Upgrade to Bludit PRO
'; + } + + return $html; + } + private function getVersion() { $url = 'https://version.bludit.com';