Skip to content

Commit

Permalink
fixed : prefixed TGMPA class with HU_ to fix potential collision with…
Browse files Browse the repository at this point in the history
… other plugins using the same class. see issue presscustomizr/customizr#1603
  • Loading branch information
noErrdev committed Oct 13, 2018
1 parent 25b9ff3 commit 932bc17
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions functions/admin/class-admin-update-notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ function hu_may_be_display_update_notice() {

if ( ! $show_new_notice )
return;

if ( ! hu_is_plugin_active('nimble-builder/nimble-builder.php') && class_exists('TGM_Plugin_Activation') && ! TGM_Plugin_Activation::get_instance()->hu_is_notice_dismissed() )
//prefixed HU_Plugin_Activation because of the possible issue : https://github.com/presscustomizr/customizr/issues/1603
if ( ! hu_is_plugin_active('nimble-builder/nimble-builder.php') && class_exists('HU_Plugin_Activation') && ! HU_Plugin_Activation::get_instance()->hu_is_notice_dismissed() )
return;

ob_start();
Expand Down
30 changes: 15 additions & 15 deletions functions/admin/class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 HU_Plugin_Activation because of the possible issue : https://github.com/presscustomizr/customizr/issues/1603
if ( ! class_exists( 'HU_Plugin_Activation' ) ) {

/**
* Automatic plugin installation and activation library.
Expand All @@ -47,7 +47,7 @@
* @author Thomas Griffin
* @author Gary Jones
*/
class TGM_Plugin_Activation {
class HU_Plugin_Activation {
/**
* TGMPA version number.
*
Expand Down Expand Up @@ -80,7 +80,7 @@ class TGM_Plugin_Activation {
*
* @since 1.0.0
*
* @var TGM_Plugin_Activation
* @var HU_Plugin_Activation
*/
public static $instance;

Expand Down Expand Up @@ -250,7 +250,7 @@ class TGM_Plugin_Activation {
*
* @since 1.0.0
*
* @see TGM_Plugin_Activation::init()
* @see HU_Plugin_Activation::init()
*/
public function __construct() {
// Set the current WordPress version.
Expand Down Expand Up @@ -485,9 +485,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 HU_Plugin_Activation::admin_menu()
* @see HU_Plugin_Activation::notices()
* @see HU_Plugin_Activation::styles()
*/
public function init() {
/**
Expand Down Expand Up @@ -786,8 +786,8 @@ public function thickbox() {
*
* @since 1.0.0
*
* @see TGM_Plugin_Activation::init()
* @see TGM_Plugin_Activation::install_plugins_page()
* @see HU_Plugin_Activation::init()
* @see HU_Plugin_Activation::install_plugins_page()
*
* @return null Return early if user lacks capability to install a plugin.
*/
Expand Down Expand Up @@ -2209,7 +2209,7 @@ public function show_tgmpa_version() {
*
* @since 2.4.0
*
* @return \TGM_Plugin_Activation The TGM_Plugin_Activation object.
* @return \HU_Plugin_Activation The HU_Plugin_Activation object.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
Expand All @@ -2227,7 +2227,7 @@ public static function get_instance() {
* @since 2.5.0
*/
function load_tgm_plugin_activation() {
$GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance();
$GLOBALS['tgmpa'] = HU_Plugin_Activation::get_instance();
}
}

Expand Down Expand Up @@ -3216,15 +3216,15 @@ 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 HU_Plugin_Activation::_get_plugin_data_from_name()} instead.
* @see HU_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', 'HU_Plugin_Activation::_get_plugin_data_from_name()' );

return $this->tgmpa->_get_plugin_data_from_name( $name, $data );
}
Expand Down
5 changes: 3 additions & 2 deletions functions/init-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ function hu_admin_style() {
/* ------------------------------------------------------------------------- */
if ( ( ! defined( 'HU_IS_PRO' ) || ! HU_IS_PRO ) && is_admin() && ! hu_is_customizing() && ! hu_is_plugin_active('nimble-builder/nimble-builder.php') ) {
/**
* Include the TGM_Plugin_Activation class.
* Include the HU_Plugin_Activation class.
*/
//prefixed HU_Plugin_Activation because of the possible issue : https://github.com/presscustomizr/customizr/issues/1603
load_template( get_template_directory() . '/functions/admin/class-tgm-plugin-activation.php' );
add_action( 'tgmpa_register', 'hu_register_required_plugins' );
}
Expand All @@ -67,7 +68,7 @@ function hu_admin_style() {
* arrays.
*
* This function is hooked into tgmpa_init, which is fired within the
* TGM_Plugin_Activation class constructor.
* HU_Plugin_Activation class constructor.
*/
function hu_register_required_plugins() {

Expand Down

0 comments on commit 932bc17

Please sign in to comment.