From 0a4185908b6d65fd5698ede4b8f68e58c3f83082 Mon Sep 17 00:00:00 2001 From: asus Date: Sun, 11 Feb 2024 19:57:44 +0100 Subject: [PATCH] cleaned files by prefixing names with 'example' when not means to be used in other plugins aka not utils --- .../css/{mystyle.css => example_style.css} | 0 .../html/{index.html => example_index.html} | 2 +- .../html/{index2.html => example_index2.html} | 0 .../html/menu/{menu.html => example_menu.html} | 0 ...presentation.html => example_presentation.html} | 0 .../js/{init.js => example_init.js} | 0 .../js/{myscript2.js => example_script2.js} | 0 .../js/{myscript3.js => example_script3.js} | 0 .../js/menu/{menu.js => example_menu.js} | 0 .../php/menu/{menu.php => example_menu.php} | 4 ++-- plugins/wp_model_plugin/php/utils/add_to_front.php | 7 +++++-- plugins/wp_model_plugin/plugin_hooks.php | 14 +++++++------- 12 files changed, 15 insertions(+), 12 deletions(-) rename plugins/wp_model_plugin/css/{mystyle.css => example_style.css} (100%) rename plugins/wp_model_plugin/html/{index.html => example_index.html} (78%) rename plugins/wp_model_plugin/html/{index2.html => example_index2.html} (100%) rename plugins/wp_model_plugin/html/menu/{menu.html => example_menu.html} (100%) rename plugins/wp_model_plugin/html/templates/{presentation.html => example_presentation.html} (100%) rename plugins/wp_model_plugin/js/{init.js => example_init.js} (100%) rename plugins/wp_model_plugin/js/{myscript2.js => example_script2.js} (100%) rename plugins/wp_model_plugin/js/{myscript3.js => example_script3.js} (100%) rename plugins/wp_model_plugin/js/menu/{menu.js => example_menu.js} (100%) rename plugins/wp_model_plugin/php/menu/{menu.php => example_menu.php} (71%) diff --git a/plugins/wp_model_plugin/css/mystyle.css b/plugins/wp_model_plugin/css/example_style.css similarity index 100% rename from plugins/wp_model_plugin/css/mystyle.css rename to plugins/wp_model_plugin/css/example_style.css diff --git a/plugins/wp_model_plugin/html/index.html b/plugins/wp_model_plugin/html/example_index.html similarity index 78% rename from plugins/wp_model_plugin/html/index.html rename to plugins/wp_model_plugin/html/example_index.html index d034d64..73a333b 100644 --- a/plugins/wp_model_plugin/html/index.html +++ b/plugins/wp_model_plugin/html/example_index.html @@ -4,6 +4,6 @@ diff --git a/plugins/wp_model_plugin/html/index2.html b/plugins/wp_model_plugin/html/example_index2.html similarity index 100% rename from plugins/wp_model_plugin/html/index2.html rename to plugins/wp_model_plugin/html/example_index2.html diff --git a/plugins/wp_model_plugin/html/menu/menu.html b/plugins/wp_model_plugin/html/menu/example_menu.html similarity index 100% rename from plugins/wp_model_plugin/html/menu/menu.html rename to plugins/wp_model_plugin/html/menu/example_menu.html diff --git a/plugins/wp_model_plugin/html/templates/presentation.html b/plugins/wp_model_plugin/html/templates/example_presentation.html similarity index 100% rename from plugins/wp_model_plugin/html/templates/presentation.html rename to plugins/wp_model_plugin/html/templates/example_presentation.html diff --git a/plugins/wp_model_plugin/js/init.js b/plugins/wp_model_plugin/js/example_init.js similarity index 100% rename from plugins/wp_model_plugin/js/init.js rename to plugins/wp_model_plugin/js/example_init.js diff --git a/plugins/wp_model_plugin/js/myscript2.js b/plugins/wp_model_plugin/js/example_script2.js similarity index 100% rename from plugins/wp_model_plugin/js/myscript2.js rename to plugins/wp_model_plugin/js/example_script2.js diff --git a/plugins/wp_model_plugin/js/myscript3.js b/plugins/wp_model_plugin/js/example_script3.js similarity index 100% rename from plugins/wp_model_plugin/js/myscript3.js rename to plugins/wp_model_plugin/js/example_script3.js diff --git a/plugins/wp_model_plugin/js/menu/menu.js b/plugins/wp_model_plugin/js/menu/example_menu.js similarity index 100% rename from plugins/wp_model_plugin/js/menu/menu.js rename to plugins/wp_model_plugin/js/menu/example_menu.js diff --git a/plugins/wp_model_plugin/php/menu/menu.php b/plugins/wp_model_plugin/php/menu/example_menu.php similarity index 71% rename from plugins/wp_model_plugin/php/menu/menu.php rename to plugins/wp_model_plugin/php/menu/example_menu.php index 3b428f3..c69058d 100644 --- a/plugins/wp_model_plugin/php/menu/menu.php +++ b/plugins/wp_model_plugin/php/menu/example_menu.php @@ -6,10 +6,10 @@ function wp_model_plugin_content() { console_log($first_script); add_files_to_front( array( - "menu/menu.js", + "menu/example_menu.js", )); - echo create_html("menu/menu.html"); + echo create_html("menu/example_menu.html"); } ?> diff --git a/plugins/wp_model_plugin/php/utils/add_to_front.php b/plugins/wp_model_plugin/php/utils/add_to_front.php index 05e892e..9610e95 100644 --- a/plugins/wp_model_plugin/php/utils/add_to_front.php +++ b/plugins/wp_model_plugin/php/utils/add_to_front.php @@ -5,8 +5,11 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * function that add the ajax script to front -no need to check if already included, because $handle is uniq -so it will not be recincluded, the first enqueued version will be kept +needs to check if already included : +- $handle is uniq so it will not be re-enqueued + the first enqueued version would be kept +- but the vars add to front would be added twice + leading to js syntaxe error (redeclaraiton of 'let' or 'const') */ function add_ajax_post() { global $first_script; diff --git a/plugins/wp_model_plugin/plugin_hooks.php b/plugins/wp_model_plugin/plugin_hooks.php index 020aec1..3b3cbf6 100644 --- a/plugins/wp_model_plugin/plugin_hooks.php +++ b/plugins/wp_model_plugin/plugin_hooks.php @@ -30,7 +30,7 @@ include_once(PLUGIN_DIR . '/php/utils/console_log.php'); include_once(PLUGIN_DIR . '/php/utils/add_to_front.php'); include_once(PLUGIN_DIR . '/php/utils/create_html.php'); -include_once(PLUGIN_DIR . '/php/menu/menu.php'); +include_once(PLUGIN_DIR . '/php/menu/example_menu.php'); @@ -42,10 +42,10 @@ plugin shortcode function main_shortcode() { add_files_to_front( array( - "mystyle.css", - "init.js", - "myscript2.js", - "myscript3.js", + "example_style.css", + "example_init.js", + "example_script2.js", + "example_script3.js", )); @@ -61,8 +61,8 @@ function main_shortcode() { $ages = ["13", "34", "56"]; $html_front = create_html( array( - "index.html", - "index2.html", + "example_index.html", + "example_index2.html", ), compact( "names",