diff --git a/Makefile b/Makefile index db79dce..4bd5a05 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ RESET = "\e[0m" COMPOSE = ./srcs/docker-compose.yml -VOLUME_PATH = $(shell grep "MAP_VOLUMES" ./srcs/.env | cut -d "=" -f 2) +VOLUME_PATH = $(shell grep -w "MAP_VOLUMES" ./srcs/.env | cut -d "=" -f 2) VOLUMES_D = $(VOLUME_PATH)/wp_volume \ $(VOLUME_PATH)/db_volume WP_URL = $(shell grep "WP_URL" ./srcs/.env | cut -d "=" -f 2) @@ -74,7 +74,7 @@ clean: docker network prune -f docker system prune -f -# remove everything +# remove everything except local volumes data fclean-images: clean - docker stop $(RUNNING) docker system prune -af @@ -84,5 +84,10 @@ fclean: fclean-images fclean-volumes re: fclean all +# !! remove everything everything +erase_v: + - rm -rf ${VOLUMES_D} +hard: erase_v re + .PHONY : all $(VOLUMES_D) build up list clean fclean re diff --git a/NetrwTreeListing b/NetrwTreeListing deleted file mode 100644 index 63ee119..0000000 --- a/NetrwTreeListing +++ /dev/null @@ -1,25 +0,0 @@ -" ============================================================================ -" Netrw Directory Listing (netrw v171) -" /home/lenovo/42/lejourduprof/srcs/plugins/google_map -" Sorted by name -" Sort sequence: [\/]$,\,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$ -" Quick Help: :help -:go up dir D:delete R:rename s:sort-by x:special -" ============================================================================== -../ -lejourduprof/ -| .git/ -| docs/ -| srcs/ -| | plugins/ -| | | google_map/ -| | | | index.php -| | | | script.js -| | | | style.css -| | | map_prof/ -| | | | map_prof.php* -| | requirements/ -| | .env -| | docker-compose.yml -| .gitignore -| Makefile -| README.md diff --git a/srcs/.env b/srcs/.env index 6d1e200..95f4b25 100644 --- a/srcs/.env +++ b/srcs/.env @@ -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 diff --git a/srcs/docker-compose.yml b/srcs/docker-compose.yml index 6ee4c30..20cc196 100644 --- a/srcs/docker-compose.yml +++ b/srcs/docker-compose.yml @@ -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: diff --git a/srcs/plugins/google_map/index.php b/srcs/plugins/google_map/index.php old mode 100644 new mode 100755 index e0303cf..aed45a6 --- a/srcs/plugins/google_map/index.php +++ b/srcs/plugins/google_map/index.php @@ -10,6 +10,7 @@ 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 = ''; + } + 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__ ); ?>
+
+