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


PHP Dir::find方法代码示例

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


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

示例1: upgrade_db

function upgrade_db($out = false)
{
    loader_import('saf.File.Directory');
    $files = Dir::find('*-' . upgrade_version_num() . '.sql', 'upgrade');
    if (count($files) == 0) {
        return true;
    }
    $file = array_shift($files);
    $sql = join('', file($file));
    $sql = sql_split($sql);
    foreach ($sql as $query) {
        if ($out) {
            echo '<pre>' . $query . '</pre>';
        }
        if (!db_execute($query)) {
            return false;
        }
    }
    return true;
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:20,代码来源:Functions.php

示例2: postElimDir

 public function postElimDir()
 {
     $id = Input::get('id');
     $dir = Dir::find($id);
     $dir->deleted = 1;
     if ($dir->save()) {
         return Response::json(array('type' => 'success', 'msg' => 'Se ha eliminado la dirección.'));
     } else {
         return Response::json(array('type' => 'danger', 'msg' => 'Error al eliminar la dirección.'));
     }
 }
开发者ID:bakuryuthem0,项目名称:nia,代码行数:11,代码来源:UserController.php

示例3: getServices

 /**
  * List all the services for a given app.  Return value is a 2-dimensional
  * array, with the keys being the service names, and the values being the
  * parsed contents of the service.php files.
  *
  * @access public
  * @param string
  * @return array
  *
  */
 function getServices($app)
 {
     $services = array();
     loader_import('saf.File.Directory');
     $files = Dir::find('service.php', 'inc/app/' . $app . '/boxes', true);
     foreach ($files as $file) {
         $c = ini_parse($file, false);
         $c['handler'] = 'box:' . str_replace('inc/app/' . $app . '/boxes', $app, $file);
         $c['handler'] = str_replace('/service.php', '', $c['handler']);
         $c['actions'] = preg_split('/, ?/', $c['actions']);
         $c['active'] = Workflow::active($c['name'], $c['actions']);
         $services[$c['name']] = $c;
     }
     return $services;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:25,代码来源:Workflow.php

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

示例5: str_replace

    $style = str_replace(' ', '', $style);
    //find last slash
    $lastslash = strrpos($style, '/');
    //break up $style into file and folder
    $file_name = substr($style, $lastslash + 1);
    $style_path = substr($style, 0, $lastslash);
    //remove leading inc/html/ from path
    $style_path = str_replace('inc/html/', '', $style_path);
    if (substr($style_path, 0, 1) == '/') {
        $style_path = substr($style_path, 1);
    }
    $name = str_replace('.css', '', $file_name);
    $data['styles'][] = array('path' => $style_path, 'file' => $file_name, 'name' => $name);
}
//the below code populates $data['images']
$allfiles = Dir::find('*.(jpg|png|gif)', 'inc/html/' . $path . '/pix');
//info($allfiles);
foreach ($allfiles as $image) {
    if (strpos($image, '/.') || @is_dir($image) || strpos($image, 'CVS')) {
        continue;
    }
    $width;
    $height;
    //remove whitespace from file
    $image = str_replace(' ', '', $image);
    //find last slash
    $lastslash = strrpos($image, '/');
    //break up $image into file and folder
    $file_name = substr($image, $lastslash + 1);
    $image_path = substr($image, 0, $lastslash);
    //remove leading inc/html/ from path
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例6: help_get_pages

function help_get_pages($appname, $lang)
{
    loader_import('saf.File.Directory');
    $files = Dir::find('*.html', 'inc/app/' . $appname . '/docs/' . $lang);
    if (count($files) == 0) {
        return array();
        // no help files
    }
    foreach ($files as $k => $v) {
        if (strstr($v, '/.')) {
            unset($files[$k]);
        }
    }
    sort($files);
    return $files;
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:16,代码来源:Help.php

示例7: getData

 /**
  * Retrieves the data from  and stores it in $data.
  */
 function getData()
 {
     foreach (Dir::find('*.php', $this->dir, false) as $file) {
         if (strpos($file, '.') === 0) {
             continue;
         }
         $inidata = ini_parse($file, true);
         $this->data[$inidata['role']['name']] = $inidata;
     }
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:13,代码来源:Manager.php

示例8: header

<?php

// BEGIN CLI KEEPOUT CHECKING
if (php_sapi_name() !== 'cli') {
    // Add these lines to the very top of any file you don't want people to
    // be able to access directly.
    header('HTTP/1.1 404 Not Found');
    echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" . "<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n" . "The requested URL " . $PHP_SELF . " was not found on this server.<p>\n<hr>\n" . $_SERVER['SERVER_SIGNATURE'] . "</body></html>";
    exit;
}
// END CLI KEEPOUT CHECKING
include_once 'init.php';
$loader->import('saf.File.Directory');
$skip = '/^lib\\/(CVS|Ext|PEAR)/';
$files = Dir::find('*.php', 'lib', 1);
$new_tests = array();
foreach ($files as $k => $file) {
    if (preg_match($skip, $file)) {
        unset($files[$k]);
        continue;
    }
    $test_file = preg_replace('/\\.php$/', '', strtolower($file));
    $test_file = explode('/', $test_file);
    array_shift($test_file);
    if ($test_file[0] == $test_file[1]) {
        array_shift($test_file);
    }
    if ($test_file[count($test_file) - 1] == $test_file[count($test_file) - 2]) {
        array_pop($test_file);
    }
    $test_file = join('_', $test_file) . '.phpt';
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:test-generator.php

示例9: foreach

    foreach ($settings as $k => $v) {
        if ($k == 'Meta') {
            continue;
        }
        $attrs[] = (object) array('name' => $k, 'typedef' => ini_write($v));
    }
    //info ($settings);
} else {
    $attrs = db_fetch_array('select * from xed_attributes where element = ? order by id asc', $cgi->tag);
    $defaults = db_fetch_array('select * from xed_attributes where element = ? order by id asc', 'default');
    $attrs = array_merge($attrs, $defaults);
}
$css = new CSS_Parser();
$classes = array();
$ids = array();
foreach (Dir::find('*.css', 'inc/html/' . conf('Server', 'default_template_set')) as $file) {
    $css->parse(@join('', @file($file)));
    $classes = array_merge($classes, $css->getClasses($cgi->tag));
    $ids = array_merge($ids, $css->getIDs($cgi->tag));
}
$classes = array_unique($classes);
$ids = array_unique($ids);
$form = new MailForm();
ini_add_filter('ini_filter_split_comma_single', array('rule 0', 'rule 1', 'rule 2', 'rule 3', 'rule 4', 'rule 5', 'rule 6', 'rule 7', 'rule 8', 'button 0', 'button 1', 'button 2', 'button 3', 'button 4', 'button 5', 'button 6', 'button 7', 'button 8', 'submitButtons'));
foreach ($attrs as $attr) {
    $w =& $form->createWidget($attr->name, ini_parse($attr->typedef, false));
    if (isset($cgi->{$attr->name})) {
        $w->setDefault($cgi->{$attr->name});
    }
}
ini_clear();
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例10: loader_import

<?php

loader_import('saf.File.Directory');
$parameters['images'] = Dir::find('*.jpg', 'pix/' . $parameters['folder']);
header('Content-Type: text/xml');
echo template_simple('xml.spt', $parameters);
exit;
开发者ID:vojtajina,项目名称:sitellite,代码行数:7,代码来源:index.php

示例11: array

<?php

global $cgi;
$data = array();
$content_types = array();
$GLOBALS['_content_weights'] = array();
$applications = parse_ini_file('inc/conf/auth/applications/index.php');
loader_import('saf.File.Directory');
$files = Dir::find('*.php', 'inc/app/cms/conf/collections', false);
foreach ($files as $file) {
    if (strstr($file, '/.')) {
        continue;
    }
    $data = ini_parse($file);
    $GLOBALS['_content_weights'][$data['Collection']['name']] = $data['Collection']['list_weight'];
    if (!isset($data['Collection']['visible']) || $data['Collection']['visible'] != false) {
        if (session_is_resource($data['Collection']['name']) && !session_allowed($data['Collection']['name'], 'rw', 'resource')) {
            continue;
        }
        if (isset($data['Collection']['app']) && isset($applications[$data['Collection']['app']]) && !$applications[$data['Collection']['app']]) {
            continue;
        }
        $content_types[$data['Collection']['name']] = intl_get($data['Collection']['display']);
    }
}
function cms_collection_sort($a, $b)
{
    global $_content_weights, $_content_types;
    if ($a == $b) {
        return 0;
    }
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例12: COPY

 /**
  * COPY method handler
  *
  * @param  array  general parameter passing array
  * @return bool   true on success
  */
 function COPY($options, $del = false)
 {
     // TODO Property updates still broken (Litmus should detect this?)
     $options['path'] = rtrim($this->_path(), '/');
     $options['dest'] = rtrim($this->_fix_name($options['dest']), '/');
     // $options['path'] is '/path/file1.ext'
     // $options['dest'] is '/path/file2.ext'
     // these do not include /webfiles-app nor /inc/data
     // strip dot-files
     if (strpos($options['dest'], '/.') !== false) {
         $this->_debug(__LINE__, 403, 'Can\'t upload dot-files: ' . $options['dest']);
         return '403 Forbidden';
     }
     if ($del && $this->checkLock($options['path'], true)) {
         $this->_debug(__LINE__, 423, 'Locked: ' . $options['path']);
         return '423 Locked';
     }
     if (!empty($this->_SERVER["CONTENT_LENGTH"])) {
         // no body parsing yet
         $this->_debug(__LINE__, 415, 'Unsupported media type?');
         return "415 Unsupported media type";
     }
     // no copying to different WebDAV Servers yet
     // dest_url is set if the url is not within the same webdav repository
     if (isset($options["dest_url"])) {
         $this->_debug(__LINE__, 502, 'Can\'t copy from one repos to another: ' . $options['dest_url']);
         return "502 bad gateway";
     }
     // $source is inc/data/path/file1.ext
     $source = strtolower($this->base . $options["path"]);
     if (!file_exists($source)) {
         $this->_debug(__LINE__, 404, 'Not found: ' . $source);
         return "404 Not found";
     }
     // $dest is inc/data/path/file2.ext
     $dest = strtolower($this->base . $options["dest"]);
     $new = !file_exists($dest);
     $existing_col = false;
     // this part is still fuzzy...
     if (!$new) {
         if ($del && is_dir($dest)) {
             if (!$options["overwrite"]) {
                 $this->_debug(__LINE__, 412, 'Conditions failed since dir already exists: ' . $dest . ' (new=false, del=true, is_dir=true, overwrite=false)');
                 return "412 precondition failed";
             }
             //$dest .= basename ($source);
             //if (file_exists ($dest)) {
             //	$options["dest"] .= basename ($source);
             //} else {
             //	$new		  = true;
             //	$existing_col = true;
             //}
         }
     }
     // delete destination first if we're overwriting
     if (!$new) {
         if ($options["overwrite"]) {
             if (@file_exists($dest)) {
                 $stat = $this->DELETE(array("dest" => $options["dest"]));
                 if ($stat[0] != "2" && substr($stat, 0, 3) != "404") {
                     $this->_debug(__LINE__, substr($stat, 0, 3), 'Failed on delete: ' . $options['dest']);
                     return $stat;
                 }
             }
         } elseif (@file_exists($dest) && !$options['overwrite']) {
             $this->_debug(__LINE__, 412, 'Conditions failed since file already exists: ' . $dest . ' (new=false, file_exists=true, overwrite=false)');
             return "412 precondition failed";
         }
     }
     //if (is_dir ($source) && ($options["depth"] != "infinity")) {
     // RFC 2518 Section 9.2, last paragraph
     //return "400 Bad request";
     //}
     if ($del) {
         loader_import('saf.File.Directory');
         if (is_dir($source)) {
             $files = array_merge(array($source), Dir::find('*', $source, 1));
             //$files = array_reverse ($files);
             if (!is_array($files) || count($files) == 0) {
                 $this->_debug(__LINE__, 500, 'No files from source: ' . $source);
                 return '500 Internal server error';
             }
             // todo: handle recursive moves!!!
             foreach ($files as $file) {
                 if ($file == $source) {
                     if (!mkdir($dest, 0777)) {
                         $this->_debug(__LINE__, 409, 'Mkdir failed: ' . $dest);
                         return '409 Conflict';
                     }
                 } elseif (is_dir($file)) {
                     $destfile = str_replace($source, $dest, $file);
                     $res = Dir::build($destfile, 0777);
                     if (!$res) {
                         $this->_debug(__LINE__, 409, 'Mkdir recursive failed: ' . $destfile);
//.........这里部分代码省略.........
开发者ID:vojtajina,项目名称:sitellite,代码行数:101,代码来源:Server.php

示例13: loader_import

<?php

loader_import('saf.File.Directory');
loader_import('monoslideshow.Functions');
if (!empty($parameters['folder'])) {
    $folder = 'pix/' . $parameters['folder'];
} else {
    $folder = 'pix';
}
$images = Dir::find('*.jpg', $folder);
$parameters['images'] = array();
$parameters['album_thumb'] = false;
foreach ($images as $image) {
    $thumb = monoslideshow_thumbnail($image);
    $parameters['images'][] = array('image' => $image, 'thumb' => $thumb);
    if (!$parameters['album_thumb']) {
        $parameters['album_thumb'] = $thumb;
    }
}
//info ($parameters);
//exit;
header('Content-Type: text/xml');
echo template_simple('xml.spt', $parameters);
exit;
开发者ID:vojtajina,项目名称:sitellite,代码行数:24,代码来源:index.php

示例14: getClass

 /**
  * Compiles all the data for a given class and its properties and methods.
  */
 function getClass($package, $cls)
 {
     $app = array_shift(explode('.', $package));
     if ($app == 'saf') {
         $prefix = 'saf/lib/';
     } else {
         $prefix = 'inc/app/' . $app . '/lib/';
     }
     if (@is_dir($prefix . str_replace($app . '.', '', $package))) {
         $files = Dir::find('*.php', $prefix . str_replace($app . '.', '', $package), true);
     } else {
         $files = array();
     }
     if (@file_exists($prefix . str_replace($app . '.', '', $package) . '.php')) {
         $files[] = $prefix . str_replace($app . '.', '', $package) . '.php';
     } elseif (@file_exists($prefix . '_' . str_replace($app . '.', '', $package) . '.php')) {
         $files[] = $prefix . '_' . str_replace($app . '.', '', $package) . '.php';
     }
     $out = array('name' => $cls, 'package' => $package, 'info' => array(), 'vars' => array(), 'methods' => array(), 'params' => array());
     $class = false;
     $class_name = false;
     $class_count = 0;
     $count = 0;
     foreach ($files as $file) {
         $src = file_get_contents($file);
         $tokens = token_get_all($src);
         foreach ($tokens as $k => $token) {
             if (is_string($token)) {
                 if (strpos($token, '{') !== false) {
                     $count++;
                 } elseif (strpos($token, '}') !== false) {
                     $count--;
                     if ($class !== false && $count <= $class_count) {
                         $class = false;
                         $class_count = 0;
                     }
                 }
                 continue;
             }
             if ($token[0] == T_CLASS) {
                 $class = true;
                 $class_count = $count;
                 $class_name = $tokens[$k + 2][1];
                 if ($class_name == $cls) {
                     $info = Docs::_getClass($k, $tokens);
                     $out['extends'] = $info->class_extends;
                     $out['comment'] = $info->comment;
                     $out['code'] = $info->code;
                     $out['params'] = $info->params;
                 }
             }
             if ($token[0] == T_VAR && count($out['methods']) == 0) {
                 $out['vars'][$tokens[$k + 2][1]] = Docs::_getVar($k, $tokens);
             }
             if ($token[0] == T_FUNCTION) {
                 if ($class && $class_name == $cls) {
                     if ($tokens[$k + 2] == '&') {
                         $out['methods'][$tokens[$k + 3][1]] = Docs::_getFunction($k, $tokens);
                     } else {
                         $out['methods'][$tokens[$k + 2][1]] = Docs::_getFunction($k, $tokens);
                     }
                 }
             }
         }
     }
     return $out;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:70,代码来源:Docs.php

示例15: unset

    $apps[$apps[$k]] = Workflow::getServices($k);
    unset($apps[$k]);
}
if (empty($cgi->submit_button)) {
    echo template_simple('workflow.spt', $apps);
} else {
    $services = array();
    foreach ($apps as $app) {
        foreach ($app as $service) {
            if ($parameters[$service['name']]) {
                foreach ($service['actions'] as $action) {
                    if (!is_array($services[$action])) {
                        $services[$action] = array();
                    }
                    $services[$action]['service:' . $service['name']] = array('name' => $service['title'], 'handler' => $service['handler']);
                }
            }
        }
    }
    loader_import('saf.File');
    loader_import('saf.File.Directory');
    foreach ($services as $action => $servs) {
        file_overwrite('inc/app/cms/conf/services/' . $action . '.php', ini_write($servs));
    }
    foreach (Dir::find('*.php', 'inc/app/cms/conf/services') as $file) {
        if (!isset($services[str_replace('.php', '', basename($file))])) {
            file_overwrite($file, ini_write(array()));
        }
    }
    echo '<p>' . intl_get('Workflow settings saved.') . '  <a href="' . site_prefix() . '/index/cms-cpanel-action">' . intl_get('Continue') . '</a></p>';
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php


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