/**
 * Begins execution of the plugin.
 *
 * @since    1.0.0
 */
function run_leafletlayers()
{
    /**
     * Check requirements and load main class
     * The main program needs to be in a separate file that only gets loaded if the plugin requirements are met.
     * Otherwise older PHP installations could crash when trying to parse it.
     **/
    if (leafletlayers_requirements_met()) {
        /**
         * The core plugin class that is used to define internationalization,
         * admin-specific hooks, and public-facing site hooks.
         */
        require_once plugin_dir_path(__FILE__) . 'includes/class-leafletlayers.php';
        /**
         * Begins execution of the plugin.
         *
         * Since everything within the plugin is registered via hooks,
         * then kicking off the plugin from this point in the file does
         * not affect the page life cycle.
         *
         * @since    1.0.0
         */
        $plugin = LeafletLayers::get_instance();
    } else {
        add_action('admin_notices', 'leafletlayers_show_requirements_error');
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
        deactivate_plugins(plugin_basename(__FILE__));
    }
}
 /**
  * Enqueue admin stuff if necessary
  *
  * @since 1.0.0
  */
 public function enqueue_admin_stuff($hook)
 {
     if (static::$hook_suffix_add != $hook && static::$hook_suffix_edit != $hook) {
         return;
     }
     wp_enqueue_style('panelcss', LeafletLayers::get_plugin_url() . 'views/css/leafletlayers.css', array(), LeafletLayers::PLUGIN_VERSION, 'all');
     wp_enqueue_script('leafletjs', LeafletLayers::get_plugin_url() . 'views/js/leaflet.js', array(), '0.7.7', false);
     wp_enqueue_script('leafletlayers', LeafletLayers::get_plugin_url() . 'views/admin/js/leafletlayers_adder.js', array('leafletjs'), LeafletLayers::PLUGIN_VERSION, true);
     wp_localize_script('leafletlayers', 'zoom_error_txt', __('Insufficent accuracy : please zoom a little more.', LeafletLayers::PLUGIN_ID));
 }
 /**
  * Render a template
  *
  * @param  string $default_template_path The path to the template, relative to the plugin's `views` folder
  * @param  array  $variables             An array of variables to pass into the template's scope, indexed with the variable name so that it can be extract()-ed
  * @param  string $require               'once' to use require_once() | 'always' to use require()
  * @return string
  *
  * @since    1.0.0
  */
 protected static function render_template($default_template_path = false, $variables = array(), $require = 'once')
 {
     if (!($template_path = locate_template(basename($default_template_path)))) {
         $template_path = LeafletLayers::get_plugin_path() . '/views/admin/' . $default_template_path;
     }
     if (is_file($template_path)) {
         extract($variables);
         ob_start();
         if ('always' == $require) {
             require $template_path;
         } else {
             require_once $template_path;
         }
         $template_content = apply_filters('leafletlayers_template_content', ob_get_clean(), $default_template_path, $template_path, $variables);
     } else {
         $template_content = '';
     }
     return $template_content;
 }
 /**
  * Define the core functionality of the plugin.
  *
  * Load the dependencies, define the locale, and set the hooks for the admin area and
  * the public-facing side of the site.
  *
  * @since    1.0.0
  */
 public function __construct()
 {
     self::$plugin_path = plugin_dir_path(dirname(__FILE__));
     self::$plugin_url = plugin_dir_url(dirname(__FILE__));
     require_once self::$plugin_path . 'includes/class-' . self::PLUGIN_PREFIX . 'loader.php';
     self::$modules['LeafletLayers_Loader'] = LeafletLayers_Loader::get_instance();
     self::$modules['LeafletLayers_Controller_Public'] = LeafletLayers_Controller_Public::get_instance();
     self::$modules['LeafletLayers_Controller_Admin_Settings'] = LeafletLayers_Controller_Admin_Settings::get_instance();
     self::$modules['LeafletLayers_Controller_Admin_Notices'] = LeafletLayers_Controller_Admin_Notices::get_instance();
     self::$modules['LeafletLayers_Controller_Admin_Menu'] = LeafletLayers_Controller_Admin_Menu::get_instance();
     LeafletLayers_Actions_Filters::init_actions_filters();
 }
 public function leafmap_form($atts, $content = null, $tag)
 {
     LeafletLayers::$is_shortcode_used = true;
     $leafletlayers['domain'] = LeafletLayers::PLUGIN_ID;
     $leafletlayers['groups'] = self::$leafletlayers_groups;
     $leafletlayers['pepito'] = wp_create_nonce('add_public_marker');
     $content = static::render_template('leafletlayers_form.php', $leafletlayers);
     return $content;
 }
 /**
  * Register callbacks for actions and filters
  *
  * @since    1.0.0.0
  */
 public function register_hook_callbacks()
 {
     register_activation_hook(LeafletLayers::get_plugin_path() . LeafletLayers::PLUGIN_ID . '.php', array($this, 'activate'));
     register_deactivation_hook(__FILE__, 'deactivate');
 }