Changeset 3338991
- Timestamp:
- 08/04/2025 01:06:41 PM (8 months ago)
- Location:
- recruitly/trunk
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
admin/dataloader.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
-
recruitly.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
recruitly/trunk
- Property svn:ignore
-
old new 1 1 .idea 2 .claude
-
- Property svn:ignore
-
recruitly/trunk/admin/dataloader.php
r3262547 r3338991 691 691 } 692 692 693 $job = json_decode($curlResp); 693 // Clean up JSON before parsing 694 // Remove BOM if present 695 $curlResp = preg_replace('/^\xEF\xBB\xBF/', '', $curlResp); 696 697 // Fix any encoding issues 698 if (function_exists('mb_check_encoding') && !mb_check_encoding($curlResp, 'UTF-8')) { 699 $curlResp = mb_convert_encoding($curlResp, 'UTF-8', 'UTF-8'); 700 } 701 702 // Decode with proper error handling 703 // Use JSON_INVALID_UTF8_SUBSTITUTE if available (PHP 7.2+) 704 $json_options = 0; 705 if (defined('JSON_INVALID_UTF8_SUBSTITUTE')) { 706 $json_options = JSON_INVALID_UTF8_SUBSTITUTE; 707 } 708 $job = json_decode($curlResp, false, 512, $json_options); 709 710 // Check for JSON errors 711 if (json_last_error() !== JSON_ERROR_NONE) { 712 recruitly_log_exception(new Exception('JSON decode error in sync_post_type_single: ' . json_last_error_msg())); 713 return; 714 } 694 715 695 716 if (!property_exists($job, 'id')) { … … 788 809 } 789 810 790 // Decode the JSON response 791 $restResponse = json_decode(wp_remote_retrieve_body($response)); 811 // Get and clean the response body 812 $responseBody = wp_remote_retrieve_body($response); 813 814 // Remove BOM if present 815 $responseBody = preg_replace('/^\xEF\xBB\xBF/', '', $responseBody); 816 817 // Fix any encoding issues 818 if (function_exists('mb_check_encoding') && !mb_check_encoding($responseBody, 'UTF-8')) { 819 $responseBody = mb_convert_encoding($responseBody, 'UTF-8', 'UTF-8'); 820 } 821 822 // Decode the JSON response with error handling 823 // Use JSON_INVALID_UTF8_SUBSTITUTE if available (PHP 7.2+) 824 $json_options = 0; 825 if (defined('JSON_INVALID_UTF8_SUBSTITUTE')) { 826 $json_options = JSON_INVALID_UTF8_SUBSTITUTE; 827 } 828 $restResponse = json_decode($responseBody, false, 512, $json_options); 829 830 // Check for JSON errors 831 if (json_last_error() !== JSON_ERROR_NONE) { 832 recruitly_log_exception(new Exception('JSON decode error in get_total_jobs_count: ' . json_last_error_msg())); 833 return 0; 834 } 792 835 793 836 // Return the count if available, otherwise return 0 … … 881 924 882 925 // Get the response body 883 $restResponse = json_decode(wp_remote_retrieve_body($response)); 884 885 // Verify server response and display errors 886 if (property_exists($restResponse, 'reason') && property_exists($restResponse, 'message')) { 926 $responseBody = wp_remote_retrieve_body($response); 927 928 // Clean up JSON before parsing 929 // Remove BOM if present 930 $responseBody = preg_replace('/^\xEF\xBB\xBF/', '', $responseBody); 931 932 // Fix any encoding issues 933 if (function_exists('mb_check_encoding') && !mb_check_encoding($responseBody, 'UTF-8')) { 934 $responseBody = mb_convert_encoding($responseBody, 'UTF-8', 'UTF-8'); 935 } 936 937 // Decode with proper error handling 938 // Use JSON_INVALID_UTF8_SUBSTITUTE if available (PHP 7.2+) 939 $json_options = 0; 940 if (defined('JSON_INVALID_UTF8_SUBSTITUTE')) { 941 $json_options = JSON_INVALID_UTF8_SUBSTITUTE; 942 } 943 $restResponse = json_decode($responseBody, false, 512, $json_options); 944 945 // Check for JSON errors 946 if (json_last_error() !== JSON_ERROR_NONE) { 947 recruitly_log_exception(new Exception('JSON decode error in sync_post_type: ' . json_last_error_msg())); 948 continue; 949 } 950 951 // Verify server response and display errors 952 if ($restResponse && property_exists($restResponse, 'reason') && property_exists($restResponse, 'message')) { 887 953 recruitly_admin_notice(htmlspecialchars($restResponse->message), 'error'); 888 954 continue; … … 998 1064 $error_message = $response->get_error_message(); 999 1065 echo esc_html("Failed to fetch data: $error_message"); 1066 return; 1000 1067 } else { 1001 $body = wp_remote_retrieve_body($response);1002 $image_data = wp_ json_decode($body, true);1068 // Get the raw image data (not JSON) 1069 $image_data = wp_remote_retrieve_body($response); 1003 1070 } 1004 1071 -
recruitly/trunk/readme.txt
r3262547 r3338991 131 131 * Add additional recruiter fields. 132 132 133 = 2.0.31 = 134 * Fix character encoding issues. 135 133 136 == Upgrade Notice == 134 137 -
recruitly/trunk/recruitly.php
r3262547 r3338991 4 4 Plugin URI: https://recruitly.io 5 5 Description: Recruitly job board integration. 6 Version: 2.0.3 06 Version: 2.0.31 7 7 Author: Recruitly 8 8 Author URI: https://recruitly.io … … 15 15 exit; // Exit if accessed directly 16 16 } 17 define('RECRUITLY_PLUGIN_VERSION', '2.0.3 0');17 define('RECRUITLY_PLUGIN_VERSION', '2.0.31'); 18 18 19 19 defined('RECRUITLY_POST_TYPE') or define('RECRUITLY_POST_TYPE', 'current-vacancies');
Note: See TracChangeset
for help on using the changeset viewer.