www.mapsmarker.com "); }
include('inc' . DIRECTORY_SEPARATOR . 'admin-header.php');
require_once( ABSPATH . 'wp-admin' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'file.php' );
WP_Filesystem();
global $wpdb, $wp_filesystem, $allowedtags;
$lmm_options = get_option( 'leafletmapsmarker_options' );
$table_name_markers = $wpdb->prefix.'leafletmapsmarker_markers';
$table_name_layers = $wpdb->prefix.'leafletmapsmarker_layers';
$markercount_all = $wpdb->get_var('SELECT count(*) FROM '.$table_name_markers.'');
$layercount_all = $wpdb->get_var('SELECT count(*) FROM '.$table_name_layers.'') - 1;
$action = isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '');
if (!empty($action)) {
$toolnonce = isset($_POST['_wpnonce']) ? $_POST['_wpnonce'] : (isset($_GET['_wpnonce']) ? $_GET['_wpnonce'] : '');
if (! wp_verify_nonce($toolnonce, 'tool-nonce') ) { die(' '.__('Security check failed - please call this function from the according admin page!','lmm').''); };
if ($action == 'mass_assign') {
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `layer` = %d WHERE `layer` = %d", $_POST['layer_assign_to'], $_POST['layer_assign_from'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . sprintf( esc_attr__('All markers from layer ID %1$s have been successfully assigned to layer ID %2$s','lmm'), htmlspecialchars($_POST['layer_assign_from']), htmlspecialchars($_POST['layer_assign_to'])) . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'basemap') {
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `basemap` = %s", $_POST['basemap'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . sprintf( esc_attr__('The basemap for the selected markers has been successfully set to %1$s','lmm'), htmlspecialchars($_POST['basemap'])) . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'overlays') {
$overlays_checkbox = isset($_POST['overlays_custom']) ? '1' : '0';
$overlays2_checkbox = isset($_POST['overlays_custom2']) ? '1' : '0';
$overlays3_checkbox = isset($_POST['overlays_custom3']) ? '1' : '0';
$overlays4_checkbox = isset($_POST['overlays_custom4']) ? '1' : '0';
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `overlays_custom` = %s, `overlays_custom2` = %s, `overlays_custom3` = %s, `overlays_custom4` = %s", $overlays_checkbox, $overlays2_checkbox, $overlays3_checkbox, $overlays4_checkbox );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . __('The overlays status for the selected markers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'wms') {
$wms_checkbox = isset($_POST['wms']) ? '1' : '0';
$wms2_checkbox = isset($_POST['wms2']) ? '1' : '0';
$wms3_checkbox = isset($_POST['wms3']) ? '1' : '0';
$wms4_checkbox = isset($_POST['wms4']) ? '1' : '0';
$wms5_checkbox = isset($_POST['wms5']) ? '1' : '0';
$wms6_checkbox = isset($_POST['wms6']) ? '1' : '0';
$wms7_checkbox = isset($_POST['wms7']) ? '1' : '0';
$wms8_checkbox = isset($_POST['wms8']) ? '1' : '0';
$wms9_checkbox = isset($_POST['wms9']) ? '1' : '0';
$wms10_checkbox = isset($_POST['wms10']) ? '1' : '0';
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `wms` = %d, `wms2` = %d, `wms3` = %d, `wms4` = %d, `wms5` = %d, `wms6` = %d, `wms7` = %d, `wms8` = %d, `wms9` = %d, `wms10` = %d", $wms_checkbox, $wms2_checkbox, $wms3_checkbox, $wms4_checkbox, $wms5_checkbox, $wms6_checkbox, $wms7_checkbox, $wms8_checkbox, $wms9_checkbox, $wms10_checkbox );
$wpdb->query( $result );
echo '
' . __('The WMS status for the selected markers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'mapsize') {
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `mapwidth` = %d, `mapwidthunit` = %s, `mapheight` = %d", $_POST['mapwidth'], $_POST['mapwidthunit'], $_POST['mapheight'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . sprintf( esc_attr__('The map size for the selected markers has been successfully set to width = %1$s %2$s and height = %3$s px','lmm'), htmlspecialchars($_POST['mapwidth']), htmlspecialchars($_POST['mapwidthunit']), htmlspecialchars($_POST['mapheight'])) . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'zoom') {
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `zoom` = %d", $_POST['zoom'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . sprintf( esc_attr__('Zoom level for the selected markers has been successfully set to %1$s','lmm'), htmlspecialchars($_POST['zoom'])) . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'controlbox') {
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `controlbox` = %d", $_POST['controlbox'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . __('Controlbox status for the selected markers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'panel') {
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `panel` = %d", $_POST['panel'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . __('Panel status for the selected markers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'icon') {
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `icon` = %s", $_POST['icon'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . __('The icon for the selected markers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'openpopup') {
$popuptext = preg_replace("/\t/", " ", $_POST['popuptext']); //info: tabs break geojson
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `popuptext` = %s", $popuptext );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . __('The popup status for the selected markers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'popuptext') {
$result = $wpdb->prepare( "UPDATE `$table_name_markers` SET `popuptext` = %s", $_POST['popuptext'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . __('The popup text for the selected markers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'basemap-layer') {
$result = $wpdb->prepare( "UPDATE `$table_name_layers` SET `basemap` = %s", $_POST['basemap-layer'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_layers`" );
echo '
' . sprintf( esc_attr__('The basemap for all layers has been successfully set to %1$s','lmm'), htmlspecialchars($_POST['basemap-layer'])) . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'overlays-layer') {
$overlays_checkbox = isset($_POST['overlays_custom-layer']) ? '1' : '0';
$overlays2_checkbox = isset($_POST['overlays_custom2-layer']) ? '1' : '0';
$overlays3_checkbox = isset($_POST['overlays_custom3-layer']) ? '1' : '0';
$overlays4_checkbox = isset($_POST['overlays_custom4-layer']) ? '1' : '0';
$result = $wpdb->prepare( "UPDATE `$table_name_layers` SET `overlays_custom` = %s, `overlays_custom2` = %s, `overlays_custom3` = %s, `overlays_custom4` = %s", $overlays_checkbox, $overlays2_checkbox, $overlays3_checkbox, $overlays4_checkbox );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_layers`" );
echo '
' . __('The overlays status for all layers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'wms-layer') {
$wms_checkbox = isset($_POST['wms-layer']) ? '1' : '0';
$wms2_checkbox = isset($_POST['wms2-layer']) ? '1' : '0';
$wms3_checkbox = isset($_POST['wms3-layer']) ? '1' : '0';
$wms4_checkbox = isset($_POST['wms4-layer']) ? '1' : '0';
$wms5_checkbox = isset($_POST['wms5-layer']) ? '1' : '0';
$wms6_checkbox = isset($_POST['wms6-layer']) ? '1' : '0';
$wms7_checkbox = isset($_POST['wms7-layer']) ? '1' : '0';
$wms8_checkbox = isset($_POST['wms8-layer']) ? '1' : '0';
$wms9_checkbox = isset($_POST['wms9-layer']) ? '1' : '0';
$wms10_checkbox = isset($_POST['wms10-layer']) ? '1' : '0';
$result = $wpdb->prepare( "UPDATE `$table_name_layers` SET `wms` = %d, `wms2` = %d, `wms3` = %d, `wms4` = %d, `wms5` = %d, `wms6` = %d, `wms7` = %d, `wms8` = %d, `wms9` = %d, `wms10` = %d", $wms_checkbox, $wms2_checkbox, $wms3_checkbox, $wms4_checkbox, $wms5_checkbox, $wms6_checkbox, $wms7_checkbox, $wms8_checkbox, $wms9_checkbox, $wms10_checkbox );
$wpdb->query( $result );
echo '
' . __('The WMS status for all layers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'mapsize-layer') {
$result = $wpdb->prepare( "UPDATE `$table_name_layers` SET `mapwidth` = %d, `mapwidthunit` = %s, `mapheight` = %d", $_POST['mapwidth-layer'], $_POST['mapwidthunit-layer'], $_POST['mapheight-layer'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_layers`" );
echo '
' . sprintf( esc_attr__('The map size for all layers has been successfully set to width = %1$s %2$s and height = %3$s px','lmm'), htmlspecialchars($_POST['mapwidth-layer']), htmlspecialchars($_POST['mapwidthunit-layer']), htmlspecialchars($_POST['mapheight-layer'])) . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'zoom-layer') {
$result = $wpdb->prepare( "UPDATE `$table_name_layers` SET `layerzoom` = %s", $_POST['zoom-layer'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_layers`" );
echo '
' . sprintf( esc_attr__('Zoom level for all layers has been successfully set to %1$s','lmm'), htmlspecialchars($_POST['zoom-layer'])) . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'controlbox-layer') {
$result = $wpdb->prepare( "UPDATE `$table_name_layers` SET `controlbox` = %d", $_POST['controlbox-layer'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_layers`" );
echo '
' . __('Controlbox status for all layers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'panel-layer') {
$result = $wpdb->prepare( "UPDATE `$table_name_layers` SET `panel` = %d", $_POST['panel-layer'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_layers`" );
echo '
' . __('Panel status for all layers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'listmarkers-layer') {
$result = $wpdb->prepare( "UPDATE `$table_name_layers` SET `listmarkers` = %d", $_POST['listmarkers-layer'] );
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_layers`" );
echo '
' . __('The list marker-status for all layers has been successfully updated','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'mass_delete_from_layer') {
$result = $wpdb->prepare( "DELETE FROM `$table_name_markers` WHERE `layer` = %d", $_POST['delete_from_layer']);
$wpdb->query( $result );
$wpdb->query( "OPTIMIZE TABLE `$table_name_markers`" );
echo '
' . sprintf( esc_attr__('All markers from layer ID %1$s have been successfully deleted','lmm'), htmlspecialchars($_POST['delete_from_layer'])) . '
' . __('Back to Tools', 'lmm') . ' ';
}
elseif ($action == 'mass_delete_all_markers') {
$result = "DELETE FROM `$table_name_markers`";
$wpdb->query( $result );
$delete_confirm_checkbox = isset($_POST['delete_confirm_checkbox']) ? '1' : '0';
if ($delete_confirm_checkbox == 1) {
echo '
' . __('All markers from all layers have been successfully deleted','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
} else {
echo '
' . __('Please confirm that you want to delete all markers by checking the checkbox','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
}
}
elseif ($action == 'database_downgrade') {
//info: remove JSON encoding
$markers = $wpdb->get_results('SELECT id,layer FROM '.$wpdb->prefix.'leafletmapsmarker_markers');
foreach($markers as $marker){
if (is_numeric($marker->layer) === FALSE) { //info: just convert non-numeric values
$layer = json_decode($marker->layer, TRUE);
$wpdb->update( $wpdb->prefix . 'leafletmapsmarker_markers',
array('layer'=> $layer[0]), //info: just take first element, discard others
array('id'=>$marker->id)
);
unset($layer);
}
}
delete_option('leafletmapsmarkerpro_license_key_trial');
echo '
' . __('Database downgrade is finished.','lmm') . '
' . __('Back to Tools', 'lmm') . ' ';
echo '';
}
} else {
$layerlist = $wpdb->get_results('SELECT * FROM `' . $table_name_layers . '` WHERE `id` > 0', ARRAY_A);
?>
- ' . __('Backup/Restore settings','lmm') . '
- ' . __('Active shortcodes with invalid map IDs','lmm') . '
- ' . __('Move markers to a layer','lmm') . '
- ' . __('Bulk updates for marker maps','lmm') . '
- ' . sprintf( esc_attr__('Bulk updates for all %1$s existing layer maps','lmm'), $layercount_all) . '
- ' . __('Change marker ID','lmm') . '
- ' . __('Change layer ID','lmm') . '
- ' . __('Web API URL generator','lmm') . '
- ' . __('Web API URL tester','lmm') . '
- ' . __('Clear QR code images cache','lmm') . '
- ' . __('Delete all markers from a layer','lmm') . '
- ' . sprintf( esc_attr__('Delete all %1$s markers from all %2$s layers','lmm'), $markercount_all, $layercount_all) . '
- ' . __('Marker validity check for layer assignements','lmm') . '
- ' . __('Initialize map texts for translations','lmm') . '
';
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
:
px
%
:
px
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
get_contents(LEAFLET_PLUGIN_ICONS_DIR . DIRECTORY_SEPARATOR . $row);
if ($icon_data == NULL) { //info: workaround #1 due to support request
$icon_data = file_get_contents(LEAFLET_PLUGIN_ICONS_DIR . DIRECTORY_SEPARATOR . $row);
}
if ($icon_data == NULL) { //info: workaround #2 due to support request
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, LEAFLET_PLUGIN_ICONS_URL . '/' . $row);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$icon_data = curl_exec($ch);
curl_close($ch);
}
$icon_base64 = 'data:image/png;base64,' . base64_encode($icon_data);
echo '';
}
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>
=' ) ) {
$settings = array(
'wpautop' => true,
'tinymce' => array(
'height' => '250',
'content_style' => 'img {' . htmlspecialchars($lmm_options['defaults_marker_popups_image_css']) . '} a {text-decoration:none;} a:hover {text-decoration:underline;}'
),
'quicktags' => array('buttons' => 'strong,em,link,block,del,ins,img,code,close'));
} else {
$settings = array(
'wpautop' => true,
'tinymce' => array(
'theme_advanced_buttons1' => 'bold,italic,underline,strikethrough,|,fontselect,fontsizeselect,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,outdent,indent,blockquote,|,link,unlink,|,ltr,rtl',
'theme' => 'advanced',
'height' => '250',
'content_style' => 'html .mcecontentbody {font:12px/1.4 "Helvetica Neue",Arial,Helvetica,sans-serif; max-width:' . intval($lmm_options['defaults_marker_popups_maxwidth']) + 1 . 'px; /* Default + 1 fix */ word-wrap:break-word;} .mcecontentbody a {text-decoration:none;} .mcecontentbody a:hover {text-decoration:underline;} .mcecontentbody img {' . htmlspecialchars($lmm_options['defaults_marker_popups_image_css']) . '}',
'theme_advanced_statusbar_location' => 'bottom'
),
'quicktags' => array('buttons' => 'strong,em,link,block,del,ins,img,code,close'));
}
wp_editor( '', 'popuptext', $settings);
?>
= 21) ? '...': '';
echo '' . mb_substr(stripslashes(htmlspecialchars($row['name'])), 0, 28) . $layername_abstract . ' (ID ' . $row['id'] . ') ';
}
?>