當前位置: 首頁>>代碼示例>>PHP>>正文


PHP File::files方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\File::files方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::files方法的具體用法?PHP File::files怎麽用?PHP File::files使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\File的用法示例。


在下文中一共展示了File::files方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getFiles

 /**
  * Return files in path
  *
  * @param string $path
  *
  * @return mixed
  */
 public function getFiles($path)
 {
     $files = File::files($this->getPath($path));
     return array_map(function ($val) {
         return $this->sanitizePath($val);
     }, $files);
 }
開發者ID:spescina,項目名稱:mediabrowser,代碼行數:14,代碼來源:Filesystem.php

示例2: run

 public function run()
 {
     // get files in database/seeds folder
     $path = base_path('database/seeds');
     $files = array_map(function ($filename) {
         return str_replace(".php", "", $filename);
     }, array_map('basename', File::files($path)));
     // get entries in database
     $seeded = DB::table('seeded')->lists('seeder');
     // find seeds that need to be done
     foreach ($files as $file) {
         if ($file == 'DatabaseSeeder') {
             continue;
         }
         if (in_array($file, $seeded)) {
             continue;
         }
         // call the seeder
         Model::unguard();
         $this->command->info("Calling {$file}");
         try {
             $this->call($file);
             DB::table('seeded')->insert(['seeder' => $file]);
         } catch (Exception $e) {
             $this->command->error("Error in {$file}");
         }
         Model::reguard();
     }
 }
開發者ID:bespired,項目名稱:tools,代碼行數:29,代碼來源:ToolsSeedSeeder.php

示例3: getAngularLocation

 /**
  * Gets the files in the folder and returns their path
  * with the route relative to the public folder
  * @param $path
  * @return mixed
  */
 private function getAngularLocation($path)
 {
     $files = File::files($this->js_path . $path);
     foreach ($files as &$location) {
         $location = str_replace(public_path(), '', $location);
     }
     return $files;
 }
開發者ID:noikiy,項目名稱:turnt-octo-archer,代碼行數:14,代碼來源:JSHelper.php

示例4: getPhotosList

 public function getPhotosList()
 {
     $photos = null;
     $folderPath = $this->property('photos_folder');
     if (File::exists($folderPath)) {
         $photos = File::files($folderPath);
     }
     return $photos;
 }
開發者ID:janusnic,項目名稱:OctoberCMS-Bootstrap,代碼行數:9,代碼來源:Carousel.php

示例5: cleanUp

 private function cleanUp()
 {
     $files = File::files(storage_path());
     foreach ($files as $file) {
         if (strpos(File::mimeType($file), 'image') != false) {
             File::delete($file);
         }
     }
 }
開發者ID:nagyistoce,項目名稱:thumbnail-maker,代碼行數:9,代碼來源:ThumbMakerService.php

示例6: test_with_alpha3_lowercase_names

 public function test_with_alpha3_lowercase_names()
 {
     $exitCode = Artisan::call('prep:country-flags', ['--name' => 2, '--case' => 'lower']);
     $this->assertEquals(0, $exitCode, 'Assert exit code is 0');
     $this->assertTrue(File::isDirectory($this->dest), 'Assert flags directory was created');
     $files = File::files($this->dest);
     $this->assertContains($this->dest . '/ukr.svg', $files, 'Assert img files were created with appropriate naming conventions');
     $this->assertGreaterThan(200, count($files), 'Assert that count of generated flags is in expected range');
 }
開發者ID:adiachenko,項目名稱:rabbits,代碼行數:9,代碼來源:CountryFlagsTest.php

示例7: getItems

 /**
  * Get the images to load for a selected folder
  *
  * @return mixed
  */
 public function getItems()
 {
     $type = Input::get('type');
     $view = $this->getView();
     $path = parent::getPath();
     $files = File::files($path);
     $file_info = $this->getFileInfos($files, $type);
     $directories = parent::getDirectories($path);
     $thumb_url = parent::getUrl('thumb');
     return view($view)->with(compact('type', 'file_info', 'directories', 'thumb_url'));
 }
