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 {
$import_export_standalone_nonce = isset($_GET['_wpnonce']) ? $_GET['_wpnonce'] : '';
if (! wp_verify_nonce($import_export_standalone_nonce, 'import-export-standalone-nonce') ) die("".__('Security check failed - please call this function from the according admin page!','lmm')."");
/**
* Sanitizes first character of string fields to prevent command injections
*
* @since 3.12.1
* @access public
* @static
*
* @return string
*/
function sanitize_excel($string) {
$filter = array('=', '+', '-', '@');
$first_char = substr($string, 0, 1);
$string = substr($string, 1);
if (in_array($first_char, $filter)) {
$first_char = "'" . $first_char . "'";
}
return $first_char . $string;
}
global $wpdb, $current_user;
$table_name_markers = $wpdb->prefix.'leafletmapsmarker_markers';
$table_name_layers = $wpdb->prefix.'leafletmapsmarker_layers';
$lmm_options = get_option( 'leafletmapsmarker_options' );
$action_iframe = isset($_GET['action_iframe']) ? $_GET['action_iframe'] : '';
$action_standalone = isset($_POST['action_standalone']) ? $_POST['action_standalone'] : '';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'PHPExcel.php';
if ($action_standalone == NULL) {
echo '
Import/Export for Maps Marker Pro
';
//info: get available caching methods for import/export prepare forms
if (version_compare(phpversion(),"5.6.29","!=")){ //info: https://github.com/PHPOffice/PHPExcel/issues/1085
if ( function_exists('sqlite_open') ){ //info: SQLite2
$caching_sqlite2_disabled = '';
$caching_sqlite2_disabled_css = '';
} else {
$caching_sqlite2_disabled = 'disabled="disabled"';
$caching_sqlite2_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
if ( class_exists('SQLite3',FALSE) === TRUE ) { //info:SQLite3
$caching_sqlite3_disabled = '';
$caching_sqlite3_disabled_css = '';
} else {
$caching_sqlite3_disabled = 'disabled="disabled"';
$caching_sqlite3_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
} else {
$caching_sqlite2_disabled = 'disabled="disabled"';
$caching_sqlite2_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
$caching_sqlite3_disabled = 'disabled="disabled"';
$caching_sqlite3_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
if ( PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_to_apc) === TRUE ) { //info: APC
$caching_apc_disabled = '';
$caching_apc_disabled_css = '';
} else {
$caching_apc_disabled = 'disabled="disabled"';
$caching_apc_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
if ( function_exists('wincache_ucache_add') ) { //info: Wincache
$caching_wincache_disabled = '';
$caching_wincache_disabled_css = '';
} else {
$caching_wincache_disabled = 'disabled="disabled"';
$caching_wincache_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
if ( PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip) === TRUE ) { //info: MemoryGZip
$caching_memorygzip_disabled = '';
$caching_memorygzip_disabled_css = '';
} else {
$caching_memorygzip_disabled = 'disabled="disabled"';
$caching_memorygzip_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
if ( PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_to_discISAM) === TRUE ) { //info: DiscISAM
$caching_discisam_disabled = '';
$caching_discisam_disabled_css = '';
} else {
$caching_discisam_disabled = 'disabled="disabled"';
$caching_discisam_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
if ( PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp) === TRUE ) { //info: PHPTemp
$caching_phptemp_disabled = '';
$caching_phptemp_disabled_css = '';
} else {
$caching_phptemp_disabled = 'disabled="disabled"';
$caching_phptemp_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
if ( function_exists('igbinary_serialize') ) { //info: Igbinary
$caching_igbinary_disabled = '';
$caching_igbinary_disabled_css = '';
} else {
$caching_igbinary_disabled = 'disabled="disabled"';
$caching_igbinary_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
if ( PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_in_memory_serialized) === TRUE ) { //info: MemorySerialized
$caching_memoryserialized_disabled = '';
$caching_memoryserialized_disabled_css = '';
} else {
$caching_memoryserialized_disabled = 'disabled="disabled"';
$caching_memoryserialized_disabled_css = 'style="color:#CCCCCC;" title="' . esc_attr__('this caching method is currently not available on your server','lmm') . '"';
}
//info: disable geocoding if no API key is set for Mapzen Search, Google Geocoding and Mapzen Search
if ($lmm_options['geocoding_mapquest_geocoding_api_key'] == NULL && $lmm_options['geocoding_provider'] == 'mapquest-geocoding') {
$geocoding_radio_button_on = ' disabled="disabled"';
$geocoding_radio_button_off = ' checked="checked"';
$geocoding_provider_api_key_warning_mapquest = ' ' . sprintf(__('Error: please enter your %2$s-API key or select an alternative geocoding provider!','lmm'), LEAFLET_WP_ADMIN_URL . 'admin.php?page=leafletmapsmarker_settings#lmm-geocoding-mapquest', 'MapQuest Geocoding', LEAFLET_WP_ADMIN_URL . 'admin.php?page=leafletmapsmarker_settings#lmm-geocoding') . '';
} else if
(
( ($lmm_options['geocoding_provider'] == 'google-geocoding') || ($lmm_options['geocoding_provider_fallback'] == 'google-geocoding') )
&&
(
( ($lmm_options['geocoding_google_geocoding_auth_method'] == 'api-key') && ($lmm_options['geocoding_google_geocoding_api_key'] == NULL) )
||
( ($lmm_options['geocoding_google_geocoding_auth_method'] == 'clientid-signature') && (($lmm_options['geocoding_google_geocoding_premium_client'] == NULL) || ($lmm_options['geocoding_google_geocoding_premium_signature'] == NULL)) )
)
)
{
$geocoding_radio_button_on = ' disabled="disabled"';
$geocoding_radio_button_off = ' checked="checked"';
$geocoding_provider_api_key_warning_google = ' ' . sprintf(__('Warning: please enter your %2$s-API key or select an alternative geocoding provider!','lmm'), LEAFLET_WP_ADMIN_URL . 'admin.php?page=leafletmapsmarker_settings#lmm-geocoding-google', 'Google Geocoding', LEAFLET_WP_ADMIN_URL . 'admin.php?page=leafletmapsmarker_settings#lmm-geocoding') . ' ';
} else if ( (($lmm_options['geocoding_provider'] == 'mapzen-search') || ($lmm_options['geocoding_provider_fallback'] == 'mapzen-search')) && ($lmm_options['geocoding_mapzen_search_api_key'] == NULL) ) {
$geocoding_radio_button_on = ' disabled="disabled"';
$geocoding_radio_button_off = ' checked="checked"';
$geocoding_provider_api_key_warning_mapzen = ' ' . sprintf(__('Error: please enter your %2$s-API key or select an alternative geocoding provider!','lmm'), LEAFLET_WP_ADMIN_URL . 'admin.php?page=leafletmapsmarker_settings#lmm-geocoding-mapzen', 'Mapzen Search', LEAFLET_WP_ADMIN_URL . 'admin.php?page=leafletmapsmarker_settings#lmm-geocoding') . '';
} else {
$geocoding_radio_button_on = ' checked="checked" disabled="disabled"';
$geocoding_radio_button_off = '';
$geocoding_provider_api_key_warning = '';
}
//info: prepare rate limit infos
if ( ($lmm_options['geocoding_algolia_appId'] != NULL) && ($lmm_options['geocoding_algolia_apiKey'] != NULL) ){
$algolia_rate_limit = sprintf(__('Rate limit: %1$s requests/%2$s and a maximum of %3$s requests/%4$s','lmm'), '100.000', __('month','lmm'), '15', __('second','lmm'));
} else {
$algolia_rate_limit = sprintf(__('Rate limit: %1$s requests/domain/%2$s and a maximum of %3$s requests/%4$s','lmm'), '1.000', __('day','lmm'), '15', __('second','lmm'));
}
$mapzen_rate_limit = sprintf(__('Rate limit: %1$s requests/%2$s and a maximum of %3$s requests/%4$s','lmm'), '30.000', __('month','lmm'), '6', __('second','lmm'));
//info: check if Mapzen Search API key is set
$geocoding_provider_mapzen_disabled = '';
if ($lmm_options['geocoding_mapzen_search_api_key'] == NULL) {
$option_mapzen_inactive = '
'. sprintf(__('Rate limit: %1$s transactions/month and a maximum of %2$s requests/%3$s','lmm'), '30.000', '6', __('second','lmm')) . $geocoding_provider_api_key_warning_mapzen . '
'. sprintf(__('Rate limit: %1$s transactions/month and a maximum of %2$s requests/%3$s','lmm'), '30.000', '6', __('second','lmm')) . '
';
$option_mapzen_inactive = '';
}
//info: check if MapQuest API key is set
$geocoding_provider_mapquest_disabled = '';
if ($lmm_options['geocoding_mapquest_geocoding_api_key'] == NULL) {
$option_mapquest_inactive = '
'. sprintf(__('Rate limit: %1$s transactions/month and a maximum of %2$s requests/%3$s','lmm'), '15.000', '10', __('second','lmm')) . $geocoding_provider_api_key_warning_mapquest . '
';
$layerlist = $wpdb->get_results('SELECT `id`,`name`,`multi_layer_map` FROM '.$table_name_layers, ARRAY_A);
$markercount_all = $wpdb->get_var('SELECT count(*) FROM '.$table_name_markers.'');
$iconlist = $wpdb->get_results('SELECT distinct(icon) FROM '.$table_name_markers, ARRAY_A);
if (extension_loaded('zip')) {
$export_disabled = '';
$export_disabled_info = '';
} else {
$export_disabled = 'disabled="disabled"';
$export_disabled_info = ' ' . __('The PHP extension php_zip is not enabled on your server - this means that .xlsx or .ods files cannot be handled. Please contact your admin for more details.','lmm') . '';
}
echo '
';
//info: ($action_iframe == 'import')
} else if ($action_iframe == 'export-layers') {
/**********************************
* export form layers *
**********************************/
echo '
';
$layerlist = $wpdb->get_results('SELECT `id`,`name`,`multi_layer_map` FROM '.$table_name_layers, ARRAY_A);
$layercount_all = $wpdb->get_var('SELECT count(*) FROM '.$table_name_layers.'') - 1;
if (extension_loaded('zip')) {
$export_disabled = '';
$export_disabled_info = '';
} else {
$export_disabled = 'disabled="disabled"';
$export_disabled_info = ' ' . __('The PHP extension php_zip is not enabled on your server - this means that .xlsx or .ods files cannot be handled. Please contact your admin for more details.','lmm') . '';
}
echo '
' . __('Please keep in mind that you can only export layer maps here - if you also want to export the assigned markers, please also use the function "export markers"!','lmm') . '