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


PHP Is_Dir函数代码示例

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


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

示例1: getFileList

function getFileList($path)
{
    global $list;
    global $i;
    $directory = dir($path);
    while ($entry = $directory->read()) {
        if ($entry != "." && $entry != "..") {
            if (Is_Dir($path . "/" . $entry) && !eregi("__zbSessionTMP", $path . "/" . $entry)) {
                getFileList($path . "/" . $entry);
            } else {
                if (!eregi("now_connect.php", $path . "/" . $entry) && !eregi("now_member_connect.php", $path . "/" . $entry) && !eregi("__zbSessionTMP", $path . "/" . $entry)) {
                    $list[] = str_replace("../", "", $path . "/" . $entry);
                    echo ".";
                    $i++;
                    if ($i > 100) {
                        $i = 0;
                        echo "\n\t\t";
                    }
                }
                flush();
            }
        }
    }
    $directory->close();
}
开发者ID:minyounglee85,项目名称:Personal-Website,代码行数:25,代码来源:arrangefile2.php

示例2: Comp_Load

function Comp_Load($Element)
{
    /****************************************************************************/
    $__args_types = array('string', '*');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $HostsIDs = System_HostsIDs(SPrintF('comp/%s.comp.php', $Element));
    if (Is_Error($HostsIDs)) {
        return ERROR | @Trigger_Error('[Comp_Load]: не возможно найти компонент');
    }
    #-----------------------------------------------------------------------------
    $IsCascade = In_Array(COMP_ALL_HOSTS, $__args__, TRUE);
    #-----------------------------------------------------------------------------
    if ($IsCascade) {
        $HostsIDs = Array_Reverse($HostsIDs);
    }
    #-----------------------------------------------------------------------------
    $Result = array();
    #-----------------------------------------------------------------------------
    foreach ($HostsIDs as $HostID) {
        #---------------------------------------------------------------------------
        $Path = SPrintF('%s/hosts/%s/comp/%s.comp.php', SYSTEM_PATH, $HostID, $Element);
        #---------------------------------------------------------------------------
        if (Is_Dir($Path)) {
            return ERROR | @Trigger_Error('[Comp_Load]: объект не является компонентом');
        }
        #---------------------------------------------------------------------------
        $Args = $__args__;
        #---------------------------------------------------------------------------
        Array_UnShift($Args, $Path);
        #---------------------------------------------------------------------------
        $Comp = Call_User_Func_Array('LoadComp', $Args);
        if (Is_Error($Comp)) {
            return ERROR | @Trigger_Error('[Comp_Load]: не возможно загрузить компонент');
        }
        #---------------------------------------------------------------------------
        if ($IsCascade) {
            $Result[] = $Comp;
        } else {
            #-------------------------------------------------------------------------
            $Result = $Comp;
            #-------------------------------------------------------------------------
            break;
        }
    }
    #-----------------------------------------------------------------------------
    $Loaded =& Link_Get('Comp/Loaded', 'array');
    #-----------------------------------------------------------------------------
    $Loaded[] = $Element;
    #-----------------------------------------------------------------------------
    return $Result;
}
开发者ID:carriercomm,项目名称:jbs,代码行数:54,代码来源:Comp.php

示例3: get_subfolder

 function get_subfolder($directory)
 {
     $arr_folder = (array) Glob($directory . '{,.}*', GLOB_BRACE + GLOB_ONLYDIR);
     $sort_order = array();
     foreach ($arr_folder as $index => $folder) {
         $path = RealPath($folder) . '/';
         if (!Is_Dir($path) || BaseName($folder) == '.' || BaseName($folder) == '..') {
             unset($arr_folder[$index]);
         } else {
             $arr_folder[$index] = $path;
             $sort_order[$index] = StrToLower($folder);
         }
     }
     Array_Multisort($sort_order, $arr_folder);
     return $arr_folder;
 }
开发者ID:RichyVN,项目名称:RST-Intranet,代码行数:16,代码来源:updates.php

示例4: RmDirR

function RmDirR($xdir)
{
    $d = dir($xdir);
    while ($entry = $d->read()) {
        if ($entry != "." && $entry != "..") {
            if (Is_Dir($xdir . "/" . $entry)) {
                RmDirR($xdir . "/" . $entry);
            } else {
                echo "Deleting {$xdir}/{$entry}<br>\n";
                UnLink($xdir . "/" . $entry);
            }
        }
    }
    $d->close();
    RmDir($xdir);
}
开发者ID:TinoDidriksen,项目名称:pjj-chats,代码行数:16,代码来源:delete.php

