function solve_paths($text) { static $test = array('/(?<=font\\/)\\S+\\.(?:woff|eot|ttf|svg)\\b/i', '/(?<=img\\/)\\S+\\.(?:jpe?g|png|gif)\\b/i'); foreach ($test as $expr) { $text = preg_replace_callback($expr, function ($match) { return \Sauce\App\Assets::solve($match[0]); }, $text); } return $text; }