開發者ID:yesteamtech,項目名稱:laravel-file-manager,代碼行數:16,代碼來源:ItemsController.php

示例8: getItems

 /**
  * Get the images to load for a selected folder
  *
  * @return mixed
  */
 public function getItems()
 {
     $type = Input::get('type');
     $view = $this->getView($type);
     $path = $this->file_location . Input::get('working_dir');
     $files = File::files(base_path($path));
     $file_info = $this->getFileInfos($files, $type);
     $directories = parent::getDirectories($path);
     $thumb_url = parent::getUrl('thumb');
     return View::make($view)->with(compact('files', 'file_info', 'directories', 'thumb_url'));
 }
開發者ID:Abdulhmid,項目名稱:inventory,代碼行數:16,代碼來源:ItemsController.php

示例9: getTemplateOptions

 /**
  * Fetches all template files in views/templates
  * Cuts out blade and extension stuff
  * @return array
  */
 public static function getTemplateOptions()
 {
     $templateFiles = File::files(__DIR__ . '/../../views/templates');
     $array = array();
     foreach ($templateFiles as $template) {
         $file = pathinfo($template);
         list($filename) = explode(".", $file['basename']);
         $array[$filename] = ucfirst($filename);
     }
     return $array;
 }
開發者ID:cednet,項目名稱:laravel-cms-addon,代碼行數:16,代碼來源:Template.php

示例10: handle

 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     // get paths of registered namespace hints
     // e.g user in @lang('user::myview') resolving to app/Modules/User/Resources
     $resDirs = Config::get('langcheck.usehints') ? Lang::getHints() : array();
     $resDirs[base_path() . '/resources/lang'] = 'app';
     // check each resource directory
     foreach ($resDirs as $path => $hint) {
         // skip vendor directories
         if (Config::get('langcheck.skipvendor') && strpos($path, "vendor/") !== false) {
             continue;
         }
         // generate path relative to project root
         $shortPath = substr($path, strlen(base_path() . '/'));
         $this->info("Checking '{$shortPath}'...");
         // load translation files into arrays
         $langDirs = File::directories($path);
         $languageData = array();
         foreach ($langDirs as $langDir) {
             $langCode = basename($langDir);
             $arrays = File::files($langDir);
             foreach ($arrays as $file) {
                 $fileName = basename($file);
                 $languageData[$langCode][$fileName] = File::getRequire($file);
             }
         }
         // compare language arrays with each other and find missing entries
         foreach ($languageData as $langCodeA => $langArraysA) {
             foreach ($langArraysA as $fileNameA => $langArrayA) {
                 foreach ($languageData as $langCodeB => $langArraysB) {
                     if ($langCodeA == $langCodeB) {
                         continue;
                     }
                     if (array_key_exists($fileNameA, $langArraysB)) {
                         $result = $this->array_diff_key_recursive($langArrayA, $langArraysB[$fileNameA]);
                         if (!empty($result)) {
                             $keys = implode($this->arrayKeysRecursive($result), ', ');
                             $this->error(" * File '{$fileNameA}':");
                             $this->error("   - Locale '{$langCodeB}' missing [{$keys}] existing in locale '{$langCodeA}'");
                         }
                     } else {
                         $this->error(" * File '{$fileNameA}' existing in locale '{$langCodeA}' is missing for locale '{$langCodeB}'");
                     }
                 }
             }
         }
         $this->info('');
     }
 }
開發者ID:ottowayne,項目名稱:laravel-langcheck,代碼行數:54,代碼來源:LangCheckCommand.php

示例11: getList

 public static function getList($dir, $file_types = array('gif' => 'image/gif', 'png' => 'image/png', 'jpg' => 'image/jpeg'))
 {
     $images = array();
     if (is_dir($dir)) {
         foreach (File::files($dir) as $entry) {
             /* return $entry; */
             if (!is_dir($entry)) {
                 if (in_array(mime_content_type($entry), $file_types)) {
                     $images[] = $entry;
                 }
             }
         }
     }
     return $images;
 }
開發者ID:rezadaulay,項目名稱:jq-upload,代碼行數:15,代碼來源:JqUpload.php

