/** * 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)); }
/** * Register the JavaScript for the public-facing side of the site. * * @since 1.0.0 */ public function enqueue_scripts() { $do_load = LeafletLayers::$is_shortcode_used; if ($do_load === true) { wp_enqueue_script('leafletjs', LeafletLayers::get_plugin_url() . 'views/js/leaflet.js', array(), '0.7.7', false); wp_enqueue_script('leafletjspanel', LeafletLayers::get_plugin_url() . 'views/js/leaflet-panel-layers.js', array('leafletjs'), '0.1', false); wp_enqueue_script('leafletlayers', LeafletLayers::get_plugin_url() . 'views/js/leafletlayers.js', array('leafletjspanel'), LeafletLayers::PLUGIN_VERSION, true); if (self::$model_sett->get_settings('leafletlayers_collab_form')) { wp_enqueue_script('leafletlayers_form', LeafletLayers::get_plugin_url() . 'views/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)); wp_localize_script('leafletlayers', 'leafletlayers_success_txt', __('Thanks you, the marker will be added after moderation', LeafletLayers::PLUGIN_ID)); wp_localize_script('leafletlayers', 'leafletlayers_error_txt', __('Oops : an error occured', LeafletLayers::PLUGIN_ID)); wp_localize_script('leafletlayers', 'leafletlayers_img_path', LeafletLayers::get_plugin_url() . 'views/images/'); wp_localize_script('leafletlayers', 'ajax_url', admin_url('admin-ajax.php')); } wp_localize_script('leafletlayers', 'markers_json', self::$markers_js); } }