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


PHP Fx::files方法代码示例

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


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

示例1: getSavestring

 public function getSavestring(System\Entity $content = null)
 {
     $old_value = $content[$this['keyword']];
     if ($old_value != $this->value) {
         if (!empty($old_value)) {
             $old_value = fx::path()->abs($old_value);
             if (file_exists($old_value) && is_file($old_value)) {
                 fx::files()->rm($old_value);
             }
         }
         if (!empty($this->value)) {
             $c_val = fx::path()->abs($this->value);
             if (file_exists($c_val) && is_file($c_val)) {
                 preg_match("~[^" . preg_quote(DIRECTORY_SEPARATOR) . ']+$~', $c_val, $fn);
                 $path = fx::path()->http('@content_files/' . $content['site_id'] . '/' . $content['type'] . '/' . $this['keyword'] . '/' . $fn[0]);
                 $try = 0;
                 while (fx::path()->exists($path)) {
                     $file_name = preg_replace("~(\\.[^\\.]+)\$~", "_" . $try . "\$1", $fn[0]);
                     $try++;
                     $path = fx::path()->http('@content_files/' . $content['type'] . '/' . $this['keyword'] . '/' . $file_name);
                 }
                 fx::files()->move($c_val, $path);
             }
         }
     }
     $res = isset($path) ? $path : $this->value;
     return $res;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:28,代码来源:File.php

示例2: getSavestring

 public function getSavestring(System\Entity $content = null)
 {
     $old_value = $content[$this['keyword']];
     $old_path = FX_BASE_URL . $old_value;
     if ($old_path === $this->value) {
         return $this->value;
     }
     $res = '';
     if (!empty($this->value)) {
         $c_val = fx::path()->abs($this->value);
         if (file_exists($c_val) && is_file($c_val)) {
             $file_name = fx::path()->fileName($c_val);
             $path = fx::path('@content_files/' . $content['site_id'] . '/' . $content['type'] . '/' . $this['keyword'] . '/' . $file_name);
             $path = fx::files()->getPutFilePath($path);
             fx::files()->move($c_val, $path);
             $res = fx::path()->removeBase(fx::path()->http($path));
         }
     }
     if (!empty($old_value)) {
         $old_value = fx::path()->abs($old_value);
         if (file_exists($old_value) && is_file($old_value)) {
             fx::files()->rm($old_value);
         }
     }
     return $res;
 }
开发者ID:floxim,项目名称:floxim,代码行数:26,代码来源:File.php

示例3: beforeDelete

 protected function beforeDelete()
 {
     parent::beforeDelete();
     $files = $this->getFileParams();
     foreach ($files as $f) {
         fx::files()->rm($f);
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:8,代码来源:Entity.php

示例4: uploadSave

 public function uploadSave($input)
 {
     $path = 'upload';
     $result = fx::files()->saveFile($input['file'], $path);
     if (!$result) {
         $result = array('error_message' => 'Can not load this file');
         fx::http()->status(500);
     }
     if (isset($input['format']) && !empty($input['format']) && isset($result['path'])) {
         $result['formatted_value'] = fx::image($result['path'], $input['format']);
     }
     return $result;
 }
开发者ID:floxim,项目名称:floxim,代码行数:13,代码来源:File.php

示例5: handleThumbs

 protected function handleThumbs()
 {
     fx::listen('unlink', function ($e) {
         $f = $e['file'];
         if (fx::files()->isMetaFile($f)) {
             return;
         }
         if (fx::path()->isInside($f, fx::path('@thumbs'))) {
             return;
         }
         if (!fx::path()->isInside($f, fx::path('@content_files'))) {
             return;
         }
         $thumbs = \Floxim\Floxim\System\Thumb::findThumbs($f);
         foreach ($thumbs as $thumb) {
             fx::files()->rm($thumb);
         }
     });
 }
开发者ID:floxim,项目名称:module-main,代码行数:19,代码来源:Module.php

示例6: dumpDictionary

 protected function dumpDictionary($dict, $file)
 {
     if (!isset($this->lang)) {
         $this->setLang();
     }
     $data = fx::data('lang_string')->where('dict', $dict)->all();
     $res = array();
     foreach ($data as $s) {
         $res[$s['string']] = $s['lang_' . $this->lang];
     }
     fx::files()->writefile($file, "<?php\nreturn " . var_export($res, 1) . ";");
 }
开发者ID:floxim,项目名称:floxim,代码行数:12,代码来源:Finder.php

示例7: templateSave

 public function templateSave($input)
 {
     $info = $this->getTemplateInfo($input['template_full_id']);
     if (!$info) {
         return;
     }
     if ($info['hash'] !== $input['hash']) {
         die("Hash error");
     }
     $res = mb_substr($info['full'], 0, $info['start']);
     $input_source = $input['source'];
     $spaces = $input['common_spaces'];
     if (!empty($spaces)) {
         $lines = explode("\n", $input_source);
         foreach ($lines as $num => &$line) {
             if ($num === 0) {
                 continue;
             }
             $line = $spaces . $line;
         }
         $input_source = join("\n", $lines);
     }
     $res .= $input_source;
     $res .= mb_substr($info['full'], $info['start'] + $info['length']);
     fx::files()->writefile($info['file'], $res);
     return array('status' => 'ok');
 }
开发者ID:floxim,项目名称:floxim,代码行数:27,代码来源:Component.php

示例8: afterUpdate

 protected function afterUpdate()
 {
     parent::afterUpdate();
     // modified image fields
     $image_fields = $this->getFields()->find('keyword', $this->modified)->find('type', array(Field\Entity::FIELD_IMAGE, Field\Entity::FIELD_FILE));
     foreach ($image_fields as $img_field) {
         $old_value = $this->modified_data[$img_field['keyword']];
         if (fx::path()->isFile($old_value)) {
             fx::files()->rm($old_value);
         }
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:12,代码来源:Entity.php

示例9: removeOldFiles

 protected function removeOldFiles()
 {
     $mask = $this->getTargetMask();
     $files = glob($mask);
     if (is_array($files)) {
         foreach ($files as $file) {
             fx::files()->rm($file);
         }
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:10,代码来源:Loader.php

示例10: deleteFiles

 protected function deleteFiles()
 {
     $path = $this->getPath();
     fx::files()->rm($path);
 }
开发者ID:floxim,项目名称:floxim,代码行数:5,代码来源:Entity.php

示例11: afterDelete

 protected function afterDelete()
 {
     parent::afterDelete();
     $path = fx::path()->abs($this->getPath());
     fx::files()->rm($path);
 }
开发者ID:floxim,项目名称:floxim,代码行数:6,代码来源:Entity.php

示例12: updateFiles

 protected function updateFiles($dir, $base)
 {
     $items = glob($dir . "/*");
     if (!$items) {
         return;
     }
     foreach ($items as $item) {
         $item_target = fx::config('ROOT_FOLDER') . str_replace($base, '', $item);
         if (is_dir($item)) {
             $item_info = pathinfo($item);
             // skip specific dirs
             if (in_array($item_info['basename'], array('_patch_generator'))) {
                 continue;
             }
             fx::files()->mkdir($item_target);
             $this->updateFiles($item, $base);
         } else {
             fx::files()->writefile($item_target, file_get_contents($item));
         }
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:21,代码来源:Entity.php


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