Beispiel #1
0
 public static function info($src)
 {
     if (!Path::theme($src)) {
         return array();
     }
     $rr = Load::srcInfo($src);
     $ext = $rr['ext'];
     $size = filesize(Path::theme($src));
     if (in_array($ext, array('mht', 'tpl', 'html', 'txt', 'php'))) {
         $rr = Mht::preview($src);
     } elseif (in_array($ext, array('docx'))) {
         $rr = Docx::preview($src);
     }
     $rr['size'] = round($size / 1000000, 2);
     //Mb
     if (!empty($rr['links'])) {
         $links = $rr['links'];
         unset($rr['links']);
         foreach ($links as $v) {
             $r = preg_match('/http.*youtube\\.com.*watch.*=([\\w\\-]+).*/', $v['href'], $match);
             $r2 = preg_match('/http.{0,1}:\\/\\/youtu\\.be\\/([\\w\\-]+)/', $v['href'], $match);
             if ($r) {
                 if (empty($rr['video'])) {
                     $rr['video'] = array();
                 }
                 $v['id'] = $match[1];
                 $rr['video'][] = $v;
             } elseif ($r2) {
                 if (empty($rr['video'])) {
                     $rr['video'] = array();
                 }
                 $v['id'] = $match[1];
                 $rr['video'][] = $v;
             } else {
                 if (empty($rr['links'])) {
                     $rr['links'] = array();
                 }
                 $rr['links'][] = $v;
             }
         }
     }
     if (!empty($rr['name'])) {
         $dir = Path::theme($rr['folder'] . $rr['name'] . '/');
         if ($dir) {
             $list = array();
             array_map(function ($file) use(&$list, $src) {
                 if ($file[0] == '.') {
                     return;
                 }
                 //if (!is_file($dir.$file)) return;
                 $fd = Load::nameinfo($file);
                 if (!in_array($fd['ext'], ['jpeg', 'jpg', 'png'])) {
                     return;
                 }
                 $list[] = Path::toutf($fd);
             }, scandir($dir));
             Load::sort($list, 'ascending');
             foreach ($list as $k => $fd) {
                 $list[$k] = Path::toutf($fd['file']);
             }
             $rr['gallerydir'] = $rr['folder'] . $rr['name'] . '/';
             $rr['gallery'] = $list;
         }
     }
     return $rr;
 }
Beispiel #2
0
    }
    list($start, $count) = $p;
    $list = Access::cache(__FILE__, function ($dir) {
        $list = array();
        array_map(function ($file) use(&$list, $dir) {
            if ($file[0] == '.') {
                return;
            }
            if ($file[0] == '~') {
                return;
            }
            //Скрытый файл Word
            if (!is_file(Path::theme($dir) . $file)) {
                return;
            }
            $fd = Load::nameinfo($file);
            if (!in_array($fd['ext'], array('docx', 'html', 'tpl'))) {
                return;
            }
            $list[] = Rubrics::info(Path::toutf($dir . $file));
        }, scandir(Path::theme($dir)));
        Load::sort($list);
        return $list;
    }, array($dir));
    $list = array_slice($list, $start, $count);
    $ans['list'] = $list;
} else {
    if ($type == 'page') {
        if ($type == 'page') {
            $id = Ans::GET('id');
        }