示例12: getDelete

 /**
  * Delete image and associated thumbnail
  *
  * @return mixed
  */
 public function getDelete()
 {
     $to_delete = Input::get('items');
     $base = Input::get("base");
     if ($base != "/") {
         if (File::isDirectory(base_path() . "/" . $this->file_location . $base . "/" . $to_delete)) {
             // make sure the directory is empty
             if (sizeof(File::files(base_path() . "/" . $this->file_location . $base . "/" . $to_delete)) == 0) {
                 File::deleteDirectory(base_path() . "/" . $this->file_location . $base . "/" . $to_delete);
                 return "OK";
             } else {
                 return "You cannot delete this folder because it is not empty!";
             }
         } else {
             if (File::exists(base_path() . "/" . $this->file_location . $base . "/" . $to_delete)) {
                 File::delete(base_path() . "/" . $this->file_location . $base . "/" . $to_delete);
                 if (Session::get('lfm_type') == "Images") {
                     File::delete(base_path() . "/" . $this->file_location . $base . "/" . "thumbs/" . $to_delete);
                 }
                 return "OK";
             } else {
                 return base_path() . "/" . $this->file_location . $base . "/" . $to_delete . " not found!";
             }
         }
     } else {
         $file_name = base_path() . "/" . $this->file_location . $to_delete;
         if (File::isDirectory($file_name)) {
             // make sure the directory is empty
             if (sizeof(File::files($file_name)) == 0) {
                 File::deleteDirectory($file_name);
                 return "OK";
             } else {
                 return "You cannot delete this folder because it is not empty!";
             }
         } else {
             if (File::exists($file_name)) {
                 File::delete($file_name);
                 if (Session::get('lfm_type') == "Images") {
                     File::delete(base_path() . "/" . $this->file_location . "thumbs/" . $to_delete);
                 }
                 return "OK";
             } else {
                 return $file_name . " not found!";
             }
         }
     }
 }
開發者ID:Nikita240,項目名稱:laravel-filemanager,代碼行數:52,代碼來源:DeleteController.php

示例13: run

 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     // Reset table
     DB::table('files')->truncate();
     // Delete /public/upload
     FileSystem::deleteDirectory(public_path('upload'));
     // Delete /app/storage/views/*.*
     foreach (FileSystem::files(storage_path() . '/views') as $file) {
         if ($file != '.gitignore') {
             FileSystem::delete($file);
         }
     }
     // Faker data
     $faker = Faker\Factory::create();
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
開發者ID:pongocms,項目名稱:cms,代碼行數:19,代碼來源:FilesTableSeeder.php

示例14: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $this->call(HochschulkompassSeeder::class);
     // call all seeders in "database/seeds/universities"
     foreach (File::files("database/seeds/universities") as $path) {
         $filename = pathinfo($path)["filename"];
         // create and execute seeder
         $seeder = new $filename();
         if ($seeder instanceof UniversitySeeder) {
             $seeder->run();
             // log
             if (isset($this->command)) {
                 $this->command->getOutput()->writeln("<info>Published:</info> " . $filename);
             }
         }
     }
     Model::reguard();
 }
開發者ID:MyGrades,項目名稱:mygrades-server,代碼行數:24,代碼來源:DatabaseSeeder.php

示例15: all

 /**
  * Get all builds.
  *
  * @return array Array of build objects
  */
 public function all()
 {
     $files = File::files($this->directory);
     $builds = array();
     foreach ($files as $file) {
         $json = File::get($file);
         $data = json_decode($json);
         $data->id = basename($file, '.json');
         $data = $this->convertTypeForObjcect($data);
         $builds[] = $data;
     }
     // Sorting by started_at in descending order
     usort($builds, function ($a, $b) {
         if ($a->started_at === $b->started_at) {
             return 0;
         }
         return $a->started_at < $b->started_at ? 1 : -1;
     });
     return $builds;
 }
開發者ID:ngmy,項目名稱:stand-ci,代碼行數:25,代碼來源:FileBuild.php


注:本文中的Illuminate\Support\Facades\File::files方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。