public static function all() { $sounds = Sound::all(); // Parse any newly added files foreach (glob(DOC_ROOT . '/uploads/*') as $filename) { if (!is_dir($filename)) { $sound = Sounds::parseSoundFile($filename); if ($sound) { array_push($sounds, $sound); } } } // Make sure files exist for all sounds foreach ($sounds as $key => $sound) { if (!file_exists($sound->filename)) { $sound->delete(); unset($sounds[$key]); } } return $sounds; }
require 'lib/bigbuttons.php'; ?> <!doctype html> <html lang="en"> <head> <title>Big Buttons</title> <meta charset=utf-8> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <script src="bigbuttons.jquery.js"></script> <link rel="stylesheet" href="bigbuttons.css" /> </head> <body> <ol class="bigbuttons"> <?php foreach (Sound::all() as $sound) { ?> <li> <button> <audio src="<?php echo h($sound->path); ?> " preload="none"> <a href="<?php echo h($sound->path); ?> "><?php echo h($sound->path); ?> </a> </audio>
?> <form class="search-form center" method="get" action="sound.php"> <div class="input-group"> <input id="sound" name="n" type="text" placeholder="Search for..." class="form-control"> </div> <button type="submit" class="btn btn-success">Search</button> </form> </p> </div> <div class="sounds panel panel-default"> <div class="panel-body"> <?php $size = 0; if (Sound::all() != null) { $size = count(Sound::all()); $all = Sound::all(); for ($i = $page * 10; $i < $page * 10 + 10; $i++) { if (!isset($all[$i])) { continue; } $sound = $all[$i]; ?> <div class="sound-container panel panel-default"> <div class="sound-title panel-heading"> <h3 class="panel-title pull-left"><a href="sound.php?n=<?php echo $sound->name; ?> "><?php echo $sound->name; ?> </a></h3>