Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first attempt to update from github repo

  • Loading branch information...
commit a96936fe2728537fc6fe13b402ce1dbd273f60f5 1 parent d593621
Kaiser authored
Showing with 63 additions and 2 deletions.
  1. +4 −0 .gitmodules
  2. +1 −0  inc/updater
  3. +58 −2 plugin-dirs.php
4 .gitmodules
View
@@ -0,0 +1,4 @@
+
+[submodule "inc/updater"]
+ path = inc/updater
+ url = git://github.com/franz-josef-kaiser/WordPress-GitHub-Plugin-Updater.git
1  inc/updater
@@ -0,0 +1 @@
+Subproject commit e18b83d4d2817bc8f8ba4df5e3c8142b8f4d4f2e
60 plugin-dirs.php
View
@@ -1,10 +1,10 @@
<?php
! defined( 'ABSPATH' ) AND exit();
/*
-Plugin Name: Additional Plugin Directories
+Plugin Name: Additional Plugin Directories 2
Plugin URI: http://github.com/chrisguitarguy
Description: A framework to allow adding additional plugin directories to WordPress
-Version: 0.9
+Version: 1.0
Author: Christopher Davis
Contributors: Franz Josef Kaiser, Julien Chaumond
Author URI: http://christopherdavis.me
@@ -107,6 +107,13 @@ public function __construct()
class_exists( $class ) AND add_action( 'plugins_loaded', array( $class, 'instance' ) );
}
+ if ( ! is_admin() )
+ return;
+
+ // Updates from GitHub
+ // $ git submodule add git://github.com/franz-josef-kaiser/WordPress-GitHub-Plugin-Updater inc/updater
+ add_action( 'admin_init', array( $this, 'update_from_github' ) );
+
// Better update message
$folder = basename( dirname( __FILE__ ) );
$file = basename( __FILE__ );
@@ -116,6 +123,55 @@ class_exists( $class ) AND add_action( 'plugins_loaded', array( $class, 'instanc
/**
+ *
+ * @since 1.0
+ *
+ * @return void
+ */
+ public function update_from_github()
+ {
+ if ( 'plugins.php' !== $GLOBALS['pagenow'] )
+ return;
+
+ global $wp_version;
+
+ // Load the updater
+ include_once plugin_dir_path( __FILE__ ).'inc/updater/updater.php';
+
+ // Fix this strange WP bug(?)
+ add_action( 'http_request_args', array( $this, 'update_request_args' ), 0, 2 );
+
+ $host = 'github.com';
+ $http = 'https://';
+ $name = 'franz-josef-kaiser';
+ $repo = 'WP-Plugin-Directories';
+ new wp_github_updater( array(
+ 'slug' => plugin_basename( __FILE__ )
+ ,'proper_folder_name' => dirname( plugin_basename(__FILE__) ) #plugin_basename( __FILE__ )
+ ,'api_url' => "{$http}api.{$host}/repos/{$name}/{$repo}"
+ ,'raw_url' => "{$http}raw.{$host}/{$name}/{$repo}/master"
+ ,'github_url' => "{$http}{$host}/{$name}/{$repo}"
+ ,'zip_url' => "{$http}{$host}/{$name}/{$repo}/zipball/master"
+ ,'sslverify' => true
+ ,'requires' => $wp_version
+ ,'tested' => $wp_version
+ ,'readme_file' => 'readme.md'
+ ) );
+ }
+
+
+ public function update_request_args( $args, $url )
+ {
+ // Only needed once - this saves us checking the $url
+ remove_filter( current_filter(), __FUNCTION__ );
+
+ return array_merge( $args, array(
+ 'sslverify' => false
+ ) );
+ }
+
+
+ /**
* Displays an update message for plugin list screens.
* Shows only the version updates from the current until the newest version
*
Please sign in to comment.
Something went wrong with that request. Please try again.