PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.17.0
GiveWP – Donation Plugin and Fundraising Platform v2.17.0
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 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / includes / plugin-compatibility.php
plugin-compatibility.php
112 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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