本文整理汇总了PHP中Filesystem::listFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::listFiles方法的具体用法?PHP Filesystem::listFiles怎么用?PHP Filesystem::listFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filesystem
的用法示例。
在下文中一共展示了Filesystem::listFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLanguageList
public function getLanguageList()
{
$files = Filesystem::listFiles(PATH_LANGUAGES, '*', 'json');
$tmp = array();
foreach ($files as $file) {
$t = new dbJSON($file, false);
$native = $t->db['language-data']['native'];
$locale = basename($file, '.json');
$tmp[$locale] = $native;
}
return $tmp;
}
示例2: uploader
public static function uploader()
{
global $L;
$html = '
<div id="upload-drop" class="uk-placeholder uk-text-center">
<i class="uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right"></i>' . $L->g('Upload Image') . '<br><a class="uk-form-file">' . $L->g('Drag and drop or click here') . '<input id="upload-select" type="file"></a>
</div>
<div id="progressbar" class="uk-progress uk-hidden">
<div class="uk-progress-bar" style="width: 0%;">0%</div>
</div>
';
$html .= '<select id="jsimageList" class="uk-width-1-1" size="10">';
$imagesList = Filesystem::listFiles(PATH_UPLOADS, '*', '*', true);
foreach ($imagesList as $file) {
$html .= '<option value="">' . basename($file) . '</option>';
}
$html .= '</select>';
$html .= '
<div class="uk-form-row uk-margin-top">
<button id="jsaddImage" class="uk-button uk-button-primary" type="button"><i class="uk-icon-angle-double-left"></i> ' . $L->g('Insert Image') . '</button>
</div>
';
$html .= '
<script>
$(document).ready(function() {
$("#jsaddImage").on("click", function() {
var filename = $("#jsimageList option:selected").text();
if(!filename.trim()) {
return false;
}
var textareaValue = $("#jscontent").val();
$("#jscontent").val(textareaValue + "<img src=\\""+filename+"\\" alt=\\"\\">" + "\\n");
});
$(function()
{
var progressbar = $("#progressbar");
var bar = progressbar.find(".uk-progress-bar");
var settings =
{
type: "json",
action: "' . HTML_PATH_ADMIN_ROOT . 'ajax/uploader",
allow : "*.(jpg|jpeg|gif|png)",
loadstart: function() {
bar.css("width", "0%").text("0%");
progressbar.removeClass("uk-hidden");
},
progress: function(percent) {
percent = Math.ceil(percent);
bar.css("width", percent+"%").text(percent+"%");
},
allcomplete: function(response) {
bar.css("width", "100%").text("100%");
setTimeout(function() { progressbar.addClass("uk-hidden"); }, 250);
$("#jsimageList").prepend("<option value=\'"+response.filename+"\' selected=\'selected\'>"+response.filename+"</option>");
},
notallowed: function(file, settings) {
alert("' . $L->g('Supported image file types') . ' "+settings.allow);
}
};
var select = UIkit.uploadSelect($("#upload-select"), settings);
var drop = UIkit.uploadDrop($("#upload-drop"), settings);
});
});
</script>';
echo $html;
}
示例3: uninstall
public function uninstall()
{
// Delete all files.
$files = Filesystem::listFiles($this->phpPathDB());
foreach ($files as $file) {
unlink($file);
}
// Delete the directory.
rmdir(PATH_PLUGINS_DATABASES . $this->directoryName);
}
示例4: bluditImagesV8
public static function bluditImagesV8()
{
global $L;
$html = '<!-- BLUDIT IMAGES V8 -->';
$html .= '
<div id="bludit-images-v8" class="uk-modal">
<div class="uk-modal-dialog">
<div id="bludit-images-v8-upload" class="uk-form-file uk-placeholder uk-text-center">
<div id="bludit-images-v8-drag-drop">
<div><i class="uk-icon-picture-o"></i> ' . $L->g('Upload image') . '</div>
<div style="font-size:0.8em;">' . $L->g('Drag and drop or click here') . '<input id="bludit-images-v8-file-select" type="file"></div>
</div>
<div id="bludit-images-v8-progressbar" class="uk-progress">
<div class="uk-progress-bar" style="width: 0%;">0%</div>
</div>
</div>
<div id="bludit-images-v8-thumbnails">
';
$thumbnailList = Filesystem::listFiles(PATH_UPLOADS_THUMBNAILS, '*', '*', true);
foreach ($thumbnailList as $file) {
$filename = basename($file);
$html .= '<img class="bludit-thumbnail" src="' . HTML_PATH_UPLOADS_THUMBNAILS . $filename . '" data-filename="' . $filename . '" alt="Thumbnail">';
}
$html .= '
</div>
';
if (empty($thumbnailList)) {
$html .= '<div class="empty-images uk-block uk-text-center uk-block-muted">' . $L->g('There are no images') . '</div>';
}
$html .= '
<div class="uk-modal-footer">
' . $L->g('Double click on the image to add it') . ' <a href="" class="uk-modal-close">' . $L->g('Click here to cancel') . '</a>
</div>
</div>
</div>
';
$script = '
<script>
// Add thumbnail to Bludit Images v8
function addBluditImagev8(filename)
{
var imageSrc = HTML_PATH_UPLOADS_THUMBNAILS + filename;
// Add the new thumbnail to Bludit Images v8
$("#bludit-images-v8-thumbnails").prepend("<img class=\\"bludit-thumbnail\\" data-filename=\\""+filename+"\\" src=\\""+imageSrc+"\\" alt=\\"Thumbnail\\">");
}
$(document).ready(function() {
// Add border when select an thumbnail
$("body").on("click", "img.bludit-thumbnail", function() {
$(".bludit-thumbnail").css("border", "1px solid #ddd");
$(this).css("border", "solid 3px orange");
});
// Hide the modal when double click on thumbnail.
$("body").on("dblclick", "img.bludit-thumbnail", function() {
var modal = UIkit.modal("#bludit-images-v8");
if ( modal.isActive() ) {
modal.hide();
}
});
// Event for double click for insert the image is in each editor plugin
// ..
var settings =
{
type: "json",
action: HTML_PATH_ADMIN_ROOT+"ajax/uploader",
allow : "*.(jpg|jpeg|gif|png|svg)",
params: {"type":"bludit-images-v8"},
loadstart: function() {
$("#bludit-images-v8-progressbar").find(".uk-progress-bar").css("width", "0%").text("0%");
$("#bludit-images-v8-drag-drop").hide();
$("#bludit-images-v8-progressbar").show();
},
progress: function(percent) {
percent = Math.ceil(percent);
$("#bludit-images-v8-progressbar").find(".uk-progress-bar").css("width", percent+"%").text(percent+"%");
},
allcomplete: function(response) {
$("#bludit-images-v8-progressbar").find(".uk-progress-bar").css("width", "100%").text("100%");
$("#bludit-images-v8-progressbar").hide();
$("#bludit-images-v8-drag-drop").show();
$(".empty-images").hide();
// Add thumbnail to Bludit Images V8
addBluditImagev8(response.filename);
//.........这里部分代码省略.........
示例5: bluditImagesV8
public static function bluditImagesV8()
{
// Javascript code
include PATH_JS . 'bludit-images-v8.js';
global $L;
$html = '<!-- BLUDIT IMAGES V8 -->';
$html .= '
<div id="bludit-images-v8" class="uk-modal">
<div class="uk-modal-dialog">
<div id="bludit-images-v8-upload" class="uk-form-file uk-placeholder uk-text-center">
<div id="bludit-images-v8-drag-drop">
<div><i class="uk-icon-picture-o"></i> ' . $L->g('Upload image') . '</div>
<div style="font-size:0.8em;">' . $L->g('Drag and drop or click here') . '<input id="bludit-images-v8-file-select" type="file"></div>
</div>
<div id="bludit-images-v8-progressbar" class="uk-progress">
<div class="uk-progress-bar" style="width: 0%;">0%</div>
</div>
</div>
<div id="bludit-images-v8-thumbnails">
';
$thumbnailList = Filesystem::listFiles(PATH_UPLOADS_THUMBNAILS, '*', '*', true);
foreach ($thumbnailList as $file) {
$filename = basename($file);
$html .= '<img class="bludit-thumbnail" src="' . HTML_PATH_UPLOADS_THUMBNAILS . $filename . '" data-filename="' . $filename . '" alt="Thumbnail">';
}
$html .= '
</div>
';
$html .= '<div class="empty-images uk-block uk-text-center uk-block-muted" ' . (!empty($thumbnailList) ? 'style="display:none"' : '') . '>' . $L->g('There are no images') . '</div>';
$html .= '
<div class="uk-modal-footer">
' . $L->g('Click on the image for options') . ' <a href="" class="uk-modal-close">' . $L->g('Click here to cancel') . '</a>
</div>
</div>
</div>
';
echo $html;
}