Skip to content

Commit

Permalink
Enhanced Github Updater Class
Browse files Browse the repository at this point in the history
v1.3.9
Included added date form Github repo response.
  • Loading branch information
monecchi committed Dec 16, 2017
1 parent 571b4f9 commit 7d2900d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
15 changes: 10 additions & 5 deletions git-updater.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* How To Deploy WordPress Plugins With GitHub Using Transients
* @see https://www.smashingmagazine.com/2015/08/deploy-wordpress-plugins-with-github-using-transients/#writing-the-code-for-our-filters [<description>]
* @see https://www.smashingmagazine.com/2015/08/deploy-wordpress-plugins-with-github-using-transients/#writing-the-code-for-our-filters [<description>]
*/
class Smashing_Updater {
class Github_Updater {

private $file;

Expand Down Expand Up @@ -115,16 +115,21 @@ public function plugin_popup( $result, $action, $args ) {

$this->get_repository_info(); // Get our repo info

date_default_timezone_set('America/Sao_Paulo');

$date_added = new DateTime( $this->github_response['created_at'] ); // convert UNIX timestamp to PHP DateTime
$date_added->format('Y-m-d'); // output = 2017-12-15

// Set it to an array
$plugin = array(
'name' => $this->plugin["Name"],
'slug' => $this->basename,
'requires' => '3.3.8',
'tested' => '3.3.5',
'requires' => '4.5.2',
'tested' => '4.9.1',
'rating' => '100.0',
'num_ratings' => '10823',
'downloaded' => '14249',
'added' => '2017-12-15',
'added' => $date_added, //'2017-12-15',
'version' => $this->github_response['tag_name'],
'author' => $this->plugin["AuthorName"],
'author_profile' => $this->plugin["AuthorURI"],
Expand Down
9 changes: 4 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: Foodstack Framework
Plugin URI: https://github.com/monecchi/FoodStack-Framework
Description: Derived from Ebor Framework by TommusRhodus Theme, this alternate version was specially crafted for WooCommerce Restaurant & Food Store websites
Version: 1.3.8
Version: 1.3.9
Author: Adriano Monecchi
Author URI: http://www.plandesign.com.br/
License: GPL2
Expand All @@ -17,7 +17,7 @@
* Plugin definitions
*/
define( 'EBOR_FRAMEWORK_PATH', trailingslashit(plugin_dir_path(__FILE__)) );
define( 'EBOR_FRAMEWORK_VERSION', '1.3.8');
define( 'EBOR_FRAMEWORK_VERSION', '1.3.9');

/**
* Styles & Scripts
Expand Down Expand Up @@ -86,13 +86,12 @@ function ebor_ajax_import_data() {

/**
* Github updater class
* @see https://www.smashingmagazine.com/2015/08/deploy-wordpress-plugins-with-github-using-transients/#writing-the-code-for-our-filters
*/
if( ! class_exists( 'Smashing_Updater' ) ){
if( ! class_exists( 'Github_Updater' ) ) {
include_once( plugin_dir_path( __FILE__ ) . 'git-updater.php' );
}

$updater = new Smashing_Updater( __FILE__ );
$updater = new Github_Updater( __FILE__ );
$updater->set_username( 'monecchi' );
$updater->set_repository( 'FoodStack-Framework' );

Expand Down

0 comments on commit 7d2900d

Please sign in to comment.