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


PHP Dir::fetch方法代码示例

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


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

示例1: packages

 /**
  * List all packages (aka folders).
  */
 function packages($app = 'saf')
 {
     if ($app == 'saf') {
         $dir = 'saf/lib';
     } else {
         $dir = 'inc/app/' . $app . '/lib';
     }
     $packages = array();
     $files = Dir::fetch($dir);
     foreach ($files as $k => $v) {
         if ($v == 'CVS' || $v == '.' || $v == '..' || $v == 'PEAR' || $v == 'Ext' || $v == 'Zend') {
             unset($files[$k]);
             continue;
         } elseif (strpos($v, '_') === 0) {
             unset($files[$k]);
             continue;
         }
         if (strpos($files[$k], '.php') !== false) {
             $pkg = $app . '.' . array_shift(explode('.', $files[$k]));
         } else {
             $pkg = $app . '.' . $v;
         }
         if (!in_array($pkg, $packages)) {
             $packages[] = $pkg;
         }
     }
     return $packages;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:Docs.php

示例2: sitegallery_first_image

function sitegallery_first_image($path)
{
    loader_import('saf.File.Directory');
    $valid = appconf('valid');
    $files = Dir::fetch($path, true);
    foreach ($files as $file) {
        $info = pathinfo($file);
        if (in_array($info['extension'], $valid)) {
            $path = preg_replace('|^pix/|', '', $path);
            return $path . '/' . $file;
        }
    }
    return false;
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:14,代码来源:index.php

示例3: unset

}
if ($parameters['ctype'] == 'all') {
    unset($parameters['ctype']);
}
if ($parameters['domains'] == 'all') {
    unset($parameters['domains']);
}
if ($cgi->multiple == 'yes') {
    $multiple = true;
} else {
    $multiple = false;
}
$sitesearch_allowed = array();
$sitesearch_highlight = array();
loader_import('saf.File.Directory');
foreach (Dir::fetch('inc/app/cms/conf/collections') as $file) {
    if (strpos($file, '.') === 0 || @is_dir('inc/app/cms/conf/collections/' . $file)) {
        continue;
    }
    $config = ini_parse('inc/app/cms/conf/collections/' . $file);
    if (isset($config['Collection']['sitesearch_url'])) {
        if (isset($config['Collection']['sitesearch_access']) && session_allowed($config['Collection']['sitesearch_access'], 'r', 'access')) {
            $sitesearch_allowed[] = $config['Collection']['name'];
        }
        $sitesearch_highlight[$config['Collection']['name']] = $config['Collection']['name'];
        if (isset($config['Collection']['sitesearch_highlight']) && !$config['Collection']['sitesearch_highlight']) {
            unset($sitesearch_highlight[$config['Collection']['name']]);
        }
    }
}
$folders = ini_parse('inc/app/sitesearch/conf/folders.ini.php');
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例4: shell_exec

     shell_exec('wget -m -w 2 -E -P tmp/ http://' . $info['domain'] . ' > /dev/null 2>&1');
     // 2. set $info['folder']
     $info['folder'] = 'tmp/' . $info['domain'];
     // 3. set $info['prefix'] as $info['domain']
     $info['prefix'] = 'http://' . $info['domain'];
     // 4. proceed with what's below
 // 4. proceed with what's below
 case 'folder':
 default:
     $files = array();
     $folders = array_merge(array($info['folder']), Dir::getStruct($info['folder']));
     foreach ($folders as $folder) {
         if (preg_match('/CVS$/', $folder)) {
             continue;
         }
         $list = Dir::fetch($folder);
         foreach ($list as $f) {
             if (strpos($f, '.') === 0 || @is_dir($folder . '/' . $f)) {
                 continue;
             } elseif (preg_match('/\\.(jpg|png|gif|css|js)$/i', $f)) {
                 continue;
             }
             $pref = str_replace($info['folder'], '', $folder);
             if (!preg_match('|/$|', $pref)) {
                 $pref .= '/';
             }
             if ($info['type'] == 'site' && $info['sitellite']) {
                 $files[$folder . '/' . $f] = $info['prefix'] . $pref . preg_replace('/\\.html$/i', '', $f);
             } else {
                 $files[$folder . '/' . $f] = $info['prefix'] . $pref . $f;
             }
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例5: header

     header('Content-Length: ' . strlen($info->body));
     header('Content-Disposition: attachment; filename=' . basename($path));
     echo $info->body;
     exit;
     break;
 case 'list':
     $path = webfiles_request();
     if (!is_dir($prefix . $path)) {
         webfiles_error(404, 'Not found');
     }
     $obj = new StdClass();
     $obj->root = $path . '/';
     $obj->files = array();
     $folder_list = array();
     $file_list = array();
     $files = Dir::fetch($prefix . $path, true);
     foreach ($files as $file) {
         if ($file == 'CVS') {
             continue;
         }
         if (is_dir($prefix . $path . '/' . $file)) {
             $folder_list[] = (object) array('type' => 'httpd/unix-directory', 'name' => $path . '/' . $file, 'created' => filectime($prefix . $path . '/' . $file), 'modified' => filemtime($prefix . $path . '/' . $file), 'lock' => webfiles_lock($path . '/' . $file));
         } else {
             $info = $rex->getCurrent(ltrim($path . '/' . $file, '/'));
             unset($info->name);
             unset($info->body);
             if (!session_allowed($info, 'rw')) {
                 continue;
             }
             $file_list[] = (object) array('type' => mime($file), 'name' => $path . '/' . $file, 'size' => $info->filesize, 'created' => $info->date_created, 'modified' => $info->last_modified, 'keywords' => $info->keywords, 'description' => $info->description, 'access' => $info->sitellite_access, 'status' => $info->sitellite_status, 'team' => $info->sitellite_team, 'owner' => $info->sitellite_owner, 'lock' => webfiles_lock($path . '/' . $file));
         }
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例6: getStruct

 /**
  * Returns the "structure" of the filesystem below the specified path.
  * This is a list of sub-directories, recursively.
  *
  * @access	public
  * @param	string	$path
  * @return	array	files
  *
  */
 function getStruct($path)
 {
     $struct = array();
     $files = Dir::fetch($path);
     foreach ($files as $file) {
         if (strpos($file, '.') === 0 || !@is_dir($path . '/' . $file)) {
             continue;
         }
         $struct[] = $path . '/' . $file;
         foreach (Dir::getStruct($path . '/' . $file) as $file) {
             $struct[] = $file;
         }
     }
     return $struct;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:24,代码来源:Directory.php


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