|
@@ -875,6 +875,67 @@ if (!function_exists('get_web_url')) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+if (!function_exists('set_format_content')) {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取文章图片格式化后内容
|
|
|
+ * @param $content
|
|
|
+ * @return false|mixed|string
|
|
|
+ */
|
|
|
+ function set_format_content($content)
|
|
|
+ {
|
|
|
+ if (empty($content)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ $domain = request()->header('HOST');
|
|
|
+ if(preg_match("/127/", $domain)){
|
|
|
+ $host = env('IMG_URL','');
|
|
|
+ if(empty($host)){
|
|
|
+ $https = request()->secure();
|
|
|
+ $host = ($https ? 'https://' : 'http://') . $host . '/uploads';
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $https = request()->secure();
|
|
|
+ $host = ($https ? 'https://' : 'http://') . $domain . '/uploads';
|
|
|
+ }
|
|
|
+
|
|
|
+ $content = str_replace("{$host}",'/uploads', htmlspecialchars_decode($content));
|
|
|
+ return $content;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+if (!function_exists('get_format_content')) {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取文章图片格式化后内容
|
|
|
+ * @param $content
|
|
|
+ * @return false|mixed|string
|
|
|
+ */
|
|
|
+ function get_format_content($content)
|
|
|
+ {
|
|
|
+ if (empty($content)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ $domain = request()->header('HOST');
|
|
|
+ if(preg_match("/127/", $domain)){
|
|
|
+ $host = env('IMG_URL','');
|
|
|
+ if(empty($host)){
|
|
|
+ $https = request()->secure();
|
|
|
+ $host = ($https ? 'https://' : 'http://') . $host . '/uploads';
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $https = request()->secure();
|
|
|
+ $host = ($https ? 'https://' : 'http://') . $domain . '/uploads';
|
|
|
+ }
|
|
|
+
|
|
|
+ $content = str_replace(["\"/uploads","'/uploads"],["\"{$host}","'{$host}"], htmlspecialchars_decode($content));
|
|
|
+ return $content;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
if (!function_exists('get_hash')) {
|
|
|
|
|
|
/**
|