示例5: getModulesList

 function getModulesList()
 {
     $dir = openDir(DIR_MODULES);
     $lst = array();
     while ($file = readDir($dir)) {
         if (Is_Dir(DIR_MODULES . "{$file}") && $file != "." && $file != "..") {
             $rec = array();
             $rec['FILENAME'] = $file;
             $lst[] = $rec;
         }
     }
     $this->modules = $lst;
     return $lst;
 }
开发者ID:vasvlad,项目名称:majordomo,代码行数:14,代码来源:control_modules.class.php

示例6: install

 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($parent_name = "")
 {
     if (!Is_Dir(ROOT . "./saverestore")) {
         mkdir(ROOT . "./saverestore", 0777);
     }
     parent::install($parent_name);
 }
开发者ID:vasvlad,项目名称:majordomo,代码行数:14,代码来源:saverestore.class.php

示例7: copyFiles

 function copyFiles($source, $destination, $over = 0, $patterns = 0)
 {
     $res = 1;
     if (!Is_Dir($source)) {
         return 0;
         // cannot create destination path
     }
     if (!Is_Dir($destination)) {
         if (!mkdir($destination)) {
             return 0;
             // cannot create destination path
         }
     }
     if ($dir = @opendir($source)) {
         while (($file = readdir($dir)) !== false) {
             if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..') {
                 //$res=$this->copyTree($source."/".$file, $destination."/".$file, $over, $patterns);
             } elseif (Is_File($source . "/" . $file) && (!file_exists($destination . "/" . $file) || $over)) {
                 if (!is_array($patterns)) {
                     $ok_to_copy = 1;
                 } else {
                     $ok_to_copy = 0;
                     $total = count($patterns);
                     for ($i = 0; $i < $total; $i++) {
                         if (preg_match('/' . $patterns[$i] . '/is', $file)) {
                             $ok_to_copy = 1;
                         }
                     }
                 }
                 if ($ok_to_copy) {
                     $res = copy($source . "/" . $file, $destination . "/" . $file);
                 }
             }
         }
         closedir($dir);
     }
     return $res;
 }
开发者ID:vasvlad,项目名称:majordomo,代码行数:38,代码来源:market.class.php

示例8: install

/**
* Install
*
* Module installation routine
*
* @access private
*/
 function install() {
  if (!Is_Dir(ROOT."./saverestore")) {
   mkdir(ROOT."./saverestore", 0777);
  }
  parent::install();
 }
开发者ID:novozhenets,项目名称:majordomo,代码行数:13,代码来源:saverestore.class.php

示例9: getTree

 function getTree($source, $recursive = 0, $mask = '')
 {
     $res = array();
     $orig_mask = $mask;
     if (!$mask) {
         $mask = '*';
     }
     $mask = preg_quote($mask);
     $mask = str_replace('\\*', '.*?', $mask);
     $mask = '^' . $mask . '$';
     if (!Is_Dir($source)) {
         return 0;
         // incorrect source path
     }
     if ($dir = @opendir($source)) {
         while (($file = readdir($dir)) !== false) {
             if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..' && $recursive) {
                 $res2 = $this->getTree($source . "/" . $file, $recursive, $orig_mask);
                 foreach ($res2 as $k => $v) {
                     $res[$k] = $v;
                 }
             } elseif (Is_File($source . "/" . $file) && preg_match('/' . $mask . '/', $file)) {
                 $res[$source . "/" . $file] = array('FILENAME' => $file, 'SIZE' => filesize($source . "/" . $file), 'MTIME' => filemtime($source . "/" . $file));
             }
         }
         closedir($dir);
     }
     return $res;
 }
开发者ID:vasvlad,项目名称:majordomo,代码行数:29,代码来源:watchfolders.class.php

示例10: install

 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./cms/calendar")) {
         mkdir(ROOT . "./cms/calendar", 0777);
     }
     parent::install();
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:15,代码来源:app_calendar.class.php

