PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.3.1
GiveWP – Donation Plugin and Fundraising Platform v2.3.1
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / includes / admin / add-ons.php

add-ons.php in GiveWP – Donation Plugin and Fundraising Platform 2.3.1, at includes/admin/add-ons.php

76 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Add-ons
4 *
5 * @package Give
6 * @subpackage Admin/Add-ons
7 * @copyright Copyright (c) 2016, GiveWP
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 &nbsp;&mdash;&nbsp;<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