impress-org / google-maps-builder

One Google Maps plugin to rule them all. Google Maps Builder is intuitive, sleek, powerful and easy to use. Forget the rest, use the best.
https://wordpress.org/plugins/google-maps-builder/
32 stars 9 forks source link

Duplicate Shortcode Generators on Free plugin #234

Closed mathetos closed 7 years ago

mathetos commented 7 years ago

Steps to Replicate

Possible Solutions

It looks like we're registering the TinyMCE button twice.

  1. Once in the CORE vendor package ( https://github.com/WordImpress/Google-Maps-Builder/blob/master/includes/admin/class-gmb-shortcode-generator.php ),
  2. and once in the Free plugin code ( https://github.com/WordImpress/Google-Maps-Builder/blob/master/includes/admin/class-gmb-shortcode-generator.php#L150 )
kevinwhoffman commented 7 years ago

There were two issues here:

  1. To clarify, there should be two classes. The Core class is an abstract class that is extended by both the Free and Pro plugins. The problem is not the existence of these two classes, but rather that new GMB_Shortcode_Generator() is called twice - once at the bottom of the generator class and once in the main Core class. I'm removing the call at the bottom of the generator class.
  2. The Free plugin did not contain the class-gmb-html-elements.php file necessary to render the shortcode generator's contents. Since the contents of the generator is the same for the Free and Pro versions, I am moving this class to Core for better maintainability in the future.

Both issues will be fixed in 2.1.2.