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


PHP Folder::create方法代码示例

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


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

示例1: __construct

 /**
  * Initialisation du cache
  */
 function __construct()
 {
     $this->folder = AdminServConfig::$PATH_RESOURCES . 'cache/';
     if (!file_exists($this->folder)) {
         Folder::create($this->folder);
     }
 }
开发者ID:keverage,项目名称:adminserv,代码行数:10,代码来源:cache.php

示例2: newFile

 public function newFile($name, $contents)
 {
     $file = new File($this->t, $name);
     $path = new Folder($file->getPath());
     $path->exists() || $path->create();
     $file->out()->write($contents);
 }
开发者ID:xp-framework,项目名称:core,代码行数:7,代码来源:ClassFromFileSystemTest.class.php

示例3: addShopToFolder

 /**
  * add shop to folder
  * 
  */
 function addShopToFolder()
 {
     $name = @$this->request->data['name'];
     $shop_id = @$this->request->data['shop_id'];
     if (!$shop_id || !$name) {
         return $this->responseng('faild to add shop.');
     }
     $dataFolder = array("user_id" => $this->user_id, "name" => $name, "type_folder" => intval(@$this->request->data['type_folder']));
     $ret = $this->FolderUser->save($dataFolder);
     $folder_id_old = @$this->request->data["older_folder_id"];
     $datashopFolder = array("folder_id" => $ret["FolderUser"]["id"], "shop_id" => $shop_id, "rank" => 1, "status" => NO_MY_FOLDER);
     $result = $this->FolderShop->save($datashopFolder);
     App::uses('Folder', 'Utility');
     $folder = new Folder();
     if (!empty($folder_id_old)) {
         $oldFolder = $this->FolderUser->findById($folder_id_old);
         $newFolder = $ret;
         $path = WWW_ROOT . 'shops' . DS . $oldFolder["FolderUser"]["user_id"] . DS . $oldFolder["FolderUser"]["id"] . DS . $shop_id;
         $newPath = WWW_ROOT . 'shops' . DS . $newFolder["FolderUser"]["user_id"] . DS . $newFolder["FolderUser"]["id"] . DS . $result["FolderShop"]["shop_id"];
         if (is_dir($path)) {
             if (!is_dir($newPath)) {
                 $folder->create($newPath);
             }
             $folder->copy(array('to' => $newPath, 'from' => $path, 'mode' => 0777));
         }
     }
     if ($result) {
         return $this->responseOk();
     }
     return $this->responseng('can not save data');
 }
开发者ID:Quang2727,项目名称:Kaopass,代码行数:35,代码来源:ShopsController.php

示例4: upload

 public function upload(Model $Model, $arquivo = array(), $altura = 800, $largura = 600, $pasta = null, $nome_arquivo)
 {
     // App::uses('Vendor', 'wideimage');
     App::import('Vendor', 'WideImage', array('file' => 'WideImage' . DS . 'WideImage.php'));
     App::uses('Folder', 'Utility');
     $ext = array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/x-jps', 'image/png', 'image/gif');
     if ($arquivo['error'] != 0 || $arquivo['size'] == 0) {
         return false;
     }
     $img = WideImage::load($arquivo['tmp_name']);
     $folder = new Folder();
     $pathinfo = pathinfo($arquivo['name']);
     if ($folder->create(WWW_ROOT . 'img' . DS . $pasta . DS)) {
         //se conseguiu criar o diretório eu dou permissão
         $folder->chmod(WWW_ROOT . 'img' . DS . $pasta . DS, 0755, true);
     } else {
         return false;
     }
     $pathinfo['filename'] = strtolower(Inflector::slug($pathinfo['filename'], '-'));
     $arquivo['name'] = $nome_arquivo . '.' . $pathinfo['extension'];
     $img->saveToFile(WWW_ROOT . 'img' . DS . $pasta . DS . 'original_' . $arquivo['name']);
     $img = $img->resize($largura, $altura, 'fill');
     $img->saveToFile(WWW_ROOT . 'img' . DS . $pasta . DS . $arquivo['name']);
     // debug(WWW_ROOT.'img'.DS.$pasta.DS.$arquivo['name']); die;
     return $arquivo['name'];
 }
