public function findFile($class)
    {
        if (!function_exists('drupal_get_path')) {
            return;
        }
        $class  = ltrim($class, '\\');

        $expl   = explode('\\', $class);

        // Convert CamelCase to camel_case
        $module = strtolower(preg_replace('/(?<=\\w)(?=[A-Z])/', '_$1', reset($expl)));

        if (2 === count($expl)) {
            // Locate Foo\Bar in foo/class/bar.class.inc (for BC purposes)
            foreach (array($module, strtolower(reset($expl))) as $mod) {
                $className = strtolower(end($expl));
                $file      =
                    DRUPAL_ROOT.
                    DIRECTORY_SEPARATOR.
                    drupal_get_path('module', $mod).
                    DIRECTORY_SEPARATOR.
                    'class'.
                    DIRECTORY_SEPARATOR.
                    "{$className}.class.inc";

                if (file_exists($file)) {
                    return $file;
                }
            }
        }

        if (1 !== count($expl)) {
            // Locate FooBar\Crux\Class in foo_bar/FooBar/Crux/Class.php
            $classPath = str_replace('_', DIRECTORY_SEPARATOR, array_pop($expl));
            $file      =
                DRUPAL_ROOT.
                DIRECTORY_SEPARATOR.
                drupal_get_path('module', $module).
                DIRECTORY_SEPARATOR.
                implode(DIRECTORY_SEPARATOR, $expl).
                DIRECTORY_SEPARATOR.
                "{$classPath}.php"
            ;

            if (file_exists($file)) {
                return $file;
            }
        }
    }