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


PHP filescount函数代码示例

本文整理汇总了PHP中filescount函数的典型用法代码示例。如果您正苦于以下问题:PHP filescount函数的具体用法?PHP filescount怎么用?PHP filescount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: action

 public function action($parent)
 {
     $s = new SessionHandler($parent->app);
     $util = new Utility();
     $c = $parent->config;
     if ($_POST['sub_action'] != 'copy' && $_POST['sub_action'] != 'cut') {
         $this->error('wrong sub-action');
         return;
     }
     if (trim($_POST['path']) == '' || trim($_POST['path_thumb']) == '') {
         $this->error('no path');
         return;
     }
     $path = $c['current_path'] . $_POST['path'];
     if (is_dir($path)) {
         // can't copy/cut dirs
         if ($c['copy_cut_dirs'] === false) {
             $this->error(sprintf('You are not allowed to %s $s.', $_POST['sub_action'] == 'copy' ? 'copy' : 'cut', 'folders'));
             return;
         }
         // size over limit
         if ($c['copy_cut_max_size'] !== false && is_int($c['copy_cut_max_size'])) {
             if ($copy_cut_max_size * 1024 * 1024 < $util->foldersize($path)) {
                 $this->error(sprintf('The selected files/folders are too big to %s. Limit: %d MB/operation', $_POST['sub_action'] == 'copy' ? 'copy' : 'cut', $c['copy_cut_max_size']));
                 return;
             }
         }
         // file count over limit
         if ($copy_cut_max_count !== false && is_int($copy_cut_max_count)) {
             if ($copy_cut_max_count < filescount($path)) {
                 $this->error(sprintf('You selected too many files/folders to %s. Limit: %d files/operation', $_POST['sub_action'] == 'copy' ? 'copy' : 'cut', $c['copy_cut_max_count']));
                 return;
             }
         }
     } else {
         // can't copy/cut files
         if ($c['copy_cut_files'] === false) {
             $this->error(sprintf('You are not allowed to %s files.', $_POST['sub_action'] == 'copy' ? 'copy' : 'cut', 'files'));
             exit;
         }
     }
     $s->setClipboardPath($_POST['path']);
     $s->setClipboardPathThumb($_POST['path_thumb']);
     $s->setClipboardAction($_POST['sub_action']);
 }
开发者ID:Kingtreemonkey,项目名称:FileManager,代码行数:45,代码来源:CopyCut.php

示例2: filescount

function filescount($path)
{
    $total_count = 0;
    $files = scandir($path);
    $cleanPath = rtrim($path, '/') . '/';
    foreach ($files as $t) {
        if ($t != "." && $t != "..") {
            $currentFile = $cleanPath . $t;
            if (is_dir($currentFile)) {
                $size = filescount($currentFile);
                $total_count += $size;
            } else {
                $total_count += 1;
            }
        }
    }
    return $total_count;
}
开发者ID:Vatia13,项目名称:funtime,代码行数:18,代码来源:utils.php

示例3: response

     if (is_dir($path)) {
         // can't copy/cut dirs
         if ($copy_cut_dirs === false) {
             response(sprintf(trans('Copy_Cut_Not_Allowed'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), trans('Folders')), 403)->send();
             exit;
         }
         // size over limit
         if ($copy_cut_max_size !== false && is_int($copy_cut_max_size)) {
             if ($copy_cut_max_size * 1024 * 1024 < foldersize($path)) {
                 response(sprintf(trans('Copy_Cut_Size_Limit'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), $copy_cut_max_size), 400)->send();
                 exit;
             }
         }
         // file count over limit
         if ($copy_cut_max_count !== false && is_int($copy_cut_max_count)) {
             if ($copy_cut_max_count < filescount($path)) {
                 response(sprintf(trans('Copy_Cut_Count_Limit'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), $copy_cut_max_count), 400)->send();
                 exit;
             }
         }
     } else {
         // can't copy/cut files
         if ($copy_cut_files === false) {
             response(sprintf(trans('Copy_Cut_Not_Allowed'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), trans('Files')), 403)->send();
             exit;
         }
     }
     $_SESSION['RF']['clipboard']['path'] = $_POST['path'];
     $_SESSION['RF']['clipboard_action'] = $_POST['sub_action'];
     break;
 case 'clear_clipboard':
开发者ID:kipps,项目名称:sri-lanka,代码行数:31,代码来源:ajax_calls.php

示例4: filescount

/**
* Get number of files in a directory
*
* @param  string  $path
*
* @return  int
*/
function filescount($path, $count_hidden = true)
{
    global $hidden_folders, $hidden_files;
    $total_count = 0;
    $files = scandir($path);
    $cleanPath = rtrim($path, '/') . '/';
    foreach ($files as $t) {
        if ($t != "." && $t != "..") {
            if ($count_hidden or !(in_array($t, $hidden_folders) or in_array($t, $hidden_files))) {
                $currentFile = $cleanPath . $t;
                if (is_dir($currentFile)) {
                    $size = filescount($currentFile);
                    $total_count += $size;
                } else {
                    $total_count += 1;
                }
            }
        }
    }
    return $total_count;
}
开发者ID:crabstudio,项目名称:app,代码行数:28,代码来源:utils.php


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