开发者ID:vitorrampazzo,项目名称:cms,代码行数:26,代码来源:UploadBehavior.php

示例5: find

 function find($conditions = null, $fields = array(), $order = null, $recursive = null)
 {
     if ($conditions != 'range') {
         return parent::find($conditions, $fields, $order, $recursive);
     }
     $file = Set::extract($fields, 'file');
     if (empty($file)) {
         $file = ROOT . DS . APP_DIR . DS . 'plugins/mobileip/config/mobile_ips.yml';
     }
     if (!file_exists($file)) {
         return false;
     }
     $cacheDir = $this->getCacheDir();
     $folder = new Folder($cacheDir);
     $folder->create($cacheDir, 0777);
     $cacheFile = $this->getCacheFile();
     if (file_exists($cacheFile) && $this->_getLastModified($file) <= filemtime($cacheFile)) {
         return include $cacheFile;
     }
     $mobile_ips =& Spyc::YAMLLoad($file);
     if (!is_array($mobile_ips)) {
         return false;
     }
     $data = $this->_get_ranges($mobile_ips);
     $file = new File($cacheFile, true);
     $file->write($data);
     $file->close();
     return include $cacheFile;
 }
开发者ID:kaz29,项目名称:mobileip,代码行数:29,代码来源:mobile_ip.php

示例6: Folder

 function save_asset($file)
 {
     $result['status'] = false;
     $this->log('file info: ', 7);
     $this->log($file, 7);
     $info = $this->fileinfo($file);
     if (empty($info['content_type']) || !in_array($info['content_type'], $this->options['valid_types'])) {
         $this->log('not saving, invalid filetype...', 7);
         $result['message'] = 'Invalid filetype';
         return $result;
     }
     if ($this->save($info)) {
         $this->log('saved on line 52', 7);
         $folder = new Folder();
         if ($folder->create($this->path() . $this->id . DS . 'original')) {
             move_uploaded_file($file['tmp_name'], $this->path() . $this->id . DS . 'original' . DS . $info['filename']);
             if (in_array($info['content_type'], $this->options['image_types'])) {
                 if ($this->create_folders($this->id) && $this->process_styles($this->id, $info)) {
                     $result['message'] = 'files resized and saved';
                     $result['status'] = true;
                 }
             }
         } else {
             $result['message'] = "There was a problem creating a folder, check your permissions";
             return $result;
         }
     }
     return $result;
 }
开发者ID:Emerson,项目名称:PaperclipPHP,代码行数:29,代码来源:asset.php

示例7: __construct

 public function __construct()
 {
     $this->path = STORAGE_DIR . 'Cache/';
     if (!is_dir($this->path)) {
         \Folder::create($this->path, 0755);
     }
     \Support::writable($this->path);
 }
开发者ID:znframework,项目名称:znframework,代码行数:8,代码来源:File.php

