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


PHP File::isDirectory方法代碼示例

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


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

示例1: getRename

 /**
  * @return string
  */
 public function getRename()
 {
     $old_name = Input::get('file');
     $new_name = Input::get('new_name');
     $file_path = parent::getPath('directory');
     $thumb_path = parent::getPath('thumb');
     $old_file = $file_path . $old_name;
     if (!File::isDirectory($old_file)) {
         $extension = File::extension($old_file);
         $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension;
     }
     $new_file = $file_path . $new_name;
     if (File::exists($new_file)) {
         return Lang::get('laravel-filemanager::lfm.error-rename');
     }
     if (File::isDirectory($old_file)) {
         File::move($old_file, $new_file);
         return 'OK';
     }
     File::move($old_file, $new_file);
     if ('Images' === $this->file_type) {
         File::move($thumb_path . $old_name, $thumb_path . $new_name);
     }
     return 'OK';
 }
開發者ID:jayked,項目名稱:laravel-filemanager,代碼行數:28,代碼來源:RenameController.php

示例2: getRename

 /**
  * @return string
  */
 public function getRename()
 {
     $old_name = Input::get('file');
     $new_name = trim(Input::get('new_name'));
     $file_path = parent::getPath('directory');
     $thumb_path = parent::getPath('thumb');
     $old_file = $file_path . $old_name;
     if (!File::isDirectory($old_file)) {
         $extension = File::extension($old_file);
         $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension;
     }
     $new_file = $file_path . $new_name;
     if (Config::get('lfm.alphanumeric_directory') && preg_match('/[^\\w-]/i', $new_name)) {
         return Lang::get('laravel-filemanager::lfm.error-folder-alnum');
     } elseif (File::exists($new_file)) {
         return Lang::get('laravel-filemanager::lfm.error-rename');
     }
     if (File::isDirectory($old_file)) {
         File::move($old_file, $new_file);
         Event::fire(new FolderWasRenamed($old_file, $new_file));
         return 'OK';
     }
     File::move($old_file, $new_file);
     if ('Images' === $this->file_type) {
         File::move($thumb_path . $old_name, $thumb_path . $new_name);
     }
     Event::fire(new ImageWasRenamed($old_file, $new_file));
     return 'OK';
 }
開發者ID:unisharp,項目名稱:laravel-filemanager,代碼行數:32,代碼來源:RenameController.php

示例3: checkDirectory

 protected function checkDirectory($namespace, $routePath)
 {
     $rootPath = config('routie.path');
     $routePath = isset($namespace) ? $rootPath . '/' . $routePath : $rootPath;
     if (!File::isDirectory($routePath)) {
         File::makeDirectory($routePath, 0775, true);
     }
     return $routePath;
 }
開發者ID:draperstudio,項目名稱:laravel-routie,代碼行數:9,代碼來源:GenerateRouTie.php

示例4: registerNamespaces

 private function registerNamespaces()
 {
     if (File::isDirectory(app_path() . '/config/packages/andywer/js-localization')) {
         Config::addNamespace('js-localization', app_path() . '/config/packages/andywer/js-localization');
     } else {
         Config::addNamespace('js-localization', __DIR__ . '/../config');
     }
     View::addNamespace('js-localization', __DIR__ . '/../views');
 }
開發者ID:natharduini,項目名稱:laravel-js-localization,代碼行數:9,代碼來源:JsLocalizationServiceProvider.php

示例5: 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

示例6: getCachePathOf

 /**
  * Get the path where an image will be cached
  *
  * @param Image $image
  *
  * @return string
  */
 public function getCachePathOf(Image $image)
 {
     $hash = $this->getHashOf($image);
     $cacheFolder = $this->illuminage->getCacheFolder();
     $hashedFolder = $cacheFolder . $this->getHashedPath($hash);
     if ($hashedFolder and !File::isDirectory($hashedFolder)) {
         @File::makeDirectory($hashedFolder, 511, true);
     }
     return $hashedFolder . $hash;
 }
