donors
7 years ago
emails
7 years ago
forms
7 years ago
payments
7 years ago
reports
8 years ago
settings
7 years ago
shortcodes
7 years ago
tools
7 years ago
upgrades
7 years ago
views
8 years ago
EDD_SL_Plugin_Updater.php
8 years ago
abstract-admin-settings-page.php
8 years ago
add-ons.php
8 years ago
admin-actions.php
7 years ago
admin-filters.php
8 years ago
admin-footer.php
8 years ago
admin-pages.php
8 years ago
class-addon-activation-banner.php
7 years ago
class-admin-settings.php
7 years ago
class-api-keys-table.php
8 years ago
class-blank-slate.php
8 years ago
class-give-settings.php
7 years ago
class-i18n-module.php
8 years ago
dashboard-widgets.php
8 years ago
give-metabox-functions.php
7 years ago
plugins.php
7 years ago
welcome.php
8 years ago
add-ons.php
76 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Admin Add-ons |
| 4 | * |
| 5 | * @package Give |
| 6 | * @subpackage Admin/Add-ons |
| 7 | * @copyright Copyright (c) 2016, WordImpress |
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | * @since 1.0 |
| 10 | */ |
| 11 | |
| 12 | // Exit if accessed directly. |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Add-ons Page |
| 19 | * |
| 20 | * Renders the add-ons page content. |
| 21 | * |
| 22 | * @since 1.0 |
| 23 | * @return void |
| 24 | */ |
| 25 | function give_add_ons_page() { |
| 26 | ?> |
| 27 | <div class="wrap" id="give-add-ons"> |
| 28 | <h1><?php echo esc_html( get_admin_page_title() ); ?> |
| 29 | — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
| 30 | <span class="dashicons dashicons-external"></span></a> |
| 31 | </h1> |
| 32 | |
| 33 | <hr class="wp-header-end"> |
| 34 | |
| 35 | <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
| 36 | <?php give_add_ons_feed(); ?> |
| 37 | </div> |
| 38 | <?php |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Add-ons Render Feed |
| 43 | * |
| 44 | * Renders the add-ons page feed. |
| 45 | * |
| 46 | * @since 1.0 |
| 47 | * @return void |
| 48 | */ |
| 49 | function give_add_ons_feed() { |
| 50 | |
| 51 | $addons_debug = false; //set to true to debug |
| 52 | $cache = Give_Cache::get( 'give_add_ons_feed', true ); |
| 53 | |
| 54 | if ( false === $cache || ( true === $addons_debug && true === WP_DEBUG ) ) { |
| 55 | if ( function_exists( 'vip_safe_wp_remote_get' ) ) { |
| 56 | $feed = vip_safe_wp_remote_get( 'https://givewp.com/downloads/feed/', false, 3, 1, 20, array( 'sslverify' => false ) ); |
| 57 | } else { |
| 58 | $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
| 59 | } |
| 60 | |
| 61 | if ( ! is_wp_error( $feed ) && ! empty( $feed ) ) { |
| 62 | if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
| 63 | $cache = wp_remote_retrieve_body( $feed ); |
| 64 | Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true ); |
| 65 | } |
| 66 | } else { |
| 67 | $cache = sprintf( |
| 68 | '<div class="error"><p>%s</p></div>', |
| 69 | esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) |
| 70 | ); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | echo wp_kses_post( $cache ); |
| 75 | } |
| 76 |