示例8: admin_export

 public function admin_export($id = null)
 {
     if (!$id) {
         $this->notice('invalid');
     }
     $this->Template->recursive = -1;
     $template = $this->Template->read(array('name', 'description', 'author', 'header', 'footer'), $id);
     if (empty($template)) {
         $this->notice('invalid');
     }
     $pattern = "/src=[\\\"']?([^\\\"']?.*(png|jpg|gif|jpeg))[\\\"']?/i";
     preg_match_all($pattern, $template['Template']['header'], $images);
     $path = TMP . 'cache' . DS . 'newsletter' . DS . 'template' . DS . $template['Template']['name'];
     $Folder = new Folder($path, 0777);
     $slash = $Folder->correctSlashFor($path);
     App::import('File');
     App::import('Folder');
     $File = new File($path . DS . 'template.xml', true, 0777);
     $imageFiles = array();
     if (!empty($images[1])) {
         foreach ($images[1] as $img) {
             $img = str_replace('/', $slash, $img);
             $img = str_replace('\\', $slash . $slash, $img);
             $imageFiles[] = $img;
             if (is_file(APP . 'webroot' . $img)) {
                 $Folder->create(dirname($path . $img), 0777);
                 $File->path = APP . 'webroot' . $img;
                 $File->copy(dirname($path . $img) . DS . basename($img));
             }
         }
     }
     $xml['template']['name'] = 'Infinitas Newsletter Template';
     $xml['template']['generator'] = 'Infinitas Template Generator';
     $xml['template']['version'] = $this->version;
     $xml['template']['template'] = $template['Template']['name'];
     $xml['template']['description'] = $template['Template']['description'];
     $xml['template']['author'] = $template['Template']['author'];
     $xml['data']['header'] = $template['Template']['header'];
     $xml['data']['footer'] = $template['Template']['footer'];
     $xml['files']['images'] = $imageFiles;
     App::Import('Helper', 'Xml');
     $Xml = new XmlHelper();
     $File->path = $path . DS . 'template.xml';
     $File->write($Xml->serialize($xml));
     App::import('Vendor', 'Zip', array('file' => 'zip.php'));
     $Zip = new CreateZipFile();
     $Zip->zipDirectory($path, null);
     $File = new File($path . DS . 'template.zip', true, 0777);
     $File->write($Zip->getZippedfile());
     $this->view = 'Media';
     $params = array('id' => 'template.zip', 'name' => $template['Template']['name'], 'download' => true, 'extension' => 'zip', 'path' => $path . DS);
     $this->set($params);
     $Folder = new Folder($path);
     $Folder->read();
     $Folder->delete($path);
 }
开发者ID:nani8124,项目名称:infinitas,代码行数:56,代码来源:TemplatesController.php

示例9: extract

 /**
  * Extract an archive file to a directory.
  *
  * @param   string  $archivename  The name of the archive file
  * @param   string  $extractdir   Directory to unpack into
  *
  * @return  boolean  True for success
  *
  * @since   1.0
  * @throws  \InvalidArgumentException
  */
 public function extract($archivename, $extractdir)
 {
     $ext = pathinfo($archivename, PATHINFO_EXTENSION);
     $path = pathinfo($archivename, PATHINFO_DIRNAME);
     $filename = pathinfo($archivename, PATHINFO_FILENAME);
     switch ($ext) {
         case 'zip':
             $result = $this->getAdapter('zip')->extract($archivename, $extractdir);
             break;
         case 'tar':
             $result = $this->getAdapter('tar')->extract($archivename, $extractdir);
             break;
         case 'tgz':
         case 'gz':
         case 'gzip':
             // This may just be an individual file (e.g. sql script)
             $tmpfname = $this->options['tmp_path'] . '/' . uniqid('gzip');
             $gzresult = $this->getAdapter('gzip')->extract($archivename, $tmpfname);
             if ($gzresult instanceof \Exception) {
                 @unlink($tmpfname);
                 return false;
             }
             if ($ext === 'tgz' || stripos($filename, '.tar') !== false) {
                 $result = $this->getAdapter('tar')->extract($tmpfname, $extractdir);
             } else {
                 Folder::create($path);
                 $result = File::copy($tmpfname, $extractdir, null, 0);
             }
             @unlink($tmpfname);
             break;
         case 'tbz2':
         case 'bz2':
         case 'bzip2':
             // This may just be an individual file (e.g. sql script)
             $tmpfname = $this->options['tmp_path'] . '/' . uniqid('bzip2');
             $bzresult = $this->getAdapter('bzip2')->extract($archivename, $tmpfname);
             if ($bzresult instanceof \Exception) {
                 @unlink($tmpfname);
                 return false;
             }
             if ($ext === 'tbz2' || stripos($filename, '.tar') !== false) {
                 $result = $this->getAdapter('tar')->extract($tmpfname, $extractdir);
             } else {
                 Folder::create($path);
                 $result = File::copy($tmpfname, $extractdir, null, 0);
             }
             @unlink($tmpfname);
             break;
         default:
             throw new Exception(sprintf('Unknown archive type: %s', $ext));
     }
     if (!$result || $result instanceof Exception) {
         return false;
     }
     return true;
 }
