<div class="twitter" title="Share on twitter">Twitter</div> <div class="vkontakte" title="Share on vkontakte">Вконтакте</div> </div> </div> <div class="sidebar-module sidebar-now-playing"> <div class="label label-info label-info-custom">Users search</div> <ul class="list-inline"> <?php $artists = randomArtists(20); ?> <?php foreach ($artists as $artst) { ?> <li> <a href="/<?php echo urlclean($artst, '-'); ?> .html"> <?php echo $artst; ?> </a> </li> <?php } ?> </ul> </div> </div><!-- /.blog-sidebar --> </div> </div>
<div class="panel panel-default"> <!-- Default panel contents --> <div class="panel-heading panel-title">The hot 100</div> <!-- List group --> <ul class="list-group"> <?php foreach ($results as $item) { ?> <li class="list-group-item list-group-item-custom"> <a href="/<?php echo urlclean($item->artist . ' ' . $item->chart_item_title, '-'); ?> .html" class="list-group-href"><strong class="track_title"><?php echo $item->chart_item_title; ?> </strong><br><span class="artist_name"><?php echo $item->artist; ?> </span></a> </li> <?php } ?> </ul> </div>
echo gmdate("i:s", $item['duration']); ?> )</span> <div class="jp-type-single"> <div class="jp-gui jp-interface"> <ul class="jp-controls bs-glyphicons-list list-inline"> <li> <a class="jp-play glyphicon glyphicon-play" tabindex="1" href="<?php echo $item['url']; ?> "></a> </li> <li> <a class="glyphicon glyphicon-download-alt" href="/dl.php?link=<?php echo urlencode($item['url']); ?> &name=<?php echo urlclean($item['title'] . '-' . $item['artist'], '-'); ?> .mp3"></a> </li> </ul> </div> </div> </div> </li> <?php } ?> </ul> </div>
<div class="panel panel-default"> <h1 class="panel-heading panel-title">Now playing mp3</h1> <ul class="list-group"> <?php foreach ($results as $item) { ?> <li class="list-group-item list-group-item-custom"> <a href="/<?php echo urlclean($item, '-'); ?> .html" class="list-group-href"><span class="artist_name"><?php echo $item; ?> </span></a> </li> <?php } ?> </ul> </div>
// Main page route $app->get('/', function () use($app) { // Search from Vk or memcache $cache = new memcache(); $cache->connect('localhost'); if (($xmlString = $cache->get('top')) === false) { $xmlString = file_get_contents('http://www.billboard.com/rss/charts/hot-100'); $cache->set('top', $xmlString, 0, 8600); } $xml = new SimpleXMLElement($xmlString); $results = $xml->channel[0]->item; $app->render('layout.php', ['page' => 'main', 'results' => $results]); }); // Search route $app->get('/:query.html', function ($query) use($app) { $query = urlclean($query); // Save request $client = new \Sokil\Mongo\Client(MONGO_DSN); $collection = $client->getDatabase(MONGO_DBNAME)->getCollection(MONGO_COLLECTION); if (!$collection->find(['request' => $query])->count()) { $collection->insert(['request' => $query, 'created' => new MongoDate(), 'views' => 1]); } else { $collection->getMongoCollection()->update(['request' => $query], ['$inc' => ['views' => 1]]); } // Search from Vk or memcache $cache = new memcache(); $cache->connect('localhost'); // Поиск в ВК и отправка пользователю if (($results = $cache->get($query)) === false) { // Search from Vk or memcache $http = new dHttp\Client('https://api.vk.com/method/audio.search.json?access_token=096fb2d19fc28da6694e9db15f47ff9561c36628f5485fbcd642f7edc6185ea413ab2f2fa4a5c1789cb79&q=' . urlencode($query));
$app->render('layout.php', ['page' => 'search', 'results' => search($query), 'query' => $query, 'video' => getVideo($query), 'title' => ucwords($query) . ' download mp3 music | Mp3Cooll.com', 'description' => 'Download ' . ucwords($query) . ' mp3 and listen online song ' . ucwords($query) . ' just now unlimited. Watch video ']); })->conditions(['query' => '.+']); /** * Search route */ $app->get('/search', function () use($app) { $query = urlclean($_GET['q']); if (strlen($query) < 1) { $app->redirect('/'); } // Save query saveRequest($query); $app->render('layout.php', ['page' => 'search', 'results' => search($query), 'query' => $query, 'video' => getVideo($query), 'title' => ucwords($query) . ' download mp3 music | Mp3Cooll.com', 'description' => 'Download ' . ucwords($query) . ' mp3 and listen online song ' . ucwords($query) . ' just now unlimited. Watch video ']); }); /** * Autocomplete route */ $app->get('/autocomplete', function () use($app) { //$_GET['query'] echo json_encode(['query' => $_GET['query'], 'suggestions' => getAutocompleteData($_GET['query'])]); }); /** * Search route */ $app->get('/:query', function ($query) use($app) { $app->redirect('/' . urlclean($query, '-') . '.html'); })->conditions(['query' => '.+']); /** * Run application */ $app->run();
<div class="panel panel-default"> <h1 class="panel-heading panel-title">Most popular mp3</h1> <ul class="list-group"> <?php foreach ($results as $item) { ?> <?php list($title, $artist) = explode(' - ', $item['title']); ?> <li class="list-group-item list-group-item-custom"> <a href="/<?php echo urlclean($artist . ' ' . $title, '-'); ?> .html" class="list-group-href"><strong class="track_title"><?php echo $title; ?> </strong> <br><span class="artist_name"><?php echo $artist; ?> </span></a> </li> <?php } ?> </ul> </div>