2013-08-06 13:04:24 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-11-03 13:53:50 +00:00
|
|
|
* Addons Page
|
2013-08-06 13:04:24 +00:00
|
|
|
*
|
2014-11-30 06:52:32 +00:00
|
|
|
* @author WooThemes
|
|
|
|
* @category Admin
|
|
|
|
* @package WooCommerce/Admin
|
2013-08-06 13:04:24 +00:00
|
|
|
* @version 2.1.0
|
|
|
|
*/
|
|
|
|
|
2014-09-20 19:52:30 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // Exit if accessed directly
|
|
|
|
}
|
2013-08-06 13:04:24 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* WC_Admin_Addons Class.
|
2013-08-06 13:04:24 +00:00
|
|
|
*/
|
|
|
|
class WC_Admin_Addons {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles output of the reports page in admin.
|
|
|
|
*/
|
2014-06-04 10:16:19 +00:00
|
|
|
public static function output() {
|
2013-08-06 13:04:24 +00:00
|
|
|
|
2014-05-19 11:53:15 +00:00
|
|
|
if ( false === ( $addons = get_transient( 'woocommerce_addons_data' ) ) ) {
|
2014-11-30 06:52:32 +00:00
|
|
|
|
2015-05-21 13:45:28 +00:00
|
|
|
$addons_json = wp_safe_remote_get( 'http://d3t0oesq8995hv.cloudfront.net/woocommerce-addons.json', array( 'user-agent' => 'WooCommerce Addons Page' ) );
|
2014-11-30 06:52:32 +00:00
|
|
|
|
2014-05-19 11:53:15 +00:00
|
|
|
if ( ! is_wp_error( $addons_json ) ) {
|
2014-11-30 06:52:32 +00:00
|
|
|
|
2014-05-19 11:53:15 +00:00
|
|
|
$addons = json_decode( wp_remote_retrieve_body( $addons_json ) );
|
2014-11-30 06:52:32 +00:00
|
|
|
|
2014-05-19 11:53:15 +00:00
|
|
|
if ( $addons ) {
|
2014-11-30 06:52:32 +00:00
|
|
|
set_transient( 'woocommerce_addons_data', $addons, WEEK_IN_SECONDS );
|
2013-08-06 13:04:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
include_once( 'views/html-admin-page-addons.php' );
|
|
|
|
}
|
2014-09-20 19:52:30 +00:00
|
|
|
}
|