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


PHP Folder::pwd方法代码示例

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


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

示例1: main

 /**
  * The main method: where things happen
  * 
  * @access public
  */
 function main()
 {
     if (isset($this->params['quiet'])) {
         $this->quiet = true;
     }
     $tmp = new Folder(TMP);
     $folders = reset($tmp->read());
     // read only directories (array[0])
     foreach ($folders as $folder) {
         $tmp->cd(TMP);
         $tmp->cd($folder);
         $files = end($tmp->read());
         // read only files (array[1])
         if (in_array('last_interaction', $files)) {
             $file_interaction = (int) file_get_contents($tmp->pwd() . DS . 'last_interaction');
             // as each piece is 1Mb, this will give the user the chance of uploading at 13,7 kbps (1,7 kb/s)
             if (time() - $file_interaction > 600) {
                 $this->out("Removing {$folder}");
                 foreach ($files as $file) {
                     unlink($tmp->pwd() . DS . $file);
                 }
                 $tmp->delete();
             }
         }
     }
 }
开发者ID:rcaravita,项目名称:jodeljodel,代码行数:31,代码来源:upload_gc.php

示例2: testTestSetup

 /**
  * Check if all dummy files exist
  */
 public function testTestSetup()
 {
     // check dummy files
     foreach (array($this->upload1, $this->upload2, $this->uploadNoExt, $this->uploadImage) as $upload) {
         $this->assertTrue(file_exists($upload['tmp_name']));
     }
     // check upload dir
     $this->assertEqual($this->UploadFolder->pwd(), MEDIA_TESTAPP_UPLOADDIR);
 }
开发者ID:fm-labs,项目名称:cakephp-media,代码行数:12,代码来源:MediaUploaderTest.php

示例3: buildCss

 public function buildCss()
 {
     App::import('Vendor', 'AssetMinify.JSMinPlus');
     // Ouverture des fichiers de config
     $dir = new Folder(Configure::read('App.www_root') . 'css' . DS . 'minified');
     if ($dir->path !== null) {
         foreach ($dir->find('config_.*.ini') as $file) {
             preg_match('`^config_(.*)\\.ini$`', $file, $grep);
             $file = new File($dir->pwd() . DS . $file);
             $ini = parse_ini_file($file->path, true);
             $fileFull = new File($dir->path . DS . 'full_' . $grep[1] . '.css', true, 0644);
             $fileGz = new File($dir->path . DS . 'gz_' . $grep[1] . '.css', true, 0644);
             $contentFull = '';
             foreach ($ini as $data) {
                 // On a pas de version minifié
                 if (!($fileMin = $dir->find('file_' . md5($data['url'] . $data['md5']) . '.css'))) {
                     $fileMin = new File($dir->path . DS . 'file_' . md5($data['url'] . $data['md5']) . '.css', true, 0644);
                     $this->out("Compression de " . $data['file'] . ' ... ', 0);
                     $fileMin->write(MinifyUtils::compressCss(MinifyUtils::cssAbsoluteUrl($data['url'], file_get_contents($data['file']))));
                     $this->out('OK');
                 } else {
                     $fileMin = new File($dir->path . DS . 'file_' . md5($data['url'] . $data['md5']) . '.css');
                 }
                 $contentFull .= $fileMin->read() . PHP_EOL;
             }
             // version full
             $fileFull->write($contentFull);
             $fileFull->close();
             // compression
             $fileGz->write(gzencode($contentFull, 6));
         }
     }
 }
开发者ID:Erwane,项目名称:cakephp-AssetMinify,代码行数:33,代码来源:AssetMinifyShell.php

示例4: upload

 function upload()
 {
     $directory = $this->getNextParam(null, 'path');
     $container = $this->getNextParam(null, 'container');
     if (empty($directory) || empty($container)) {
         $this->errorAndExit('Directory and Container required');
     }
     $Folder = new Folder($directory);
     if ($this->params['recursive']) {
         $files = $Folder->findRecursive();
     } else {
         $single_files = $Folder->find();
         $files = array();
         foreach ($single_files as $file) {
             $files[] = $Folder->pwd() . DS . $file;
         }
     }
     $this->ProgressBar->start(count($files));
     foreach ($files as $file) {
         CloudFiles::upload($file, $container);
         $this->ProgressBar->next();
     }
     $this->out();
     $this->out("Finished.");
 }
开发者ID:rnavarro,项目名称:CakePHP-CloudFiles-Plugin,代码行数:25,代码来源:CloudFilesShell.php

