本文整理汇总了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();
}
}
}
}
示例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);
}
示例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));
}
}
}
示例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.");
}
示例5: Folder
function __cleanUp()
{
$Cleanup = new Folder(TMP . 'tests/git');
if ($Cleanup->pwd() == TMP . 'tests/git') {
$Cleanup->delete();
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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);
}
示例10: end
function end()
{
parent::end();
$Cleanup = new Folder(TMP . 'tests/svn');
if ($Cleanup->pwd() == TMP . 'tests/svn') {
$Cleanup->delete();
}
}
示例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);
}
}
示例12: endTest
function endTest()
{
$Cleanup = new Folder(TMP . 'tests/git');
if ($Cleanup->pwd() == TMP . 'tests/git') {
$Cleanup->delete();
}
unset($this->Source);
}
示例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;
}
}
示例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");
}
示例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);
}