fix #119
This commit is contained in:
parent
55250f8e28
commit
2b4612493c
|
@ -1513,32 +1513,36 @@ function codecheese_register_post( $sanitized_user_login, $user_email, $errors )
|
||||||
|
|
||||||
// html 标签处理器
|
// html 标签处理器
|
||||||
function html_tag_parser($content) {
|
function html_tag_parser($content) {
|
||||||
if(!is_feed()) {
|
if(!is_feed()) {
|
||||||
if(akina_option('lazyload') && akina_option('lazyload_spinner')){
|
$content=preg_replace(
|
||||||
$content=preg_replace(
|
'/<img(.+)src=[\'"]([^\'"]+)[\'"](.*)>/i',
|
||||||
'/<img(.+)src=[\'"]([^\'"]+)[\'"](.*)>/i',
|
"<img $1 class=\"lazyload\" data-src=\"$2\" src=\"https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\" $3 >\n<noscript>$0</noscript>",
|
||||||
"<img $1 class=\"lazyload\" data-src=\"$2\" src=\"".akina_option('lazyload_spinner')."\" onerror=\"imgError(this)\" $3 >\n<noscript>$0</noscript>",
|
$content
|
||||||
$content
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Fancybox
|
//Fancybox
|
||||||
/* Markdown Regex Pattern for Matching URLs:
|
/* Markdown Regex Pattern for Matching URLs:
|
||||||
* https://daringfireball.net/2010/07/improved_regex_for_matching_urls
|
* https://daringfireball.net/2010/07/improved_regex_for_matching_urls
|
||||||
*/
|
*/
|
||||||
$url_regex ='(((http|https):\/\/)?(\w(\:\w)?@)?([0-9a-z_-]+\.)*?([a-z0-9-]+\.[a-z]{2,6}(\.[a-z]{2})?(\:[0-9]{2,6})?)((\/[^?#<>\/\\*":]*)+(\?[^#]*)?(#.*)?)?)';
|
$url_regex ='((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))';
|
||||||
|
|
||||||
//With Thumbnail: !{alt}(url)[th_url]
|
//With Thumbnail: !{alt}(url)[th_url]
|
||||||
$content=preg_replace(
|
if (preg_match_all('/\!\{.*?\)\[.*?\]/i', $content,$matches)){
|
||||||
'/!\{([^\{\}]+)*\}\('.$url_regex.'\)\['.$url_regex.'\]/i',
|
$i=0;
|
||||||
'<a data-fancybox="gallery"
|
foreach ($matches as $val) {
|
||||||
data-caption="$1"
|
$content=str_replace($val[$i],preg_replace(
|
||||||
class="fancybox"
|
'/!\{([^\{\}]+)*\}\('.$url_regex.'\)\['.$url_regex.'\]/i',
|
||||||
href="$2"
|
'<a data-fancybox="gallery"
|
||||||
alt="$1"
|
data-caption="$1"
|
||||||
title="$1"><img src="$15" target="_blank" rel="nofollow" class="fancybox"></a>',
|
class="fancybox"
|
||||||
$content
|
href="$2"
|
||||||
);
|
alt="$1"
|
||||||
|
title="$1"><img src="$7" target="_blank" rel="nofollow" class="fancybox"></a>',
|
||||||
|
$val[$i]),
|
||||||
|
$content);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Without Thumbnail :!{alt}(url)
|
//Without Thumbnail :!{alt}(url)
|
||||||
$content=preg_replace(
|
$content=preg_replace(
|
||||||
|
|
Loading…
Reference in New Issue