示例#1
0
 public static function load()
 {
     global $Settings;
     if (is_array(self::$Modules) && count(self::$Modules)) {
         return;
     }
     // Load the various modules (search for the "tv" subdirectory in case it might
     // find some other "modules" directory, too.
     if (modules_path && modules_path != 'modules_path') {
         foreach (get_sorted_files(modules_path) as $module) {
             if (preg_match('/^_/', $module)) {
                 continue;
             }
             if (!is_dir(modules_path . "/{$module}")) {
                 continue;
             }
             if (!file_exists(modules_path . "/{$module}/init.php")) {
                 continue;
             }
             require_once modules_path . "/{$module}/init.php";
         }
     }
     if (empty($Modules)) {
         tailored_error('no_modules');
     }
     // Sort the modules
     uasort($Modules, 'Modules::by_module_sort');
     self::$Modules = $Modules;
     unset($Modules);
 }
示例#2
0
/**
 * Displays a <select> of the available skins
/**/
function skin_select($name = 'skin', $selected = null)
{
    echo '<select id="' . $name . '" name="' . $name . '">';
    foreach (get_sorted_files("skins/") as $skin) {
        // Skip the svn directory
        if (in_array($skin, array('.svn'))) {
            continue;
        }
        // Ignore non-directories
        if (!is_dir("skins/{$skin}")) {
            continue;
        }
        // Print the option
        echo '<option value="' . html_entities($skin) . '"';
        if ($selected == $skin) {
            echo ' SELECTED';
        }
        echo '>' . html_entities(str_replace('_', ' ', $skin)) . '</option>';
    }
    echo '</select>';
}