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


PHP FileHandler::copyFile方法代码示例

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


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

示例1: moduleUpdate

 /**
  * @brief 업데이트 실행
  **/
 function moduleUpdate()
 {
     $oDB =& DB::getInstance();
     // 2009. 02. 11 menu 테이블에 site_srl 추가
     if (!$oDB->isColumnExists('layouts', 'site_srl')) {
         $oDB->addColumn('layouts', 'site_srl', 'number', 11, 0, true);
     }
     // 2009. 02. 26 faceOff에 맞춰 기존 레이아웃 편집본을 이동
     $oLayoutModel =& getModel('layout');
     $files = FileHandler::readDir('./files/cache/layout');
     for ($i = 0, $c = count($files); $i < $c; $i++) {
         $filename = $files[$i];
         if (!preg_match('/([0-9]+)\\.html/i', $filename, $match)) {
             continue;
         }
         $layout_srl = $match[1];
         if (!$layout_srl) {
             continue;
         }
         $path = $oLayoutModel->getUserLayoutPath($layout_srl);
         if (!is_dir($path)) {
             FileHandler::makeDir($path);
         }
         FileHandler::copyFile('./files/cache/layout/' . $filename, $path . 'layout.html');
         @unlink('./files/cache/layout/' . $filename);
     }
     return new Object(0, 'success_updated');
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:31,代码来源:layout.class.php

示例2: testFileMethods

 public function testFileMethods()
 {
     $mock = dirname(__FILE__) . '/mock.txt';
     $mock2 = dirname(__FILE__) . '/mock2.txt';
     touch($mock);
     // copy file
     $this->assertTrue(is_readable($mock));
     FileHandler::copyFile($mock, $mock2);
     $this->assertTrue(is_readable($mock2));
     // remove file
     $this->assertTrue(FileHandler::removeFile($mock2));
     $this->assertFalse(is_readable($mock2));
     $this->assertFalse(FileHandler::removeFile($mock2));
     // rename file
     $this->assertTrue(FileHandler::rename($mock, $mock2));
     $this->assertFalse(is_readable($mock));
     $this->assertTrue(is_readable($mock2));
     $this->assertFalse(FileHandler::rename($mock, $mock2));
     // move file
     $this->assertTrue(FileHandler::rename($mock2, $mock));
     $this->assertTrue(is_readable($mock));
     $this->assertFalse(is_readable($mock2));
     $this->assertTrue(touch($mock2) && is_readable($mock2));
     $this->assertTrue(FileHandler::moveFile($mock, $mock2));
     $this->assertFalse(is_readable($mock));
     $this->assertTrue(is_readable($mock2));
     // remove file
     $this->assertFalse(FileHandler::removeFile($mock));
     $this->assertTrue(FileHandler::removeFile($mock2));
     $this->assertFalse(is_readable($mock));
     $this->assertFalse(is_readable($mock2));
 }
开发者ID:relip,项目名称:xe-core,代码行数:32,代码来源:FileHandlerTest.php

示例3: pluginInstall

 function pluginInstall($args)
 {
     // mkdir
     FileHandler::makeDir(sprintf(_XE_PATH_ . "files/epay/%s/log", $args->plugin_srl));
     // copy files
     FileHandler::copyFile(_XE_PATH_ . 'modules/epay/plugins/payplus6/.htaccess', sprintf(_XE_PATH_ . "files/epay/%s/.htaccess", $args->plugin_srl));
     FileHandler::copyFile(_XE_PATH_ . 'modules/epay/plugins/payplus6/readme.txt', sprintf(_XE_PATH_ . "files/epay/%s/readme.txt", $args->plugin_srl));
 }
开发者ID:bjrambo,项目名称:nurigo,代码行数:8,代码来源:payplus6.plugin.php

示例4: saveImage

 /**
  * Save image to disk
  *
  * @author Dan Dragan (dev@xpressengine.org)
  * @param $image ProductImage
  * @return boolean
  */
 public function saveImage(ProductImage &$image)
 {
     try {
         $path = sprintf('./files/attach/images/shop/%d/product-images/%d/', $image->module_srl, $image->product_srl);
         $filename = sprintf('%s%s', $path, $image->filename);
         FileHandler::copyFile($image->source_filename, $filename);
     } catch (Exception $e) {
         return new Object(-1, $e->getMessage());
     }
     return TRUE;
 }
开发者ID:haegyung,项目名称:xe-module-shop,代码行数:18,代码来源:ProductImageRepository.php

示例5: moduleUpdate

 /**
  * Execute update
  * @return Object
  */
 function moduleUpdate()
 {
     $oDB =& DB::getInstance();
     // 2009. 02. 11 Add site_srl to menu table
     if (!$oDB->isColumnExists('layouts', 'site_srl')) {
         $oDB->addColumn('layouts', 'site_srl', 'number', 11, 0, true);
     }
     // 2009. 02. 26 Move the previous layout for faceoff
     $oLayoutModel = getModel('layout');
     $files = FileHandler::readDir('./files/cache/layout');
     for ($i = 0, $c = count($files); $i < $c; $i++) {
         $filename = $files[$i];
         if (!preg_match('/([0-9]+)\\.html/i', $filename, $match)) {
             continue;
         }
         $layout_srl = $match[1];
         if (!$layout_srl) {
             continue;
         }
         $path = $oLayoutModel->getUserLayoutPath($layout_srl);
         if (!is_dir($path)) {
             FileHandler::makeDir($path);
         }
         FileHandler::copyFile('./files/cache/layout/' . $filename, $path . 'layout.html');
         @unlink('./files/cache/layout/' . $filename);
     }
     if (!$oDB->isColumnExists('layouts', 'layout_type')) {
         $oDB->addColumn('layouts', 'layout_type', 'char', 1, 'P', true);
     }
     $args = new stdClass();
     $args->layout = '.';
     $output = executeQueryArray('layout.getLayoutDotList', $args);
     if ($output->data && count($output->data) > 0) {
         foreach ($output->data as $layout) {
             $layout_path = explode('.', $layout->layout);
             if (count($layout_path) != 2) {
                 continue;
             }
             if (is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) {
                 $args->layout = implode('|@|', $layout_path);
                 $args->layout_srl = $layout->layout_srl;
                 $output = executeQuery('layout.updateLayout', $args);
                 Rhymix\Framework\Cache::delete('layout:' . $args->layout_srl);
             }
         }
     }
     return new Object(0, 'success_updated');
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:52,代码来源:layout.class.php

示例6: procSeoAdminSaveSetting

 function procSeoAdminSaveSetting()
 {
     $oModuleController = getController('module');
     $vars = Context::getRequestVars();
     $config = $this->getConfig();
     if ($vars->setting_section == 'general') {
         // 기본 설정
         $config->use_optimize_title = $vars->use_optimize_title;
         $config->site_name = $vars->site_name;
         $config->site_slogan = $vars->site_slogan;
         $config->site_description = $vars->site_description;
         $config->site_keywords = $vars->site_keywords;
         if ($vars->site_image) {
             $path = _XE_PATH_ . 'files/attach/site_image/';
             $ext = strtolower(array_pop(explode('.', $vars->site_image['name'])));
             $timestamp = time();
             $filename = "site_image.{$timestamp}.{$ext}";
             FileHandler::copyFile($vars->site_image['tmp_name'], $path . $filename);
             $config->site_image = $filename;
         }
     } elseif ($vars->setting_section == 'analytics') {
         // analytics
         // Google
         $config->ga_id = trim($vars->ga_id);
         $config->ga_except_admin = $vars->ga_except_admin;
         // Naver
         $config->na_id = trim($vars->na_id);
         $config->na_except_admin = $vars->na_except_admin;
     } elseif ($vars->setting_section == 'miscellaneous') {
         // miscellaneous
         // Facebook
         $config->fb_app_id = trim($vars->fb_app_id);
         $config->fb_admins = trim($vars->fb_admins);
     }
     $config->site_image_url = NULL;
     $oModuleController->updateModuleConfig('seo', $config);
     $this->setMessage('success_updated');
     if (Context::get('success_return_url')) {
         $this->setRedirectUrl(Context::get('success_return_url'));
     }
 }
开发者ID:misol,项目名称:xe-module-seo,代码行数:41,代码来源:seo.admin.controller.php

示例7: addProductsToExportFolder

 /**
  * Add products info to export folder
  * @author Dan Dragan (dev@xpressengine.org)
  *
  * @param array $products
  *
  * @return boolean
  */
 public function addProductsToExportFolder($products)
 {
     $buff = '';
     //table header for products csv
     foreach ($products[0] as $key => $value) {
         if (!in_array($key, array('member_srl', 'module_srl', 'regdate', 'last_update', 'primary_image', 'repo', 'associated_products', 'cache'))) {
             if ($key == 'product_srl') {
                 $buff = $buff . 'id,';
             } else {
                 $buff = $buff . $key . ",";
             }
         }
     }
     $buff = $buff . "configurable_attributes\r\n";
     //table values  for products  csv
     foreach ($products as $product) {
         // add images to temp folder
         foreach ($product->images as $image) {
             $path = sprintf('./files/attach/images/shop/%d/product-images/%d/', $image->module_srl, $image->product_srl);
             $filename = sprintf('%s%s', $path, $image->filename);
             $export_filename = sprintf('./files/attach/shop/export-import/images/%s', $image->product_srl . $image->filename);
             FileHandler::copyFile($filename, $export_filename);
         }
         foreach ($product as $key => $value) {
             if (!in_array($key, array('member_srl', 'module_srl', 'regdate', 'last_update', 'primary_image', 'primary_image_filename', 'repo', 'categories', 'attributes', 'images', 'associated_products', 'configurable_attributes', 'cache'))) {
                 $buff = $buff . str_replace(",", ";;", $value) . ",";
             }
             if ($key == 'primary_image_filename') {
                 if (isset($product->primary_image_filename)) {
                     $buff = $buff . $product->product_srl . $value . ",";
                 } else {
                     $buff = $buff . ",";
                 }
             }
             $product_categories = '';
             if ($key == 'categories') {
                 foreach ($value as $category) {
                     if ($product_categories == '') {
                         $product_categories = $category;
                     } else {
                         $product_categories = $product_categories . '|' . $category;
                     }
                 }
                 $buff = $buff . $product_categories . ",";
             }
             $product_attributes = '';
             if ($key == 'attributes') {
                 foreach ($value as $attribute_srl => $attribute_value) {
                     if ($product_attributes == '') {
                         $product_attributes = $attribute_srl . '=' . $attribute_value;
                     } else {
                         $product_attributes = $product_attributes . '|' . $attribute_srl . '=' . $attribute_value;
                     }
                 }
                 $buff = $buff . $product_attributes . ",";
             }
             $images = '';
             if ($key == 'images') {
                 foreach ($value as $image) {
                     if ($image->filename) {
                         if ($images == '') {
                             $images = $product->product_srl . $image->filename;
                         } else {
                             $images = $images . '|' . $product->product_srl . $image->filename;
                         }
                     }
                 }
                 $buff = $buff . $images . ",";
             }
             if ($key == 'configurable_attributes') {
                 $configurable_attributes = '';
                 foreach ($value as $attribute_srl => $attribute_value) {
                     if ($configurable_attributes == '') {
                         $configurable_attributes = $attribute_srl;
                     } else {
                         $configurable_attributes = $configurable_attributes . '+' . $attribute_srl;
                     }
                 }
             }
         }
         $buff = $buff . $configurable_attributes . "\r\n";
     }
     $product_csv_filename = 'products.csv';
     $product_csv_path = sprintf('./files/attach/shop/export-import/%s', $product_csv_filename);
     FileHandler::writeFile($product_csv_path, $buff);
     return TRUE;
 }
开发者ID:haegyung,项目名称:xe-module-shop,代码行数:95,代码来源:ProductRepository.php

示例8: saveIcon

 function saveIcon($icon, $iconname)
 {
     $mobicon_size = array('57', '114');
     $target_file = $icon['tmp_name'];
     $type = $icon['type'];
     $target_filename = _XE_PATH_ . 'files/attach/xeicon/' . $iconname;
     list($width, $height, $type_no, $attrs) = @getimagesize($target_file);
     if ($iconname == 'favicon.ico' && preg_match('/^.*(icon).*$/', $type)) {
         $fitHeight = $fitWidth = '16';
     } else {
         if ($iconname == 'mobicon.png' && preg_match('/^.*(png).*$/', $type) && in_array($height, $mobicon_size) && in_array($width, $mobicon_size)) {
             $fitHeight = $fitWidth = $height;
         } else {
             return false;
         }
     }
     //FileHandler::createImageFile($target_file, $target_filename, $fitHeight, $fitWidth, $ext);
     FileHandler::copyFile($target_file, $target_filename);
 }
开发者ID:relip,项目名称:xe-core,代码行数:19,代码来源:install.admin.controller.php

示例9: saveCategoryImage

 /**
  * Save category image to disc
  *
  * @param int    $module_srl        Module's srl
  * @param string $original_filename Original filename of the uploaded file
  * @param string $tmp_name          Uploaded file's content
  *
  * @return string
  */
 public function saveCategoryImage($module_srl, $original_filename, $tmp_name)
 {
     $tmp_arr = explode('.', $original_filename);
     $extension = $tmp_arr[count($tmp_arr) - 1];
     $path = sprintf($this->category_images_folder, $module_srl);
     $filename = sprintf('%s%s.%s', $path, uniqid('product-category-'), $extension);
     FileHandler::copyFile($tmp_name, $filename);
     return $filename;
 }
开发者ID:haegyung,项目名称:xe-module-shop,代码行数:18,代码来源:CategoryRepository.php

示例10: _copyLayoutFile

 /**
  * Layout file copy
  * @param $sourceLayoutSrl origin layout number
  * @param $targetLayoutSrl origin layout number
  * @return void
  */
 function _copyLayoutFile($sourceLayoutSrl, $targetLayoutSrl)
 {
     $oLayoutModel = getModel('layout');
     $sourceLayoutPath = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($sourceLayoutSrl));
     $targetLayoutPath = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($targetLayoutSrl));
     $sourceImagePath = $oLayoutModel->getUserLayoutImagePath($sourceLayoutSrl);
     $targetImagePath = $oLayoutModel->getUserLayoutImagePath($targetLayoutSrl);
     FileHandler::makeDir($targetImagePath);
     $sourceFileList = $oLayoutModel->getUserLayoutFileList($sourceLayoutSrl);
     foreach ($sourceFileList as $key => $file) {
         if (is_readable($sourceLayoutPath . $file)) {
             FileHandler::copyFile($sourceLayoutPath . $file, $targetLayoutPath . $file);
             if ($file == 'layout.html' || $file == 'layout.css') {
                 $this->_changeFilepathInSource($targetLayoutPath . $file, $sourceImagePath, $targetImagePath);
             }
         }
     }
 }
