Version Description
- 06/01/2017 =
- Fixed default class back
Download this release
Release Info
| Developer | codeinwp |
| Plugin | |
| Version | 3.0.2 |
| Comparing to | |
| See all releases | |
Code changes from version 3.0.1 to 3.0.2
- CHANGELOG.md +4 -2
- README.md +1 -1
- css/feedzy-rss-feeds.css +1 -1
- feedzy-rss-feed.php +1 -1
- includes/abstract/feedzy-rss-feeds-admin-abstract.php +3 -3
- includes/admin/feedzy-wp-widget.php +2 -1
- includes/feedzy-rss-feeds-i18n.php +3 -1
- includes/feedzy-rss-feeds.php +1 -1
- languages/feedzy-rss-feeds.pot +4 -4
- readme.txt +15 -1
- vendor/themeisle/inc/base.php +0 -111
- vendor/themeisle/inc/license.php +0 -633
- vendor/themeisle/inc/log.php +0 -76
- vendor/themeisle/load.php +0 -66
- vendor/themeisle/start.php +0 -4
CHANGELOG.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
| 2 |
-
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
-
Fixed html markup error
|
| 1 |
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
|
| 6 |
|
| 7 |
|
| 8 |
|
|
|
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
# Feedzy RSS Feeds Lite
|
| 2 |
-
[](https://codeclimate.com/github/Codeinwp/feedzy-rss-feeds)
|
| 4 |
[](https://codeclimate.com/github/Codeinwp/feedzy-rss-feeds)
|
| 5 |
|
| 1 |
# Feedzy RSS Feeds Lite
|
| 2 |
+
[](https://travis-ci.org/Codeinwp/feedzy-rss-feeds)
|
| 3 |
[](https://codeclimate.com/github/Codeinwp/feedzy-rss-feeds)
|
| 4 |
[](https://codeclimate.com/github/Codeinwp/feedzy-rss-feeds)
|
| 5 |
|
css/feedzy-rss-feeds.css
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
* feedzy-rss-feeds.css
|
| 3 |
* Feedzy RSS Feed
|
| 4 |
* Copyright: (c) 2016 Themeisle, themeisle.com
|
| 5 |
-
* Version: 3.0.
|
| 6 |
* Plugin Name: FEEDZY RSS Feeds
|
| 7 |
* Plugin URI: http://themeisle.com/plugins/feedzy-rss-feeds/
|
| 8 |
* Author: Themeisle
|
| 2 |
* feedzy-rss-feeds.css
|
| 3 |
* Feedzy RSS Feed
|
| 4 |
* Copyright: (c) 2016 Themeisle, themeisle.com
|
| 5 |
+
* Version: 3.0.2
|
| 6 |
* Plugin Name: FEEDZY RSS Feeds
|
| 7 |
* Plugin URI: http://themeisle.com/plugins/feedzy-rss-feeds/
|
| 8 |
* Author: Themeisle
|
feedzy-rss-feed.php
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
* Plugin Name: Feedzy RSS Feeds Lite
|
| 16 |
* Plugin URI: https://themeisle.com/plugins/feedzy-rss-feeds-lite/
|
| 17 |
* Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.
|
| 18 |
-
* Version: 3.0.
|
| 19 |
* Author: Themeisle
|
| 20 |
* Author URI: http://themeisle.com
|
| 21 |
* License: GPL-2.0+
|
| 15 |
* Plugin Name: Feedzy RSS Feeds Lite
|
| 16 |
* Plugin URI: https://themeisle.com/plugins/feedzy-rss-feeds-lite/
|
| 17 |
* Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.
|
| 18 |
+
* Version: 3.0.2
|
| 19 |
* Author: Themeisle
|
| 20 |
* Author URI: http://themeisle.com
|
| 21 |
* License: GPL-2.0+
|
includes/abstract/feedzy-rss-feeds-admin-abstract.php
CHANGED
|
@@ -515,16 +515,16 @@ abstract class Feedzy_Rss_Feeds_Admin_Abstract {
|
|
| 515 |
$contentThumb .= '<span class="fetched" style="background-image: url(' . $theThumbnail . ');" alt="' . $item->get_title() . '"></span>';
|
| 516 |
}
|
| 517 |
if ( $sc['thumb'] == 'yes' ) {
|
| 518 |
-
$contentThumb .= '<span style="background-image:url(' . $sc['default'] . ');" alt="' . $item->get_title() . '"></span>';
|
| 519 |
}
|
| 520 |
} else {
|
| 521 |
-
$contentThumb .= '<span style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px; background-image:url(' . $sc['default'] . ');" alt="' . $item->get_title() . '"></span>';
|
| 522 |
}
|
| 523 |
|
| 524 |
$contentThumb = apply_filters( 'feedzy_thumb_output', $contentThumb, $feedURL );
|
| 525 |
} else {
|
| 526 |
$contentThumb = '';
|
| 527 |
-
$contentThumb .= '<span style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px; background-image:url(' . $sc['default'] . ');" alt="' . $item->get_title() . '"></span>';
|
| 528 |
$contentThumb = apply_filters( 'feedzy_thumb_output', $contentThumb, $feedURL );
|
| 529 |
}
|
| 530 |
|
| 515 |
$contentThumb .= '<span class="fetched" style="background-image: url(' . $theThumbnail . ');" alt="' . $item->get_title() . '"></span>';
|
| 516 |
}
|
| 517 |
if ( $sc['thumb'] == 'yes' ) {
|
| 518 |
+
$contentThumb .= '<span class="default" style="background-image:url(' . $sc['default'] . ');" alt="' . $item->get_title() . '"></span>';
|
| 519 |
}
|
| 520 |
} else {
|
| 521 |
+
$contentThumb .= '<span class="default" style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px; background-image:url(' . $sc['default'] . ');" alt="' . $item->get_title() . '"></span>';
|
| 522 |
}
|
| 523 |
|
| 524 |
$contentThumb = apply_filters( 'feedzy_thumb_output', $contentThumb, $feedURL );
|
| 525 |
} else {
|
| 526 |
$contentThumb = '';
|
| 527 |
+
$contentThumb .= '<span class="default" style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px; background-image:url(' . $sc['default'] . ');" alt="' . $item->get_title() . '"></span>';
|
| 528 |
$contentThumb = apply_filters( 'feedzy_thumb_output', $contentThumb, $feedURL );
|
| 529 |
}
|
| 530 |
|
includes/admin/feedzy-wp-widget.php
CHANGED
|
@@ -16,8 +16,9 @@
|
|
| 16 |
* @subpackage feedzy-rss-feeds/includes/admin
|
| 17 |
* @author Themeisle <friends@themeisle.com>
|
| 18 |
*/
|
|
|
|
| 19 |
class feedzy_wp_widget extends WP_Widget {
|
| 20 |
-
|
| 21 |
/**
|
| 22 |
* The class instance.
|
| 23 |
*
|
| 16 |
* @subpackage feedzy-rss-feeds/includes/admin
|
| 17 |
* @author Themeisle <friends@themeisle.com>
|
| 18 |
*/
|
| 19 |
+
// @codingStandardsIgnoreStart
|
| 20 |
class feedzy_wp_widget extends WP_Widget {
|
| 21 |
+
// @codingStandardsIgnoreEnd
|
| 22 |
/**
|
| 23 |
* The class instance.
|
| 24 |
*
|
includes/feedzy-rss-feeds-i18n.php
CHANGED
|
@@ -23,8 +23,10 @@
|
|
| 23 |
* @subpackage feedzy-rss-feeds/includes
|
| 24 |
* @author Themeisle <friends@themeisle.com>
|
| 25 |
*/
|
| 26 |
-
class Feedzy_Rss_Feeds_i18n {
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
/**
|
| 30 |
* Load the plugin text domain for translation.
|
| 23 |
* @subpackage feedzy-rss-feeds/includes
|
| 24 |
* @author Themeisle <friends@themeisle.com>
|
| 25 |
*/
|
|
|
|
| 26 |
|
| 27 |
+
// @codingStandardsIgnoreStart
|
| 28 |
+
class Feedzy_Rss_Feeds_i18n {
|
| 29 |
+
// @codingStandardsIgnoreEnd
|
| 30 |
|
| 31 |
/**
|
| 32 |
* Load the plugin text domain for translation.
|
includes/feedzy-rss-feeds.php
CHANGED
|
@@ -69,7 +69,7 @@ class Feedzy_Rss_Feeds {
|
|
| 69 |
public function __construct() {
|
| 70 |
|
| 71 |
$this->plugin_name = 'feedzy-rss-feeds';
|
| 72 |
-
$this->version = '3.0.
|
| 73 |
|
| 74 |
$this->load_dependencies();
|
| 75 |
$this->set_locale();
|
| 69 |
public function __construct() {
|
| 70 |
|
| 71 |
$this->plugin_name = 'feedzy-rss-feeds';
|
| 72 |
+
$this->version = '3.0.2';
|
| 73 |
|
| 74 |
$this->load_dependencies();
|
| 75 |
$this->set_locale();
|
languages/feedzy-rss-feeds.pot
CHANGED
|
@@ -4,7 +4,7 @@ msgid ""
|
|
| 4 |
msgstr ""
|
| 5 |
"Project-Id-Version: Feedzy RSS Feeds Lite 3.0.1\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://github.com/Codeinwp/feedzy-rss-feeds/issues\n"
|
| 7 |
-
"POT-Creation-Date: 2017-01-
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
|
@@ -269,15 +269,15 @@ msgstr ""
|
|
| 269 |
msgid "Style 2"
|
| 270 |
msgstr ""
|
| 271 |
|
| 272 |
-
#: includes/admin/feedzy-wp-widget.php:
|
| 273 |
msgid "Feedzy RSS Feeds"
|
| 274 |
msgstr ""
|
| 275 |
|
| 276 |
-
#: includes/admin/feedzy-wp-widget.php:
|
| 277 |
msgid "Widget Title"
|
| 278 |
msgstr ""
|
| 279 |
|
| 280 |
-
#: includes/admin/feedzy-wp-widget.php:
|
| 281 |
msgid "Intro text"
|
| 282 |
msgstr ""
|
| 283 |
|
| 4 |
msgstr ""
|
| 5 |
"Project-Id-Version: Feedzy RSS Feeds Lite 3.0.1\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://github.com/Codeinwp/feedzy-rss-feeds/issues\n"
|
| 7 |
+
"POT-Creation-Date: 2017-01-06 10:05:03+00:00\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 269 |
msgid "Style 2"
|
| 270 |
msgstr ""
|
| 271 |
|
| 272 |
+
#: includes/admin/feedzy-wp-widget.php:48
|
| 273 |
msgid "Feedzy RSS Feeds"
|
| 274 |
msgstr ""
|
| 275 |
|
| 276 |
+
#: includes/admin/feedzy-wp-widget.php:92
|
| 277 |
msgid "Widget Title"
|
| 278 |
msgstr ""
|
| 279 |
|
| 280 |
+
#: includes/admin/feedzy-wp-widget.php:96
|
| 281 |
msgid "Intro text"
|
| 282 |
msgstr ""
|
| 283 |
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: themeisle,codeinwp
|
|
| 3 |
Tags: RSS, SimplePie, shortcode, feed, thumbnail, image, rss feeds, aggregator, tinyMCE, WYSIWYG, MCE, UI, flux, plugin, WordPress, widget, importer, XML, ATOM, API, parser
|
| 4 |
Requires at least: 3.7
|
| 5 |
Tested up to: 4.7
|
| 6 |
-
Stable tag:
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -30,6 +30,17 @@ The plugin uses the SimplePie php CLASS natively included in WordPress. SimplePi
|
|
| 30 |
|
| 31 |
FEEDZY RSS Feeds therefore supports any additional library and uses only the bare minimum to ensure good performance (minimalistic CSS + cache). This will ensure compatibility with any hosting provider that supports WordPress, but if for any reason it doesn't work for yours feel free to <a href="http://themeisle.com/contact/" rel="nofollow">contact us</a>.
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
You may use this plugin in your widgets and your pages and reuse the shortcode + widget several times within the same page.
|
| 34 |
|
| 35 |
By activating this plugin, your cover picture will be inserted into your RSS feeds. By doing so, you'll make it will easier for external sites to retrieve images from your feeds.
|
|
@@ -128,6 +139,9 @@ You have to check first if your feed is valid. Please test it here: https://vali
|
|
| 128 |
|
| 129 |
== Changelog ==
|
| 130 |
|
|
|
|
|
|
|
|
|
|
| 131 |
= 3.0.1 - 05/01/2017 =
|
| 132 |
* Fixed html markup error which was breaking user websites
|
| 133 |
|
| 3 |
Tags: RSS, SimplePie, shortcode, feed, thumbnail, image, rss feeds, aggregator, tinyMCE, WYSIWYG, MCE, UI, flux, plugin, WordPress, widget, importer, XML, ATOM, API, parser
|
| 4 |
Requires at least: 3.7
|
| 5 |
Tested up to: 4.7
|
| 6 |
+
Stable tag: trunk
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 30 |
|
| 31 |
FEEDZY RSS Feeds therefore supports any additional library and uses only the bare minimum to ensure good performance (minimalistic CSS + cache). This will ensure compatibility with any hosting provider that supports WordPress, but if for any reason it doesn't work for yours feel free to <a href="http://themeisle.com/contact/" rel="nofollow">contact us</a>.
|
| 32 |
|
| 33 |
+
|
| 34 |
+
= ** See how Feedzy can integrate with your website ** =
|
| 35 |
+
|
| 36 |
+
* [Shop feed – 2 columns layout](https://demo.themeisle.com/feedzy-rss-feeds/shop-feed/)
|
| 37 |
+
* [Large image square grid – 2 columns layout](https://demo.themeisle.com/feedzy-rss-feeds/2-columns-large-images-square-grid/)
|
| 38 |
+
* [Square grid template – 2 columns layout](https://demo.themeisle.com/feedzy-rss-feeds/square-template/)
|
| 39 |
+
* [Round grid templates – 2 columns layout](https://demo.themeisle.com/feedzy-rss-feeds/round-grid-template/)
|
| 40 |
+
* [Standard grid layout – 2 columns layout](https://demo.themeisle.com/feedzy-rss-feeds/grid-layout-feed-items/)
|
| 41 |
+
* [Blog layout – 1 column layout](https://demo.themeisle.com/feedzy-rss-feeds/blog-layout/)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
You may use this plugin in your widgets and your pages and reuse the shortcode + widget several times within the same page.
|
| 45 |
|
| 46 |
By activating this plugin, your cover picture will be inserted into your RSS feeds. By doing so, you'll make it will easier for external sites to retrieve images from your feeds.
|
| 139 |
|
| 140 |
== Changelog ==
|
| 141 |
|
| 142 |
+
= 3.0.2 - 06/01/2017 =
|
| 143 |
+
* Fixed default class back
|
| 144 |
+
|
| 145 |
= 3.0.1 - 05/01/2017 =
|
| 146 |
* Fixed html markup error which was breaking user websites
|
| 147 |
|
vendor/themeisle/inc/base.php
DELETED
|
@@ -1,111 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
if ( ! class_exists( "THEMEISLE_SDK" ) ) :
|
| 3 |
-
class THEMEISLE_SDK {
|
| 4 |
-
|
| 5 |
-
/**
|
| 6 |
-
* @var string $product_slug Should contain the product slug
|
| 7 |
-
*/
|
| 8 |
-
public $product_slug;
|
| 9 |
-
|
| 10 |
-
/**
|
| 11 |
-
* @var string $product_version Should contain the product version string
|
| 12 |
-
*/
|
| 13 |
-
public $product_version;
|
| 14 |
-
|
| 15 |
-
/**
|
| 16 |
-
* @var string $product_name Should contain the product name string
|
| 17 |
-
*/
|
| 18 |
-
public $product_name;
|
| 19 |
-
|
| 20 |
-
/**
|
| 21 |
-
* @var string $store_url Should contain the store url to check agains updates
|
| 22 |
-
*/
|
| 23 |
-
public $store_url;
|
| 24 |
-
|
| 25 |
-
/**
|
| 26 |
-
* @var string $store_name Should contain the store name to check agains updates
|
| 27 |
-
*/
|
| 28 |
-
public $store_name;
|
| 29 |
-
|
| 30 |
-
/**
|
| 31 |
-
* @var string $product_type Should contain the product type, either theme or plugin
|
| 32 |
-
*/
|
| 33 |
-
public $product_type;
|
| 34 |
-
|
| 35 |
-
/**
|
| 36 |
-
* @var bool $wordpress_available Either is available on wordpress or not
|
| 37 |
-
*/
|
| 38 |
-
public $wordpress_available;
|
| 39 |
-
|
| 40 |
-
/**
|
| 41 |
-
* @var bool $activation Either is requiring license activation or not
|
| 42 |
-
*/
|
| 43 |
-
public $paid;
|
| 44 |
-
|
| 45 |
-
/**
|
| 46 |
-
* @var bool $product_data Product metadata and basename file for plugins
|
| 47 |
-
*/
|
| 48 |
-
public $product_data;
|
| 49 |
-
|
| 50 |
-
public function __construct( $data = array() ) {
|
| 51 |
-
$data = $data["product_data"];
|
| 52 |
-
$args = wp_parse_args( $data, array(
|
| 53 |
-
'store_url' => '',
|
| 54 |
-
'store_name' => '',
|
| 55 |
-
'product_slug' => '',
|
| 56 |
-
'product_type' => 'theme',
|
| 57 |
-
'wordpress_available' => false,
|
| 58 |
-
'paid' => false,
|
| 59 |
-
) );
|
| 60 |
-
$this->product_slug = $args['product_slug'];
|
| 61 |
-
$this->store_url = $args['store_url'];
|
| 62 |
-
$this->store_name = $args['store_name'];
|
| 63 |
-
$this->paid = ( bool ) $args['paid'] ;
|
| 64 |
-
$this->wordpress_available = ( bool ) $args['wordpress_available'] ;
|
| 65 |
-
$this->product_type = in_array( $args['product_type'], array(
|
| 66 |
-
'theme',
|
| 67 |
-
'plugin'
|
| 68 |
-
) ) ? $args['product_type'] : "";
|
| 69 |
-
if ( empty( $this->product_type ) ) {
|
| 70 |
-
return false;
|
| 71 |
-
}
|
| 72 |
-
if ( $this->product_type === "theme" ) {
|
| 73 |
-
$this->product_data = wp_get_theme( $this->product_slug );
|
| 74 |
-
$this->product_version = $this->product_data->get( "Version" );
|
| 75 |
-
$this->product_name = $this->product_data->get( "Name" );
|
| 76 |
-
|
| 77 |
-
}
|
| 78 |
-
if ( $this->product_type === 'plugin' ) {
|
| 79 |
-
$this->product_data = $this->get_plugin_data( $this->product_slug );
|
| 80 |
-
$this->product_version = $this->product_data["data"]['Version'];
|
| 81 |
-
$this->product_name = $this->product_data["data"]['Name'];
|
| 82 |
-
}
|
| 83 |
-
if ( ! $this->wordpress_available ) {
|
| 84 |
-
$logger = new THEMEISLE_LOGGER( $this->product_slug, $this->product_version );
|
| 85 |
-
$logger->start();
|
| 86 |
-
$licenser = new THEMEISLE_LICENSE( $this->product_name, $this->product_slug, $this->product_version, $this->product_type, $this->paid, $this->store_url, $this->product_data, $this->store_name );
|
| 87 |
-
$licenser->enable();
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
/**
|
| 93 |
-
* @param string $slug Slug of the plugin to get the information for
|
| 94 |
-
*
|
| 95 |
-
* @return mixed $metadata The plugin metadata
|
| 96 |
-
*/
|
| 97 |
-
private function get_plugin_data( $slug ) {
|
| 98 |
-
if ( ! function_exists( 'get_plugins' ) ) {
|
| 99 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
| 100 |
-
}
|
| 101 |
-
$plugins = get_plugins();
|
| 102 |
-
foreach ( $plugins as $plugin_file => $plugin_data ) {
|
| 103 |
-
if ( strpos( $plugin_file, $slug ) !== false ) {
|
| 104 |
-
return array( "basename" => $plugin_file, "data" => $plugin_data );
|
| 105 |
-
}
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
}
|
| 111 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/themeisle/inc/license.php
DELETED
|
@@ -1,633 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
if ( ! class_exists( 'THEMEISLE_LICENSE' ) ) :
|
| 3 |
-
/**
|
| 4 |
-
* Class THEMEISLE_LICENSE
|
| 5 |
-
*
|
| 6 |
-
* Used to update the themeisle products
|
| 7 |
-
*/
|
| 8 |
-
class THEMEISLE_LICENSE extends THEMEISLE_SDK {
|
| 9 |
-
|
| 10 |
-
/**
|
| 11 |
-
* @var string $license_key The license key string
|
| 12 |
-
*/
|
| 13 |
-
public $license_key;
|
| 14 |
-
/**
|
| 15 |
-
* @var string $store_url The store url where to check against the updates
|
| 16 |
-
*/
|
| 17 |
-
public $store_url;
|
| 18 |
-
/**
|
| 19 |
-
* @var string $store_name The store name where to check against the updates
|
| 20 |
-
*/
|
| 21 |
-
public $store_name;
|
| 22 |
-
/**
|
| 23 |
-
* @var string $product_type Either theme or plugin
|
| 24 |
-
*/
|
| 25 |
-
public $product_type;
|
| 26 |
-
/**
|
| 27 |
-
* @var bool $paid Either it's a paid or free product
|
| 28 |
-
*/
|
| 29 |
-
public $paid;
|
| 30 |
-
/**
|
| 31 |
-
* @var string $product_name The current product name
|
| 32 |
-
*/
|
| 33 |
-
public $product_name;
|
| 34 |
-
/**
|
| 35 |
-
* @var string $product_slug The current product slug
|
| 36 |
-
*/
|
| 37 |
-
public $product_slug;
|
| 38 |
-
/**
|
| 39 |
-
* @var string $product_version The current product version
|
| 40 |
-
*/
|
| 41 |
-
public $product_version;
|
| 42 |
-
/**
|
| 43 |
-
* @var string $product_data The product metadata as well as the basename for plugins
|
| 44 |
-
*/
|
| 45 |
-
public $product_data;
|
| 46 |
-
|
| 47 |
-
/**
|
| 48 |
-
* @var string $product_key The key used for transients
|
| 49 |
-
*/
|
| 50 |
-
public $product_key;
|
| 51 |
-
|
| 52 |
-
/**
|
| 53 |
-
* @var string $product_normalized The normalized product name
|
| 54 |
-
*/
|
| 55 |
-
public $product_normalized;
|
| 56 |
-
|
| 57 |
-
/**
|
| 58 |
-
* @var bool $do_check This ensures that the custom API request only runs on the second time that WP fires the update check
|
| 59 |
-
*/
|
| 60 |
-
private $do_check = false;
|
| 61 |
-
|
| 62 |
-
public function __construct( $product_name, $product_slug, $product_version, $product_type, $paid, $store_url, $product_data, $store_name ) {
|
| 63 |
-
$this->product_version = $product_version;
|
| 64 |
-
$this->product_slug = $product_slug;
|
| 65 |
-
$this->product_name = $product_name;
|
| 66 |
-
$this->product_type = $product_type;
|
| 67 |
-
$this->store_url = $store_url;
|
| 68 |
-
$this->store_name = $store_name;
|
| 69 |
-
$this->paid = $paid;
|
| 70 |
-
$this->product_data = $product_data;
|
| 71 |
-
$this->product_key = $this->product_slug . '-update-response';
|
| 72 |
-
$this->product_normalized = THEMEISLE_LOGGER::key_ready_name( $this->product_slug );
|
| 73 |
-
if ( ! $this->paid ) {
|
| 74 |
-
$this->license_key = "free";
|
| 75 |
-
} else {
|
| 76 |
-
do_action($this->product_normalized . '_license_upgrade');
|
| 77 |
-
$license_data = get_option( $this->product_normalized . '_license_data', '' );
|
| 78 |
-
if ( $license_data !== '' ) {
|
| 79 |
-
$this->license_key = isset( $license_data->key ) ? $license_data->key : get_option( $this->product_normalized . '_license', '' );
|
| 80 |
-
} else {
|
| 81 |
-
$this->license_key = get_option( $this->product_normalized . '_license', '' );
|
| 82 |
-
}
|
| 83 |
-
$this->register_license_hooks();
|
| 84 |
-
}
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
/**
|
| 88 |
-
* Register license hooks for the themeisle products
|
| 89 |
-
*/
|
| 90 |
-
public function register_license_hooks() {
|
| 91 |
-
add_action( 'admin_init', array( $this, 'register_settings' ) );
|
| 92 |
-
add_action( 'admin_init', array( $this, 'activate_license' ) );
|
| 93 |
-
add_action( 'admin_init', array( $this, 'product_valid' ), 99999999 );
|
| 94 |
-
add_action( 'admin_notices', array( $this, 'show_notice' ) );
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
/**
|
| 98 |
-
* Register the setting for the license of the product
|
| 99 |
-
*
|
| 100 |
-
* @return bool
|
| 101 |
-
*/
|
| 102 |
-
public function register_settings() {
|
| 103 |
-
if ( ! is_admin() ) {
|
| 104 |
-
return false;
|
| 105 |
-
}
|
| 106 |
-
add_settings_field(
|
| 107 |
-
$this->product_normalized . '_license',
|
| 108 |
-
$this->product_name . " license",
|
| 109 |
-
array( $this, 'license_view' ),
|
| 110 |
-
'general'
|
| 111 |
-
);
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
/**
|
| 115 |
-
* The license view field
|
| 116 |
-
*/
|
| 117 |
-
public function license_view() {
|
| 118 |
-
$status = $this->get_license_status();
|
| 119 |
-
$value = $this->license_key;
|
| 120 |
-
echo '<p ><input ' . ( ( $status === 'valid' ) ? ( 'style="border:1px solid #7ad03a; "' ) : '' ) . ' type="text" id="' . $this->product_normalized . '_license" name="' . $this->product_normalized . '_license" value="' . $value . '" /><a ' . ( ( $status === 'valid' ) ? ( 'style="color:#fff;background: #7ad03a; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">Valid' ) : ( 'style="color:#fff;background: #dd3d36; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">Invalid' ) ) . ' </a> <button name="' . $this->product_normalized . '_btn_trigger" ' . ( ( $status === 'valid' ) ? ( ' class="button button-primary">Deactivate' ) : ( ' class="button button-primary" value="yes" type="submit" >Activate' ) ) . ' </button></p><p class="description">Enter your license from <a href="' . $this->store_url . '">' . $this->store_name . '</a> purchase history in order to get ' . $this->product_type. ' updates</p>';
|
| 121 |
-
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
/** Return the license status
|
| 125 |
-
*
|
| 126 |
-
* @return mixed|void
|
| 127 |
-
*/
|
| 128 |
-
public function get_license_status() {
|
| 129 |
-
$license_data = get_option( $this->product_normalized . '_license_data', '' );
|
| 130 |
-
if ( $license_data !== '' ) {
|
| 131 |
-
return isset( $license_data->license ) ? $license_data->license : get_option( $this->product_normalized . '_license_status', '' );
|
| 132 |
-
} else {
|
| 133 |
-
return get_option( $this->product_normalized . '_license_status', '' );
|
| 134 |
-
}
|
| 135 |
-
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
/**
|
| 139 |
-
* Check if the license is active or not
|
| 140 |
-
*
|
| 141 |
-
* @return bool
|
| 142 |
-
*/
|
| 143 |
-
public function check_activation() {
|
| 144 |
-
$license_data = get_option( $this->product_normalized . '_license_data', '' );
|
| 145 |
-
if ( $license_data !== '' ) {
|
| 146 |
-
return isset( $license_data->error ) ? ( $license_data->error == 'no_activations_left' ) : false;
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
return false;
|
| 150 |
-
}
|
| 151 |
-
|
| 152 |
-
/**
|
| 153 |
-
* Check if the license is about to expire in the next month
|
| 154 |
-
*
|
| 155 |
-
* @return bool
|
| 156 |
-
*/
|
| 157 |
-
function check_expiration() {
|
| 158 |
-
$license_data = get_option( $this->product_normalized . '_license_data', '' );
|
| 159 |
-
if ( $license_data !== '' ) {
|
| 160 |
-
if ( isset( $license_data->expires ) ) {
|
| 161 |
-
if ( strtotime( $license_data->expires ) - time() < 30 * 24 * 3600 ) {
|
| 162 |
-
return true;
|
| 163 |
-
}
|
| 164 |
-
}
|
| 165 |
-
}
|
| 166 |
-
|
| 167 |
-
return false;
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
/**
|
| 171 |
-
* Return the renew url from the store used
|
| 172 |
-
* @return string
|
| 173 |
-
*/
|
| 174 |
-
function renew_url() {
|
| 175 |
-
$license_data = get_option( $this->product_normalized . '_license_data', '' );
|
| 176 |
-
if ( $license_data !== '' ) {
|
| 177 |
-
if ( isset( $license_data->download_id ) && isset( $license_data->key ) ) {
|
| 178 |
-
return $this->store_url . "/checkout/?edd_license_key=" . $license_data->key . "&download_id=" . $license_data->download_id;
|
| 179 |
-
}
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
return $this->store_url;
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
/**
|
| 186 |
-
* Check if we hide the notificatin nag or not
|
| 187 |
-
*
|
| 188 |
-
* @param $hide
|
| 189 |
-
*
|
| 190 |
-
* @return bool
|
| 191 |
-
*/
|
| 192 |
-
function check_hide( $hide ) {
|
| 193 |
-
if ( isset( $_GET[ $this->product_normalized . '_hide_' . $hide ] ) ) {
|
| 194 |
-
if ( $_GET[ $this->product_normalized . '_hide_' . $hide ] === 'yes' ) {
|
| 195 |
-
update_option( $this->product_normalized . '_hide_' . $hide, "yes" );
|
| 196 |
-
return false;
|
| 197 |
-
}
|
| 198 |
-
} else {
|
| 199 |
-
$license = get_option( $this->product_normalized . '_hide_' . $hide, '' );;
|
| 200 |
-
if ( $license === 'yes' ) {
|
| 201 |
-
return false;
|
| 202 |
-
}
|
| 203 |
-
}
|
| 204 |
-
|
| 205 |
-
return true;
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
/**
|
| 209 |
-
* Show the admin notice regarding the license status
|
| 210 |
-
*
|
| 211 |
-
* @return bool
|
| 212 |
-
*/
|
| 213 |
-
function show_notice() {
|
| 214 |
-
if ( ! is_admin() ) {
|
| 215 |
-
return false;
|
| 216 |
-
}
|
| 217 |
-
global $wp;
|
| 218 |
-
$status = $this->get_license_status();
|
| 219 |
-
$admin_url = admin_url( "options-general.php" );
|
| 220 |
-
if ( $status != 'valid' ) {
|
| 221 |
-
if ( $this->check_activation() ) {
|
| 222 |
-
if ( $this->check_hide( 'activation' ) ) {
|
| 223 |
-
?>
|
| 224 |
-
<div class="error">
|
| 225 |
-
<p><strong>No activations left for <?php echo $this->product_name; ?> !!!. You need to
|
| 226 |
-
upgrade your plan in order to use <?php echo $this->product_name; ?> on more
|
| 227 |
-
websites. Please ask the <a href="<?php echo $this->store_url; ?>"
|
| 228 |
-
target="_blank"><?php echo $this->store_name; ?> </a>
|
| 229 |
-
Staff for more details.</strong>| <a
|
| 230 |
-
href="<?php echo add_query_arg( $this->product_normalized . "_activation", "yes" ); ?> ">Hide
|
| 231 |
-
Notice</a></p>
|
| 232 |
-
</div>
|
| 233 |
-
<?php
|
| 234 |
-
return false;
|
| 235 |
-
}
|
| 236 |
-
}
|
| 237 |
-
?>
|
| 238 |
-
<?php if ( $this->check_hide( 'valid' ) ): ?>
|
| 239 |
-
<div class="error">
|
| 240 |
-
<p><strong>In order to benefit from updates and support
|
| 241 |
-
for <?php echo $this->product_name; ?> <?php echo $this->product_type; ?>, please add
|
| 242 |
-
your license code from your <a
|
| 243 |
-
href="<?php echo $this->store_url; ?>" target="_blank">purchase history</a> and
|
| 244 |
-
validate it <a
|
| 245 |
-
href="<?php echo admin_url( "options-general.php" ); ?>#<?php echo $this->product_normalized; ?>_license">here</a>
|
| 246 |
-
</strong>| <a
|
| 247 |
-
href="<?php echo add_query_arg( $this->product_normalized . "_hide_valid", "yes" ); ?> ">Hide
|
| 248 |
-
Notice</a></p>
|
| 249 |
-
</div>
|
| 250 |
-
<?php endif; ?>
|
| 251 |
-
<?php
|
| 252 |
-
} else {
|
| 253 |
-
if ( $this->check_expiration() ) {
|
| 254 |
-
if ( $this->check_hide( 'expiration' ) ) {
|
| 255 |
-
?>
|
| 256 |
-
<div class="update-nag">
|
| 257 |
-
<p><strong>Your license is about to expire
|
| 258 |
-
for <?php echo $this->product_name; ?> <?php echo $this->product_type; ?> !!!.
|
| 259 |
-
You can go to <a
|
| 260 |
-
href="<?php echo $this->renew_url(); ?>"
|
| 261 |
-
target="_blank"><?php echo $this->store_name; ?></a> and renew it.</strong>| <a
|
| 262 |
-
href="<?php echo add_query_arg( $this->product_normalized . "_hide_expiration", "yes" ); ?> ">Hide
|
| 263 |
-
Notice</a></p>
|
| 264 |
-
</div>
|
| 265 |
-
<?php
|
| 266 |
-
}
|
| 267 |
-
}
|
| 268 |
-
}
|
| 269 |
-
}
|
| 270 |
-
|
| 271 |
-
public function product_valid( $force = false ) {
|
| 272 |
-
if ( false === ( $license = get_transient( $this->product_normalized . '_license_data' ) ) ) {
|
| 273 |
-
$license = $this->check_license();
|
| 274 |
-
set_transient( $this->product_normalized . '_license_data', $license, 12 * HOUR_IN_SECONDS );
|
| 275 |
-
update_option( $this->product_normalized . '_license_data', $license );
|
| 276 |
-
}
|
| 277 |
-
|
| 278 |
-
}
|
| 279 |
-
|
| 280 |
-
/**
|
| 281 |
-
* Check the license status
|
| 282 |
-
* @return array|mixed|object|stdClass
|
| 283 |
-
*/
|
| 284 |
-
public function check_license() {
|
| 285 |
-
$status = $this->get_license_status();
|
| 286 |
-
if ( $status != "valid" ) {
|
| 287 |
-
$license_data = new stdClass();
|
| 288 |
-
$license_data->license = "invalid";
|
| 289 |
-
|
| 290 |
-
return $license_data;
|
| 291 |
-
}
|
| 292 |
-
$license = trim( $this->license_key );
|
| 293 |
-
$api_params = array(
|
| 294 |
-
'edd_action' => 'check_license',
|
| 295 |
-
'license' => $license,
|
| 296 |
-
'item_name' => urlencode( $this->product_name ),
|
| 297 |
-
'url' => urlencode(home_url())
|
| 298 |
-
);
|
| 299 |
-
// Call the custom API.
|
| 300 |
-
$response = wp_remote_get( add_query_arg( $api_params, $this->store_url ), array(
|
| 301 |
-
'timeout' => 15,
|
| 302 |
-
'sslverify' => false
|
| 303 |
-
) );
|
| 304 |
-
if ( is_wp_error( $response ) ) {
|
| 305 |
-
$license_data = new stdClass();
|
| 306 |
-
$license_data->license = "valid";
|
| 307 |
-
|
| 308 |
-
} else {
|
| 309 |
-
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
| 310 |
-
if ( ! is_object( $license_data ) ) {
|
| 311 |
-
$license_data = new stdClass();
|
| 312 |
-
$license_data->license = "valid";
|
| 313 |
-
}
|
| 314 |
-
}
|
| 315 |
-
$license_old = get_option( $this->product_normalized . '_license_data', '' );
|
| 316 |
-
if ( isset( $license_old->hide_valid ) ) {
|
| 317 |
-
$license_data->hide_valid = true;
|
| 318 |
-
}
|
| 319 |
-
if ( ! isset( $license_data->key ) ) {
|
| 320 |
-
$license_data->key = isset( $license_old->key ) ? $license_old->key : "";
|
| 321 |
-
}
|
| 322 |
-
if ( isset( $license_old->hide_expiration ) ) {
|
| 323 |
-
$license_data->hide_expiration = true;
|
| 324 |
-
}
|
| 325 |
-
if ( isset( $license_old->hide_activation ) ) {
|
| 326 |
-
$license_data->hide_activation = true;
|
| 327 |
-
}
|
| 328 |
-
|
| 329 |
-
return $license_data;
|
| 330 |
-
|
| 331 |
-
}
|
| 332 |
-
|
| 333 |
-
/**
|
| 334 |
-
* Activate the license remotely
|
| 335 |
-
*/
|
| 336 |
-
function activate_license() {
|
| 337 |
-
// listen for our activate button to be clicked
|
| 338 |
-
if ( isset( $_POST[ $this->product_normalized . '_btn_trigger' ] ) ) {
|
| 339 |
-
$status = $this->get_license_status();
|
| 340 |
-
// retrieve the license from the database
|
| 341 |
-
$license = $_POST[ $this->product_normalized . '_license' ];
|
| 342 |
-
if ( $status != "valid" ) {
|
| 343 |
-
// data to send in our API request
|
| 344 |
-
$api_params = array(
|
| 345 |
-
'edd_action' => 'activate_license',
|
| 346 |
-
'license' => $license,
|
| 347 |
-
'item_name' => urlencode( $this->product_name ),
|
| 348 |
-
'url' => urlencode(home_url())
|
| 349 |
-
);
|
| 350 |
-
} else {
|
| 351 |
-
$api_params = array(
|
| 352 |
-
'edd_action' => 'deactivate_license',
|
| 353 |
-
'license' => $license,
|
| 354 |
-
'item_name' => urlencode( $this->product_name ),
|
| 355 |
-
'url' => urlencode(home_url())
|
| 356 |
-
);
|
| 357 |
-
}
|
| 358 |
-
// Call the custom API.
|
| 359 |
-
$response = wp_remote_get( add_query_arg( $api_params, $this->store_url ) );
|
| 360 |
-
// make sure the response came back okay
|
| 361 |
-
if ( is_wp_error( $response ) ) {
|
| 362 |
-
$license_data = new stdClass();
|
| 363 |
-
$license_data->license = ( $status != "valid" ) ? "valid" : "invalid";
|
| 364 |
-
|
| 365 |
-
} else {
|
| 366 |
-
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
| 367 |
-
if ( ! is_object( $license_data ) ) {
|
| 368 |
-
$license_data = new stdClass();
|
| 369 |
-
$license_data->license = ( $status != "valid" ) ? "valid" : "invalid";
|
| 370 |
-
}
|
| 371 |
-
}
|
| 372 |
-
if ( ! isset( $license_data->key ) ) {
|
| 373 |
-
$license_data->key = $license;
|
| 374 |
-
}
|
| 375 |
-
if ( isset( $license_data->plan ) ) {
|
| 376 |
-
update_option( $this->product_normalized . '_license_plan', $license_data->plan );
|
| 377 |
-
}
|
| 378 |
-
update_option( $this->product_normalized . '_license_data', $license_data );
|
| 379 |
-
delete_transient( $this->product_normalized . '_license_data' );
|
| 380 |
-
set_transient( $this->product_normalized . '_license_data', $license_data, 12 * HOUR_IN_SECONDS );
|
| 381 |
-
|
| 382 |
-
}
|
| 383 |
-
}
|
| 384 |
-
|
| 385 |
-
/**
|
| 386 |
-
* Enable the license system
|
| 387 |
-
*/
|
| 388 |
-
public function enable() {
|
| 389 |
-
if ( $this->product_type == 'plugin' ) {
|
| 390 |
-
add_filter( 'pre_set_site_transient_update_plugins', array(
|
| 391 |
-
$this,
|
| 392 |
-
'pre_set_site_transient_update_plugins_filter'
|
| 393 |
-
) );
|
| 394 |
-
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
| 395 |
-
add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
|
| 396 |
-
}
|
| 397 |
-
if ( $this->product_type == 'theme' ) {
|
| 398 |
-
add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
|
| 399 |
-
add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
|
| 400 |
-
add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
|
| 401 |
-
add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
|
| 402 |
-
add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
|
| 403 |
-
|
| 404 |
-
}
|
| 405 |
-
|
| 406 |
-
}
|
| 407 |
-
|
| 408 |
-
/**
|
| 409 |
-
* Load the Themes screen
|
| 410 |
-
*/
|
| 411 |
-
function load_themes_screen() {
|
| 412 |
-
add_thickbox();
|
| 413 |
-
add_action( 'admin_notices', array( &$this, 'update_nag' ) );
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
-
/**
|
| 417 |
-
* Alter the nag for themes update
|
| 418 |
-
*/
|
| 419 |
-
function update_nag() {
|
| 420 |
-
$theme = wp_get_theme( $this->product_slug );
|
| 421 |
-
$api_response = get_transient( $this->product_key );
|
| 422 |
-
if ( false === $api_response ) {
|
| 423 |
-
return;
|
| 424 |
-
}
|
| 425 |
-
$update_url = wp_nonce_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $this->product_slug ), 'upgrade-theme_' . $this->product_slug );
|
| 426 |
-
$update_onclick = ' onclick="if ( confirm(\'' . esc_js( __( "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update." ) ) . '\') ) {return true;}return false;"';
|
| 427 |
-
if ( version_compare( $this->product_version, $api_response->new_version, '<' ) ) {
|
| 428 |
-
echo '<div id="update-nag">';
|
| 429 |
-
printf( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
|
| 430 |
-
$theme->get( 'Name' ),
|
| 431 |
-
$api_response->new_version,
|
| 432 |
-
'#TB_inline?width=640&inlineId=' . $this->product_version . '_changelog',
|
| 433 |
-
$theme->get( 'Name' ),
|
| 434 |
-
$update_url,
|
| 435 |
-
$update_onclick
|
| 436 |
-
);
|
| 437 |
-
echo '</div>';
|
| 438 |
-
echo '<div id="' . $this->product_slug . '_' . 'changelog" style="display:none;">';
|
| 439 |
-
echo wpautop( $api_response->sections['changelog'] );
|
| 440 |
-
echo '</div>';
|
| 441 |
-
}
|
| 442 |
-
}
|
| 443 |
-
|
| 444 |
-
/**
|
| 445 |
-
* @param mixed $value the transient data
|
| 446 |
-
*
|
| 447 |
-
* @return mixed
|
| 448 |
-
*/
|
| 449 |
-
function theme_update_transient( $value ) {
|
| 450 |
-
$update_data = $this->check_for_update();
|
| 451 |
-
if ( $update_data ) {
|
| 452 |
-
$value->response[ $this->product_slug ] = $update_data;
|
| 453 |
-
}
|
| 454 |
-
|
| 455 |
-
return $value;
|
| 456 |
-
}
|
| 457 |
-
|
| 458 |
-
/**
|
| 459 |
-
* Delete the update transient
|
| 460 |
-
*/
|
| 461 |
-
function delete_theme_update_transient() {
|
| 462 |
-
delete_transient( $this->product_key );
|
| 463 |
-
}
|
| 464 |
-
|
| 465 |
-
/**
|
| 466 |
-
* Check for updates
|
| 467 |
-
*
|
| 468 |
-
* @return array|bool Either the update data or false in case of failure
|
| 469 |
-
*/
|
| 470 |
-
function check_for_update() {
|
| 471 |
-
$theme = wp_get_theme( $this->product_slug );
|
| 472 |
-
$update_data = get_transient( $this->product_key );
|
| 473 |
-
if ( false === $update_data ) {
|
| 474 |
-
$failed = false;
|
| 475 |
-
if ( empty( $this->license_key ) ) {
|
| 476 |
-
return false;
|
| 477 |
-
}
|
| 478 |
-
$api_params = array(
|
| 479 |
-
'edd_action' => 'get_version',
|
| 480 |
-
'version' => $this->product_version,
|
| 481 |
-
'license' => $this->license_key,
|
| 482 |
-
'name' => $this->product_name,
|
| 483 |
-
'slug' => $this->product_slug,
|
| 484 |
-
'author' => $this->store_name,
|
| 485 |
-
'url' => urlencode(home_url())
|
| 486 |
-
);
|
| 487 |
-
$response = wp_remote_post( $this->store_url, array(
|
| 488 |
-
'timeout' => 15,
|
| 489 |
-
'sslverify' => false,
|
| 490 |
-
'body' => $api_params
|
| 491 |
-
) );
|
| 492 |
-
// make sure the response was successful
|
| 493 |
-
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
|
| 494 |
-
$failed = true;
|
| 495 |
-
}
|
| 496 |
-
$update_data = json_decode( wp_remote_retrieve_body( $response ) );
|
| 497 |
-
if ( ! is_object( $update_data ) ) {
|
| 498 |
-
$failed = true;
|
| 499 |
-
}
|
| 500 |
-
// if the response failed, try again in 30 minutes
|
| 501 |
-
if ( $failed ) {
|
| 502 |
-
$data = new stdClass;
|
| 503 |
-
$data->new_version = $this->product_version;
|
| 504 |
-
set_transient( $this->product_key, $data, strtotime( '+30 minutes' ) );
|
| 505 |
-
|
| 506 |
-
return false;
|
| 507 |
-
}
|
| 508 |
-
// if the status is 'ok', return the update arguments
|
| 509 |
-
if ( ! $failed ) {
|
| 510 |
-
$update_data->sections = maybe_unserialize( $update_data->sections );
|
| 511 |
-
set_transient( $this->product_key, $update_data, strtotime( '+12 hours' ) );
|
| 512 |
-
}
|
| 513 |
-
}
|
| 514 |
-
if ( version_compare( $this->product_version, $update_data->new_version, '>=' ) ) {
|
| 515 |
-
return false;
|
| 516 |
-
}
|
| 517 |
-
|
| 518 |
-
return (array) $update_data;
|
| 519 |
-
}
|
| 520 |
-
|
| 521 |
-
/**
|
| 522 |
-
* Check for Updates at the defined API endpoint and modify the update array.
|
| 523 |
-
*
|
| 524 |
-
* This function dives into the update API just when WordPress creates its update array,
|
| 525 |
-
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
| 526 |
-
* It is reassembled from parts of the native WordPress plugin update code.
|
| 527 |
-
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
| 528 |
-
*
|
| 529 |
-
* @uses api_request()
|
| 530 |
-
*
|
| 531 |
-
* @param array $_transient_data Update array build by WordPress.
|
| 532 |
-
*
|
| 533 |
-
* @return array Modified update array with custom plugin data.
|
| 534 |
-
*/
|
| 535 |
-
public function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
|
| 536 |
-
if ( empty( $_transient_data ) || ! $this->do_check ) {
|
| 537 |
-
$this->do_check = true;
|
| 538 |
-
|
| 539 |
-
return $_transient_data;
|
| 540 |
-
}
|
| 541 |
-
$api_response = $this->api_request();
|
| 542 |
-
if ( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
|
| 543 |
-
if ( version_compare( $this->product_version, $api_response->new_version, '<' ) ) {
|
| 544 |
-
$_transient_data->response[ $this->product_data["basename"] ] = $api_response;
|
| 545 |
-
}
|
| 546 |
-
}
|
| 547 |
-
|
| 548 |
-
return $_transient_data;
|
| 549 |
-
}
|
| 550 |
-
|
| 551 |
-
/**
|
| 552 |
-
* Calls the API and, if successfull, returns the object delivered by the API.
|
| 553 |
-
*
|
| 554 |
-
* @uses get_bloginfo()
|
| 555 |
-
* @uses wp_remote_post()
|
| 556 |
-
* @uses is_wp_error()
|
| 557 |
-
*
|
| 558 |
-
* @param string $_action The requested action.
|
| 559 |
-
* @param array $_data Parameters for the API action.
|
| 560 |
-
*
|
| 561 |
-
* @return false||object
|
| 562 |
-
*/
|
| 563 |
-
private function api_request( $_action = "", $_data = "" ) {
|
| 564 |
-
if ( empty( $this->license_key ) ) {
|
| 565 |
-
return;
|
| 566 |
-
}
|
| 567 |
-
$api_params = array(
|
| 568 |
-
'edd_action' => 'get_version',
|
| 569 |
-
'license' => $this->license_key,
|
| 570 |
-
'name' => urlencode( $this->product_name ),
|
| 571 |
-
'slug' => urlencode( $this->product_slug ),
|
| 572 |
-
'author' => $this->store_name,
|
| 573 |
-
'url' => urlencode(home_url())
|
| 574 |
-
);
|
| 575 |
-
$request = wp_remote_post( $this->store_url, array(
|
| 576 |
-
'timeout' => 15,
|
| 577 |
-
'sslverify' => false,
|
| 578 |
-
'body' => $api_params
|
| 579 |
-
) );
|
| 580 |
-
if ( ! is_wp_error( $request ) ):
|
| 581 |
-
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
| 582 |
-
if ( $request && isset( $request->sections ) ) {
|
| 583 |
-
$request->sections = maybe_unserialize( $request->sections );
|
| 584 |
-
}
|
| 585 |
-
|
| 586 |
-
return $request;
|
| 587 |
-
else:
|
| 588 |
-
return false;
|
| 589 |
-
endif;
|
| 590 |
-
}
|
| 591 |
-
|
| 592 |
-
/**
|
| 593 |
-
* Updates information on the "View version x.x details" page with custom data.
|
| 594 |
-
*
|
| 595 |
-
* @uses api_request()
|
| 596 |
-
*
|
| 597 |
-
* @param mixed $_data
|
| 598 |
-
* @param string $_action
|
| 599 |
-
* @param object $_args
|
| 600 |
-
*
|
| 601 |
-
* @return object $_data
|
| 602 |
-
*/
|
| 603 |
-
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
| 604 |
-
if ( ( $_action != 'plugin_information' ) || ! isset( $_args->slug ) || ( $_args->slug != $this->product_slug ) ) {
|
| 605 |
-
return $_data;
|
| 606 |
-
}
|
| 607 |
-
$api_response = $this->api_request();
|
| 608 |
-
if ( false !== $api_response ) {
|
| 609 |
-
$_data = $api_response;
|
| 610 |
-
}
|
| 611 |
-
|
| 612 |
-
return $_data;
|
| 613 |
-
}
|
| 614 |
-
|
| 615 |
-
/**
|
| 616 |
-
* Disable SSL verification in order to prevent download update failures
|
| 617 |
-
*
|
| 618 |
-
* @param array $args
|
| 619 |
-
* @param string $url
|
| 620 |
-
*
|
| 621 |
-
* @return object $array
|
| 622 |
-
*/
|
| 623 |
-
function http_request_args( $args, $url ) {
|
| 624 |
-
// If it is an https request and we are performing a package download, disable ssl verification
|
| 625 |
-
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
| 626 |
-
$args['sslverify'] = false;
|
| 627 |
-
}
|
| 628 |
-
|
| 629 |
-
return $args;
|
| 630 |
-
}
|
| 631 |
-
|
| 632 |
-
}
|
| 633 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/themeisle/inc/log.php
DELETED
|
@@ -1,76 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
if ( ! class_exists( "THEMEISLE_LOGGER" ) ) :
|
| 3 |
-
/**
|
| 4 |
-
* Class THEMEISLE_LOGGER
|
| 5 |
-
*
|
| 6 |
-
* Send the statistics to the Themeisle Endpoint
|
| 7 |
-
*/
|
| 8 |
-
/**
|
| 9 |
-
* Class THEMEISLE_LOGGER
|
| 10 |
-
*/
|
| 11 |
-
class THEMEISLE_LOGGER {
|
| 12 |
-
|
| 13 |
-
/**
|
| 14 |
-
* @var string $logging_url Url where to send the logs
|
| 15 |
-
*/
|
| 16 |
-
private $logging_url = 'http://mirror.themeisle.com';
|
| 17 |
-
|
| 18 |
-
/**
|
| 19 |
-
* @var string $product_slug Slug of the product
|
| 20 |
-
*/
|
| 21 |
-
private $product_slug;
|
| 22 |
-
|
| 23 |
-
/**
|
| 24 |
-
* @var string $product_version Version of the product
|
| 25 |
-
*/
|
| 26 |
-
private $product_version;
|
| 27 |
-
|
| 28 |
-
/**
|
| 29 |
-
* @var string $product_cron Cron name handler
|
| 30 |
-
*/
|
| 31 |
-
private $product_cron;
|
| 32 |
-
|
| 33 |
-
public function __construct( $slug, $version ) {
|
| 34 |
-
$this->product_slug = $slug;
|
| 35 |
-
$this->product_version = $version;
|
| 36 |
-
$this->product_cron = self::key_ready_name( $this->product_slug ) . "_log_activity";
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
/**
|
| 40 |
-
* @param string $string the String to be normalized for cron handler
|
| 41 |
-
*
|
| 42 |
-
* @return string $name the normalized string
|
| 43 |
-
*/
|
| 44 |
-
static function key_ready_name( $string ) {
|
| 45 |
-
return str_replace( "-", "_", strtolower( trim( $string ) ) );
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
/**
|
| 49 |
-
* Start the cron to send the log. It will randomize the interval in order to not send all the logs at the same time.
|
| 50 |
-
*/
|
| 51 |
-
public function start() {
|
| 52 |
-
if ( ! wp_next_scheduled( $this->product_cron ) ) {
|
| 53 |
-
wp_schedule_single_event( time() + ( rand( 15, 24 ) * 3600 ), $this->product_cron );
|
| 54 |
-
}
|
| 55 |
-
add_action( $this->product_cron, array( $this, "send_log" ) );
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
/**
|
| 59 |
-
* Send the statistics to the api endpoint
|
| 60 |
-
*/
|
| 61 |
-
public function send_log() {
|
| 62 |
-
wp_remote_post( $this->logging_url, array(
|
| 63 |
-
'method' => 'POST',
|
| 64 |
-
'timeout' => 3,
|
| 65 |
-
'redirection' => 5,
|
| 66 |
-
'headers' => array( "X-ThemeIsle-Event" => "log_site" ),
|
| 67 |
-
'body' => array(
|
| 68 |
-
'site' => get_site_url(),
|
| 69 |
-
'product' => $this->product_slug,
|
| 70 |
-
'version' => $this->product_version
|
| 71 |
-
),
|
| 72 |
-
) );
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
}
|
| 76 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/themeisle/load.php
DELETED
|
@@ -1,66 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/*
|
| 3 |
-
* Themeisle SDK
|
| 4 |
-
*
|
| 5 |
-
* @version 1.0.0
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*/
|
| 9 |
-
/**
|
| 10 |
-
* Themeisle SDK Version
|
| 11 |
-
*
|
| 12 |
-
* @var string
|
| 13 |
-
*/
|
| 14 |
-
$this_themeisle_sdk_version = "1.2.0";
|
| 15 |
-
/**
|
| 16 |
-
* Themeisle SDK Path
|
| 17 |
-
*
|
| 18 |
-
* @var string
|
| 19 |
-
*/
|
| 20 |
-
$this_themeisle_sdk_path = dirname( __FILE__ );
|
| 21 |
-
global $themeisle_sdk_products;
|
| 22 |
-
if ( ! isset( $themeisle_sdk_products ) ) {
|
| 23 |
-
$themeisle_sdk_products = array();
|
| 24 |
-
}
|
| 25 |
-
//load the product details
|
| 26 |
-
$themeisle_sdk_products[] = array(
|
| 27 |
-
"version" => $this_themeisle_sdk_version,
|
| 28 |
-
"sdk_path" => $this_themeisle_sdk_path
|
| 29 |
-
);
|
| 30 |
-
// load the latest sdk version from the active Themeisle products
|
| 31 |
-
if ( ! function_exists( "themeisle_sdk_load" ) ) :
|
| 32 |
-
function themeisle_sdk_load() {
|
| 33 |
-
global $themeisle_sdk_products;
|
| 34 |
-
global $this_themeisle_sdk_version;
|
| 35 |
-
$max_version = reset( $themeisle_sdk_products );
|
| 36 |
-
if ( ! isset ( $max_version ["version"] ) ) {
|
| 37 |
-
$max_version = $this_themeisle_sdk_version;
|
| 38 |
-
} else{
|
| 39 |
-
$max_version = $max_version["version"];
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
$path_to_load = "";
|
| 43 |
-
foreach ( $themeisle_sdk_products as $product ) {
|
| 44 |
-
if ( version_compare( $product["version"], $max_version ) >= 0 ) {
|
| 45 |
-
$path_to_load = $product["sdk_path"];
|
| 46 |
-
$max_version = $product['version'];
|
| 47 |
-
}
|
| 48 |
-
}
|
| 49 |
-
include $path_to_load . "/start.php";
|
| 50 |
-
foreach ( $themeisle_sdk_products as $registered_product ) {
|
| 51 |
-
${$registered_product["product_data"]["product_slug"] . "_themeisle_sdk"} = new THEMEISLE_SDK( $registered_product );
|
| 52 |
-
}
|
| 53 |
-
}
|
| 54 |
-
endif;
|
| 55 |
-
//register the product which will use the sdk
|
| 56 |
-
if ( ! function_exists( "themeisle_sdk_register" ) ) :
|
| 57 |
-
function themeisle_sdk_register( $array ) {
|
| 58 |
-
global $themeisle_sdk_products;
|
| 59 |
-
foreach ( $themeisle_sdk_products as $key => $product ) {
|
| 60 |
-
if ( strpos( $product["sdk_path"], $array["product_slug"] ) !== false ) {
|
| 61 |
-
$themeisle_sdk_products[ $key ]["product_data"] = $array;
|
| 62 |
-
}
|
| 63 |
-
}
|
| 64 |
-
}
|
| 65 |
-
endif;
|
| 66 |
-
add_action( "wp_loaded", "themeisle_sdk_load" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/themeisle/start.php
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
include dirname( __FILE__ ) . '/inc/base.php';
|
| 3 |
-
include dirname( __FILE__ ) . '/inc/license.php';
|
| 4 |
-
include dirname( __FILE__ ) . '/inc/log.php';
|
|
|
|
|
|
|
|
|
|
|
|