开发者ID:xamiro-dev,项目名称:xamiro,代码行数:67,代码来源:Archive.php

示例10: createTmpFile

 /**
  * Create temporary file for upload test.
  *
  * @param string $fileName Temporary file name
  * @return void
  */
 public function createTmpFile($fileName)
 {
     //アップロードテストのためのテンポラリファイル生成
     $folder = new Folder();
     $folder->create(TMP . 'tests' . DS . 'files' . DS . 'tmp');
     $file = new File(APP . 'Plugin' . DS . 'Files' . DS . 'Test' . DS . 'Fixture' . DS . $fileName);
     $file->copy(TMP . 'tests' . DS . 'files' . DS . 'tmp' . DS . $fileName);
     $file->close();
     unset($folder, $file);
 }
开发者ID:Onasusweb,项目名称:Files,代码行数:16,代码来源:FilesModelTestBase.php

示例11: makeDir

 function makeDir($dir)
 {
     if (!is_dir($dir)) {
         $parent_perms = $this->getPerms(dirname($dir));
         $f = new Folder();
         if ($f->create($dir, octdec($parent_perms))) {
             return true;
         } else {
             if ($parent_perms == '0755') {
                 if ($f->chmod($dir, 0777) && $f->create($dir)) {
                     return true;
                 }
             }
         }
         return false;
     } else {
         return true;
     }
 }
开发者ID:pkdevbox,项目名称:app.director,代码行数:19,代码来源:FileComponent.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     $this->console = new ConsoleOutput();
     $this->temp_dir = sys_get_temp_dir() . '/FilesystemDatasourceWorkdir/';
     $folder = new Folder();
     $folder->create($this->temp_dir);
     $this->console->write('<info>Using temporary dir: "' . $this->temp_dir . '"</info>');
     $config = array('baseDir' => $this->temp_dir);
     $this->datasource = new FilesystemSource($config);
 }
开发者ID:stefanheinen,项目名称:cake-filesystem-datasource,代码行数:11,代码来源:FilesystemSourceTest.php

示例13: __construct

 public function __construct()
 {
     // Dil doyalarının yer alacağı dizinin belirtiliyor.
     $this->appdir = STORAGE_DIR . 'MultiLanguage/';
     // Eğer dizin mevcut değilse oluşturulması sağlanıyor.
     if (!is_dir($this->appdir)) {
         Folder::create($this->appdir, 0777);
     }
     // Aktif dil dosyasının yolu belirtiliyor.
     $this->lang = $this->appdir . getLang() . $this->extension;
 }
开发者ID:bytemtek,项目名称:znframework,代码行数:11,代码来源:ML.php

示例14: __construct

 /**
  * Apply the cache settings.
  *
  * @param array $config
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     if (Cache::config('feeds') === false) {
         $cachePath = CACHE . 'feeds' . DS;
         if (!file_exists($cachePath)) {
             $folder = new Folder();
             $folder->create($cachePath, 0777);
         }
         Cache::config('feeds', array('engine' => 'File', 'serialize' => true, 'prefix' => 'feed_', 'path' => $cachePath, 'duration' => '+1 day'));
     }
 }
开发者ID:asciipup,项目名称:asciipup.github.io,代码行数:17,代码来源:FeedSource.php

示例15: __construct

 public function __construct( $request = NULL, $response = NULL ) {
     Configure::load('report_manager.bootstrap');        
     $reportPath = Configure::read('ReportManager.reportPath');
     if ( !isset($reportPath) )
         $reportPath = 'tmp'.DS.'reports'.DS;
     $this->path = $reportPath;
     if(!is_dir(APP.$this->path)) {
         $folder = new Folder();
         $folder->create(APP.$this->path);
     }
     parent::__construct($request,$response);
 }    
开发者ID:sherix88,项目名称:sigedu,代码行数:12,代码来源:ReportsController.php


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