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


PHP Dir::read_all方法代码示例

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


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

示例1: help_walker

/**
 * Walks through the boxes or forms folders and recursively builds a $list of found actions.
 *
 * @param string
 * @param string
 * @param string
 * @param array
 * @return boolean
 *
 */
function help_walker($appname, $type = 'boxes', $directory, &$list)
{
    $dir = new Dir($directory);
    if (!$dir->handle) {
        return false;
    }
    foreach ($dir->read_all() as $file) {
        if (strpos($file, '.') === 0 || $file == 'CVS') {
            continue;
        } elseif (@is_dir($directory . '/' . $file)) {
            $name = str_replace(getcwd() . '/inc/app/' . $appname . '/' . $type . '/', '', $directory . '/' . $file);
            $box = array('name' => $name, 'alt' => ucfirst(basename($name)), $type => array(), 'is_dir' => false);
            if (!@file_exists($directory . '/' . $file . '/index.php')) {
                $box['is_dir'] = true;
            } else {
                if ($type == 'boxes' && @file_exists($directory . '/' . $file . '/settings.php')) {
                    $settings = ini_parse($directory . '/' . $file . '/settings.php');
                    $box['alt'] = $settings['Meta']['name'];
                }
            }
            $list[$name] = $box;
            help_walker($appname, $type, $directory . '/' . $file, $list[$name][$type]);
        }
    }
    return true;
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:36,代码来源:functions.php

示例2: getChildFolders

 function getChildFolders($id, $limit)
 {
     if (!empty($id)) {
         $root = 'inc/data/';
     } else {
         $root = 'inc/data';
     }
     $d = new Dir($root . $id);
     $list = $d->read_all();
     $folders = array();
     foreach ($list as $file) {
         if (strpos($file, '.') === 0 || !@is_dir($root . $id . '/' . $file) || $file == 'CVS') {
             continue;
         }
         if (!empty($id)) {
             $pref = $id . '/';
         } else {
             $pref = '';
         }
         $folders[] = (object) array('id' => $pref . $file, 'name' => $file);
     }
     return $folders;
     /*
     if (session_admin ()) {
     	$function = 'session_allowed_sql';
     } else {
     	$function = 'session_approved_sql';
     }
     if (! $id) {
     	$id = '';
     }
     return db_fetch_array ('select id, name from webpages_folder where parent_id = ? and ' . $function (), $id);
     */
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:34,代码来源:PageBrowser.php

示例3: getTemplates

 function getTemplates($path = false)
 {
     if (!$path) {
         $path = 'inc/html/' . conf('Server', 'default_template_set');
     }
     $templates = array('' => 'Inherit', 'default' => 'Default');
     loader_import('saf.File.Directory');
     $dir = new Dir();
     if (!$dir->open($path)) {
         return $templates;
     }
     foreach ($dir->read_all() as $file) {
         if (strpos($file, '.') === 0 || @is_dir($path . '/' . $file)) {
             continue;
         }
         if (preg_match('/^html.([^\\.]+)\\.tpl$/', $file, $regs)) {
             if ($regs[1] == 'default') {
                 continue;
             }
             $templates[$regs[1]] = ucfirst($regs[1]);
         }
     }
     asort($templates);
     return $templates;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:25,代码来源:Templates.php

示例4: getThemes

 function getThemes($path = false)
 {
     if (!$path) {
         $path = site_docroot() . '/inc/app/sitepresenter/themes';
     }
     $themes = array();
     //'' => 'Default');
     loader_import('saf.File.Directory');
     $dir = new Dir();
     if (!$dir->open($path)) {
         return $themes;
     }
     foreach ($dir->read_all() as $file) {
         if (strpos($file, '.') === 0 || !@is_dir($path . '/' . $file)) {
             continue;
         }
         //if (preg_match ('/^html.([^\.]+)\.tpl$/', $file, $regs)) {
         //if ($regs[1] == 'default') {
         //	continue;
         //}
         $themes[$file] = ucfirst($file);
         //}
     }
     return $themes;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:25,代码来源:Theme.php

示例5: 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

示例6: listAll

 /**
  * Returns an array of all installed modules as Module objects.
  * 
  * @access	public
  * @return	array
  * 
  */
 function listAll()
 {
     global $loader;
     $loader->import('saf.File.Directory');
     $d = new Dir('mod');
     $dirs = $d->read_all();
     $mods = array();
     foreach ($dirs as $dir) {
         if ($dir == '_backup' || $dir == '.' || $dir == '..') {
             continue;
         }
         if (@file_exists('mod/' . $dir . '/settings.php')) {
             $tmp = new Module($dir);
             if (!$tmp->error) {
                 array_push($mods, $tmp);
             }
         }
     }
     return $mods;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:27,代码来源:Module.php

示例7: Dir

<?php

if (!session_admin()) {
    return;
}
$applications = parse_ini_file('inc/conf/auth/applications/index.php');
loader_import('saf.File.Directory');
$d = new Dir('inc/app');
$apps = array();
foreach ($d->read_all() as $file) {
    if (strpos($file, '.') === 0 || !@is_dir('inc/app/' . $file) || !@file_exists('inc/app/' . $file . '/conf/config.ini.php') || in_array($file, array('cms', 'usradm'))) {
        continue;
    }
    if (session_is_resource('app_' . $file) && !session_allowed('app_' . $file, 'rw', 'resource')) {
        continue;
    }
    if (isset($applications[$file]) && !$applications[$file]) {
        continue;
    }
    $c = @parse_ini_file('inc/app/' . $file . '/conf/config.ini.php');
    if (!isset($c['admin_handler']) || !isset($c['admin_handler_type']) || isset($c['admin']) && !$c['admin']) {
        continue;
    }
    if (!isset($c['app_name'])) {
        $c['app_name'] = $file;
    }
    if ($c['admin_handler_type'] == 'box') {
        $type = 'action';
    } else {
        $type = $c['admin_handler_type'];
    }
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例8: 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

示例9: Dir

    return;
}
page_title(intl_get('AppDoc'));
echo '<p>';
//echo '<a href="' . site_prefix () . '/index/appdoc-translation-action?appname=GLOBAL">' . intl_get ('Global Translation') . '</a>';
//echo ' &nbsp; &nbsp; ';
echo '<a href="' . site_prefix() . '/index/help-app?appname=appdoc">' . intl_get('Help') . '</a>';
echo '</p>';
echo '<p>' . intl_get('Choose an app') . ':</p>';
loader_import('saf.File.Directory');
$dir = new Dir(getcwd() . '/inc/app');
if (!$dir->handle) {
    die($dir->error);
}
$apps = array();
$files = $dir->read_all();
echo '<ul>' . NEWLINE;
foreach ($files as $file) {
    if (strpos($file, '.') === 0 || $file == 'CVS') {
        continue;
    } elseif (@is_dir(getcwd() . '/inc/app/' . $file)) {
        // get name
        $info = ini_parse(getcwd() . '/inc/app/' . $file . '/conf/config.ini.php', false);
        if (isset($info['app_name'])) {
            $name = $info['app_name'];
        } else {
            $name = ucfirst($file);
        }
        echo '<li><a href="' . site_prefix() . '/index/appdoc-appinfo-action?appname=' . $file . '">' . $name . '</a></li>' . NEWLINE;
    }
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例10: getMods

 /**
  * Fills the $tables property with a list of Sitellite modules.
  * 
  * @access	public
  * 
  */
 function getMods()
 {
     global $loader;
     $loader->import('saf.App.Module');
     $loader->import('saf.File.Directory');
     $dir = new Dir(getcwd() . '/mod');
     $files = $dir->read_all();
     foreach ($files as $file) {
         if (ereg("^\\.+\$", $file)) {
             continue;
         }
         $module = new Module($file);
         if (!empty($module->name)) {
             $this->tables[$file] = $module->name;
         }
     }
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:23,代码来源:Allow.php

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