作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !2407
... ... @@ -145,23 +145,32 @@ class Temp extends Command
$content = '';
if ($data[4] ?? '') {
//处理内容中的图片
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
//处理内容中的pdf文件
preg_match_all('/<a\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
if ($result[2] ?? []) {
foreach ($result[2] as $img) {
$new_img = check_remote_url_down($img, $project_id, $domain, 1);
$new_img && $data[4] = str_replace($img, $new_img, $data[4]);
foreach ($result[2] as $pdf) {
$new_img = check_remote_url_down($pdf, $project_id, $domain, 1);
$new_img && $data[4] = str_replace($pdf, $new_img, $data[4]);
}
}
//处理内容中的图片
// preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
// if ($result[2] ?? []) {
// foreach ($result[2] as $img) {
// $new_img = check_remote_url_down($img, $project_id, $domain, 1);
// $new_img && $data[4] = str_replace($img, $new_img, $data[4]);
// }
// }
//处理内容中的视频
preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result_video);
if ($result_video[2] ?? []) {
foreach ($result_video[2] as $video) {
$new_video = check_remote_url_down($video, $project_id, $domain, 1);
$new_video && $data[4] = str_replace($video, $new_video, $data[4]);
}
}
// preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result_video);
// if ($result_video[2] ?? []) {
// foreach ($result_video[2] as $video) {
// $new_video = check_remote_url_down($video, $project_id, $domain, 1);
// $new_video && $data[4] = str_replace($video, $new_video, $data[4]);
// }
// }
$content = $data[4];
}
... ...