Google_Maps_Builder

Main Maps Builder Class.

Defined (1)

The class is defined in the following location(s).

/google-maps-builder.php  
  1. final class Google_Maps_Builder extends Google_Maps_Builder_Core { 
  2.  
  3.  
  4. /** 
  5. * @var Google_Maps_Builder The one true Google Maps Builder instance 
  6. * @since 2.0 
  7. */ 
  8. private static $instance; 
  9.  
  10. /** 
  11. * Prevent new instances 
  12. */ 
  13. private function __construct() { 
  14. //you can not haz instance 
  15.  
  16. /** 
  17. * User meta key for marking welcome message as dismissed 
  18. * @since 2.1.0 
  19. * @var string 
  20. */ 
  21. protected $hide_welcome_key = 'gmb_hide_welcome'; 
  22.  
  23. /** 
  24. * Main Google_Maps_Builder Instance 
  25. * Insures that only one instance of Google_Maps_Builder exists in memory at any one 
  26. * time. Also prevents needing to define globals all over the place. 
  27. * @since 2.0 
  28. * @static 
  29. * @static var array $instance 
  30. * @uses Google_Maps_Builder::setup_constants() Setup the constants needed 
  31. * @uses Google_Maps_Builder::includes() Include the required files 
  32. * @uses Google_Maps_Builder::load_textdomain() load the language files 
  33. * @see Google_Maps_Builder() 
  34. * @return Google_Maps_Builder 
  35. */ 
  36. public static function instance() { 
  37. if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Google_Maps_Builder ) ) { 
  38.  
  39. self::$instance = new Google_Maps_Builder(); 
  40.  
  41. add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); 
  42.  
  43. self::$instance->includes(); 
  44. self::$instance->activate = new Google_Maps_Builder_Activate(); 
  45. self::$instance->scripts = new Google_Maps_Builder_Scripts(); 
  46. self::$instance->settings = new Google_Maps_Builder_Settings(); 
  47. self::$instance->engine = new Google_Maps_Builder_Engine(); 
  48.  
  49. register_activation_hook( __FILE__, array( 
  50. self::$instance->activate,  
  51. 'activation_flush_rewrites' 
  52. ) ); 
  53.  
  54. // Read plugin meta 
  55. // Check that function get_plugin_data exists 
  56. if ( ! function_exists( 'get_plugin_data' ) ) { 
  57. require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
  58. self::$instance->meta = get_plugin_data( GMB_PLUGIN_FILE, false ); 
  59.  
  60.  
  61. return self::$instance; 
  62.  
  63.  
  64. /** 
  65. * Include required files 
  66. * @access protected 
  67. * @since 2.0 
  68. * @return void 
  69. */ 
  70. protected function includes() { 
  71. $this->include_core_classes(); 
  72. $this->load_activate(); 
  73.  
  74. $this->cmb2_load(); 
  75. $this->load_files(); 
  76. require_once GMB_PLUGIN_PATH . 'includes/class-gmb-scripts.php'; 
  77.  
  78. if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { 
  79.  
  80. $this->load_admin(); 
  81. //Admin 
  82.  
  83. //@TODO only load when needed 
  84. $this->init_map_editor_admin(); 
  85.  
  86.  
  87.