開發者ID:Daegon,項目名稱:illuminage,代碼行數:17,代碼來源:Cache.php

示例7: createSizeFolder

 /**
  * Хэмжээтэй хавтаснуудыг үүсээгүй байвал үүсгэнэ.
  * 
  * @return void
  */
 private function createSizeFolder($size_name)
 {
     $p = $this->basePath . $size_name;
     if (!File::isDirectory($p)) {
         mkdir($p);
     }
     $p .= "/" . $this->folder;
     if (!File::isDirectory($p)) {
         mkdir($p);
     }
 }
開發者ID:selmonal,項目名稱:imagemanager,代碼行數:16,代碼來源:ImageManipulator.php

示例8: findFiles

 /**
  * @param $path
  * @param $fileName
  * @return array
  */
 public function findFiles($path, $fileName)
 {
     if ($path == '') {
         $path = base_path();
     }
     if (File::isDirectory($path)) {
         $path = str_finish($path, '/');
     }
     $path .= $fileName;
     return File::glob($path);
 }
開發者ID:b2msrl,項目名稱:laravel-composer-security,代碼行數:16,代碼來源:FileHelper.php

示例9: __construct

 /**
  * @param ImageUploader $uploader
  */
 public function __construct(ImageUploader $uploader)
 {
     $this->uploader = $uploader;
     $this->uploadDirectory = public_path() . '/' . config('html_template_curator.upload_directory_name') . '/';
     // Check if uploads folder exists and create if not
     if (!File::isDirectory($this->uploadDirectory)) {
         File::makeDirectory($this->uploadDirectory, 0755, true, true);
     }
     // Check if folder for storing images and temp dir exists and create if not
     if (!File::isDirectory($this->uploadDirectory . 'images/temp/')) {
         File::makeDirectory($this->uploadDirectory . 'images/temp/', 0755, true, true);
     }
 }
開發者ID:despark,項目名稱:html-template-curator,代碼行數:16,代碼來源:UploadController.php

示例10: updateSpartan

 public function updateSpartan($account, $size = 512)
 {
     $spartan = $this->_getSpartanImage($account, $size);
     if ($spartan == null) {
         return;
     }
     $base = 'uploads/h5/';
     // Create directory
     if (!File::isDirectory(public_path($base . $account->seo))) {
         File::makeDirectory(public_path($base . $account->seo), 0755, true);
     }
     $spartan->save(public_path($base . $account->seo . "/" . 'spartan.png'));
 }
開發者ID:GMSteuart,項目名稱:PandaLove,代碼行數:13,代碼來源:Client.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CoursesRequest $request)
 {
     $course = Course::create($request->all());
     $pathToCourse = storage_path() . '/courses/';
     echo $pathToCourse;
     if (!File::isDirectory($pathToCourse)) {
         File::makeDirectory($pathToCourse);
     }
     File::makeDirectory($pathToCourse . $course->slug);
     $course->path_to_material = $pathToCourse . $course->slug;
     $course->save();
     return redirect('courses');
 }
開發者ID:starkbaum,項目名稱:sucon,代碼行數:19,代碼來源:CoursesController.php

示例12: uploadToLocal

 private static function uploadToLocal($fileName, $file, $imagesdir)
 {
     $inputDir = Config::get('astroanu.imagecache.paths.input');
     if (!File::isDirectory($inputDir)) {
         File::makeDirectory($inputDir);
     }
     $destDir = $inputDir . '/' . $imagesdir;
     if (!File::isDirectory($destDir)) {
         File::makeDirectory($destDir);
     }
     $image = $file->move($destDir, $fileName);
     return $fileName;
 }
開發者ID:astroanu,項目名稱:laravel-image-cache,代碼行數:13,代碼來源:Uploader.php

