|
@@ 26-34 (lines=9) @@
|
| 23 |
|
* @return array of objects |
| 24 |
|
*/ |
| 25 |
|
public static function get_featured() { |
| 26 |
|
if ( false === ( $featured = get_transient( 'wc_addons_featured' ) ) ) { |
| 27 |
|
$raw_featured = wp_safe_remote_get( 'https://dl.dropboxusercontent.com/u/2659230/wc/featured.json', array( 'user-agent' => 'WooCommerce Addons Page' ) ); |
| 28 |
|
if ( ! is_wp_error( $raw_featured ) ) { |
| 29 |
|
$featured = json_decode( wp_remote_retrieve_body( $raw_featured ) ); |
| 30 |
|
if ( $featured ) { |
| 31 |
|
set_transient( 'wc_addons_featured', $featured, WEEK_IN_SECONDS ); |
| 32 |
|
} |
| 33 |
|
} |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
if ( is_object( $featured ) ) { |
| 37 |
|
self::output_featured_sections( $featured->sections ); |
|
@@ 48-57 (lines=10) @@
|
| 45 |
|
* @return array of objects |
| 46 |
|
*/ |
| 47 |
|
public static function get_sections() { |
| 48 |
|
if ( false === ( $sections = get_transient( 'wc_addons_sections' ) ) ) { |
| 49 |
|
$raw_sections = wp_safe_remote_get( 'https://d3t0oesq8995hv.cloudfront.net/addon-sections.json', array( 'user-agent' => 'WooCommerce Addons Page' ) ); |
| 50 |
|
if ( ! is_wp_error( $raw_sections ) ) { |
| 51 |
|
$sections = json_decode( wp_remote_retrieve_body( $raw_sections ) ); |
| 52 |
|
|
| 53 |
|
if ( $sections ) { |
| 54 |
|
set_transient( 'wc_addons_sections', $sections, WEEK_IN_SECONDS ); |
| 55 |
|
} |
| 56 |
|
} |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
$addon_sections = array(); |
| 60 |
|
|