diff --git a/README.md b/README.md index ee17542..be191fb 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,11 @@ - [exemple of googlemap plugin creation](https://www.inkthemes.com/implement-google-map-plugin-for-wordpress/) - [Error: not a valid JSON response](https://wordpress.org/support/topic/publishing-failed-error-message-the-response-is-not-a-valid-json-response-2/) - [permalink broken](https://wordpress.org/support/topic/permalinks-change-breaks-all-links/) +- [console.log in php](https://stackify.com/how-to-log-to-console-in-php/) +- [plugins_url with symlink pbm](https://wordpress.stackexchange.com/questions/102681/plugins-url-file-wp-plugin-url-with-sym-links) +- [make nginx follow symlinks](https://unix.stackexchange.com/questions/157022/make-nginx-follow-symlinks) +- [nginx not following symlink maybe due to permissions](https://stackoverflow.com/questions/12624358/nginx-not-following-symlinks) +- [symlink pbm with php-fpm](https://joshtronic.com/2019/07/29/symlinks-with-nginx-and-php-fpm/) --- --- diff --git a/srcs/plugins/google_map/index.php b/srcs/plugins/google_map/index.php index aed45a6..095c145 100755 --- a/srcs/plugins/google_map/index.php +++ b/srcs/plugins/google_map/index.php @@ -17,12 +17,26 @@ // - permalink broken : https://wordpress.org/support/topic/permalinks-change-breaks-all-links/ // - solution classic editor -> ok -add_action('admin_menu', 'ink_menu_page'); +// 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 = ''; + } + echo $js_code; +} +//add_action( "plugins_loaded", "plugin_path" ) ; +//function plugin_path(){ +// define( 'PLUGIN_DIR_PATH', dirname(__FILE__) ); +// define( 'PLUGIN_URL_PATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' ); +//} + +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(){ ?>

Google Map

@@ -54,25 +68,18 @@ if(isset($_POST['submit'])){ update_option('map_zoom_value', $zoom); } -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; -} - 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__) ); + $script_path = plugins_url('script.js', __FILE__); + wp_enqueue_script('my_script', $script_path, array('jquery')); + console_log("script_path :"); + console_log($script_path); + //$style_path = plugins_url('temp/style.css', dirname(__FILE__)); + $style_path = plugins_url('style.css', __FILE__); + //$style_path = PLUGIN_URL_PATH . "style.css"; + wp_enqueue_style('my_style', $style_path); + console_log("style_path :"); + console_log($style_path); } function show_google_map() { @@ -80,18 +87,14 @@ 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__ ); ?> -
-
-
-
-
+
+
+