private static function find_theme_location($themename) {
        global $CFG;

        if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
            $dir = "$CFG->dirroot/theme/$themename";

        } else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
            $dir = "$CFG->themedir/$themename";

        } else {
            return null;
        }

        if (file_exists("$dir/styles.php")) {
            //legacy theme - needs to be upgraded - upgrade info is displayed on the admin settings page
            return null;
        }

        return $dir;
    }
private static function find_theme_location($themename) {
        global $CFG;

        if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
            $dir = "$CFG->dirroot/theme/$themename";

        } else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
            $dir = "$CFG->themedir/$themename";

        } else {
            return null;
        }

        if (file_exists("$dir/styles.php")) {
            //legacy theme - needs to be upgraded - upgrade info is displayed on the admin settings page
            return null;
        }

        return $dir;
    }
private static function find_theme_location ( $ themename ) { global $ CFG ; if ( file_exists ( "$CFG->dirroot/theme/$themename/config.php" ) ) { $ dir = "$CFG->dirroot/theme/$themename" ; } else if ( ! empty ( $ CFG -> themedir ) and file_exists ( "$CFG->themedir/$themename/config.php" ) ) { $ dir = "$CFG->themedir/$themename" ; } else { return null ; } if ( file_exists ( "$dir/styles.php" ) ) { //legacy theme - needs to be upgraded - upgrade info is displayed on the admin settings page return null ; } return $ dir ; }
Finds the theme location and verifies the theme has all needed files
and is not obsoleted.

@param string $themename
@return string full dir path or null if not found
Finds the theme location and verifies the theme has all needed files and is not obsoleted .