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


PHP f::move方法代码示例

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


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

示例1: rename

 /**
  * Renames the file and also its meta info txt
  *
  * @param string $filename
  */
 public function rename($name)
 {
     $filename = f::safeName($name) . '.' . $this->extension();
     $root = $this->dir() . DS . $filename;
     if ($root == $this->root()) {
         return $filename;
     }
     if (file_exists($root)) {
         throw new Exception('A file with that name already exists');
     }
     if (!f::move($this->root(), $root)) {
         throw new Exception('The file could not be renamed');
     }
     $meta = $this->textfile();
     if (file_exists($meta)) {
         f::move($meta, $this->page->textfile($filename));
     }
     cache::flush();
     return $filename;
 }
开发者ID:madebypost,项目名称:Gulp-Neat-KirbyCMS,代码行数:25,代码来源:file.php

示例2: move

 /**
  * Moves the file to a new location
  *
  * @param string $to
  * @return boolean
  */
 public function move($to)
 {
     if (!f::move($this->root, $to)) {
         return false;
     } else {
         $this->root = $to;
         return true;
     }
 }
开发者ID:kgchoy,项目名称:main-portfolio-website,代码行数:15,代码来源:media.php

示例3: rename

 /**
  * Renames the file and also its meta info txt
  *
  * @param string $filename
  */
 public function rename($name)
 {
     $filename = $this->createNewFilename($name);
     $root = $this->dir() . DS . $filename;
     if (empty($name)) {
         throw new Exception('The filename is missing');
     }
     if ($root == $this->root()) {
         return $filename;
     }
     if (file_exists($root)) {
         throw new Exception('A file with that name already exists');
     }
     if (!f::move($this->root(), $root)) {
         throw new Exception('The file could not be renamed');
     }
     $meta = $this->textfile();
     if (file_exists($meta)) {
         f::move($meta, $this->page->textfile($filename));
     }
     // reset the page cache
     $this->page->reset();
     cache::flush();
     return $filename;
 }
开发者ID:smongey,项目名称:ck,代码行数:30,代码来源:file.php

示例4: rename

 /**
  * Renames the file and also its meta info txt
  *  
  * @param string $filename
  */
 public function rename($name)
 {
     $filename = f::safeName($name) . '.' . $this->extension();
     $root = $this->dir() . DS . $filename;
     if (empty($name)) {
         throw new Exception('The filename is missing');
     }
     if ($root == $this->root()) {
         return $filename;
     }
     if (file_exists($root)) {
         throw new Exception('A file with that name already exists');
     }
     if (!f::move($this->root(), $root)) {
         throw new Exception('The file could not be renamed');
     }
     foreach ($this->site->languages() as $lang) {
         // rename all meta files
         $meta = $this->textfile($lang->code());
         if (file_exists($meta)) {
             f::move($meta, $this->page->textfile($filename, $lang->code()));
         }
     }
     return $filename;
 }
开发者ID:robinandersen,项目名称:robin,代码行数:30,代码来源:file.php

