improved plugin class by changing for only one method to do all

This commit is contained in:
asus
2024-02-15 00:40:07 +01:00
parent 8d0122f63e
commit aaca16525b
7 changed files with 84 additions and 78 deletions

View File

@@ -33,7 +33,7 @@ define( 'FIPFCARD_PLUGIN_DIR', plugin_dir_path(__FILE__) );
define( 'FIPFCARD_PLUGIN_URL', plugin_dir_url(__FILE__) );
include_once( plugin_dir_path(__FILE__) . '/php/utils/plugin_tools.php');
PLGNTOOLS::set_root_dir( plugin_dir_path(__FILE__), plugin_dir_url(__FILE__) );
PLGNTLS_class::set_root_dir( plugin_dir_path(__FILE__), plugin_dir_url(__FILE__) );
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -55,25 +55,12 @@ plugin shortcode
*/
function fipfcard_main_shortcode() {
$fipfcard_tools = new PLGNTOOLS();
$fipfcard_tools = new PLGNTLS_class();
$fipfcard_tools->add_files_to_front( array(
"example_style.css",
"example_init.js",
"example_script2.js",
"example_script3.js",
));
$myvar_1 = "I am one";
$myvar_2 = "I am two";
$fipfcard_tools->add_var_to_front( compact(
"myvar_1",
"myvar_2",
));
$names = ["hugo", "camille"];
$ages = ["13", "34", "56"];
@@ -84,12 +71,19 @@ function fipfcard_main_shortcode() {
$getUserMeta = get_metadata( 'user', get_current_user_id() );
$user_meta = $getUserMeta;
$html_front = $fipfcard_tools->create_html(
return $fipfcard_tools->add_to_front(
array(
"example_style.css",
"example_init.js",
"example_script2.js",
"example_script3.js",
"example_index.html",
"example_index2.html",
),
compact(
"myvar_1",
"myvar_2",
"post_meta",
"user_meta",
"names",
@@ -97,7 +91,6 @@ function fipfcard_main_shortcode() {
)
);
return $html_front;
}
add_shortcode('fipfcard_plugin', 'fipfcard_main_shortcode');