Easy Digital Downloads
  • Package
  • Function
  • Tree

Packages

  • EDD
    • Admin
      • Actions
      • Add-ons
      • Dashboard
      • Discounts
      • Downloads
      • Export
      • Notices
      • Pages
      • Payments
      • Reports
      • Settings
      • System
      • Upgrades
      • Upload
      • Welcome
    • Cart
    • Checkout
    • Classes
      • API
      • Fees
      • HTML
      • Roles
      • Session
    • Emails
    • Functions
      • AJAX
      • Compatibility
      • Errors
      • Formatting
      • Install
      • Login
      • Taxes
      • Templates
    • Gateways
    • Logging
    • Payments
    • Shortcodes
    • Widgets

Functions

  • edd_append_no_cache_param
  • edd_disable_jetpack_og_on_checkout
  • edd_is_caching_plugin_active
  • edd_remove_post_types_order
  • edd_remove_restrict_meta_box
  • edd_responsive_download_post_class
 1 <?php
 2 /**
 3  * Plugin Compatibility
 4  *
 5  * Functions for compatibility with other plugins.
 6  *
 7  * @package     EDD
 8  * @subpackage  Functions/Compatibility
 9  * @copyright   Copyright (c) 2013, Pippin Williamson
10  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11  * @since       1.0
12  */
13 
14 // Exit if accessed directly
15 if ( ! defined( 'ABSPATH' ) ) exit;
16 
17 /**
18  * Removes the "Restrict This Content" meta box from Restrict Content Pro.
19  *
20  * @since 1.0
21  * @param array $post_types Post Types
22  * @return array $post_types Array with 'download' post type added
23  */
24 function edd_remove_restrict_meta_box( $post_types ) {
25     $post_types[] = 'download';
26 
27     return $post_types;
28 }
29 add_filter( 'rcp_metabox_excluded_post_types', 'edd_remove_restrict_meta_box', 999 );
30 
31 /**
32  * Disables admin sorting of Post Types Order
33  *
34  * When sorting downloads by price, earnings, sales, date, or name,
35  * we need to remove the posts_orderby that Post Types Order imposes
36  *
37  * @since 1.2.2
38  * @return void
39  */
40 function edd_remove_post_types_order() {
41     remove_filter( 'posts_orderby', 'CPTOrderPosts' );
42 }
43 add_action( 'load-edit.php', 'edd_remove_post_types_order' );
44 
45 /**
46  * Disables opengraph tags on the checkout page
47  *
48  * There is a bizarre conflict that makes the checkout errors not get displayed
49  * when the Jetpack opengraph tags are displayed
50  *
51  * @since 1.3.3.1
52  * @return bool
53  */
54 function edd_disable_jetpack_og_on_checkout() {
55     if ( edd_is_checkout() ) {
56         remove_action( 'wp_head', 'jetpack_og_tags' );
57     }
58 }
59 add_action( 'template_redirect', 'edd_disable_jetpack_og_on_checkout' );
60 
61 /**
62  * Checks if a caching plugin is active
63  *
64  * @since 1.4.1
65  * @return bool $caching True if caching plugin is enabled, false otherwise
66  */
67 function edd_is_caching_plugin_active() {
68     $caching = ( function_exists( 'wpsupercache_site_admin' ) || defined( 'W3TC' ) );
69     return apply_filters( 'edd_is_caching_plugin_active', $caching );
70 }
71 
72 /**
73  * Adds a ?nocache option for the checkout page
74  *
75  * This ensures the checkout page remains uncached when plugins like WP Super Cache are activated
76  *
77  * @since 1.4.1
78  * @param array $settings Misc Settings
79  * @return array $settings Updated Misc Settings
80  */
81 function edd_append_no_cache_param( $settings ) {
82     if ( ! edd_is_caching_plugin_active() )
83         return $settings;
84 
85     $settings[] = array(
86         'id' => 'no_cache_checkout',
87         'name' => __('No Caching on Checkout?', 'edd'),
88         'desc' => __('Check this box in order to append a ?nocache parameter to the checkout URL to prevent caching plugins from caching the page.', 'edd'),
89         'type' => 'checkbox'
90     );
91 
92     return $settings;
93 }
94 add_filter( 'edd_settings_misc', 'edd_append_no_cache_param', -1 );
Easy Digital Downloads API documentation generated by ApiGen 2.8.0