erased test plugin

This commit is contained in:
lenovo
2022-11-01 10:21:38 +01:00
parent 57c7dac62a
commit 679c7c28ed
6 changed files with 0 additions and 168 deletions

View File

@@ -1,13 +0,0 @@
<?php
// https://stackify.com/how-to-log-to-console-in-php/
function console_log($output, $with_script_tags = true) {
$js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) .
');';
if ($with_script_tags) {
$js_code = '<script>' . $js_code . '</script>';
}
echo $js_code;
}
?>

View File

@@ -1,23 +0,0 @@
<?php
function get_url( $url ) {
if ( in_array('curl', get_loaded_extensions()) ) {
$args = curl_init();
curl_setopt($args, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($args, CURLOPT_HEADER, 0);
curl_setopt($args, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($args, CURLOPT_REFERER, site_url());
curl_setopt($args, CURLOPT_URL, $url);
curl_setopt($args, CURLOPT_FOLLOWLOCATION, TRUE);
$data = curl_exec($args);
curl_close($args);
return $data;
}
else
console_log("curl is not installed");
}
?>

View File

@@ -1 +0,0 @@
/home/www-data/google_map

View File

@@ -1,79 +0,0 @@
<?php
/* Plugin Name: gmap_test
Plugin URI:
Description: Integrate Google Maps on any page or post in a simple way
Version: 1.0
Author: hugogogo
Author URI:
*/
?>
<?php
include_once('debug.php');
require_once('get_url.php');
?>
<?php
add_action('admin_menu', 'ink_menu_page');
function ink_menu_page() {
add_menu_page('GM', 'Google Map', 'manage_options', 'gm_setting', 'ink_gm_setting', '', 120);
}
function ink_gm_setting(){
?>
<h2>Google Map</h2>
<form action="" method="post">
<div class="ink_set">
<label>Latitude : </label>
<input type="text" name="latitude" class="gm_lat">
</div>
<div class="ink_set">
<label>Longitude : </label>
<input type="text" name="longitude" class="gm_log">
</div>
<div class="ink_set">
<label>Zoom : </label>
<input type="text" name="zoom" class="gm_zoom">
</div>
<input type="submit" name="submit" class="submit_button">
</form>
<?php
}
if(isset($_POST['submit'])){
$latitude = $_POST['latitude'];
$logitude = $_POST['longitude'];
$zoom = $_POST['zoom'];
$map_type = $_POST['map_type'];
update_option('googleMap_latitude_position', $latitude );
update_option('googleMap_longitude_position', $logitude );
update_option('map_zoom_value', $zoom);
}
add_action( 'init', 'my_init_script' );
function my_init_script() {
$script_path = plugins_url('script.js', __FILE__);
wp_enqueue_script('my_script', $script_path, array('jquery'));
$style_path = plugins_url('style.css', __FILE__);
wp_enqueue_style('my_style', $style_path);
}
add_shortcode('googlemap', 'show_google_map');
function show_google_map() {
global $wpdb;
$GoogleMap_Latitude = get_option('googleMap_latitude_position');
$GoogleMap_Longitude = get_option('googleMap_longitude_position');
$GoogleMap_zoom = get_option('map_zoom_value');
//src="https://maps.googleapis.com/maps/api/geocode/json?address=paris&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE
return '
<script
src="https://maps.googleapis.com/maps/api/js?&sensor=false?&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE">
</script>
<div class="latitude"><?php echo $GoogleMap_Latitude; ?></div>
<div class="longitude" ><?php echo $GoogleMap_Longitude; ?></div>
<div class="zoom"><?php echo $GoogleMap_zoom; ?></div>
<div id="showmap"> </div>
';
}
?>

View File

@@ -1,21 +0,0 @@
jQuery(document).ready(function() {
var lat = jQuery('.latitude').text();
var lng = jQuery('.longitude').text();
var zoom = parseInt(jQuery('.zoom').text());
function initialize(){
var myCenter = new google.maps.LatLng(lat, lng);
var mapProp = {
center: myCenter,
zoom: zoom,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("showmap"),mapProp);
marker = new google.maps.Marker({
position: myCenter,
animation: google.maps.Animation.BOUNCE
});
marker.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
});

View File

@@ -1,31 +0,0 @@
.ink_set{
margin-top: 10px;
}
.latitude, .longitude, .zoom {
/* display:none;*/
}
#showmap{
width:500px;
height:380px;
border: 2px solid rgb(207, 203, 203);
margin-top:10px;
}
.submit_button{
margin-top:20px;
}
.gm_lat{
margin-left: 20px;
}
.gm_log{
margin-left: 10px;
}
.gm_zoom{
margin-left: 35px;
}