adding auto updater

This commit is contained in:
Holger 2014-12-23 15:54:43 +01:00
parent 9b045edeb6
commit 29692fa0fa
58 changed files with 74 additions and 227 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -52,3 +52,6 @@ require get_template_directory() . '/inc/jetpack.php';
* Load custom WordPress nav walker.
*/
require get_template_directory() . '/inc/bootstrap-wp-navwalker.php';
require_once('inc/wp-updates-theme.php');
new WPUpdatesThemeUpdater_1114( 'http://wp-updates.com/api/2/theme', basename( get_template_directory() ) );

68
inc/wp-updates-theme.php Normal file
View File

@ -0,0 +1,68 @@
<?php
/*
WPUpdates Theme Updater Class
http://wp-updates.com
v2.0
Example Usage:
require_once('wp-updates-theme.php');
new WPUpdatesThemeUpdater_1114( 'http://wp-updates.com/api/2/theme', basename(get_template_directory()) );
*/
if( !class_exists('WPUpdatesThemeUpdater_1114') ) {
class WPUpdatesThemeUpdater_1114 {
var $api_url;
var $theme_id = 1114;
var $theme_slug;
var $license_key;
function __construct( $api_url, $theme_slug, $license_key = null ) {
$this->api_url = $api_url;
$this->theme_slug = $theme_slug;
$this->license_key = $license_key;
add_filter( 'pre_set_site_transient_update_themes', array(&$this, 'check_for_update') );
// This is for testing only!
//set_site_transient('update_themes', null);
}
function check_for_update( $transient ) {
if (empty($transient->checked)) return $transient;
$request_args = array(
'id' => $this->theme_id,
'slug' => $this->theme_slug,
'version' => $transient->checked[$this->theme_slug]
);
if ($this->license_key) $request_args['license'] = $this->license_key;
$request_string = $this->prepare_request( 'theme_update', $request_args );
$raw_response = wp_remote_post( $this->api_url, $request_string );
$response = null;
if( !is_wp_error($raw_response) && ($raw_response['response']['code'] == 200) )
$response = unserialize($raw_response['body']);
if( !empty($response) ) // Feed the update data into WP updater
$transient->response[$this->theme_slug] = $response;
return $transient;
}
function prepare_request( $action, $args ) {
global $wp_version;
return array(
'body' => array(
'action' => $action,
'request' => serialize($args),
'api-key' => md5(home_url())
),
'user-agent' => 'WordPress/'. $wp_version .'; '. home_url()
);
}
}
}

0
sass/jasny-offcanvas/_alerts-fixed.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/_button-labels.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/_fileinput.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/_grid-container-smooth.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/_nav-tab-alignment.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/_navmenu.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/_offcanvas.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/_rowlink.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/_variables.scss Executable file → Normal file
View File

0
sass/jasny-offcanvas/jasny-bootstrap.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/_mixins.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/_theme.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/owl.animate.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/owl.autoheight.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/owl.carousel.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/owl.lazyload.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/owl.theme.default.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/owl.theme.green.scss Executable file → Normal file
View File

0
sass/owlcarousel-slider/owl.video.scss Executable file → Normal file
View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

0
sass/underscores/_reset.scss Executable file → Normal file
View File

0
sass/underscores/elements/_elements.scss Executable file → Normal file
View File

0
sass/underscores/elements/_lists.scss Executable file → Normal file
View File

0
sass/underscores/elements/_tables.scss Executable file → Normal file
View File

0
sass/underscores/forms/_buttons.scss Executable file → Normal file
View File

0
sass/underscores/forms/_fields.scss Executable file → Normal file
View File

0
sass/underscores/forms/_forms.scss Executable file → Normal file
View File

0
sass/underscores/layout/_content-sidebar.scss Executable file → Normal file
View File

0
sass/underscores/layout/_sidebar-content.scss Executable file → Normal file
View File

0
sass/underscores/media/_captions.scss Executable file → Normal file
View File

0
sass/underscores/media/_galleries.scss Executable file → Normal file
View File

0
sass/underscores/media/_media.scss Executable file → Normal file
View File

0
sass/underscores/mixins/_mixins-master.scss Executable file → Normal file
View File

0
sass/underscores/modules/_accessibility.scss Executable file → Normal file
View File

0
sass/underscores/modules/_alignments.scss Executable file → Normal file
View File

0
sass/underscores/modules/_clearings.scss Executable file → Normal file
View File

0
sass/underscores/modules/_infinite-scroll.scss Executable file → Normal file
View File

0
sass/underscores/navigation/_links.scss Executable file → Normal file
View File

0
sass/underscores/navigation/_menus.scss Executable file → Normal file
View File

0
sass/underscores/navigation/_navigation.scss Executable file → Normal file
View File

0
sass/underscores/site/_site.scss Executable file → Normal file
View File

0
sass/underscores/site/primary/_asides.scss Executable file → Normal file
View File

0
sass/underscores/site/primary/_comments.scss Executable file → Normal file
View File

0
sass/underscores/site/primary/_posts-and-pages.scss Executable file → Normal file
View File

0
sass/underscores/site/secondary/_widgets.scss Executable file → Normal file
View File

0
sass/underscores/typography/_copy.scss Executable file → Normal file
View File

0
sass/underscores/typography/_headings.scss Executable file → Normal file
View File

0
sass/underscores/typography/_typography.scss Executable file → Normal file
View File

0
sass/underscores/variables-site/_colors.scss Executable file → Normal file
View File

0
sass/underscores/variables-site/_structure.scss Executable file → Normal file
View File

0
sass/underscores/variables-site/_typography.scss Executable file → Normal file
View File

0
sass/underscores/variables-site/_variables-site.scss Executable file → Normal file
View File

View File

@ -4,10 +4,11 @@ Theme URI: http://holgerkoenemann.de/understrap
Author: Holger Koenemann
Author URI: http://www.holgerkoenemann.de
Description: Combination of Automattic´s _s theme and Bootstrap SASS
Version: 0.2
Version: 0.2.6
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: understrap
Details URI: http://example.com/my-theme-changelog.html
*/
/*This file is just used to identify the theme in wordpress. The compiles CSS output can be found in /css/theme.css