Skip to content

Instantly share code, notes, and snippets.

@ach-raf
Forked from maniflames/index.php
Created August 24, 2020 17:31
Show Gist options
  • Save ach-raf/3801610ba76958a047c98877bab52802 to your computer and use it in GitHub Desktop.
Save ach-raf/3801610ba76958a047c98877bab52802 to your computer and use it in GitHub Desktop.
Custom Xampp Dashboard (Xampp Project Finder)
<?php
/**
* Xampp Project Finder (xpf)
* Author: Maniflames <[email protected]>
*
* Not a front-ender
* Styling Cred: https://codepen.io/acjdesigns/pen/vZKLyX
*/
//Load CSS
function load_css( $css_file ){
?>
<link href="https://fonts.googleapis.com/css?family=Roboto:100" rel="stylesheet">
<style media="screen">
<?php require_once $css_file; ?>
</style>
<?php
}
load_css('xpf.css');
//Scan working directory
$cwd_path = getcwd();
$cwd = scandir( $cwd_path );
//Filter and only keep the directories
function is_directory( $value ){
if( $value == "." || $value == ".."){
return ;
}
$path = getcwd() . "\\" . $value;
return is_dir( $path );
}
$directories = array_filter($cwd , "is_directory");
//show directories on screen
function directory_html( $value ){
?>
<div class="directory">
<a href="/<?php echo $value ?>">
<h3><?php echo $value ?></h3>
</a>
</div>
<?php
}
?>
<div class="wrapper"><?php array_map("directory_html", $directories); ?> </div>
<?php
body {
background-image: linear-gradient(to bottom right, #C4D8D5, #D3D1C5);
font-family: 'Roboto', sans-serif;
}
.wrapper{
display: flex;
margin: 20px;
flex-direction: row;
flex-wrap: wrap;
}
.directory {
background-color: rgba(255, 255, 255, 0.4);
min-width: 230px;
min-height: 230px;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
margin: 10px;
}
.directory > a {
letter-spacing: 2px;
text-transform: uppercase;
text-decoration: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment