admin_options_name = 'arrow-google-maps-admin-options'; $this->default_settings = array( 'title' => 'Untitled Map', 'shortcode' => 'untitled' ); $this->pagename = 'arrow-google-maps'; $this->new_pagename = 'new_arrow-google-maps'; } function get_admin_options() { // delete_option($this->admin_options_name); // $options = array( // array( // "id" => "123", // "title" => "the-title", // "settings" => array( // "key" => "val" // "key" => "val" // "key" => "val" // ) // ), // array( // "id" => "123", // "title" => "the-title", // "settings" => array( // "key" => "val" // "key" => "val" // "key" => "val" // ) // ), // ); $admin_options = array( "instances" => array() ); $loaded_options = get_option($this->admin_options_name); if (!empty($loaded_options)) { foreach ($loaded_options as $key => $option) { $admin_options[$key] = $option; } } // print_r($admin_options); // die(); update_option($this->admin_options_name, $admin_options); return $admin_options; } function init_pages() { add_menu_page( "Google Maps by Arrow Plugins", "Google Maps by Arrow Plugins", "manage_options", $this->pagename, array($this, "print_options_page"), 'dashicons-location-alt', 25 ); } function admin_includes() { wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_enqueue_script('jquery'); wp_enqueue_style('thickbox'); wp_enqueue_style('arrow-google-maps-bootstrap-css', plugins_url('/css/bootstrap.css', __FILE__), false, '1.0', false); wp_enqueue_script('arrow-google-maps-bootstrap-js', plugins_url('/js/bootstrap.min.js', __FILE__), false, '1.0', true); wp_enqueue_style('arrow-google-maps-admin-css', plugins_url('/css/admin.css', __FILE__), false, '1.0', false); wp_enqueue_script('arrow-google-maps-admin-js', plugins_url('/js/admin.js', __FILE__), false, '1.0', true); wp_enqueue_script('arrow-google-maps-styles-js', plugins_url('/js/styles.js', __FILE__), false, '1.0', true); wp_enqueue_style('arrow-google-maps-editor-css', plugins_url('/css/arrow-google-maps-editor.css', __FILE__), false, '1.0', false); wp_enqueue_script('arrow-google-maps-editor-js', plugins_url('/js/arrow-google-maps-editor.js', __FILE__), false, '1.0', true); wp_enqueue_style('arrow-google-maps-css', plugins_url('/css/arrow-google-maps.css', __FILE__), false, '1.0', false); wp_enqueue_script('arrow-google-maps-js', plugins_url('/js/arrow-google-maps.js', __FILE__), false, '1.0', true); } function client_includes() { wp_enqueue_style('arrow-google-maps-css', plugins_url('/css/arrow-google-maps.css', __FILE__), false, '1.0', false); wp_enqueue_script('arrow-google-maps-js', plugins_url('/js/arrow-google-maps.js', __FILE__), false, '1.0', true); } function call_plugin() { $options = $this->get_admin_options(); $instances = $options['instances']; ?> get_admin_options(); $instances = $options['instances']; ?>

Google Maps by Arrow Plugins

Need help? Click here to get support or see Documentation

admin_includes(); } function print_shortcode($atts) { $options = $this->get_admin_options(); $shortcode = $atts["name"]; foreach ($options["instances"] as $instance) { if ($instance["settings"]["shortcode"] == $shortcode) { $result = $instance; } } $final = '
'; $this->client_includes(); return $final; } function shortcodes() { $options = $this->get_admin_options(); add_shortcode("arrowgooglemaps", array($this, "print_shortcode")); } // AJAX function create_instance() { $options = $this->get_admin_options(); $checking = $options['instances']; if(count($checking) >= 1 ){die();} $new_instance = array( "id" => rand(0, 10000), "settings" => $this->default_settings ); if (!isset($options["instances"])) { $options["instances"] = array(); } array_push($options["instances"], $new_instance); // Save update_option($this->admin_options_name, $options); // return echo json_encode($new_instance); die(); } function load_instances() { $options = $this->get_admin_options(); $instances = $options['instances']; if (count($instances) > 0) { // INSTANCES EXIST ?>
Map Title Shortcode Edit Delete
[arrowgooglemaps name=""]
SHOW A HELP TOOLTIP ?>

Click the button below to create a new map.

Only one Map can be created in Free Version, to Create Unlimited number of Maps Please buy Premium Version with same awesome Features.

get_admin_options(); $instances = $options['instances']; $id = $_POST['id']; for ($i=0; $iget_admin_options(); $instances = $options['instances']; $id = $_POST['id']; for ($i=0; $iadmin_options_name, $options); die(); } function save_instance() { $options = $this->get_admin_options(); $instances = $options['instances']; $id = $_POST['id']; $settings = $_POST['settings']; // // Replace \" with " // $settings = str_replace('\\"', '"', $settings); // // // Replace \' with ' // $settings = str_replace('\\\'', '\'', $settings); // // // Replace \\ with \ // $settings = str_replace('\\\\', '\\', $settings); for ($i=0; $iadmin_options_name, $options); print_r($settings); die(); } function get_map_editor() { // $html_file = file_get_contents(PLUGINS_URL() . '/arrow-google-maps/map_editor.html'); // $arr = explode('', $html_file); // $html = $arr[1]; // $html = str_replace('img/', PLUGINS_URL() . '/arrow-google-maps/img/', $html); // echo $html; ?>

Map Editor

Changes saved.

Left-Click on the map to add a marker. Right-Click a marker to delete it. Drag a marker to move it around.

Left-Click a marker to attach an info window to it, or Right-Click to remove it.

1. Map Position

2. Markers

3. Info Windows

4. Style


Visit https://snazzymaps.com/editor to create a custom style array.

5. Map Size

px
px

6. Settings

Full shortcode:
[arrowgooglemaps name="shortcode"]

shortcodes(); } add_action('admin_menu', array($instance, 'init_pages')); add_action('wp_ajax_uber_google_maps_create_instance', array($instance, 'create_instance')); add_action('wp_ajax_uber_google_maps_load_instances', array($instance, 'load_instances')); add_action('wp_ajax_uber_google_maps_get_instance_options', array($instance, 'get_instance_options')); add_action('wp_ajax_uber_google_maps_get_map_editor', array($instance, 'get_map_editor')); add_action('wp_ajax_uber_google_maps_delete_instance', array($instance, 'delete_instance')); add_action('wp_ajax_uber_google_maps_save_instance', array($instance, 'save_instance')); add_action('wp_head', array($instance, 'client_includes')); add_action('wp_footer', array($instance, 'call_plugin')); ?>