Plugin Directory

Changeset 3219989


Ignore:
Timestamp:
01/10/2025 04:53:24 AM (15 months ago)
Author:
recruitly
Message:

WordPress code review comments implemented

Location:
recruitly/trunk
Files:
1 added
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • recruitly/trunk/admin/dataloader.php

    r3216721 r3219989  
    409409    } catch (Throwable $ex) {
    410410    }
    411 
    412     try {
    413         if (isset($job->webAdvert)) {
    414             update_post_meta($post_id, 'webAdvert', wp_json_encode($job->webAdvert));
    415             update_post_meta($post_id, 'webAdvertrecruitmentProcess', mb_convert_encoding($job->webAdvert->recruitmentProcess, 'UTF-8', 'ISO-8859-1'));
    416             update_post_meta($post_id, 'webAdvertmainResponsibilities', mb_convert_encoding($job->webAdvert->mainResponsibilities, 'UTF-8', 'ISO-8859-1'));
    417             update_post_meta($post_id, 'webAdvertwhatsOnOffer', mb_convert_encoding($job->webAdvert->whatsOnOffer, 'UTF-8', 'ISO-8859-1'));
    418             update_post_meta($post_id, 'webAdvertcoreSkills', mb_convert_encoding($job->webAdvert->coreSkills, 'UTF-8', 'ISO-8859-1'));
    419             update_post_meta($post_id, 'webAdvertwhatWillYouLearn', mb_convert_encoding($job->webAdvert->whatWillYouLearn, 'UTF-8', 'ISO-8859-1'));
    420             update_post_meta($post_id, 'webAdvertkeyLanguages', mb_convert_encoding($job->webAdvert->keyLanguages, 'UTF-8', 'ISO-8859-1'));
    421         }
    422     } catch (Throwable $ex) {
    423     }
     411   
     412    try {
     413        if (isset($job->webAdvert)) {
     414            // Ensure 'webAdvert' is encoded as JSON and stored
     415            update_post_meta($post_id, 'webAdvert', wp_json_encode($job->webAdvert));
     416   
     417            // Custom function to handle UTF-8 encoding
     418            $recruitly_encode = function ($value) {
     419                if (is_string($value)) {
     420                    return mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
     421                }
     422                return $value;
     423            };
     424   
     425            // Update post meta with properly encoded values
     426            update_post_meta($post_id, 'webAdvertrecruitmentProcess', $recruitly_encode($job->webAdvert->recruitmentProcess ?? ''));
     427            update_post_meta($post_id, 'webAdvertmainResponsibilities', $recruitly_encode($job->webAdvert->mainResponsibilities ?? ''));
     428            update_post_meta($post_id, 'webAdvertwhatsOnOffer', $recruitly_encode($job->webAdvert->whatsOnOffer ?? ''));
     429            update_post_meta($post_id, 'webAdvertcoreSkills', $recruitly_encode($job->webAdvert->coreSkills ?? ''));
     430            update_post_meta($post_id, 'webAdvertwhatWillYouLearn', $recruitly_encode($job->webAdvert->whatWillYouLearn ?? ''));
     431            update_post_meta($post_id, 'webAdvertkeyLanguages', $recruitly_encode($job->webAdvert->keyLanguages ?? ''));
     432        }
     433    } catch (Throwable $ex) {
     434    }
    424435
    425436    try {
     
    10491060    }
    10501061}
     1062
     1063/**
     1064 * Alternative to utf8_encode() using mb_convert_encoding
     1065 *
     1066 * @param string $string The string to convert to UTF-8.
     1067 * @return string The UTF-8 encoded string.
     1068 */
     1069function utf8_encode_alternative($string) {
     1070    // Check if the mbstring extension is loaded
     1071    if (function_exists('mb_convert_encoding')) {
     1072        // Convert from ISO-8859-1 to UTF-8
     1073        return mb_convert_encoding($string, 'UTF-8', 'ISO-8859-1');
     1074    } else {
     1075        // Fallback if mb_convert_encoding is not available
     1076        throw new RuntimeException('The mbstring extension is required for this function to work.');
     1077    }
     1078}
  • recruitly/trunk/readme.txt

    r3216721 r3219989  
    3535Use the dynamic shortcodes `[recruitly_job_search]` and `[recruitly_jobs]` to display the job search form and job listings, respectively. These shortcodes can be placed anywhere on your website.
    3636
    37 == External services ==
    38  This plugin connects to Recruitly API to fetch your data and to read configuration. We send your WordPress plugin information for version compatiblity.
    39  Please refer to https://recruitly.io/terms-of-service for terms of use, https://recruitly.io/privacy-policy for privacy policy.
    40 
    4137== Changelog ==
    4238
    43 = 2.0.20 =
    44 * Stable release.
     39= 2.0.16 =
     40* Initial stable release.
    4541
    4642== Upgrade Notice ==
    4743
    48 = 2.0.16 =
     44= 2.0.20 =
    4945This is the first stable version of the plugin. Please update if you are using an earlier version.
Note: See TracChangeset for help on using the changeset viewer.