示例11: files

 function files($parameters="") {
  global $REQUEST_URI;
  global $out;
  global $mode;

  $dir=str_replace('\\\'', "'", $_SERVER['REQUEST_URI']);
  $dir=preg_replace("/^\/.*?\//", "./", $dir);
  $dir=preg_replace("/\?.*?$/", "", $dir);
  $dir=urldecode($dir);

  //echo utf2win($dir);
  //exit;

  $paths=split("/", $dir);
  $old="";
  $history=array();
  foreach($paths as $v) {
   if ($v=="") continue;
   if ($v==".") continue;
   $rec=array();
   $rec['TITLE']=$v;
   $rec['PATH']=$old."$v/";
   $old.="$v/";
   $history[]=$rec;
  }
  $out['HISTORY']=$history;
  $out['CURRENT_DIR_TITLE']=($dir);
  $out['CURRENT_DIR']=urlencode($dir);

  $act_dir=INIT_DIR."$dir";

  if (@$mode=="descr") {
   global $file;
   global $new_descr;
   global $REMOTE_ADDR;
   global $can_edit;
   if (strpos($can_edit, $REMOTE_ADDR)>0) setDescription($act_dir, $file, $new_descr);
   $mode="";
   header("Location:?\n\n");
   exit;
  }

  $descriptions=getDescriptions($act_dir);

  $d=openDir($act_dir);
  $dirs=array();
  while ($file=readDir($d)) {
   if (($file==".") || ($file=="..")) {
    continue;
   }
   if (Is_Dir($act_dir.$file)) {
    $rec=array();
    $rec['TITLE']=$file;
    $rec['TITLE_SHORT']=$rec['TITLE'];
    if (strlen($rec['TITLE_SHORT'])>30) {
     $rec['TITLE_SHORT']=substr($rec['TITLE_SHORT'], 0, 30).'...';
    }
    if (IsSet($descriptions[$file])) {
     $rec['DESCR']=$descriptions[$file];
    }
    $rec['PATH']=urlencode("$file").'/';
    $rec['REAL_PATH']=$dir.$file;
    $dirs[]=$rec;
   }
  }
  closeDir($d);

  $dirs=mysort_array($dirs, "TITLE");

  if (count($dirs)>0) $out['DIRS']=$dirs;

  $d=openDir($act_dir);
  $files=array();
  while ($file=readDir($d)) {
   if (($file==".") || ($file=="..") || ($file=="Descript.ion")) {
    continue;
   }
   if (Is_File($act_dir.$file)) {
    $rec=array();
    $rec['TITLE']=$file;
    if (IsSet($descriptions[$file])) {
     $rec['DESCR']=$descriptions[$file];
    }
    if (strlen($rec['TITLE'])>30) {
     $rec['TITLE_SHORT']=substr($rec['TITLE'], 0, 30)."...";
    } else {
     $rec['TITLE_SHORT']=$rec['TITLE'];
    }
    $rec['PATH']="$file";
    $size=filesize($act_dir.$file);
    $total_size+=$size;
    if ($size>1024) {
     if ($size>1024*1024) {
      $size=(((int)(($size/1024/1024)*10))/10)." Mb";
     } else {
      $size=(int)($size/1024)." Kb";
     }
    } else {
     $size.=" b";
    }
//.........这里部分代码省略.........
开发者ID:novozhenets,项目名称:majordomo,代码行数:101,代码来源:app_run.php

示例12: Install_Template

 public function Install_Template()
 {
     # Was this a Post request with data enctype?
     if (!Is_Array($_FILES) || empty($_FILES)) {
         return False;
     }
     # Check the files
     foreach ($_FILES as $field_name => $arr_file) {
         if (!Is_File($arr_file['tmp_name'])) {
             unset($_FILES[$field_name]);
         }
     }
     # Check if there are uploaded files
     if (empty($_FILES)) {
         return False;
     }
     # Create template dir
     if (!Is_Dir($this->template_dir)) {
         MkDir($this->template_dir);
         ChMod($this->template_dir, 0755);
     }
     # Copy the template file
     if (isset($_FILES['template_zip'])) {
         # Install the ZIP Template
         $zip_file = $_FILES['template_zip']['tmp_name'];
         require_once 'includes/file.php';
         WP_Filesystem();
         return UnZip_File($zip_file, $this->template_dir);
     } elseif (isset($_FILES['template_php']) && $this->Get_Template_Properties($_FILES['template_php']['tmp_name'])) {
         # Install the PHP Template
         $php_file = $_FILES['template_php']['tmp_name'];
         $template_name = BaseName($_FILES['template_php']['name'], '.php');
         # Create dir and copy file
         if (!Is_Dir($this->template_dir . '/' . $template_name)) {
             MkDir($this->template_dir . '/' . $template_name);
             ChMod($this->template_dir . '/' . $template_name, 0755);
         }
         Copy($php_file, $this->template_dir . '/' . $template_name . '/' . $template_name . '.php');
         ChMod($this->template_dir . '/' . $template_name . '/' . $template_name . '.php', 0755);
     } else {
         return False;
     }
     # Template installed
     return True;
 }
开发者ID:marleexoxo,项目名称:FWC,代码行数:45,代码来源:class.core.php

示例13: IO_RmDir

function IO_RmDir($Folder)
{
    #-------------------------------------------------------------------------------
    $Folder = Preg_Replace('/\\/{2,}/', '/', rTrim($Folder, '/'));
    #-------------------------------------------------------------------------------
    if (StrPos(SPrintF('/%s/', $Folder), SYSTEM_PATH) === FALSE) {
        return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка безопасности при удалении (%s)', $Folder));
    }
    #-------------------------------------------------------------------------------
    $Entities = IO_Scan($Folder, FALSE);
    if (Is_Error($Entities)) {
        return ERROR | @Trigger_Error('[IO_RmDir]: не удалось получить содержимое папки');
    }
    #-------------------------------------------------------------------------------
    if (Count($Entities)) {
        #-------------------------------------------------------------------------------
        foreach ($Entities as $Entity) {
            #-------------------------------------------------------------------------------
            $Entity = SPrintF('%s/%s', $Folder, $Entity);
            #-------------------------------------------------------------------------------
            if (Is_Dir($Entity)) {
                #-------------------------------------------------------------------------------
                if (Is_Error(IO_RmDir($Entity))) {
                    return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка рекурсивного вызова при удалении (%s)', $Entity));
                }
                #-------------------------------------------------------------------------------
            } else {
                #-------------------------------------------------------------------------------
                if (!UnLink($Entity)) {
                    return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении файла (%s)', $Entity));
                }
                #-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    if (!@RmDir($Folder)) {
        return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении директории (%s)', $Folder));
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return TRUE;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
}
开发者ID:carriercomm,项目名称:jbs,代码行数:47,代码来源:IO.php

示例14: Error

     if (!@UnLink(SETTINGS_FILE)) {
         Error(SPrintF('Не возможно удалить файл (%s)', SETTINGS_FILE));
     }
 }
 #-------------------------------------------------------------------------------
 if (!Count($__ERRORS)) {
     #-------------------------------------------------------------------------------
     $Files = array('INSTALL', 'install.settings', 'install.my.cnf', 'install/index.php', 'install');
     #-------------------------------------------------------------------------------
     foreach ($Files as $File) {
         #-------------------------------------------------------------------------------
         $File = SPrintF('%s/%s', SYSTEM_PATH, $File);
         #-------------------------------------------------------------------------------
         if (File_Exists($File)) {
             #-------------------------------------------------------------------------------
             if (Is_Dir($File)) {
                 #-------------------------------------------------------------------------------
                 if (!@RmDir($File)) {
                     Error(SPrintF('Не возможно удалить директорию (%s)', $File));
                 }
                 #-------------------------------------------------------------------------------
             } else {
                 #-------------------------------------------------------------------------------
                 if (!@UnLink($File)) {
                     Error(SPrintF('Не возможно удалить файл (%s)', $File));
                 }
                 #-------------------------------------------------------------------------------
             }
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
开发者ID:carriercomm,项目名称:jbs,代码行数:31,代码来源:index.php

示例15: parseModules

 /**
 * Module tag parsing
 *
 * Used to include other object-modules in current workspace
 *
 * @access private
 * @param string $res template strings
 * @param array $hash data params
 * @param string $dir current template directory (for correct [#inc ...#] tags parsing)
 */
 function parseModules(&$res, &$hash, $dir)
 {
     global $md;
     global $inst;
     $instance = $inst;
     if (preg_match_all('/\\[#module (.*?)#\\]/', $res, $matches, PREG_PATTERN_ORDER)) {
         $count_matches_0 = count($matches[0]);
         for ($i = 0; $i < $count_matches_0; $i++) {
             $data = $matches[1][$i];
             $tmp = "";
             // reading module data from module including directive
             $module_data = array();
             if (preg_match_all('/(\\w+?)="(.*?)"/i', $data, $matches1, PREG_PATTERN_ORDER)) {
                 $count_matches1_0 = count($matches1[0]);
                 for ($k = 0; $k < $count_matches1_0; $k++) {
                     $key = $matches1[1][$k];
                     $value = $matches1[2][$k];
                     if ($key == "template") {
                         $value = $dir . $value;
                     }
                     $module_data[$key] = $value;
                 }
             }
             if (file_exists(DIR_MODULES . $module_data["name"] . '/' . $module_data["name"] . ".class.php") || class_exists($module_data["name"])) {
                 // including module class
                 if (!class_exists($module_data["name"])) {
                     include_once DIR_MODULES . $module_data["name"] . '/' . $module_data["name"] . ".class.php";
                 }
                 // creating code for module creation and running
                 $obj = "\$object{$i}";
                 $code = "";
                 $code .= "{$obj}=new " . $module_data["name"] . ";\n";
                 $code .= $obj . "->owner=&\$this->owner;\n";
                 // setting module parameters from module including directive
                 foreach ($module_data as $k => $v) {
                     if ($k == "name") {
                         continue;
                     }
                     $code .= $obj . "->" . $k . "='" . addslashes($v) . "';\n";
                 }
                 // setting other module parameters
                 // if current request is to this module, then run get params otherwise get params from encoded query
                 if ($md != $module_data["name"] || $module_data["instance"] != '' && $module_data["instance"] != $instance && $instance != '') {
                     // restoring module params from coded string (module should not overwrite this method)
                     $code .= $obj . "->restoreParams();\n";
                 } elseif ($module_data["name"] == $md && ($module_data["instance"] == '' || $module_data["instance"] == $instance || $instance == '')) {
                     // getting module params from query string (every module should handle this method)
                     $code .= $obj . "->getParams();\n";
                 }
                 // repeating module set parameters for security reasons
                 foreach ($module_data as $k => $v) {
                     if ($k == "name") {
                         continue;
                     }
                     $code .= $obj . "->" . $k . "='" . addslashes($v) . "';\n";
                 }
                 StartMeasure("module_" . $module_data["name"]);
                 if (SETTINGS_SITE_LANGUAGE && file_exists(ROOT . 'languages/' . $module_data["name"] . '_' . SETTINGS_SITE_LANGUAGE . '.php')) {
                     include_once ROOT . 'languages/' . $module_data["name"] . '_' . SETTINGS_SITE_LANGUAGE . '.php';
                 }
                 if (file_exists(ROOT . 'languages/' . $module_data["name"] . '_default.php')) {
                     include_once ROOT . 'languages/' . $module_data["name"] . '_default.php';
                 }
                 // run module and insert module result in template
                 $code .= $obj . "->run();\n";
                 $code .= "\$tmp=" . $obj . "->result;\n";
                 eval($code);
                 EndMeasure("module_" . $module_data["name"]);
             } else {
                 // module class file was not found
                 global $current_installing_module;
                 $rep_ext = '';
                 if (preg_match('/\\.dev/is', $_SERVER['HTTP_HOST'])) {
                     $rep_ext = '.dev';
                     $install_dir = "/var/projects/repository/engine_2.x/modules/";
                 }
                 if (preg_match('/\\.jbk/is', $_SERVER['HTTP_HOST'])) {
                     $rep_ext = '.jbk';
                     $install_dir = "d:/jey/projects/repository/engine_2.x/modules/";
                 }
                 if (!$current_installing_module[$module_data["name"]] && $rep_ext != '' && @Is_Dir($install_dir . $module_data["name"])) {
                     //$tmp="<div><iframe src=\"http://installer.dev/installer.php?host=".$_SERVER['HTTP_HOST']."&doc_root=".$_SERVER['DOCUMENT_ROOT']."&mode=install&modules[]=".$module_data["name"]."\" width=100% height=100></iframe></div>";
                     $wnd_name = "win" . rand(1, 10000000);
                     $tmp = "<script language='javascript' type='text/JavaScript'>wnd=window.open(\"http://installer" . $rep_ext . "/installer.php?host=" . $_SERVER['HTTP_HOST'] . "&doc_root=" . $_SERVER['DOCUMENT_ROOT'] . "&mode=install&modules[]=" . $module_data["name"] . "\", \"" . $wnd_name . "\", \"height=400,width=400\");</script>";
                     $current_installing_module[$module_data["name"]] = 1;
                     echo $tmp;
                 } else {
                     $tmp = "<p align=center><font color='red'><b>Module \"" . $module_data["name"] . "\" not found</b> (" . str_replace('#', '', $matches[0][$i]) . ")</font></p>";
                 }
             }
//.........这里部分代码省略.........
开发者ID:NioFBI,项目名称:majordomo,代码行数:101,代码来源:jTemplate.class.php


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