plugin path is now symlink inside docker plugin
This commit is contained in:
29
srcs/plugins/google_map/index.php
Normal file → Executable file
29
srcs/plugins/google_map/index.php
Normal file → Executable file
@@ -10,6 +10,7 @@
|
||||
|
||||
<?php
|
||||
|
||||
// https://www.inkthemes.com/implement-google-map-plugin-for-wodpress/
|
||||
// Error: Publishing failed. The response is not a valid JSON response.
|
||||
// -> https://wordpress.org/support/topic/publishing-failed-error-message-the-response-is-not-a-valid-json-response-2/
|
||||
// - solution permalink -> broken
|
||||
@@ -53,11 +54,25 @@ if(isset($_POST['submit'])){
|
||||
update_option('map_zoom_value', $zoom);
|
||||
}
|
||||
|
||||
add_action( 'init', 'my_script' );
|
||||
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;
|
||||
}
|
||||
|
||||
function my_script() {
|
||||
wp_enqueue_script('my_script', plugins_url('js/script.js', __FILE__), array('jquery'));
|
||||
wp_enqueue_style('my_style', plugins_url('css/style.css', __FILE__));
|
||||
add_action( 'init', 'my_init_script' );
|
||||
|
||||
function my_init_script() {
|
||||
// __FILE__ = "/home/www-data/plugins/google_map/index.php"
|
||||
wp_enqueue_script('my_script', plugins_url('script.js', __FILE__), array('jquery'));
|
||||
console_log( plugins_url('script.js', __FILE__) );
|
||||
wp_enqueue_style('my_style', plugins_url('style.css', __FILE__));
|
||||
console_log( plugins_url('style.css', __FILE__) );
|
||||
console_log( plugin_dir_path(__FILE__) );
|
||||
console_log( plugin_dir_url(__FILE__) );
|
||||
}
|
||||
|
||||
function show_google_map() {
|
||||
@@ -65,14 +80,18 @@ function show_google_map() {
|
||||
$GoogleMap_Latitude = get_option('googleMap_latitude_position');
|
||||
$GoogleMap_Longitude = get_option('googleMap_longitude_position');
|
||||
$GoogleMap_zoom = get_option('map_zoom_value');
|
||||
$File = dirname(__FILE__);
|
||||
$Plugin = plugins_url( 'style.css', __FILE__ );
|
||||
|
||||
?>
|
||||
<script
|
||||
src="http://maps.googleapis.com/maps/api/js?&sensor=false?key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE">
|
||||
src="http://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><?php echo $File; ?></div>
|
||||
<div><?php echo $Plugin; ?></div>
|
||||
<div id="showmap"> </div>
|
||||
<?php
|
||||
}
|
||||
|
||||
0
srcs/plugins/google_map/script.js
Normal file → Executable file
0
srcs/plugins/google_map/script.js
Normal file → Executable file
0
srcs/plugins/google_map/style.css
Normal file → Executable file
0
srcs/plugins/google_map/style.css
Normal file → Executable file
Reference in New Issue
Block a user