public function webroot($file)
    {
        $request = $this->_View->getRequest();

        $asset = explode('?', $file);
        $asset[1] = isset($asset[1]) ? '?' . $asset[1] : null;
        $webPath = $request->getAttribute('webroot') . $asset[0];
        $file = $asset[0];

        if (!empty($this->_View->getTheme())) {
            $file = trim($file, '/');
            $theme = $this->_inflectThemeName($this->_View->getTheme()) . '/';

            if (DIRECTORY_SEPARATOR === '\\') {
                $file = str_replace('/', '\\', $file);
            }

            if (file_exists(Configure::read('App.wwwRoot') . $theme . $file)) {
                $webPath = $request->getAttribute('webroot') . $theme . $asset[0];
            } else {
                $themePath = Plugin::path($this->_View->getTheme());
                $path = $themePath . 'webroot/' . $file;
                if (file_exists($path)) {
                    $webPath = $request->getAttribute('webroot') . $theme . $asset[0];
                }
            }
        }
        if (strpos($webPath, '//') !== false) {
            return str_replace('//', '/', $webPath . $asset[1]);
        }

        return $webPath . $asset[1];
    }