From 795037eb91768b0d5315bf8182a782b306dbf165 Mon Sep 17 00:00:00 2001 From: nikeo Date: Sat, 13 Oct 2018 09:57:20 +0200 Subject: [PATCH] prefixed TGMPA class with CZR to fix potential collision with other plugins using the same class. fixes #1603 --- core/_dev/_admin/class-fire-admin_init.php | 7 ++-- core/class-tgm-plugin-activation.php | 46 +++++++++++++--------- core/init-base.php | 5 ++- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/core/_dev/_admin/class-fire-admin_init.php b/core/_dev/_admin/class-fire-admin_init.php index 15ca32f36..a5628b66a 100644 --- a/core/_dev/_admin/class-fire-admin_init.php +++ b/core/_dev/_admin/class-fire-admin_init.php @@ -323,9 +323,6 @@ function czr_fn_may_be_display_update_notice() { if ( ( defined('DISPLAY_UPDATE_NOTIFICATION') && ! DISPLAY_UPDATE_NOTIFICATION ) || ( defined('DISPLAY_PRO_UPDATE_NOTIFICATION') && ! DISPLAY_PRO_UPDATE_NOTIFICATION ) ) return; - if ( ! czr_fn_is_plugin_active('nimble-builder/nimble-builder.php') && class_exists('TGM_Plugin_Activation') && ! TGM_Plugin_Activation::get_instance()->czr_fn_is_notice_dismissed() ) - return; - $opt_name = CZR_IS_PRO ? 'last_update_notice_pro' : 'last_update_notice'; $last_update_notice_values = czr_fn_opt($opt_name); $show_new_notice = false; @@ -370,6 +367,10 @@ function czr_fn_may_be_display_update_notice() { if ( ! $show_new_notice ) return; + // prefixed CZR_Plugin_Activation because of the possible issue : https://github.com/presscustomizr/customizr/issues/1603 + if ( ! czr_fn_is_plugin_active('nimble-builder/nimble-builder.php') && class_exists('CZR_Plugin_Activation') && ! CZR_Plugin_Activation::get_instance()->czr_fn_is_notice_dismissed() ) + return; + ob_start(); ?>
diff --git a/core/class-tgm-plugin-activation.php b/core/class-tgm-plugin-activation.php index 38ec26449..ece290df9 100644 --- a/core/class-tgm-plugin-activation.php +++ b/core/class-tgm-plugin-activation.php @@ -31,8 +31,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -if ( ! class_exists( 'TGM_Plugin_Activation' ) ) { +// prefixed CZR_Plugin_Activation because of the possible issue : https://github.com/presscustomizr/customizr/issues/1603 +if ( ! class_exists( 'CZR_Plugin_Activation' ) ) { /** * Automatic plugin installation and activation library. @@ -47,7 +47,7 @@ * @author Thomas Griffin * @author Gary Jones */ - class TGM_Plugin_Activation { + class CZR_lugin_Activation { /** * TGMPA version number. * @@ -80,7 +80,7 @@ class TGM_Plugin_Activation { * * @since 1.0.0 * - * @var TGM_Plugin_Activation + * @var CZR_Plugin_Activation */ public static $instance; @@ -250,7 +250,7 @@ class TGM_Plugin_Activation { * * @since 1.0.0 * - * @see TGM_Plugin_Activation::init() + * @see CZR_Plugin_Activation::init() */ public function __construct() { // Set the current WordPress version. @@ -486,9 +486,9 @@ public function __get( $name ) { * * @since 2.0.0 * - * @see TGM_Plugin_Activation::admin_menu() - * @see TGM_Plugin_Activation::notices() - * @see TGM_Plugin_Activation::styles() + * @see CZR_Plugin_Activation::admin_menu() + * @see CZR_Plugin_Activation::notices() + * @see CZR_Plugin_Activation::styles() */ public function init() { /** @@ -787,8 +787,8 @@ public function thickbox() { * * @since 1.0.0 * - * @see TGM_Plugin_Activation::init() - * @see TGM_Plugin_Activation::install_plugins_page() + * @see CZR_Plugin_Activation::init() + * @see CZR_Plugin_Activation::install_plugins_page() * * @return null Return early if user lacks capability to install a plugin. */ @@ -1326,7 +1326,7 @@ public function notices() { $rendered, __( 'Nimble is a section builder plugin companion for the Customizr theme.', 'customizr'), sprintf( - __( 'It allows you to drag and drop beautiful pre-designed sections, or create your own sections with modules like Google map or a contact form, in live preview from the WordPress customizer. You\'ll find a quick introduction of the plugin %1$s.', 'customizr' ), + __( 'It allows you to drag and drop pre-built sections, or create your own sections in live preview from the WordPress customizer. You can easily create column layouts and add content like buttons, icons, Google map and even contact forms in any page. You\'ll find a quick introduction of the plugin %1$s.', 'customizr' ), sprintf('%2$s', esc_url('docs.presscustomizr.com/article/337-getting-started-with-the-nimble-builder-plugin'), __('here', 'customizr') ) ), __( "The plugin has been designed to integrate perfectly with the Customizr theme. Lightweight and safe.", 'customizr') @@ -2210,7 +2210,7 @@ public function show_tgmpa_version() { * * @since 2.4.0 * - * @return \TGM_Plugin_Activation The TGM_Plugin_Activation object. + * @return \CZR_Plugin_Activation The CZR_Plugin_Activation object. */ public static function get_instance() { if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { @@ -2228,7 +2228,7 @@ public static function get_instance() { * @since 2.5.0 */ function load_tgm_plugin_activation() { - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); + $GLOBALS['tgmpa'] = CZR_Plugin_Activation::get_instance(); } } @@ -3217,20 +3217,30 @@ public function prepare_items() { * Retrieve plugin data, given the plugin name. * * @since 2.2.0 - * @deprecated 2.5.0 use {@see TGM_Plugin_Activation::_get_plugin_data_from_name()} instead. - * @see TGM_Plugin_Activation::_get_plugin_data_from_name() + * @deprecated 2.5.0 use {@see CZR_Plugin_Activation::_get_plugin_data_from_name()} instead. + * @see CZR_Plugin_Activation::_get_plugin_data_from_name() * * @param string $name Name of the plugin, as it was registered. * @param string $data Optional. Array key of plugin data to return. Default is slug. * @return string|boolean Plugin slug if found, false otherwise. */ protected function _get_plugin_data_from_name( $name, $data = 'slug' ) { - _deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'TGM_Plugin_Activation::_get_plugin_data_from_name()' ); + _deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'CZR_Plugin_Activation::_get_plugin_data_from_name()' ); return $this->tgmpa->_get_plugin_data_from_name( $name, $data ); } - } -} + }//end of CZR_Plugin_Activation +}//class_exists() + + + + + + + + + + if ( ! class_exists( 'TGM_Bulk_Installer' ) ) { diff --git a/core/init-base.php b/core/init-base.php index 05c3f4804..8cb7ee708 100644 --- a/core/init-base.php +++ b/core/init-base.php @@ -1114,7 +1114,8 @@ function czr_fn_maybe_register_nimble_location() { /* ------------------------------------------------------------------------- */ if ( is_admin() && ! czr_fn_is_customizing() && ! czr_fn_is_pro() && ! czr_fn_is_plugin_active('nimble-builder/nimble-builder.php') ) { /** - * Include the TGM_Plugin_Activation class. + * Include the CZR_Plugin_Activation class. + * prefixed CZR_Plugin_Activation because of the possible issue : https://github.com/presscustomizr/customizr/issues/1603 */ load_template( get_template_directory() . '/core/class-tgm-plugin-activation.php' ); add_action( 'tgmpa_register', 'czr_fn_register_required_plugins'); @@ -1130,7 +1131,7 @@ function czr_fn_maybe_register_nimble_location() { * arrays. * * This function is hooked into tgmpa_init, which is fired within the - * TGM_Plugin_Activation class constructor. + * CZR_Plugin_Activation class constructor. */ function czr_fn_register_required_plugins() {