示例5: testMove

 public function testMove()
 {
     $this->assertTrue(f::move($this->tmpFile, TEST_ROOT_TMP . DS . 'moved.txt'));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:4,代码来源:FTest.php

示例6: changeTemplate

 public function changeTemplate($newTemplate)
 {
     $oldTemplate = $this->intendedTemplate();
     if ($newTemplate == $oldTemplate) {
         return true;
     }
     if ($this->site()->multilang()) {
         foreach ($this->site()->languages() as $lang) {
             $old = $this->textfile(null, $lang->code());
             $new = $this->textfile($newTemplate, $lang->code());
             f::move($old, $new);
             $this->reset();
             $this->updateForNewTemplate($oldTemplate, $newTemplate, $lang->code());
         }
     } else {
         $old = $this->textfile();
         $new = $this->textfile($newTemplate);
         f::move($old, $new);
         $this->reset();
         $this->updateForNewTemplate($oldTemplate, $newTemplate);
     }
     return true;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:23,代码来源:page.php

示例7: editFile

 static function editFile()
 {
     global $page;
     $filename = get('filename');
     $newname = str::urlify(get('newname'));
     $file = $page->files()->find($filename);
     if (!$file) {
         return array('status' => 'error', 'msg' => l::get('files.edit.errors.notfound'));
     }
     $newfilename = $newname . '.' . $file->extension();
     if ($newfilename == $file->filename()) {
         return array('status' => 'success', 'msg' => l::get('nochanges'));
     }
     $newroot = dirname($file->root()) . '/' . $newfilename;
     if (file_exists($newroot)) {
         return array('status' => 'error', 'msg' => l::get('files.edit.errors.exists'));
     }
     if (!f::move($file->root(), $newroot)) {
         return array('status' => 'error', 'msg' => l::get('files.edit.errors.permissions'));
     }
     self::killCache();
     return array('status' => 'success', 'msg' => l::get('files.edit.success'));
 }
开发者ID:nilshendriks,项目名称:kirbycms-panel,代码行数:23,代码来源:data.php

示例8: editFile

 static function editFile()
 {
     global $panel, $page;
     $filename = get('filename');
     $newname = str::urlify(get('newname'));
     $file = $page->files()->find($filename);
     if (!$file) {
         return array('status' => 'error', 'msg' => l::get('files.edit.errors.notfound'));
     }
     if (str::length($newname) < 1) {
         return array('status' => 'error', 'msg' => l::get('files.edit.errors.filename'));
     }
     $newfilename = $newname . '.' . $file->extension();
     if ($newfilename != $file->filename()) {
         $newroot = dirname($file->root()) . '/' . $newfilename;
         if (file_exists($newroot)) {
             return array('status' => 'error', 'msg' => l::get('files.edit.errors.exists'));
         }
         if (!f::move($file->root(), $newroot)) {
             return array('status' => 'error', 'msg' => l::get('files.edit.errors.permissions'));
         }
         // delete the old meta file
         if (c::get('lang.support')) {
             // make sure to remove the meta file without language extension
             $invalidfile = dirname($file->root()) . '/' . $file->filename() . '.' . c::get('content.file.extension', 'txt');
             f::remove($invalidfile);
             // remove the translated meta file
             $oldmeta = dirname($file->root()) . '/' . $file->filename() . '.' . c::get('lang.current') . '.' . c::get('content.file.extension', 'txt');
         } else {
             $oldmeta = dirname($file->root()) . '/' . $file->filename() . '.' . c::get('content.file.extension', 'txt');
         }
         f::remove($oldmeta);
     }
     if (c::get('lang.support')) {
         // delete the untranslated file
         $delete = dirname($file->root()) . '/' . $newfilename . '.' . c::get('content.file.extension', 'txt');
         f::remove($delete);
         // set the translated file
         $destination = dirname($file->root()) . '/' . $newfilename . '.' . c::get('lang.current') . '.' . c::get('content.file.extension', 'txt');
     } else {
         $destination = dirname($file->root()) . '/' . $newfilename . '.' . c::get('content.file.extension', 'txt');
     }
     $updateInfo = self::updateFileinfo($file, $destination);
     if (error($updateInfo)) {
         return $updateInfo;
     }
     self::killCache();
     return array('status' => 'success', 'msg' => l::get('files.edit.success'));
 }
开发者ID:codecuts,项目名称:lanningsmith-website,代码行数:49,代码来源:data.php

示例9: editFile

 static function editFile()
 {
     global $panel, $page;
     $filename = get('filename');
     $newname = str::urlify(get('newname'));
     $file = $page->files()->find($filename);
     if (!$file) {
         return array('status' => 'error', 'msg' => l::get('files.edit.errors.notfound'));
     }
     if (str::length($newname) < 1) {
         return array('status' => 'error', 'msg' => l::get('files.edit.errors.filename'));
     }
     $newfilename = $newname . '.' . $file->extension();
     if ($newfilename != $file->filename()) {
         $newroot = dirname($file->root()) . '/' . $newfilename;
         if (file_exists($newroot)) {
             return array('status' => 'error', 'msg' => l::get('files.edit.errors.exists'));
         }
         if (!f::move($file->root(), $newroot)) {
             return array('status' => 'error', 'msg' => l::get('files.edit.errors.permissions'));
         }
         // delete the old meta file
         $oldmeta = dirname($file->root()) . '/' . $file->filename() . '.txt';
         f::remove($oldmeta);
     }
     $destination = dirname($file->root()) . '/' . $newfilename . '.txt';
     $updateInfo = self::updateFileinfo($file, $destination);
     if (error($updateInfo)) {
         return $updateInfo;
     }
     self::killCache();
     return array('status' => 'success', 'msg' => l::get('files.edit.success'));
 }
开发者ID:04x10,项目名称:04x10.com,代码行数:33,代码来源:data.php

示例10: rename

 /**
  * Renames the file and also its meta info txt
  *  
  * @param string $filename
  * @param boolean $safeName
  */
 public function rename($name, $safeName = true)
 {
     $filename = $this->createNewFilename($name, $safeName);
     $root = $this->dir() . DS . $filename;
     if ($root == $this->root()) {
         return $filename;
     }
     if (file_exists($root)) {
         throw new Exception('A file with that name already exists');
     }
     if (!f::move($this->root(), $root)) {
         throw new Exception('The file could not be renamed');
     }
     foreach ($this->site->languages() as $lang) {
         // rename all meta files
         $meta = $this->textfile($lang->code());
         if (file_exists($meta)) {
             f::move($meta, $this->page->textfile($filename, $lang->code()));
         }
     }
     // reset the page cache
     $this->page->reset();
     // reset the basics
     $this->root = $root;
     $this->filename = $filename;
     $this->name = $name;
     $this->cache = array();
     cache::flush();
     return $filename;
 }
开发者ID:Socialsquare,项目名称:rodvig-bags,代码行数:36,代码来源:file.php

示例11: move

 /**
  * Move the source to the final destination
  */
 protected function move()
 {
     $exists = $this->pluginExists();
     $error = $exists ? 'The plugin could not be updated' : 'The plugin could not be installed';
     $success = $exists ? 'The plugin has been updated to version:' : 'The plugin has been installed at version:';
     if ($exists) {
         $this->output->writeln('<info>Updating plugin...</info>');
     } else {
         $this->output->writeln('<info>Installing plugin...</info>');
     }
     $this->output->writeln('<info></info>');
     $this->prepare();
     $src = $this->source();
     $dest = $this->destination();
     // overwriting means having to clean the plugin first
     if (is_dir($dest)) {
         if (!dir::remove($dest)) {
             throw new RuntimeException('The old plugin could not be removed before the update');
         }
     }
     if (is_file($src)) {
         if (!f::move($src, $dest)) {
             throw new RuntimeException($error);
         }
     } else {
         if (is_dir($src)) {
             if (!dir::move($src, $dest)) {
                 throw new RuntimeException($error);
             }
         } else {
             throw new RuntimeException('Invalid source');
         }
     }
     $this->output->writeln('<comment>' . $success . ' "' . $this->version() . '"</comment>');
 }
开发者ID:getkirby,项目名称:cli,代码行数:38,代码来源:Plugin.php


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