plugin path is now symlink inside docker plugin

This commit is contained in:
lenovo
2022-10-25 17:52:48 +02:00
parent 10bb6ff743
commit f768bf85e8
8 changed files with 41 additions and 37 deletions

View File

@@ -10,6 +10,7 @@ DB_PSWD="too bad you have read this now i have to erase your memory"
WP_URL=local_lejourduprof.com
WP_DIR=/var/www/html
WP_PLUGIN_DIR=/home/www-data/
WP_TITLE=title
WP_ADMIN=hulamy
@@ -22,7 +23,8 @@ WP_USER_EMAIL=moehu36@42.fr
# MAP
MAX_UPLOAD_SIZE=2046
EXECUTION_TIME=2000
MAX_UPLOAD_SIZE=512
EXECUTION_TIME=300
MAP_VOLUMES=/home/lenovo/data/lejourduprof
MAP_VOLUMES_PLUGINS=/home/lenovo/42/lejourduprof/srcs/plugins

View File

@@ -64,8 +64,8 @@ services:
networks:
- inception
volumes:
- wp_volume:/var/www/html
- wp_plugins:/home/www-data/plugins
- wp_volume:${WP_DIR}
- wp_plugins:${WP_PLUGIN_DIR}
build:
context: ./requirements/wordpress
args:
@@ -91,7 +91,7 @@ volumes:
driver_opts:
type: none
o: "bind"
device: /home/lenovo/42/lejourduprof/srcs/plugins
device: ${MAP_VOLUMES_PLUGINS}
db_volume:
driver: local
driver_opts:

29
srcs/plugins/google_map/index.php Normal file → Executable file
View 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
View File

0
srcs/plugins/google_map/style.css Normal file → Executable file
View File

View File

@@ -67,5 +67,8 @@ fi
chown -R www-data:www-data /var/www/*
chmod 755 -R /var/www/*
# symlinks for folders found in host plugins/
# todo
exec "${PHP_VERSION}" -FR