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


PHP Dir::close方法代码示例

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


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

示例1: build

 function build($path = false)
 {
     if ($path === false) {
         $path = $this->root;
     }
     $dir = new Dir($path);
     if (!$dir->handle) {
         $this->error = 'Failed to read directory: ' . $path;
         return false;
     }
     echo '<ul>';
     foreach ($dir->read_all() as $file) {
         if (strpos($file, '.') === 0 || in_array($file, array('CVS', 'PEAR', 'Ext', 'pix', 'install', 'data', 'lang', 'modes.php', 'images.php', 'access.php')) || preg_match('/\\.(jpg|gif|png|css|js)$/i', $file)) {
             continue;
         }
         if (in_array($path . '/' . $file, $this->except) || in_array($file, $this->except)) {
             continue;
         }
         echo '<li>' . $path . '/' . $file . '</li>';
         if (@is_dir($path . '/' . $file)) {
             if (!$this->build($path . '/' . $file)) {
                 $dir->close();
                 return false;
             }
         } elseif (@is_file($path . '/' . $file) && preg_match('/\\.(' . join('|', array_keys($this->extensions)) . ')$/i', $file, $regs)) {
             if ($file == 'settings.php' && strstr($path, 'forms')) {
                 $regs[1] = 'settings';
             } elseif ($file == 'translate.ini.php') {
                 $regs[1] = 'db';
             } elseif (strstr($path, 'conf/collections')) {
                 $regs[1] = 'collection';
             } elseif ($file == 'config.ini.php') {
                 $regs[1] = 'config';
             } elseif ($file == 'settings.ini.php') {
                 $regs[1] = 'settings';
             }
             if (!$this->{$this->extensions[$regs[1]]}($path . '/' . $file, $this->getContents($path . '/' . $file))) {
                 $dir->close();
                 return false;
             }
         }
         // else it's not a type of file we know how to parse
     }
     echo '</ul>';
     $dir->close();
     return true;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:47,代码来源:Builder.php

示例2: fopen

    }
}
// open log file
$log = fopen('inc/app/scheduler/log/scheduler.log', 'a');
$tasks = array();
if ($task == 'all') {
    // run all of the tasks
    loader_import('saf.File.Directory');
    $dir = new Dir('inc/app/scheduler/tasks');
    foreach ($dir->readAll() as $file) {
        if (strpos($file, '.') === 0 || $file == 'CVS' || in_array($file, $skip) || !@is_dir('inc/app/scheduler/tasks/' . $file)) {
            continue;
        }
        $tasks[] = $file;
    }
    $dir->close();
} elseif (empty($task) || $task == 'help') {
    // display scheduler help
    loader_import('saf.File.Directory');
    $dir = new Dir('inc/app/scheduler/tasks');
    foreach ($dir->readAll() as $file) {
        if (strpos($file, '.') === 0 || $file == 'CVS' || in_array($file, $skip) || !@is_dir('inc/app/scheduler/tasks/' . $file)) {
            continue;
        }
        $tasks[] = $file;
    }
    echo <<<END

Sitellite Scheduler

Abstract:
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例3: display

    /**
     * Returns the display HTML for this widget.  The optional
     * parameter determines whether or not to automatically display the widget
     * nicely, or whether to simply return the widget (for use in a template).
     * 
     * @access	public
     * @param	boolean	$generate_html
     * @return	string
     * 
     */
    function display($generate_html = 0)
    {
        $_dl = new MF_Widget_select('MF_' . $this->name . '_DIRLIST');
        $_dl->extra = $this->extra;
        $dir = new Dir($this->directory);
        if ($this->recursive == 0) {
            $list = $dir->read_all();
            $goodlist = array();
            $dir->close();
            foreach ($list as $file) {
                if (!eregi('^\\.ht', $file) && (eregi('\\.(' . join('|', $this->extensions) . ')$', $file) || count($this->extensions) == 0) && $file != '.' && $file != '..') {
                    $goodlist[$file] = $file;
                }
            }
        } else {
            $goodlist = array();
            // recurse
            $list = $dir->find('*', $this->directory, 1);
            for ($i = 0; $i < count($list); $i++) {
                if (!@is_dir($list[$i]) && !eregi('^\\.ht', $list[$i]) && (eregi('\\.(' . join('|', $this->extensions) . ')$', $list[$i]) || count($this->extensions) == 0) && $list[$i] != '.' && $list[$i] != '..') {
                    $list[$i] = preg_replace('/^' . preg_quote($this->directory . '/', '/') . '/', '', $list[$i]);
                    $goodlist[$list[$i]] = $list[$i];
                }
            }
        }
        $_dl->setValues($goodlist);
        $_dl->data_value = $this->data_value_DIRLIST;
        $_dirlist = new MF_Widget_hidden($this->name);
        $data = '';
        if ($this->show_viewbutton) {
            global $intl;
            $data .= '<script language="JavaScript">
<!--

function ' . $this->name . '_preview (name, params, formname) {
	// get src from form widget
	path = "' . $this->web_path . '/' . '" + document.forms[formname].elements[name].options[document.forms[formname].elements[name].selectedIndex].value;

	pop = window.open (\'\', name, params);
	pop.document.open ();
	pop.document.write (\'<link rel="stylesheet" type="text/css" href="css/site.css" />\');
	pop.document.write (\'<div align="center">\');
	pop.document.write (\'<img src="\' + path + \'" alt="\' + name + \'" border="0" />\');
	pop.document.write (\'<br /><br /><a href="#" onclick="window.close ()">' . $intl->get('Close Window') . '</a></div>\');
}

// -->
</script>';
            $showbutton = '&nbsp;<a href="#" onclick="' . $this->name . '_preview (\'MF_' . $this->name . '_DIRLIST\', \'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,dependent=no,fullscreen=no,width=300,height=300,top=50,left=160\', \'' . $this->formname . '\')">' . $intl->get('Preview') . '</a>';
        } else {
            $showbutton = '';
        }
        if ($generate_html) {
            $data .= $_dirlist->display(0) . "\n";
            $data .= "\t<tr>\n\t\t<td>" . '<label for="' . $this->name . '"' . $this->invalid() . '>' . $this->display_value . "</label></td>\n\t\t<td>" . $_dl->display(0) . $showbutton . "</td>\n\t</tr>\n";
        } else {
            $data .= $_dirlist->display(0);
            $data .= $_dl->display(0);
            $data .= $showbutton;
        }
        return $data;
    }
开发者ID:vojtajina,项目名称:sitellite,代码行数:72,代码来源:Dirlist.php

示例4: getCollections

 /**
  * Returns a list of collection names for use in looping
  * through multiple collections at a time.  Called as a
  * static method, ie. Rex::getCollections ().
  *
  * @return array
  */
 function getCollections()
 {
     loader_import('saf.File.Directory');
     $dir = new Dir('inc/app/cms/conf/collections');
     $list = array();
     foreach ($dir->readAll() as $file) {
         if (strpos($file, '.') === 0 || !strstr($file, '.php')) {
             continue;
         }
         $list[] = str_replace('.php', '', $file);
     }
     $dir->close();
     return $list;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:21,代码来源:Rex.php

示例5: findInFiles

 /**
  * Searches a directory or directories (recursively) for a file
  * that contains a given string or pattern.  Note: this method requires
  * the saf.File class.
  * 
  * @access	public
  * @param	string	$string
  * @param	string	$basedir
  * @param	boolean	$recursive
  * @param	boolean	$regex
  * @return	array
  * 
  */
 function findInFiles($string, $basedir, $recursive = 0, $regex = 0)
 {
     $dir = new Dir($basedir);
     $res = array();
     $files = $dir->read_all();
     //echo "evaluating $basedir...\n";
     foreach ($files as $file) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         //echo "trying file $file...\n";
         if (is_file($basedir . '/' . $file) && File::contains($string, $regex, $basedir . '/' . $file)) {
             array_push($res, $basedir . '/' . $file);
         }
         //exit;
         if ($recursive && is_dir($basedir . '/' . $file)) {
             $new_res = Dir::find_in_files($string, $basedir . '/' . $file, $recursive, $regex);
             // add $new_res to $res
             foreach ($new_res as $n) {
                 array_push($res, $n);
             }
         }
     }
     $dir->close();
     return $res;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:39,代码来源:Directory.php


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