当前位置: 首页>>代码示例>>PHP>>正文


PHP gpFiles::ReadFolderAndFiles方法代码示例

本文整理汇总了PHP中gpFiles::ReadFolderAndFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles::ReadFolderAndFiles方法的具体用法?PHP gpFiles::ReadFolderAndFiles怎么用?PHP gpFiles::ReadFolderAndFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gpFiles的用法示例。


在下文中一共展示了gpFiles::ReadFolderAndFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: InlineList

 /**
  * Output a list a images in a director for use in inline editing
  * @static
  */
 function InlineList($dir, $dir_piece)
 {
     global $page, $langmessage, $dataDir;
     ob_start();
     $isThumbDir = false;
     $thumbFolder = $dataDir . '/data/_uploaded/image/thumbnails';
     if (strpos($dir, $thumbFolder) !== false) {
         $isThumbDir = true;
     }
     $folders = $files = array();
     $allFiles = gpFiles::ReadFolderAndFiles($dir);
     list($folders, $files) = $allFiles;
     //available images
     $avail_imgs = '<div id="gp_gallery_avail_imgs">';
     $image_count = 0;
     foreach ($files as $file) {
         $img = admin_uploaded::ShowFile_Gallery($dir_piece, $file, $isThumbDir);
         if ($img) {
             $avail_imgs .= $img;
             $image_count++;
         }
     }
     $avail_imgs .= '</div>';
     //folder select
     echo '<div class="option_area">';
     echo '<div class="gp_edit_select">';
     echo '<a href="#" class="gp_gallery_folder ckeditor_control" name="gp_show_select"><span class="folder"></span>';
     if (strlen($dir_piece) > 23) {
         echo '...' . substr($dir_piece, -20);
     } else {
         echo $dir_piece;
     }
     echo '</a>';
     echo '<div class="gp_edit_select_options">';
     if ($dir_piece != '/') {
         $temp = dirname($dir_piece);
         echo '<a href="?cmd=new_dir&dir=' . rawurlencode($dir_piece) . '" class="gp_gallery_folder" name="gpabox"><span class="add"></span>' . $langmessage['create_dir'] . '</a>';
         echo '<a class="gp_gallery_folder" name="gp_gallery_folder" rel="' . htmlspecialchars($temp) . '"><span class="folder"></span>../</a>';
     }
     foreach ($folders as $folder) {
         if ($dir_piece == '/') {
             $new_dir = '/' . $folder;
         } else {
             $new_dir = $dir_piece . '/' . $folder;
         }
         echo '<a class="gp_gallery_folder" name="gp_gallery_folder" rel="' . htmlspecialchars($new_dir) . '"><span class="folder"></span>' . $folder . '</a>';
     }
     echo '</div>';
     echo '</div>';
     //add all images
     if ($image_count > 0) {
         echo '<a href="#" name="gp_gallery_add_all" class="ckeditor_control full_width">' . $langmessage['Add All Images'] . '</a>';
     }
     if ($dir_piece != '/') {
         echo '<form action="' . common::GetUrl('Admin_Uploaded') . '" method="post"  enctype="multipart/form-data" class="gp_upload_form" id="gp_upload_form">';
         admin_uploaded::Max_File_Size();
         echo '<a href="#" class="ckeditor_control full_width">' . $langmessage['upload_files'] . '</a>';
         echo '<div class="gp_object_wrapper">';
         echo '<input type="file" name="userfiles[]" class="file" />';
         echo '<input type="hidden" name="file_cmd" value="inline_upload" />';
         echo '<input type="hidden" name="output" value="gallery" />';
         echo '<input type="hidden" name="dir" value="' . $dir_piece . '" />';
         echo '</div>';
         echo '</form>';
     }
     echo '</div>';
     echo $avail_imgs;
     $content = ob_get_clean();
     $page->ajaxReplace[] = array('gp_gallery_images', '', $content);
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:74,代码来源:admin_uploaded.php

示例2: InlineList

 /**
  * Output a list a images in a director for use in inline editing
  * @static
  */
 static function InlineList($dir_piece)
 {
     global $page, $langmessage, $dataDir;
     $page->ajaxReplace = array();
     $dir_piece = common::WinPath($dir_piece);
     $dir = $dataDir . '/data/_uploaded' . $dir_piece;
     $prev_piece = false;
     while ($dir_piece != '/' && !file_exists($dir)) {
         $prev_piece = $dir_piece;
         $dir = common::DirName($dir);
         $dir_piece = common::DirName($dir_piece);
     }
     //new directory?
     if ($prev_piece) {
         $prev_piece = gp_edit::CleanArg($prev_piece);
         $dir_piece = $prev_piece;
         $dir = $dataDir . '/data/_uploaded' . $prev_piece;
         if (!gpFiles::CheckDir($dir)) {
             message($langmessage['OOPS']);
             $dir = common::DirName($dir);
             $dir_piece = common::DirName($prev_piece);
         }
     }
     //folder information
     $folders = $files = array();
     $allFiles = gpFiles::ReadFolderAndFiles($dir);
     list($folders, $files) = $allFiles;
     //folder select
     ob_start();
     echo '<div class="gp_edit_select ckeditor_control">';
     echo '<a class="gp_selected_folder"><span class="folder"></span>';
     if (strlen($dir_piece) > 23) {
         echo '...' . substr($dir_piece, -20);
     } else {
         echo $dir_piece;
     }
     echo '</a>';
     echo '<div class="gp_edit_select_options">';
     if ($dir_piece != '/') {
         $temp = common::DirName($dir_piece);
         echo '<a href="?cmd=new_dir&dir=' . rawurlencode($dir_piece) . '" class="gp_gallery_folder" data-cmd="gpabox"><span class="add"></span>' . $langmessage['create_dir'] . '</a>';
         echo '<a class="gp_gallery_folder" data-cmd="gp_gallery_folder" data-arg="' . htmlspecialchars($temp) . '"><span class="folder"></span>../</a>';
     }
     foreach ($folders as $folder) {
         if ($dir_piece == '/') {
             $sub_dir = '/' . $folder;
         } else {
             $sub_dir = $dir_piece . '/' . $folder;
         }
         $full_dir = $dataDir . '/data/_uploaded' . $sub_dir;
         $sub_files = scandir($full_dir);
         $count = 0;
         foreach ($sub_files as $file) {
             if (admin_uploaded::IsImg($file)) {
                 $count++;
             }
         }
         echo '<a class="gp_gallery_folder" data-cmd="gp_gallery_folder" data-arg="' . htmlspecialchars($sub_dir) . '"><span class="folder"></span><span class="gp_count">' . $count . '</span>' . $folder . '</a>';
     }
     echo '</div>';
     echo '</div>';
     $gp_option_area = ob_get_clean();
     //available images
     ob_start();
     $image_count = 0;
     foreach ($files as $file) {
         $img = admin_uploaded::ShowFile_Gallery($dir_piece, $file);
         if ($img) {
             echo $img;
             $image_count++;
         }
     }
     $gp_gallery_avail_imgs = ob_get_clean();
     // Folder controls
     ob_start();
     if ($image_count > 0) {
         echo '<a data-cmd="gp_gallery_add_all" class="ckeditor_control half_width add_all_images">' . $langmessage['Add All Images'] . '</a>';
     }
     if ($dir_piece != '/') {
         echo '<form action="' . common::GetUrl('Admin_Uploaded') . '" method="post"  enctype="multipart/form-data" class="gp_upload_form" id="gp_upload_form">';
         admin_uploaded::Max_File_Size();
         echo '<a class="ckeditor_control half_width">' . $langmessage['upload_files'] . '</a>';
         echo '<div class="gp_object_wrapper">';
         echo '<input type="file" name="userfiles[]" class="file" />';
         echo '<input type="hidden" name="file_cmd" value="inline_upload" />';
         echo '<input type="hidden" name="output" value="gallery" />';
         echo '<input type="hidden" name="dir" value="' . $dir_piece . '" />';
         echo '</div>';
         echo '</form>';
     }
     $folder_options = ob_get_clean();
     //send content according to request
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'gallery_folder':
             $page->ajaxReplace[] = array('inner', '#gp_option_area', $gp_option_area);
//.........这里部分代码省略.........
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:101,代码来源:admin_uploaded.php


注:本文中的gpFiles::ReadFolderAndFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。