Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public static function removeWebLinks($content, $domain) { |
||
15 | if (!empty($content)) { |
||
16 | if(!empty($domain)) { |
||
17 | $pattern = '#<a [^>]*\bhref=([\'"])http.?://((?!$domain)[^\'"])+\1 *>.*?</a>#i'; |
||
18 | $filteredString = preg_replace($pattern, '', $content); |
||
19 | } else { |
||
20 | $filteredString = preg_replace('#<a.*?>.*?</a>#i', '', $content); |
||
21 | } |
||
22 | |||
23 | return $filteredString; |
||
24 | } |
||
25 | } |
||
26 | } |
||
27 |