Deprecated: Function eregi_replace() is deprecated
-
Hi there,
It’s me, again ??
I continued my little dev and found that:
Deprecated: Function eregi_replace() is deprecated in /Applications/MAMP/htdocs/gereso/wp-content/plugins/dofollow-case-by-case/dofollow-case-by-case.php on line 259
To fix this, just replace line 259 by that line :
$text = preg_replace('#(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~\#?&//=]+)#i','$1', $text);
Just after that, I do a var_dump() of $url in this clearComment() function and found lots of NULL.
I found two NULL by comment, so that function is called two times by comment.
Lines 586 and 587, you use two filters. Why? One seems to be enough.
comment_text
is an alias ofget_comment_text
, so by keeping only theget_comment_text
, the work is done ??Finally, if comment contains something between double-quotes, your regexp will return the content between those double-quotes instead of NULL.
Oh, other point : by using preg_match, your function can be improved:
function clearComment( $comment ) { preg_match( '%(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@|\d{1,3}(?:\.\d{1,3}){3}|(?:(?:[a-z\d\x{00a1}-\x{ffff}]+-?)*[a-z\d\x{00a1}-\x{ffff}]+)(?:\.(?:[a-z\d\x{00a1}-\x{ffff}]+-?)*[a-z\d\x{00a1}-\x{ffff}]+)*(?:\.[a-z\x{00a1}-\x{ffff}]{2,6}))(?::\d+)?(?:[^\s]*)?%iu', $comment, $matches ); return isset( $matches[0] ) ? trim( $matches[0], '"') : NULL; }
Regexp inspired by https://gist.github.com/dperini/729294
Thank you.
- The topic ‘Deprecated: Function eregi_replace() is deprecated’ is closed to new replies.