function filter_files($files)
{
    # Exclude files. Adjust as necessary.
    return array_filter($files, function ($file) {
        return !is_hidden($file) && substr($file, -4) != '.php';
        # PHP scripts
    });
}
Esempio n. 2
0
                	document.location.href = "index.php?game=" + newgame + document.location.hash;
		});

		$("#ArrayList").change(function() {
			var game = $('#GameList').val();
			var newarray = $("#ArrayList").val();
			document.location.href = "index.php?game=" + game + "&array=" + newarray + document.location.hash;
		});
	});
})();
</script>
</head>

<body id="body_top">
<div style="display:<?php 
echo is_hidden();
?>
" class="hd">
	<div class="title left hdblock">zPerfmon</div>
    <div id="game-info" class="right">
        <div id="select-game-div" class="left">
            <div class="left">
                <div class="label">Game</div>
                <div class="options">
                    <select name=GameSelector id="GameList">
                        <?php 
echo populateGameList();
?>
                    </select>
                </div>
            </div>
Esempio n. 3
0
 /**
  * Looks at a directory and loads all of the modules, getting info about the files,
  * and returns an array with the module's info, options, files, and file contents
  *
  * @package Librarian
  *
  * @param string $directory The directory to look in. Defaults to 'modules' if none provided
  *
  * @uses Librarian::settings
  * @uses Librarian::root_path
  * @uses Librarian::is_module_file()
  * @uses Librarian::get_module_assets()
  * @uses Librarian::get_module_options()
  * @uses Librarian::scandir_without_invisibles()
  *
  * @return array An associative array of modules with info, options, files and file contents
  */
 public function get_modules($directory = false)
 {
     // We'll build up this variable with the return value
     $output = false;
     // Set if we're working in a passed in dir or the classes's setting
     $dir = $directory ? $directory : $this->settings['directory'];
     // Create dir path
     $path = $this->root_path . '/' . $dir;
     // Get list of modules
     $modules = scandir($path);
     // If the dir's empty, end early
     if (!count($modules)) {
         return;
     }
     // Loop through the dir and find the modules to use
     $count = 0;
     foreach ($modules as $module_dir_name => $module) {
         if (is_dir($dir . '/' . $module) && !is_hidden($module) & !in_array($module, $this->settings['exclude_modules'])) {
             // First time with match, make output an array
             if ($count == 0) {
                 $output = array();
             }
             // Put module name in the array
             $output[$module]['slug'] = $module;
             // Put the module's directory in the array
             $output[$module]['dir'] = $dir;
             // Put module path in the array
             $output[$module]['path'] = $this->root_path . '/' . $dir . '/' . $module;
             // Get file content except for hidden files
             $files = $this->scandir_without_invisibles($path . '/' . $module);
             // If the directory is empty, skip this itteration and remove the item from the modules list
             if (empty($files)) {
                 unset($modules[$module_dir_name]);
                 continue;
             }
             // Set the file extension as the array key, and add to array
             $found_php = false;
             // Since modules must have a .php file, let's skip ones that don't
             // Find the module's files and add that to the modules array
             foreach ($files as $file) {
                 // Get the extension
                 $ext = explode(".", $file);
                 $ext = end($ext);
                 // Add to array if it's a module file
                 if ($this->is_module_file($file, $module)) {
                     $output[$module]['files'][$ext] = $this->root_path . '/' . $dir . '/' . $module . '/' . $file;
                 } else {
                     // Otherwise we're create an 'attachments' array by extension
                     $output[$module]['attachments'][$ext][] = $this->root_path . '/' . $dir . '/' . $module . '/' . $file;
                 }
                 // Set if we found a php file
                 if ($ext == 'php') {
                     $found_php = true;
                 }
             }
             // Modules must have a php file, so let's remove ones that don't
             if (!$found_php) {
                 unset($modules[$module_dir_name]);
                 continue;
             }
             // Put module's assets in the array
             $output[$module]['assets'] = $this->get_module_assets($output[$module]);
             // Put module options in the array
             $output[$module]['options'] = $this->get_module_options($output[$module]);
             $count++;
         }
     }
     // foreach
     return $output;
 }