https://www.mapsmarker.com/path-error for more details');
}
include( 'wp-load.php' );
//info: check if plugin is active (didnt use is_plugin_active() due to problems reported by users)
function lmm_is_plugin_active( $plugin ) {
$active_plugins = get_option('active_plugins');
$active_plugins = array_flip($active_plugins);
if ( isset($active_plugins[$plugin]) || lmm_is_plugin_active_for_network( $plugin ) ) { return true; }
}
function lmm_is_plugin_active_for_network( $plugin ) {
if ( !is_multisite() )
return false;
$plugins = get_site_option( 'active_sitewide_plugins');
if ( isset($plugins[$plugin]) )
return true;
return false;
}
if (!lmm_is_plugin_active('leaflet-maps-marker/leaflet-maps-marker.php') ) {
echo sprintf(__('The plugin "Leaflet Maps Marker" is inactive on this site and therefore this API link is not working. Please contact the site owner (%1s) who can activate this plugin again.','lmm'), antispambot(get_bloginfo('admin_email')) );
} else {
global $wpdb, $allowedtags, $locale, $allowedposttags;
$additionaltags = array('iframe' => array('id' => true,'name' => true,'src' => true,'class' => true,'style' => true,'frameborder' => true,'scrolling' => true,'align' => true,'width' => true,'height' => true,'marginwidth' => true,'marginheight' => true),'style' => array('media' => true,'scoped' => true,'type' => true),'input' => array('accept' => true,'align' => true,'alt' => true,'autocomplete' => true,'autofocus' => true,'checked' => true,'dirname' => true,'disabled' => true,'form' => true,'formaction' => true,'formenctype' => true,'formmethod' => true,'formnovalidate' => true,'formtarget' => true,'height' => true,'id' => true,'list' => true,'max' => true,'maxlength' => true,'min' => true,'multiple' => true,'name' => true,'pattern' => true,'placeholder' => true,'readonly' => true,'required' => true,'size' => true,'src' => true,'step' => true,'type' => true,'value' => true,'width' => true), 'source' => array('type' => true,'src' => true));
$table_name_markers = $wpdb->prefix.'leafletmapsmarker_markers';
$table_name_layers = $wpdb->prefix.'leafletmapsmarker_layers';
$lmm_options = get_option( 'leafletmapsmarker_options' );
//info: set marker shadow url
if ( $lmm_options['defaults_marker_icon_shadow_url_status'] == 'default' ) {
if ( $lmm_options['defaults_marker_icon_shadow_url'] == NULL ) {
$marker_shadow_url = '';
} else {
$marker_shadow_url = LEAFLET_PLUGIN_URL . 'leaflet-dist/images/marker-shadow.png';
}
} else {
$marker_shadow_url = htmlspecialchars($lmm_options['defaults_marker_icon_shadow_url']);
}
$plugin_version = get_option('leafletmapsmarker_version');
if (isset($_GET['layer'])) {
$layer = intval($_GET['layer']);
$uid = substr(md5(''.rand()), 0, 8);
$table_name_layers = $wpdb->prefix.'leafletmapsmarker_layers';
$row = $wpdb->get_row($wpdb->prepare('SELECT `id`,`name`,`basemap`,`mapwidth`,`mapheight`,`mapwidthunit`,`panel`,`layerzoom`,`layerviewlat`,`layerviewlon`,`controlbox`,`overlays_custom`,`overlays_custom2`,`overlays_custom3`,`overlays_custom4`,`wms`,`wms2`,`wms3`,`wms4`,`wms5`,`wms6`,`wms7`,`wms8`,`wms9`,`wms10`,`multi_layer_map`,`multi_layer_map_list` FROM `'.$table_name_layers.'` WHERE `id` = %d',$layer), ARRAY_A);
$id = $row['id'];
$layername = $row['name'];
$basemap = $row['basemap'];
//info: fallback for existing maps if Google API is disabled
if (($lmm_options['google_maps_api_status'] == 'disabled') && (($basemap == 'googleLayer_roadmap') || ($basemap == 'googleLayer_satellite') || ($basemap == 'googleLayer_hybrid') || ($basemap == 'googleLayer_terrain')) ) {
$basemap = 'osm_mapnik';
}
$lat = $row['layerviewlat'];
$lon = $row['layerviewlon'];
$zoom = $row['layerzoom'];
$mapwidth = $row['mapwidth'];
$mapheight = $row['mapheight'];
$mapwidthunit = $row['mapwidthunit'];
$panel = $row['panel'];
$paneltext = ($row['name'] == NULL) ? ' ' : htmlspecialchars(stripslashes($row['name']));
$controlbox = $row['controlbox'];
$overlays_custom = $row['overlays_custom'];
$overlays_custom2 = $row['overlays_custom2'];
$overlays_custom3 = $row['overlays_custom3'];
$overlays_custom4 = $row['overlays_custom4'];
$wms = $row['wms'];
$wms2 = $row['wms2'];
$wms3 = $row['wms3'];
$wms4 = $row['wms4'];
$wms5 = $row['wms5'];
$wms6 = $row['wms6'];
$wms7 = $row['wms7'];
$wms8 = $row['wms8'];
$wms9 = $row['wms9'];
$wms10 = $row['wms10'];
$mapname = 'mapsmarker_'.$uid;
$multi_layer_map = $row['multi_layer_map'];
$multi_layer_map_list = $row['multi_layer_map_list'];
//info: check if layer/marker ID exists
if ($row == NULL) {
$error_layer_not_exists = sprintf( esc_attr__('Error: a layer with the ID %1$s does not exist!','lmm'), $layer);
echo $error_layer_not_exists;
} else {
//info: starting output on frontend
$lmm_out = ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= '
'.PHP_EOL;
if ($layername == '') { $title_layername = get_bloginfo('name'); } else { $title_layername = htmlspecialchars(stripslashes($layername)); }
$lmm_out .= '' . $title_layername . ' - ' . get_bloginfo('name') . ' '.PHP_EOL;
$lmm_out .= ' '.PHP_EOL;
$lmm_out .= ' '.PHP_EOL;
$lmm_out .= ' '.PHP_EOL;
$lmm_out .= ' '.PHP_EOL;
if ( function_exists( 'is_rtl' ) && is_rtl() ) {
$lmm_out .= ' '.PHP_EOL;
} else {
$lmm_out .= ' '.PHP_EOL;
}
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
//info: Google API key
if ( isset($lmm_options['google_maps_api_key']) && ($lmm_options['google_maps_api_key'] != NULL) ) { $google_maps_api_key = '?key=' . esc_js(trim($lmm_options['google_maps_api_key'])); } else { $google_maps_api_key = ''; }
if ($lmm_options['google_maps_api_status'] == 'enabled') {
$lmm_out .= ''.PHP_EOL;
}
//info: Google language localization (JSON API)
if ($lmm_options['google_maps_language_localization'] == 'browser_setting') {
$google_language = '';
} else if ($lmm_options['google_maps_language_localization'] == 'wordpress_setting') {
if ( $locale != NULL ) { $google_language = "&language=" . substr($locale, 0, 2); } else { $google_language = '&language=en'; }
} else {
$google_language = "&language=" . $lmm_options['google_maps_language_localization'];
}
if ($lmm_options['google_maps_base_domain_custom'] == 'maps.google.com') {
$gmaps_base_domain = "&base_domain=" . $lmm_options['google_maps_base_domain'];
} else {
$gmaps_base_domain = "&base_domain=" . htmlspecialchars($lmm_options['google_maps_base_domain_custom']);
}
//info: Bing culture code
if ($lmm_options['bingmaps_culture'] == 'automatic') {
if ( $locale != NULL ) { $bing_culture = str_replace("_","-", $locale); } else { $bing_culture = 'en_us'; }
} else {
$bing_culture = esc_js($lmm_options['bingmaps_culture']);
}
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL; //info: for layer controlbox
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
//info: panel for layer/marker name and API URLs
if ($panel == 1) {
if ( function_exists( 'is_rtl' ) && is_rtl() ) { $panel_fullscreen_text = 'text-align:right;'; } else { $panel_fullscreen_text = 'text-align:left;'; }
$lmm_out .= ''.PHP_EOL;
}
//info: if panel enabled, only 94% height as otherwise attribution wont be visible
if ($panel == 1) {
$lmm_out .= ''. PHP_EOL;
} else {
$lmm_out .= ''. PHP_EOL;
}
//info: add geo microformats
$layermarklist = $wpdb->get_results($wpdb->prepare('SELECT l.id as lid,l.name as lname, m.lon as mlon, m.lat as mlat, m.markername as markername,m.id as markerid FROM `'.$table_name_layers.'` as l INNER JOIN `'.$table_name_markers.'` AS m ON l.id=m.layer WHERE l.id = %d LIMIT 1000',$layer), ARRAY_A);
if (count($layermarklist) < 1) {
$lmm_out .= '' . $paneltext . ': ' . $lat . ' , ' . $lon . '
'.PHP_EOL;
} else {
foreach ($layermarklist as $row){
$lmm_out .= '' . htmlspecialchars($row['markername']) . ': ' . $row['mlat'] . ' , ' . $row['mlon'] . '
'.PHP_EOL;
}
}
$lmm_out .= '';
$lmm_out .= '';
$lmm_out .= '';
echo $lmm_out;
} //info: end check if marker/layer exists
} //info: end isset($_GET['layer'])
elseif (isset($_GET['marker'])) {
$markerid = intval($_GET['marker']);
$uid = substr(md5(''.rand()), 0, 8);
$table_name_markers = $wpdb->prefix.'leafletmapsmarker_markers';
$row = $wpdb->get_row($wpdb->prepare('SELECT `id`,`markername`,`basemap`,`layer`,`lat`,`lon`,`icon`,`popuptext`,`zoom`,`openpopup`,`mapwidth`,`mapwidthunit`,`mapheight`,`panel`,`controlbox`,`overlays_custom`,`overlays_custom2`,`overlays_custom3`,`overlays_custom4`,`wms`,`wms2`,`wms3`,`wms4`,`wms5`,`wms6`,`wms7`,`wms8`,`wms9`,`wms10`,`address` FROM `'.$table_name_markers.'` WHERE `id` = %d',$markerid), ARRAY_A);
if(!empty($row)) {
$id = $row['id'];
$markername = esc_js($row['markername']);
$basemap = $row['basemap'];
//info: fallback for existing maps if Google API is disabled
if (($lmm_options['google_maps_api_status'] == 'disabled') && (($basemap == 'googleLayer_roadmap') || ($basemap == 'googleLayer_satellite') || ($basemap == 'googleLayer_hybrid') || ($basemap == 'googleLayer_terrain')) ) {
$basemap = 'osm_mapnik';
}
$lon = $row['lon'];
$lat = $row['lat'];
$coords = $lat.', '.$lon;
$icon = $row['icon'];
//info: strip evil scripts
if ($lmm_options['wp_kses_status'] == 'enabled') {
$popuptext = wp_kses($row['popuptext'], array_merge($allowedposttags, $additionaltags));
} else {
$popuptext = $row['popuptext'];
}
$zoom = $row['zoom'];
$openpopup = ($row['openpopup'] == 1) ? '.openPopup()' : '';
$mopenpopup = $openpopup;
$layer = $row['layer'];
$mlat = $lat;
$mlon = $lon;
$mpopuptext = $popuptext;
$micon = $icon;
$mapwidth = $row['mapwidth'];
$mapwidthunit = $row['mapwidthunit'];
$mapheight = $row['mapheight'];
$panel = $row['panel'];
$paneltext = ($row['markername'] == NULL) ? ' ' : htmlspecialchars(stripslashes($row['markername']));
$controlbox = $row['controlbox'];
$overlays_custom = $row['overlays_custom'];
$overlays_custom2 = $row['overlays_custom2'];
$overlays_custom3 = $row['overlays_custom3'];
$overlays_custom4 = $row['overlays_custom4'];
$wms = $row['wms'];
$wms2 = $row['wms2'];
$wms3 = $row['wms3'];
$wms4 = $row['wms4'];
$wms5 = $row['wms5'];
$wms6 = $row['wms6'];
$wms7 = $row['wms7'];
$wms8 = $row['wms8'];
$wms9 = $row['wms9'];
$wms10 = $row['wms10'];
$address = $row['address'];
$mapname = 'mapsmarker_'.$uid;
}
//info: check if layer/marker ID exists
if ($row == NULL) {
$error_marker_not_exists = sprintf( esc_attr__('Error: a marker with the ID %1$s does not exist!','lmm'), $markerid);
echo $error_marker_not_exists;
} else {
//info: starting output on frontend
$lmm_out = ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
if ($markername == '') { $title_markername = get_bloginfo('name'); } else { $title_markername = htmlspecialchars(stripslashes($markername)); }
$lmm_out .= '' . $title_markername . ' - ' . get_bloginfo('name') . ' '.PHP_EOL;
$lmm_out .= ' '.PHP_EOL;
$lmm_out .= ' '.PHP_EOL;
$lmm_out .= ' '.PHP_EOL;
$lmm_out .= ' '.PHP_EOL;
if ( function_exists( 'is_rtl' ) && is_rtl() ) {
$lmm_out .= ' '.PHP_EOL;
} else {
$lmm_out .= ' '.PHP_EOL;
}
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
//info: Google API key
if ( isset($lmm_options['google_maps_api_key']) && ($lmm_options['google_maps_api_key'] != NULL) ) { $google_maps_api_key = '?key=' . esc_js(trim($lmm_options['google_maps_api_key'])); } else { $google_maps_api_key = ''; }
if ($lmm_options['google_maps_api_status'] == 'enabled') {
$lmm_out .= ''.PHP_EOL;
}
//info: Google language localization (JSON API)
if ($lmm_options['google_maps_language_localization'] == 'browser_setting') {
$google_language = '';
} else if ($lmm_options['google_maps_language_localization'] == 'wordpress_setting') {
if ( $locale != NULL ) { $google_language = "&language=" . substr($locale, 0, 2); } else { $google_language = '&language=en'; }
} else {
$google_language = "&language=" . $lmm_options['google_maps_language_localization'];
}
if ($lmm_options['google_maps_base_domain_custom'] == 'maps.google.com') {
$gmaps_base_domain = "&base_domain=" . $lmm_options['google_maps_base_domain'];
} else {
$gmaps_base_domain = "&base_domain=" . htmlspecialchars($lmm_options['google_maps_base_domain_custom']);
}
//info: Bing culture code
if ($lmm_options['bingmaps_culture'] == 'automatic') {
if ( $locale != NULL ) { $bing_culture = str_replace("_","-", $locale); } else { $bing_culture = 'en_us'; }
} else {
$bing_culture = esc_js($lmm_options['bingmaps_culture']);
}
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL; //info: for layer controlbox
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
$lmm_out .= ''.PHP_EOL;
//info: panel for layer/marker name and API URLs
if ($panel == 1) {
if ( function_exists( 'is_rtl' ) && is_rtl() ) { $panel_fullscreen_text = 'text-align:right;'; } else { $panel_fullscreen_text = 'text-align:left;'; }
$lmm_out .= ''.PHP_EOL;
}
//info: if panel enabled, only 94% height as otherwise attribution wont be visible
if ($panel == 1) {
$lmm_out .= ''. PHP_EOL;
} else {
$lmm_out .= ''. PHP_EOL;
}
//info: add geo microformats
$lmm_out .= '' . $paneltext . ': ' . $lat . ' , ' . $lon . '
'.PHP_EOL;
$lmm_out .= '';
$lmm_out .= '';
$lmm_out .= '';
echo $lmm_out;
} //info: end check if marker/layer exists
} //info: end isset($_GET['marker'])
} //info: end plugin active check
?>