/** * Callback function for updating href's with data-* attrbutes, after they've been identified with a regular expression * @param $matches * @return string */ private static function filter_callback($matches) { $data = Amber::lookup_url($matches[1]); $result = $matches[0]; foreach ($data as $key => $value) { $result .= " {$key}=\"{$value}\""; } return $result; }