symlinks doesn't works sadly

This commit is contained in:
lenovo
2022-10-25 21:47:42 +02:00
parent f768bf85e8
commit 4b053a5582
4 changed files with 42 additions and 28 deletions

View File

@@ -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/)
---
---

View File

@@ -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 = '<script>' . $js_code . '</script>';
}
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(){
?>
<h2> Google Map </h2>
@@ -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 = '<script>' . $js_code . '</script>';
}
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__ );
?>
<script
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 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>
<?php
}

View File

@@ -3,7 +3,7 @@
}
.latitude, .longitude, .zoom {
display:none;
/* display:none;*/
}
#showmap{

View File

@@ -19,16 +19,22 @@ server {
index index.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
location / {
autoindex on;
try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
}
# pass PHP scripts to FastCGI (PHP-FPM) server
location ~ \.php$ {
autoindex on;
include fastcgi_params;
fastcgi_pass wordpress:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# https://joshtronic.com/2019/07/29/symlinks-with-nginx-and-php-fpm/
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri =404;
}
}