- moving ajax script outside plugin class, as a js file

- wip trying to use the wordpress image editor
This commit is contained in:
asus
2024-02-19 00:46:03 +01:00
parent e9032647f2
commit 04c4ea31d5
9 changed files with 97 additions and 105 deletions

View File

@@ -29,19 +29,18 @@ Author URI:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
plugin dir root
*/
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');
include_once( plugin_dir_path(__FILE__) . '/utils/plugin_tools.php');
PLGNTLS_class::set_root_dir( plugin_dir_path(__FILE__), plugin_dir_url(__FILE__) );
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
inclusions
*/
include_once(FIPFCARD_PLUGIN_DIR . '/php/utils/globals.php');
include_once(PLGNTLS_class::get_path() . '/php/utils/globals.php');
include_once(PLGNTLS_class::get_path() . '/php/menu/example_menu.php');
//include_once(PLGNTLS_class::get_path() . '/php/images/image-edit.php');
include_once(FIPFCARD_PLUGIN_DIR . '/php/menu/example_menu.php');
@@ -52,6 +51,7 @@ plugin shortcode
*/
function fipfcard_main_shortcode()
{
$fipfcard_tools = new PLGNTLS_class();
@@ -67,9 +67,9 @@ $data = $data->data;
$data = $data->user_email;
//error_log("data->data");
//error_log($data);
delete_post_meta(get_the_ID(), "_data_user_email");
delete_post_meta(get_the_ID(), "_data");
add_post_meta(get_the_ID(), "data_user_email", $data);
//delete_post_meta(get_the_ID(), "_data_user_email");
//delete_post_meta(get_the_ID(), "_data");
//add_post_meta(get_the_ID(), "data_user_email", $data);
$post_metadata = get_metadata( 'post', get_the_ID() );
$post_meta = get_post_meta( get_the_ID() );
@@ -112,6 +112,31 @@ add_post_meta(get_the_ID(), "data_user_email", $data);
add_shortcode('fipfcard_plugin', 'fipfcard_main_shortcode');
function fipfcard_image_editor()
{
// ob_start();
// wp_image_editor('33545');
// return ob_get_clean();
$test1 = "hello";
$test2 = "you";
$fipfcard_image_editor = new PLGNTLS_class();
return $fipfcard_image_editor->add_to_front(
array(
"js/image_editor.js",
"html/image_editor.html",
),
compact(
"test1",
"test2",
)
);
/*
*/
}
add_shortcode('fipfcard_image_editor', 'fipfcard_image_editor');
/*
add_action('init', 'custom_action_handler');
function custom_action_handler() {
@@ -279,6 +304,7 @@ function PLGNTLS_my_custom_df_form_handler($form_id, $post_array, $form_type)
}
// Hook into the 'acf/save_post' action
/*
add_action('acf/save_post', 'handle_acf_form_submission', 5); // 20 is the priority, you can adjust it as needed
@@ -358,12 +384,10 @@ ajax
*/
function fipfcard_ajax_handler()
{
wp_send_json_success
(
array
wp_send_json_success( array
(
'It works',
"data_received" => $_POST['data'],
"data_received" => $_POST['postid'],
),
200
);