示例5: Folder

 function __cleanUp()
 {
     $Cleanup = new Folder(TMP . 'tests/git');
     if ($Cleanup->pwd() == TMP . 'tests/git') {
         $Cleanup->delete();
     }
 }
开发者ID:Theaxiom,项目名称:chaw-source,代码行数:7,代码来源:post_receive.test.php

示例6: pwd

 /**
  * Returns the full path of the File.
  *
  * @return string Full path to file
  * @access public
  */
 function pwd()
 {
     if (is_null($this->path)) {
         $this->path = $this->Folder->slashTerm($this->Folder->pwd()) . $this->name;
     }
     return $this->path;
 }
开发者ID:codegooglecom,项目名称:ypanel,代码行数:13,代码来源:file.php

示例7: pwd

 /**
  * Returns the full path of the file.
  *
  * @return string Full path to the file
  * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::pwd
  */
 public function pwd()
 {
     if ($this->path === null) {
         $this->path = $this->Folder->slashTerm($this->Folder->pwd()) . $this->name;
     }
     return $this->path;
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:13,代码来源:File.php

示例8: admin_reset

 public function admin_reset($user_id)
 {
     if ($this->Auth->user('role') > 1) {
         $dir = new Folder('../webroot/img/avatars/');
         if ($dir->path != null) {
             // On supprime le fichier
             $files = $dir->find($user_id . '.jpg');
             foreach ($files as $file) {
                 $file = new File($dir->pwd() . DS . $file);
                 $file->delete();
                 $file->close();
             }
             // On sauvegarde
             $user = $this->User->find('first', ['conditions' => ['User.id' => $user_id]]);
             $username = $user['User']['username'];
             $avatar = 'http://cravatar.eu/helmavatar/' . $username;
             $this->User->id = $user_id;
             $this->User->saveField('avatar', $avatar);
             // Redirection
             $this->Session->setFlash('L\'avatar de ' . $username . ' a été réinitialisé', 'toastr_success');
             return $this->redirect(['controller' => 'users', 'action' => 'edit', $user_id]);
         }
     } else {
         throw new NotFoundException();
     }
 }
开发者ID:Mortex68,项目名称:ExtazCMS,代码行数:26,代码来源:AvatarsController.php

示例9: view

 public function view($id = null)
 {
     $this->layout = 'index';
     $this->Anotacion->id = $id;
     $user = $this->User->findByUsername('transparenciapasiva');
     if (!$this->Anotacion->exists() || $this->Anotacion->field('user_id') != $user['User']['id']) {
         $this->Session->setFlash('<h2 class="alert alert-error">La Anotacion no Existe</h2>', 'default', array(), 'buscar');
         $this->redirect(array('controller' => 'home', 'action' => 'index/tab:3'));
     }
     $this->set('anotacion', $this->Anotacion->read(null, $id));
     $folder_anot = new Folder(WWW_ROOT . 'files' . DS . 'Anotaciones' . DS . 'anot_' . $this->Anotacion->id);
     $files_url = array();
     foreach ($folder_anot->find('.*') as $file) {
         $files_url[] = basename($folder_anot->pwd()) . DS . $file;
     }
     $this->set('files', $files_url);
     ////////////////////////////////////////////////////////////////////
     $folder_anot = new Folder(WWW_ROOT . 'files' . DS . 'Anotaciones' . DS . 'anot_' . $this->Anotacion->id . DS . 'Respuestas');
     $files_url = array();
     $dir = $folder_anot->read(true, false, true);
     foreach ($dir[0] as $key => $value) {
         $folder = new Folder($value);
         foreach ($folder->find('.*') as $file) {
             $files_url[basename($folder->pwd())][] = $file;
         }
     }
     $this->set('files_res', $files_url);
 }
开发者ID:penalolen,项目名称:Oirs-Digital,代码行数:28,代码来源:TransparenciaPasivasController.php

示例10: end

 function end()
 {
     parent::end();
     $Cleanup = new Folder(TMP . 'tests/svn');
     if ($Cleanup->pwd() == TMP . 'tests/svn') {
         $Cleanup->delete();
     }
 }
开发者ID:Theaxiom,项目名称:chaw-source,代码行数:8,代码来源:svn.test.php

示例11: uploadConsultDocument

 function uploadConsultDocument($data)
 {
     $folderPath = WWW_ROOT . $this->consult_document_path . DS . $data['consult_id'];
     $consultantFolder = new Folder($folderPath, true, 0755);
     $extension = substr($data['name'], -3);
     $fileName = uniqid() . '.' . $extension;
     if (is_null($consultantFolder->pwd())) {
         if (!$this->createFolder($folderPath)) {
             throw new Exception(self::CREATE_FILE_ERROR);
         }
     }
     if (move_uploaded_file($data['tmp_name'], $consultantFolder->pwd() . DS . $fileName)) {
         return $consultantFolder->pwd() . DS . $fileName;
     } else {
         throw new Exception(self::CREATE_FILE_ERROR);
     }
 }
开发者ID:thedrumz,项目名称:music,代码行数:17,代码来源:FileUploaderComponent.php

示例12: endTest

 function endTest()
 {
     $Cleanup = new Folder(TMP . 'tests/git');
     if ($Cleanup->pwd() == TMP . 'tests/git') {
         $Cleanup->delete();
     }
     unset($this->Source);
 }
开发者ID:Theaxiom,项目名称:chaw-source,代码行数:8,代码来源:source_controller.test.php

示例13: ingest

 public function ingest($type = "meta")
 {
     if ($type == "meta") {
         $meta = new Folder('/Users/n00002621/Dropbox/Research - Cheminfo/OSDB/IS-DB/metadata');
         $files = $meta->find('.*\\.xml');
         foreach ($files as $file) {
             $file = new File($meta->pwd() . DS . $file);
             $text = $file->read();
             $xml = simplexml_load_string($text);
             $data = json_decode(json_encode($xml), true);
             $set = $data['data_set'];
             $sam = $data['sample'];
             $set['id'] = $set['DataSetId'];
             unset($set['DataSetId']);
             $set['author_id'] = $set['ContactAuthor'];
             unset($set['ContactAuthor']);
             $set['publication_id'] = $set['PublicationId'];
             unset($set['PublicationId']);
             $set['sample_id'] = $set['SampleId'];
             unset($set['SampleId']);
             $set['datatype'] = $set['DataType'];
             unset($set['DataType']);
             $set['dataformat'] = $set['DataFormat'];
             unset($set['DataFormat']);
             $set['description'] = $set['Description'];
             unset($set['Description']);
             if (isset($set['Instrument'])) {
                 $set['instrument'] = $set['Instrument'];
                 unset($set['Instrument']);
             } else {
                 $set['instrument'] = "";
             }
             if (isset($set['MeasurementTechnique'])) {
                 $set['measurement'] = $set['MeasurementTechnique'];
                 unset($set['MeasurementTechnique']);
             } else {
                 $set['measurement'] = "";
             }
             $set['oldfilename'] = $set['OldFileName'];
             unset($set['OldFileName']);
             $set['newfilename'] = $set['NewFileName'];
             unset($set['NewFileName']);
             $set['mimetype'] = $set['MimeType'];
             unset($set['MimeType']);
             $set['filesize'] = $set['FileSize'];
             unset($set['FileSize']);
             $set['submitted'] = $set['SubmissionDate'];
             unset($set['SubmissionDate']);
             $set['flags'] = $set['DataSetFlags'];
             unset($set['DataSetFlags']);
             debug($set);
             debug($sam);
             exit;
         }
         debug($files);
         exit;
     }
 }
开发者ID:stuchalk,项目名称:OSDB,代码行数:58,代码来源:IsdbsController.php

示例14: main

 public function main()
 {
     $Folder = new Folder(dirname(dirname(dirname(__FILE__))) . DS . "features");
     $this->out("copy " . $Folder->pwd() . " to Cake Root...");
     $Folder->copy(array('to' => ROOT . DS . "features"));
     $File = new File(dirname(__FILE__) . DS . "behat.yml.default");
     $this->out("copy " . $File->name() . " to App/Config...");
     $File->copy(APP . DS . "Config" . DS . "behat.yml");
 }
开发者ID:nojimage,项目名称:Bdd,代码行数:9,代码来源:InitShell.php

示例15: listar

 public function listar($idConvenio)
 {
     $dir = new Folder(WWW_ROOT . 'xml/' . $idConvenio);
     $path = $dir->pwd() . '\\';
     $files = $dir->read(true);
     $this->set('idConvenio', $idConvenio);
     $this->set('path', $path);
     $this->set('files', $files);
 }
开发者ID:rodrigofigueira,项目名称:leste,代码行数:9,代码来源:XMLController.php


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