当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::file方法代码示例

本文整理汇总了PHP中Pagekit\Application::file方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::file方法的具体用法?PHP Application::file怎么用?PHP Application::file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pagekit\Application的用法示例。


在下文中一共展示了Application::file方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPath

 /**
  * @param string $path
  * @return string
  */
 protected function getPath($path = '')
 {
     $root = strtr(App::path(), '\\', '/');
     $path = $this->normalizePath($root . '/storage/' . $path);
     if (!is_dir($path)) {
         App::file()->makeDir($path);
     }
     return $path;
 }
开发者ID:stroborobo,项目名称:pagekit-framework,代码行数:13,代码来源:UploadFieldType.php

示例2: getSource

 /**
  * {@inheritdoc}
  */
 public function getSource()
 {
     if (!($path = $this->getPath())) {
         return parent::getSource();
     }
     $path = App::file()->getUrl($path);
     if ($version = $this->getOption('version')) {
         $path .= (false === strpos($path, '?') ? '?' : '&') . 'v=' . $version;
     }
     return $path;
 }
开发者ID:rifal89,项目名称:pagekit,代码行数:14,代码来源:FileLocatorAsset.php

示例3: uninstall

 /**
  * @param  array $uninstall
  * @return bool
  */
 public function uninstall($uninstall)
 {
     foreach ((array) $uninstall as $name) {
         if (!($package = App::package($name))) {
             throw new \RuntimeException(__('Unable to find "%name%".', ['%name%' => $name]));
         }
         $this->disable($package);
         $this->getScripts($package)->uninstall();
         App::config('system')->remove('packages.' . $package->get('module'));
         if ($this->composer->isInstalled($package->getName())) {
             $this->composer->uninstall($package->getName());
         } else {
             if (!($path = $package->get('path'))) {
                 throw new \RuntimeException(__('Package path is missing.'));
             }
             $this->output->writeln(__("Removing package folder."));
             App::file()->delete($path);
             @rmdir(dirname($path));
         }
     }
 }
开发者ID:pagekit,项目名称:pagekit,代码行数:25,代码来源:PackageManager.php

示例4: getCachepath

 /**
  * @return bool|string
  */
 public function getCachepath()
 {
     $folder = App::path() . '/' . App::module('bixie/portfolio')->config('cache_path');
     if (file_exists($folder) && is_writable($folder)) {
         //all fine, quick return
         return $folder;
     }
     //try to create user-folder
     App::file()->makeDir($folder, 0755);
     if (!file_exists($folder)) {
         //create default folder
         $folder = $this->app['path.cache'] . '/portfolio';
         if (!file_exists($folder)) {
             App::file()->makeDir($folder, 0755);
         }
     }
     if (!file_exists($folder) || !is_writable($folder)) {
         //give up
         return false;
     }
     return $folder;
 }
开发者ID:Bixie,项目名称:pagekit-portfolio,代码行数:25,代码来源:PortfolioModule.php

示例5: removeFilesAction

 /**
  * @Request({"names": "array"})
  */
 public function removeFilesAction($names)
 {
     foreach ($names as $name) {
         if (!($path = $this->getPath($name))) {
             return $this->error(__('Invalid path.'));
         }
         if ('w' !== $this->getMode($path)) {
             throw new ForbiddenException(__('Permission denied.'));
         }
         try {
             App::file()->delete($path);
         } catch (\Exception $e) {
             return $this->error(__('Unable to remove.'));
         }
     }
     return $this->success(__('Removed selected.'));
 }
开发者ID:4nxiety,项目名称:pagekit,代码行数:20,代码来源:FinderController.php

示例6: getImageCachepath

 /**
  * @return bool|string
  */
 public function getImageCachepath()
 {
     if ($folder = App::locator()->get(App::module('bixie/framework')->config('image_cache_path')) and is_writable($folder)) {
         //all fine, quick return
         return $folder;
     }
     //try to create user-folder
     App::file()->makeDir($folder, 0755);
     if (!file_exists($folder)) {
         //create default folder
         $folder = $this->app['path.storage'] . '/bixframework';
         if (!file_exists($folder)) {
             App::file()->makeDir($folder, 0755);
         }
     }
     if (!file_exists($folder) || !is_writable($folder)) {
         //give up
         return false;
     }
     return $folder;
 }
开发者ID:Bixie,项目名称:pagekit-framework,代码行数:24,代码来源:FrameworkModule.php

示例7: clearCache

 /**
  * @param array $options
  */
 public static function clearCache($options = [])
 {
     if (@$options['temp'] and $cache_path = App::module('bixie/portfolio')->getCachepath()) {
         App::file()->delete($cache_path);
     }
 }
开发者ID:Bixie,项目名称:pagekit-portfolio,代码行数:9,代码来源:PortfolioImageHelper.php

示例8: clearCache

 /**
  * @param array $options
  */
 public static function clearCache($options = [])
 {
     if (@$options['temp'] and $cache_path = App::module('bixie/framework')->getImageCachepath()) {
         App::file()->delete($cache_path);
     }
 }
开发者ID:Bixie,项目名称:pagekit-framework,代码行数:9,代码来源:ImageHelper.php

示例9: clearCache

 /**
  * @param array $options
  */
 public static function clearCache($options = [])
 {
     if (@$options['temp']) {
         App::file()->delete(App::get('path.cache') . '/portfolio');
     }
 }
开发者ID:4nxiety,项目名称:pagekit-portfolio,代码行数:9,代码来源:PortfolioImageHelper.php

示例10: doClearCache

 /**
  * TODO: clear opcache
  */
 public function doClearCache(array $options = [])
 {
     // clear cache
     if (empty($options) || @$options['cache']) {
         App::cache()->flushAll();
         foreach (glob(App::get('path.cache') . '/*.cache') as $file) {
             @unlink($file);
         }
     }
     // clear temp folder
     if (@$options['temp']) {
         foreach (App::finder()->in(App::get('path.temp'))->depth(0)->ignoreDotFiles(true) as $file) {
             App::file()->delete($file->getPathname());
         }
     }
 }
开发者ID:apogeecreative,项目名称:pagekit,代码行数:19,代码来源:CacheModule.php

示例11: getSource

 /**
  * {@inheritdoc}
  */
 public function getSource()
 {
     return ($path = $this->getPath()) ? App::file()->getUrl($path) : parent::getSource();
 }
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:7,代码来源:FileLocatorAsset.php


注:本文中的Pagekit\Application::file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。