function pugpig_rewrite_wpcontent_links($markup) { $content_fragment = pugpig_strip_domain(content_url()); $regex = '#([\'"])(' . $content_fragment . '/.*?)\\1#i'; $index = 0; if (preg_match_all($regex, $markup, $matches)) { foreach ($matches[2] as $src) { $quote = $matches[1][$index]; $new_uri = url_create_deep_dot_url($src); // Strip version number? $new_uri = remove_query_arg('ver', $new_uri); $markup = str_replace($quote . $src . $quote, $quote . $new_uri . $quote, $markup); ++$index; } } return _pugpig_rewrite_pugpig_html_links($markup); }
/** * @dataProvider dataProvider */ public function test($body, $expected) { $this->assertEquals($expected, \_pugpig_rewrite_pugpig_html_links($body)); }