admin
4 months ago
api
3 years ago
database
5 months ago
deprecated
9 months ago
donors
5 months ago
emails
9 months ago
forms
9 months ago
frontend
6 years ago
gateways
9 months ago
libraries
9 months ago
payments
2 months ago
actions.php
9 months ago
ajax-functions.php
9 months ago
class-give-async-process.php
1 year ago
class-give-background-updater.php
9 months ago
class-give-cache-setting.php
1 year ago
class-give-cache.php
9 months ago
class-give-cli-commands.php
1 year ago
class-give-comment.php
9 months ago
class-give-cron.php
9 months ago
class-give-donate-form.php
1 year ago
class-give-donor.php
2 years ago
class-give-email-access.php
5 years ago
class-give-license-handler.php
1 year ago
class-give-logging.php
9 months ago
class-give-readme-parser.php
4 years ago
class-give-roles.php
5 months ago
class-give-scripts.php
8 months ago
class-give-session.php
9 months ago
class-give-stats.php
6 years ago
class-give-template-loader.php
6 years ago
class-give-tooltips.php
6 years ago
class-give-translation.php
4 years ago
class-notices.php
9 months ago
country-functions.php
7 months ago
currencies-list.php
7 months ago
currency-functions.php
3 years ago
error-tracking.php
6 years ago
filters.php
9 months ago
formatting.php
9 months ago
install.php
9 months ago
login-register.php
2 years ago
misc-functions.php
9 months ago
plugin-compatibility.php
6 years ago
post-types.php
1 year ago
price-functions.php
6 years ago
process-donation.php
1 year ago
setting-functions.php
6 years ago
shortcodes.php
1 year ago
template-functions.php
1 year ago
user-functions.php
3 years ago
plugin-compatibility.php
112 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Compatibility |
| 4 | * |
| 5 | * Functions for compatibility with other plugins. |
| 6 | * |
| 7 | * @package Give |
| 8 | * @subpackage Functions/Compatibility |
| 9 | * @copyright Copyright (c) 2016, GiveWP |
| 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 11 | * @since 1.4 |
| 12 | */ |
| 13 | |
| 14 | |
| 15 | /** |
| 16 | * If Tickera is active then allow TCPDF calls in HTML. |
| 17 | * |
| 18 | * TCPDF defines this as false by default as a security precaution. Because Tickera uses GiveWP's composer autoloaded |
| 19 | * TCPDF the constant is false. Therefore, we will set it to true so the QR code feature works as expected. |
| 20 | * |
| 21 | * GitHub Issue: |
| 22 | * See: https://tcpdf.org/examples/example_049/ |
| 23 | * |
| 24 | * @since 2.5.4 |
| 25 | */ |
| 26 | function give_tickera_qr_compatibility() { |
| 27 | if ( is_plugin_active( 'tickera-event-ticketing-system/tickera.php' ) ) { |
| 28 | define( 'K_TCPDF_CALLS_IN_HTML', true ); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | add_action( 'plugins_loaded', 'give_tickera_qr_compatibility' ); |
| 33 | |
| 34 | /** |
| 35 | * Disables the mandrill_nl2br filter while sending Give emails. |
| 36 | * |
| 37 | * @return void |
| 38 | * @since 1.4 |
| 39 | */ |
| 40 | function give_disable_mandrill_nl2br() { |
| 41 | add_filter( 'mandrill_nl2br', '__return_false' ); |
| 42 | } |
| 43 | |
| 44 | add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br' ); |
| 45 | |
| 46 | |
| 47 | /** |
| 48 | * This function will clear the Yoast SEO sitemap cache on update of settings |
| 49 | * |
| 50 | * @return void |
| 51 | * @since 1.8.9 |
| 52 | */ |
| 53 | function give_clear_seo_sitemap_cache_on_settings_change() { |
| 54 | // Load required file if the fn 'is_plugin_active' doesn't exists. |
| 55 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 56 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 57 | } |
| 58 | |
| 59 | if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
| 60 | || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) |
| 61 | && class_exists( 'WPSEO_Sitemaps_Cache' ) |
| 62 | ) { |
| 63 | |
| 64 | $forms_singular_option = give_get_option( 'forms_singular' ); |
| 65 | $forms_archive_option = give_get_option( 'forms_singular' ); |
| 66 | |
| 67 | // If there is change detected for Single Form View and Form Archives options then proceed. |
| 68 | if ( |
| 69 | ( isset( $_POST['forms_singular'] ) && $_POST['forms_singular'] !== $forms_singular_option ) || |
| 70 | ( isset( $_POST['forms_archives'] ) && $_POST['forms_archives'] !== $forms_archive_option ) |
| 71 | ) { |
| 72 | // If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache. |
| 73 | $yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache(); |
| 74 | if ( method_exists( $yoast_sitemaps_cache, 'clear' ) ) { |
| 75 | WPSEO_Sitemaps_Cache::clear(); |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | add_action( 'give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change' ); |
| 82 | |
| 83 | /** |
| 84 | * This is support for the plugin Elementor. This function |
| 85 | * disables the Give Shortcodes button on the Elementor's |
| 86 | * editor page. |
| 87 | * |
| 88 | * See link: https://github.com/impress-org/give/issues/3171#issuecomment-387471355 |
| 89 | * |
| 90 | * @return boolean |
| 91 | * @since 2.1.3 |
| 92 | */ |
| 93 | function give_elementor_hide_shortcodes_button() { |
| 94 | |
| 95 | /** |
| 96 | * Is the plugin: Elementor activated? |
| 97 | */ |
| 98 | if ( is_plugin_active( 'elementor/elementor.php' ) ) { |
| 99 | |
| 100 | /** |
| 101 | * Check user is on the Elementor's editor page, then hide Give Shortcodes Button. |
| 102 | */ |
| 103 | if ( isset( $_GET['action'] ) && 'elementor' === give_clean( $_GET['action'] ) ) { |
| 104 | return false; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | return true; |
| 109 | } |
| 110 | |
| 111 | add_filter( 'give_shortcode_button_condition', 'give_elementor_hide_shortcodes_button', 11 ); |
| 112 |