本文整理汇总了PHP中Dir::ReadFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::ReadFiles方法的具体用法?PHP Dir::ReadFiles怎么用?PHP Dir::ReadFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dir
的用法示例。
在下文中一共展示了Dir::ReadFiles方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TemplateRecompileAll
function TemplateRecompileAll($directory = TEMPLATES_DIR)
{
$files = Dir::ReadFiles($directory, '~^(?!email).*?(\\.tpl$|\\.css$)~');
foreach ($files as $file) {
$compiled = TEMPLATE_COMPILE_DIR . '/' . $file;
if (($code = Template_Compiler::CompileFile($file, $directory)) === false) {
return array('message' => 'Template ' . $file . ' contains errors', 'errors' => Template_Compiler::GetErrors());
} else {
file_put_contents($compiled, $code);
@chmod($compiled, 0666);
}
}
return true;
}
示例2:
<div class="centerer">
<span class="centerer" style="width: 90%;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="header">Select Template</div>
</td>
<td style="padding-left: 10px;">
<div class="header" id="code-header" style="display: none;">Template Code For <span id="loaded-template"></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width: 20em; min-width: 20em;">
<?php
$templates = String::HtmlSpecialChars(Dir::ReadFiles(TEMPLATES_DIR, '~^email~'));
asort($templates);
?>
<div class="explorer">
<?php
foreach ($templates as $template) {
?>
<div class="explorer-template"><span><?php
echo $template;
?>
</span></div>
<?php
}
?>
</div>
</td>
示例3:
<div id="dialog-header" class="ui-widget-header ui-corner-all">
<div id="dialog-close"></div>
E-mail Template Search and Replace
</div>
<form method="post" action="ajax.php">
<div id="dialog-panel">
<div style="padding: 8px;">
<div class="field">
<label class="short">Templates:</label>
<span class="field-container">
<?php
$templates = Dir::ReadFiles(TEMPLATES_DIR, '~^email~');
asort($templates);
?>
<select name="templates[]" id="templates" multiple="multiple" size="10">
<?php
echo Form_Field::OptionsSimple($templates);
?>
</select>
</span>
</div>
<div class="field">
<label class="short">Search For:</label>
<span class="field-container"><textarea name="search" id="search" rows="5" cols="110"></textarea></span>
</div>
<div class="field">
<label class="short">Replace With:</label>
示例4: foreach
}
// Remove all database tables
foreach ($tables as $table) {
$DB->Update('DROP TABLE IF EXISTS #', array($table));
}
// Clear out directories
$dirs = array('temp', 'uploads', 'videos', 'templates/_cache');
foreach ($dirs as $dir) {
$dir = BASE_DIR . '/' . $dir;
// Remove sub-directories and their contents
$removals = Dir::ReadDirectories($dir, '~^[^.]~');
foreach ($removals as $removal) {
Dir::Remove($dir . '/' . $removal);
}
// Remove files
$files = Dir::ReadFiles($dir, '~^[^.]~');
foreach ($files as $file) {
@unlink($dir . '/' . $file);
}
}
}
$fp = fopen(__FILE__, 'r');
fseek($fp, __COMPILER_HALT_OFFSET__);
eval(stream_get_contents($fp));
fclose($fp);
__halt_compiler();?>
<html>
<head>
<title>Reset TubeX Installation</title>
</head>
<body>
示例5:
<div id="dialog-header" class="ui-widget-header ui-corner-all">
<div id="dialog-close"></div>
Site Template Search and Replace
</div>
<form method="post" action="ajax.php">
<div id="dialog-panel">
<div style="padding: 8px;">
<div class="field">
<label class="short">Templates:</label>
<span class="field-container">
<?php
$templates = Dir::ReadFiles(TEMPLATES_DIR, '~^(?!email).*?(\\.tpl$|\\.css$)~');
asort($templates);
?>
<select name="templates[]" id="templates" multiple="multiple" size="10">
<?php
echo Form_Field::OptionsSimple($templates);
?>
</select>
</span>
</div>
<div class="field">
<label class="short">Search For:</label>
<span class="field-container"><textarea name="search" id="search" rows="5" cols="110"></textarea></span>
</div>
<div class="field">
<label class="short">Replace With:</label>
示例6:
</form>
</div>
</td>
<td width="2%"></td>
<td width="49%" valign="top" class="fieldset">
<div style="position: relative;">
<div class="legend">Database Restore</div>
Use this function to restore data from a previously generated dump of your MySQL data. Note that this will overwrite all of your existing MySQL database tables!
<br />
<br />
<?php
$files = Dir::ReadFiles(BASE_DIR . '/data', '~\\.sql$~');
if (count($files)) {
?>
<b>Restore Filename:</b>
<form method="post" action="ajax.php" id="restore-form">
<select name="filename">
<?php
echo Form_Field::OptionsSimple($files);
?>
</select>
<input type="submit" value="Run Database Restore" />
<input type="hidden" name="r" value="tbxDatabaseRestore" />
<img src="images/activity-22x22.gif" border="0" title="Working..." class="activity" style="position: absolute; display: inline;" />
</form>
<?php
} else {