public function filter(&$text)
    {
        $pattern = '~
            <ktml:(?:script|style) # match ktml:script and ktml:style tags
            [^(?:src=)]+           # anything before src=
            src="                  # match the link
              ((?:media://|assets://)           # starts with media:// or assets://
              (?:koowa/)?            # may or may not be in koowa/ folder
              (?:com_([^/]+)/|js/|css/|scss/) # either has package name (com_foo) or in framework
              [^"]+)"                # match the rest of the link
             (.*)/>
        ~siUx';

        // Hold a list of already processed URLs
        $processed = array();

        if(preg_match_all($pattern, $text, $matches, PREG_SET_ORDER))
        {
            foreach ($matches as $match)
            {
                $version = $this->_getVersion(!empty($match[2]) ? $match[2] : 'koowa');

                if ($version)
                {
                    $url = $match[1];

                    if (!in_array($url, $processed))
                    {
                        $processed[] = $url;

                        $version = substr(md5($version), 0, 8);
                        $suffix  = strpos($url, '?') === false ? '?'.$version : '&'.$version;
                        $text    = str_replace($url, $url.$suffix, $text);
                    }


                }
            }
        }
    }