示例13: resize

 public function resize($width, $height)
 {
     $useStorage = Config::get('astroanu.imagecache.usestorage');
     if ($useStorage) {
         $inputDisk = Storage::disk(Config::get('astroanu.imagecache.paths.input'));
         $outputDisk = Storage::disk(Config::get('astroanu.imagecache.paths.output'));
         if (!$inputDisk->exists($this->folder . '/' . $this->filename)) {
             return false;
         }
         if (is_null($width) || is_null($height)) {
             return $this->imagine->load($inputDisk->get($this->folder . '/' . $this->filename))->show('jpg');
         }
         if ($outputDisk->exists($this->folder . '/' . $this->filename)) {
             return $this->imagine->load($outputDisk->get($this->folder . '/' . $this->filename))->show('jpg');
         }
         $size = new \Imagine\Image\Box($width, $height);
         $mode = \Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND;
         if (!$outputDisk->exists($this->folder)) {
             $outputDisk->makeDirectory($this->folder);
         }
         $tmp = storage_path() . '\\tmp_' . $this->filename;
         $this->outputFile = $this->folder . '/' . $width . '-' . $height . '_' . $this->filename;
         $tmpImage = $this->imagine->load($inputDisk->get($this->folder . '/' . $this->filename))->thumbnail($size, $mode)->save($tmp, array('quality' => Config::get('astroanu.imagecache.defaults.jpgquality')));
         $outputDisk->put($this->outputFile, File::get($tmp));
         unlink($tmp);
         return $this->imagine->load($outputDisk->get($this->outputFile))->show('jpg');
     } else {
         // to be removed
         $outputDir = Config::get('astroanu.imagecache.paths.output') . '/' . $this->folder;
         $inputDir = Config::get('astroanu.imagecache.paths.input') . '/' . $this->folder;
         $inputFile = $inputDir . '/' . $this->filename;
         if (!file_exists($inputFile)) {
             return false;
         }
         if (is_null($width) || is_null($height)) {
             return $this->imagine->open($inputFile)->show('jpg');
         }
         $this->outputFile = $outputDir . '/' . $width . '-' . $height . '_' . $this->filename;
         if (File::isFile($this->outputFile)) {
             return $this->imagine->open($this->outputFile)->show('jpg');
         }
         $size = new \Imagine\Image\Box($width, $height);
         $mode = \Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND;
         if (!File::isDirectory($outputDir)) {
             File::makeDirectory($outputDir);
         }
         return $this->imagine->open($inputFile)->thumbnail($size, $mode)->save($this->outputFile, array('quality' => Config::get('astroanu.imagecache.defaults.jpgquality')))->show('jpg');
     }
 }
開發者ID:astroanu,項目名稱:laravel-image-cache,代碼行數:49,代碼來源:Image.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     $response = $next($request);
     // HTML cache
     if (!$response->isRedirection() && $request->isMethod('get') && !Auth::check() && !config('app.debug') && config('typicms.html_cache')) {
         if ($this->hasPageThatShouldNotBeCached($response)) {
             return $response;
         }
         $directory = public_path() . '/html' . $request->getPathInfo();
         if (!File::isDirectory($directory)) {
             File::makeDirectory($directory, 0777, true);
         }
         File::put($directory . '/index' . ($request->getQueryString() ? md5($request->getQueryString()) : '') . '.html', $response->content());
     }
     return $response;
 }
開發者ID:webfactorybulgaria,項目名稱:Core,代碼行數:24,代碼來源:PublicCache.php

示例15: checkPathIsOk

 private function checkPathIsOk($path, $dir = null)
 {
     $path = rtrim($path, '/') . ($dir ? '/' . trim($dir, '/') : '');
     if (File::isDirectory($path) && File::isWritable($path)) {
         return true;
     } else {
         try {
             @File::makeDirectory($path, 0777, true);
             return true;
         } catch (\Exception $e) {
             Log::error('Uploader: ' . $e->getMessage());
             $this->results['error'] = $e->getMessage();
             return false;
         }
     }
 }
開發者ID:awatbayazidi,項目名稱:foundation,代碼行數:16,代碼來源:Uploader.php


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