本文整理汇总了PHP中files::scandir方法的典型用法代码示例。如果您正苦于以下问题:PHP files::scandir方法的具体用法?PHP files::scandir怎么用?PHP files::scandir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类files
的用法示例。
在下文中一共展示了files::scandir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isDeletable
function isDeletable($f)
{
if (is_file($f)) {
return is_writable(dirname($f));
} elseif (is_dir($f)) {
return is_writable(dirname($f)) && count(files::scandir($f)) <= 2;
}
}
示例2: array_merge
$ductile_counts = array_merge($ductile_counts_base, $ductile_counts);
$ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme . '_stickers');
$ductile_stickers = @unserialize($ductile_stickers);
// If no stickers defined, add feed Atom one
if (!is_array($ductile_stickers)) {
$ductile_stickers = array(array('label' => __('Subscribe'), 'url' => $core->blog->url . $core->url->getURLFor('feed', 'atom'), 'image' => 'sticker-feed.png'));
}
$ductile_stickers_full = array();
// Get all sticker images already used
if (is_array($ductile_stickers)) {
foreach ($ductile_stickers as $v) {
$ductile_stickers_full[] = $v['image'];
}
}
// Get all sticker-*.png in img folder of theme
$ductile_stickers_images = files::scandir($img_path);
if (is_array($ductile_stickers_images)) {
foreach ($ductile_stickers_images as $v) {
if (preg_match('/^sticker\\-(.*)\\.png$/', $v)) {
if (!in_array($v, $ductile_stickers_full)) {
// image not already used
$ductile_stickers[] = array('label' => null, 'url' => null, 'image' => $v);
}
}
}
}
$conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html';
if (!empty($_POST)) {
try {
# HTML
if ($conf_tab == 'html') {
示例3: ductileEntriesList
public static function ductileEntriesList($attr)
{
global $core;
$tpl_path = dirname(__FILE__) . '/tpl/';
$list_types = array('title', 'short', 'full');
// Get all _entry-*.html in tpl folder of theme
$list_types_templates = files::scandir($tpl_path);
if (is_array($list_types_templates)) {
foreach ($list_types_templates as $v) {
if (preg_match('/^_entry\\-(.*)\\.html$/', $v, $m)) {
if (isset($m[1])) {
if (!in_array($m[1], $list_types)) {
// template not already in full list
$list_types[] = $m[1];
}
}
}
}
}
$default = isset($attr['default']) ? trim($attr['default']) : 'short';
$ret = '<?php ' . "\n" . 'switch (tplDuctileTheme::ductileEntriesListHelper(\'' . $default . '\')) {' . "\n";
foreach ($list_types as $v) {
$ret .= ' case \'' . $v . '\':' . "\n" . '?>' . "\n" . $core->tpl->includeFile(array('src' => '_entry-' . $v . '.html')) . "\n" . '<?php ' . "\n" . ' break;' . "\n";
}
$ret .= '}' . "\n" . '?>';
return $ret;
}