diff --git a/plugins/fipfcard_plugin/php/filter_mail.php b/plugins/fipfcard_plugin/php/filter_mail.php index a87efc4..aa7ce7a 100644 --- a/plugins/fipfcard_plugin/php/filter_mail.php +++ b/plugins/fipfcard_plugin/php/filter_mail.php @@ -92,8 +92,6 @@ add_filter('df_notification_body', 'filter_email_fb_CIPF', 10, 2); // the admini * or event that a different user has already logged in */ function filter_email_wp_CIPF($args) { - error_log("in filter_email_wp_CIPF"); - // pattern : anything surrounded by '$$', ex : $$value$$ $pattern = '/\$\$(.*?)\$\$/'; diff --git a/plugins/fipfcard_plugin/php/images/image-edit.php b/plugins/fipfcard_plugin/php/images/image-edit.php index a11c58b..f4f51b4 100644 --- a/plugins/fipfcard_plugin/php/images/image-edit.php +++ b/plugins/fipfcard_plugin/php/images/image-edit.php @@ -25,7 +25,6 @@ if (!defined('ABSPATH')) { * Default false. */ function wp_image_editor( $post_id, $msg = false ) { -error_log("------1"); $nonce = wp_create_nonce( "image_editor-$post_id" ); $meta = wp_get_attachment_metadata( $post_id ); @@ -39,7 +38,6 @@ error_log("------1"); die( __( 'Image data does not exist. Please re-upload the image.' ) ); } -error_log("------2"); $sizer = $big > 600 ? 600 / $big : 1; @@ -67,7 +65,6 @@ error_log("------2"); */ $edit_thumbnails_separately = (bool) apply_filters( 'image_edit_thumbnails_separately', false ); -error_log("------3"); ?>
@@ -291,7 +288,6 @@ error_log("------3"); @@ -346,7 +342,6 @@ error_log("------4");
600 ? ( 600 / $max ) : 1; @@ -553,7 +545,6 @@ error_log("------1"); * @return resource|GdImage|false GD image resource or GdImage instance, false otherwise. */ function _rotate_image_resource( $img, $angle ) { -error_log("------1"); _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()' ); @@ -583,7 +574,6 @@ error_log("------1"); * @return resource|GdImage (maybe) flipped image resource or GdImage instance. */ function _flip_image_resource( $img, $horz, $vert ) { -error_log("------1"); _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::flip()' ); @@ -620,7 +610,6 @@ error_log("------1"); * @return resource|GdImage (maybe) cropped image resource or GdImage instance. */ function _crop_image_resource( $img, $x, $y, $w, $h ) { -error_log("------1"); $dst = wp_imagecreatetruecolor( $w, $h ); @@ -644,7 +633,6 @@ error_log("------1"); * @return WP_Image_Editor WP_Image_Editor instance with changes applied. */ function image_edit_apply_changes( $image, $changes ) { -error_log("------1"); if ( is_gd_image( $image ) ) { /* translators: 1: $image, 2: WP_Image_Editor */ @@ -781,7 +769,6 @@ error_log("------1"); * @return bool True on success, false on failure. */ function stream_preview_image( $post_id ) { -error_log("------1"); $post = get_post( $post_id ); @@ -823,7 +810,6 @@ error_log("------1"); * @return stdClass Image restoration message object. */ function wp_restore_image( $post_id ) { -error_log("------1"); $meta = wp_get_attachment_metadata( $post_id ); $file = get_attached_file( $post_id ); @@ -919,7 +905,6 @@ error_log("------1"); * @return stdClass */ function wp_save_image( $post_id ) { -error_log("------1"); $_wp_additional_image_sizes = wp_get_additional_image_sizes(); diff --git a/plugins/fipfcard_plugin/php/paypal/paypal.php b/plugins/fipfcard_plugin/php/paypal/paypal.php index fbcdf66..9e954dd 100644 --- a/plugins/fipfcard_plugin/php/paypal/paypal.php +++ b/plugins/fipfcard_plugin/php/paypal/paypal.php @@ -21,31 +21,6 @@ include_once(PLGNTLS_class::get_path() . '/php/paypal/routes.php'); -/* -function check_paypal_request() -{ - error_log("----"); - if (is_page('test_paypal_payment')) - error_log("on test_paypal_payment"); - else if (is_page('test_paypal_ok')) - error_log("on test_paypal_ok"); - else if (is_page('test_paypal_infos')) - error_log("on test_paypal_infos"); - else - return; - error_log("_GET"); - error_log(json_encode($_GET)); - error_log("_POST"); - error_log(json_encode($_POST)); -// error_log("_COOKIE"); -// error_log(json_encode($_COOKIE)); -} -add_action('template_redirect', 'check_paypal_request'); -*/ - - - - ?> diff --git a/plugins/fipfcard_plugin/php/paypal/route_api_orders_capture.php b/plugins/fipfcard_plugin/php/paypal/route_api_orders_capture.php index 0387158..1188f92 100644 --- a/plugins/fipfcard_plugin/php/paypal/route_api_orders_capture.php +++ b/plugins/fipfcard_plugin/php/paypal/route_api_orders_capture.php @@ -26,7 +26,6 @@ function handle_orders_capture_request_FIPF($request) { return new WP_REST_Response($json_response, $http_status_code); } catch (Exception $e) { - error_log('Failed to capture order: ' . $e->getMessage()); return new WP_REST_Response(array('error' => 'Failed to capture order.'), 500); } } diff --git a/plugins/fipfcard_plugin/php/paypal/update_user_payment.php b/plugins/fipfcard_plugin/php/paypal/update_user_payment.php index 406f526..9d29485 100644 --- a/plugins/fipfcard_plugin/php/paypal/update_user_payment.php +++ b/plugins/fipfcard_plugin/php/paypal/update_user_payment.php @@ -48,10 +48,22 @@ function update_user_payment_FIPF($message, $step) { // add a schedule event to delete this order_id schedule_delete_orderid_FIPF($user_id, $order_id); + /* + * create a meta field to check states of payements on prof author page : + * - 'started' -> payement started | at order creation (if seen on author page, it means failure) + * - 'success' -> success payement | at order success (on author page, it means success, then empty it) + * - '' -> no message to output | on author page (after set to empty on author page) + * + */ + delete_user_meta($user_id, 'fipf_payement_status'); + add_user_meta($user_id, 'fipf_payement_status', 'started'); + // if transaction is COMPLETED, then delete order_id and update user if ($status === 'COMPLETED') { // find the user containing the order_id and delete this order_id $user_id_to_update = delete_order_id_on_success_FIPF($user_id, $order_id); + // change payement status to success + update_user_meta($user_id_to_update, 'fipf_payement_status', 'success'); // proceed to validate payment for user validate_payment_for_user_FIPF($user_id_to_update, $order_id); } @@ -132,14 +144,14 @@ function validate_payment_for_user_FIPF($user_id, $order_id) { * update date limit validity to add 1 year * */ - $date_plus_one_year = $current_date_limit->add(date_interval_create_from_date_string('+'.$card_duration));; + $date_plus_one_year = $current_date_limit->add(date_interval_create_from_date_string('+'.$card_duration)); update_field($acf_card_expiration, $date_plus_one_year->format($acf_date_format), $acf_id); /* * change user profil to active * */ - update_field($prof_is_activ, 'Active', $acf_id) + update_field($prof_is_activ, 'Actif', $acf_id); } @@ -169,7 +181,6 @@ function schedule_delete_orderid_FIPF($user_id, $order_id) */ function delete_order_id_later_FIPF($user_id, $order_id) { - error_log("delete order_id[$order_id] from user_id[$user_id]"); delete_user_meta($user_id, 'fipf_order_id', $order_id); } add_action('orderid_deletion_event_FIPF', 'delete_order_id_later_FIPF', 5, 2); diff --git a/plugins/fipfcard_plugin/php/prof_check_page.php b/plugins/fipfcard_plugin/php/prof_check_page.php index bcb3b7d..75d496b 100644 --- a/plugins/fipfcard_plugin/php/prof_check_page.php +++ b/plugins/fipfcard_plugin/php/prof_check_page.php @@ -50,6 +50,54 @@ function handle_prof_is_activ_CIPF($author_id) { } +/* +* check meta field 'fipf_payement_status' +* if field value is 'success' +* - hide block 'failure' +* - and update field to '', so it will not show next time +* if field value is 'started' +* - hide bloc success +* (we assume it means the order didn't go well) +* (it does not really makes sens, but ok for the moment) +* if field value is '' +* - hide both 'success' and 'failure' blocs +* +* .fipf_prof_paiement_message -> on row, added display none in page css +* #fipf_prof_paiement_reussi -> on row +* #fipf_prof_paiement_echoue -> on row +* +*/ +function show_prof_paiement_messages_CIPF($user_id) { + /* + * if prof is inactive, do nothing more + * + */ + $acf_prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV; + $acf_id = 'user_' . $user_id; + $is_activ = get_field($acf_prof_is_activ, $acf_id); + if (is_null($is_activ) || empty($is_activ)) + return; + if ($is_activ === 'Inactif') + return; + + $fipf_prof_payement = new PLGNTLS_class(); + + $payement_status2 = get_user_meta($user_id, 'fipf_payement_status'); + $payement_status = get_user_meta($user_id, 'fipf_payement_status', true); + if ($payement_status === 'success') { + $fipf_prof_payement->add_to_front(array( + array( 'css' => '#fipf_prof_paiement_reussi {display: block;}' ) + )); + } + else if ($payement_status === 'started') { + $fipf_prof_payement->add_to_front(array( + array( 'css' => '#fipf_prof_paiement_echoue {display: block;}' ) + )); + } + + update_user_meta($user_id, 'fipf_payement_status', ''); +} + /* * series of check to do before printing a prof author page @@ -64,6 +112,9 @@ function check_prof_page_CIPF() { $author_id = get_queried_object_id(); handle_prof_is_activ_CIPF($author_id); + + show_prof_paiement_messages_CIPF($author_id); + } add_action('template_redirect', 'check_prof_page_CIPF', 11); diff --git a/plugins/fipfcard_plugin/php/register_partenaires.php b/plugins/fipfcard_plugin/php/register_partenaires.php index 049864e..a32593a 100644 --- a/plugins/fipfcard_plugin/php/register_partenaires.php +++ b/plugins/fipfcard_plugin/php/register_partenaires.php @@ -14,9 +14,6 @@ if (!defined('ABSPATH')) { */ function add_partenaires_PLGNTLS($customer_data){ $current_url = $_SERVER['HTTP_REFERER']; // not reliable to use referer, TODO: find another solution - error_log("---"); - error_log("uri:"); - error_log($_SERVER['REQUEST_URI']); $path_brut = parse_url($current_url, PHP_URL_PATH); $path = trim($path_brut, '/'); if ($path === 'creation-du-compte-partenaire') diff --git a/plugins/fipfcard_plugin/utils/plgntls_class.php b/plugins/fipfcard_plugin/utils/plgntls_class.php index 04db941..2d0f415 100644 --- a/plugins/fipfcard_plugin/utils/plgntls_class.php +++ b/plugins/fipfcard_plugin/utils/plgntls_class.php @@ -304,16 +304,26 @@ class PLGNTLS_class } private function add_inline_script($src) { $handle = $src->depends; - if ($handle === null) + if ($handle === null || empty($handle)) $handle = $this->_first_script; - wp_add_inline_script($src->depends, $src->src, 'before'); + if ($handle === null || empty($handle)) { + global $wp_scripts; + $script_queue = $wp_scripts->queue; + $handle = array_pop($script_queue); + } + wp_add_inline_script($handle, $src->src, 'before'); } private function add_inline_style($src) { error_log("inside add_inline_style"); $handle = $src->depends; - if ($handle === null) + if ($handle === null || empty($handle)) $handle = $this->_first_style; - wp_add_inline_style($src->depends, $src->src); + if ($handle === null || empty($handle)) { + global $wp_styles; + $style_queue = $wp_styles->queue; + $handle = array_pop($style_queue); + } + wp_add_inline_style($handle, $src->src); } diff --git a/private b/private index f8fbd02..0243fd7 160000 --- a/private +++ b/private @@ -1 +1 @@ -Subproject commit f8fbd0231d00a0125f9995b60a4ead6f65de7cb6 +Subproject commit 0243fd7e20aa7aed83e1c14ef15f5ae007a1fded