Beispiel #1
0
 /**
  * Load the config.php file for a particular theme, and return an instance
  * of this class. (That is, this is a factory method.)
  *
  * @param string $themename the name of the theme.
  * @return theme_config an instance of this class.
  */
 public static function load($themename)
 {
     global $CFG;
     // We have to use the variable name $THEME (upper case) because that
     // is what is used in theme config.php files.
     // Set some other standard properties of the theme.
     $THEME = new theme_config();
     $THEME->name = $themename;
     $THEME->dir = $CFG->themedir . '/' . $themename;
     // Load up the theme config
     $configfile = $THEME->dir . '/config.php';
     if (!is_readable($configfile)) {
         throw new coding_exception('Cannot use theme ' . $themename . '. The file ' . $configfile . ' does not exist or is not readable.');
     }
     include $configfile;
     $THEME->update_legacy_information();
     return $THEME;
 }