开发者ID:ddmshu,项目名称:xe-core,代码行数:24,代码来源:layout.admin.controller.php

示例11: _copyDir

 /**
  * Copy directory
  *
  * @param array $file_list File list to copy
  * @return Object
  */
 function _copyDir(&$file_list)
 {
     $output = $this->_connect();
     if (!$output->toBool()) {
         return $output;
     }
     $target_dir = $this->target_path;
     if (is_array($file_list)) {
         foreach ($file_list as $k => $file) {
             $org_file = $file;
             if ($this->package->path == ".") {
                 $file = substr($file, 3);
             }
             $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
             $path_list = explode('/', dirname($this->target_path . "/" . $file));
             $real_path = "./";
             for ($i = 0; $i < count($path_list); $i++) {
                 if ($path_list == "") {
                     continue;
                 }
                 $real_path .= $path_list[$i] . "/";
                 if (!file_exists(FileHandler::getRealPath($real_path))) {
                     FileHandler::makeDir($real_path);
                 }
             }
             FileHandler::copyFile(FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
         }
     }
     $this->_close();
     return new Object();
 }
开发者ID:conory,项目名称:rhymix,代码行数:37,代码来源:autoinstall.lib.php

示例12: _copyButton

 /**
  * When copy a menu, button copied also.
  * @param $args menuItemInfo with button values
  */
 private function _copyButton($insertedMenuItemSrl, $insertedMenuSrl, &$menuItemInfo)
 {
     $copied_info = array("normal_btn" => "", "hover_btn" => "", "active_btn" => "");
     //normal_btn
     if ($menuItemInfo->normal_btn) {
         $originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
         $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
         FileHandler::copyFile($originFile, $targetFile);
         $copied_info['normal_btn'] = $targetFile;
     }
     //hover_btn
     if ($menuItemInfo->hover_btn) {
         $originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
         $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
         FileHandler::copyFile($originFile, $targetFile);
         $copied_info['hover_btn'] = $targetFile;
     }
     //active_btn
     if ($menuItemInfo->active_btn) {
         $originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
         $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
         FileHandler::copyFile($originFile, $targetFile);
         $copied_info['active_btn'] = $targetFile;
     }
     return $copied_info;
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:30,代码来源:menu.admin.controller.php

示例13: loadLangSelected

 /**
  * @brief 설정한 언어 파일 찾기
  **/
 function loadLangSelected()
 {
     static $lang_selected = null;
     if (is_null($lang_selected)) {
         $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
         $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
         if (!file_exists($selected_lang_file) || !filesize($selected_lang_file)) {
             $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
             if (file_exists($old_selected_lang_file)) {
                 FileHandler::copyFile($old_selected_lang_file, $selected_lang_file);
                 FileHandler::removeFile($old_selected_lang_file);
             }
         }
         if (!file_exists($selected_lang_file) || !filesize($selected_lang_file)) {
             $buff = FileHandler::readFile($orig_lang_file);
             FileHandler::writeFile($selected_lang_file, $buff);
             $lang_selected = Context::loadLangSupported();
         } else {
             $langs = file($selected_lang_file);
             foreach ($langs as $val) {
                 list($lang_prefix, $lang_text) = explode(',', $val);
                 $lang_text = trim($lang_text);
                 $lang_selected[$lang_prefix] = $lang_text;
             }
         }
     }
     return $lang_selected;
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:31,代码来源:Context.class.php

示例14: _saveFaviconTemp

 private function _saveFaviconTemp($icon, $iconname)
 {
     $site_info = Context::get('site_module_info');
     $virtual_site = '';
     if ($site_info->site_srl) {
         $virtual_site = $site_info->site_srl . '/';
     }
     $original_filename = $icon['tmp_name'];
     $type = $icon['type'];
     $relative_filename = 'files/attach/xeicon/' . $virtual_site . 'tmp/' . $iconname;
     $target_filename = RX_BASEDIR . $relative_filename;
     list($width, $height, $type_no, $attrs) = @getimagesize($original_filename);
     if ($iconname == 'favicon.ico') {
         if (!preg_match('/^.*(x-icon|\\.icon)$/i', $type)) {
             Context::set('msg', '*.ico ' . Context::getLang('msg_possible_only_file'));
             return;
         }
     } elseif ($iconname == 'mobicon.png') {
         if (!preg_match('/^.*(png).*$/', $type)) {
             Context::set('msg', '*.png ' . Context::getLang('msg_possible_only_file'));
             return;
         }
         if (!($height == '57' && $width == '57' || $height == '114' && $width == '114')) {
             Context::set('msg', Context::getLang('msg_invalid_format') . ' (size : 57x57, 114x114)');
             return;
         }
     } else {
         Context::set('msg', Context::getLang('msg_invalid_format'));
         return;
     }
     $fitHeight = $fitWidth = $height;
     FileHandler::copyFile($original_filename, $target_filename);
     return $relative_filename;
 }
开发者ID:kkkyyy03,项目名称:coffeemix,代码行数:34,代码来源:admin.admin.controller.php

示例15: getUserLayoutIni

 /**
  * user layout ini
  * @param int $layout_srl
  * @return string
  */
 function getUserLayoutIni($layout_srl)
 {
     $src = $this->getUserLayoutPath($layout_srl) . 'layout.ini';
     if ($this->useUserLayoutTemp == 'temp') {
         $temp = $this->getUserLayoutTempIni($layout_srl);
         if (!file_exists(FileHandler::getRealPath($temp))) {
             FileHandler::copyFile($src, $temp);
         }
         return $temp;
     }
     return $src;
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:17,代码来源:layout.model.php


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