<?php require './vendor/autoload.php'; set_time_limit(0); while ($word = trim(read_and_delete_first_line(__DIR__ . '/vocabulary.txt'))) { $content = file_get_contents("https://ssl.gstatic.com/dictionary/static/sounds/de/0/{$word}.mp3"); file_put_contents(__DIR__ . "/mp3/{$word}.mp3", $content); } echo 'xong'; function read_and_delete_first_line($filename) { $file = file($filename); $output = isset($file[0]) ? $file[0] : NULL; unset($file[0]); file_put_contents($filename, $file); return $output; }
$source = "application/upgrade_script/"; $destination = "upgrade_script/"; if (!file_exists($destination)) { if (!mkdir($destination, 0777, true)) { die('Failed to create upgrade folder'); } } // Cycle through all source files foreach ($files as $file) { if (in_array($file, array(".", ".."))) { continue; } // If we copied this successfully, mark it for deletion if (copy($source . $file, $destination . $file)) { // remove the first line from the new destination to allow it to be accessed read_and_delete_first_line($destination . $file); $delete[] = $source . $file; } } return Redirect::to('upgrade_script/index.php'); }); }); Route::get('pages/{slug}', function ($slug) { $page = Page::where('url', '=', $slug)->first(); $data = array('page' => $page, 'categories' => Category::all(), 'pages' => Page::all(), 'settings' => Setting::first()); return View::make('Theme::page', $data); }); Route::get('view/list', function () { $cookie = Cookie::make('media_view', 'list', 30); return Redirect::to('/')->withCookie($cookie); });