コード例 #1
0
 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
0
ファイル: _config.php プロジェクト: nikrou/dotclear
$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
0
ファイル: _public.php プロジェクト: nikrou/dotclear
 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;
 }