This commit is contained in:
2022-11-05 09:37:57 -04:00
parent 48f30e9dfe
commit 7abf541bce
3 changed files with 53 additions and 2 deletions
+41 -2
View File
@@ -32,7 +32,45 @@ function formatCreateTranspData($in) {
return $in;
}
function cleanUpDescription($job_description){
// $job_description = trim($job_description); // trim it first
/*
*
* $rest = substr("abcdef", -1); // returns "f"
$rest = substr("abcdef", -2); // returns "ef"
$rest = substr("abcdef", -3, 1); // returns "d"
*/
if ( substr($job_description,0,1)==='"' ){
// $job_description = substr($job_description,1);
}
$job_description =fixtags($job_description);
if ( substr($job_description,0,1)==='"' ){
// $job_description = substr($job_description,2);
}
return $job_description;
}
function fixtags($text){
$text = htmlspecialchars($text);
$text = preg_replace("/=/", "=\"\"", $text);
$text = preg_replace("/"/", ""\"", $text);
$tags = "/<(\/|)(\w*)(\ |)(\w*)([\\\=]*)(?|(\")\""\"|)(?|(.*)?"(\")|)([\ ]?)(\/|)>/i";
$replacement = "<$1$2$3$4$5$6$7$8$9$10>";
$text = preg_replace($tags, $replacement, $text);
$text = preg_replace("/=\"\"/", "=", $text);
$text = str_replace("\\n", "<br />", $text);
$text = str_replace('"&quot;\"','',$text);
$text = str_replace('&quot;\""','',$text);
$text = str_replace('&nbsp;','',$text);
$text = str_replace('href=\\&quot;\"http://','',$text);
$text = str_replace('href=\\&quot;\"https://','',$text);
return $text;
}
function processOutJson($in, $out) {
@@ -121,11 +159,12 @@ function processOutJson($in, $out) {
"title" => $out["title_${key}"],
"description" => $out["description_${key}"],
"id" => $out["id_${key}"],
"job_description" => $out["job_description_${key}"],
"job_description" => cleanUpDescription($out["job_description_${key}"]),
"price" => $out["price_${key}"],
"timeline_days" => $out["timeline_days_${key}"],
"expire" => $out["expire_${key}"],
"sent" => $out["sent_${key}"]
"sent" => $out["sent_${key}"],
"offer_code" => $out["offer_code_${key}"]
);
}