agm_settings_init(); } /* * Register our short-code [ank_google_map] */ add_shortcode('ank_google_map', array($this, 'agm_do_shortCode')); }/*end constructor*/ private function agm_settings_page_url() { return add_query_arg('page', AGM_PLUGIN_SLUG, 'options-general.php'); } function agm_plugin_actions_links($links, $file) { static $plugin; $plugin = plugin_basename(__FILE__); if ($file == $plugin && current_user_can('manage_options')) { array_unshift( $links, sprintf('%s', esc_attr($this->agm_settings_page_url()), __('Settings')) ); } return $links; } function agm_plugin_meta_links($links,$file) { /* * additional link on plugin list page */ static $plugin; $plugin = plugin_basename( __FILE__ ); if ( $file == $plugin ) { $links[] = 'Read Me'; $links[] = 'GitHub'; } return $links; } function agm_settings_init() { /* * these are default settings * save settings in array for faster access */ $new_options = array( 'div_width' => '100', 'div_width_unit' => 2, 'div_height' => '300', 'div_border_color' => '#ccc', 'map_Lat' => '29.453182059948965', 'map_Lng' => '77.7068350911577', 'map_zoom' => 2, 'map_control_1' => '0', 'map_control_2' => '0', 'map_control_3' => '0', 'map_control_4' => '0', 'map_control_5' => '0', 'map_lang_code' => '', 'map_type' => 1, 'marker_on' => '1', 'marker_title' => 'We are here', 'marker_anim' => 1, 'marker_color' => 1, 'info_on' => '1', 'info_text' => 'Your Destination', 'info_state' => '0', 'te_meta_1' => '1' , 'te_meta_2' => '0', 'te_meta_3' => '0', 'plugin_ver' => AGM_PLUGIN_VERSION, ); /* * save default settings to wp_options table * */ add_option('ank_google_map', $new_options); } function agm_marker_url($id) { /** * We depends on Google server for maker images * @source http://ex-ample.blogspot.in/2011/08/all-url-of-markers-used-by-google-maps.html */ $path=array( /* 1 is reserved for default */ '2'=>'https://maps.gstatic.com/intl/en_us/mapfiles/marker.png', '3'=>'https://maps.gstatic.com/intl/en_us/mapfiles/marker_black.png', '4'=>'https://maps.gstatic.com/intl/en_us/mapfiles/marker_grey.png', '5'=>'https://maps.gstatic.com/intl/en_us/mapfiles/marker_orange.png', '6'=>'https://maps.gstatic.com/intl/en_us/mapfiles/marker_white.png', '7'=>'https://maps.gstatic.com/intl/en_us/mapfiles/marker_yellow.png', '8'=>'https://maps.gstatic.com/intl/en_us/mapfiles/marker_purple.png', '9'=>'https://maps.gstatic.com/intl/en_us/mapfiles/marker_green.png', ); if(array_key_exists($id,$path)){ return $path[$id]; }else{ return false; } } /* ********* front end started ********* */ function agm_write_html($options) { /* * Decide some options here */ $w_unit = ($options["div_width_unit"] === 1) ? 'px' : '%'; $b_color=($options["div_border_color"]==='')? '' : 'border:1px solid '.esc_attr($options["div_border_color"]); echo '
'; } function agm_write_css() { /* * Special fixes for google map controls. * They may appear incorrectly due to theme style */ ?> function Load_agm_Map() { var cn = new google.maps.LatLng(); var op = { center: cn, zoom: , mapTypeId: google.maps.MapTypeId.}; var map = new google.maps.Map(agm_div, op); var mk = new google.maps.Marker({ agm_marker_url($options['marker_color']).'",'; } ?> position: cn, map: map , title: "" }); var iw = new google.maps.InfoWindow({content: ""}); google.maps.event.addListener(map, 'click', function () { iw.close(); }); google.maps.event.addListener(mk, "click", function () { iw.open(map, mk); mk.setAnimation(null); }); window.setTimeout(function () { iw.open(map, mk); mk.setAnimation(null); }, 2000); var rT; google.maps.event.addDomListener(window, 'resize', function () { if (rT) { clearTimeout(rT); } rT = window.setTimeout(function () { map.setCenter(cn); }, 300); }); } var agm_div = document.getElementById("agm_map_canvas"); if (agm_div) { if (typeof google == "object") { google.maps.event.addDomListener(window, "load", Load_agm_Map) } else { agm_div.innerHTML = 'Failed to load Google Map.
Please try again.