當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。