예제 #1
0
 /**
  * Get the content of the file in the trash so we can restore file information
  *  - resized images
  *  - \gp\special\Galleries::UpdateGalleryInfo($title,$content)
  *
  */
 public static function RestoreFile($title, $file, $title_info)
 {
     $file_sections = \gp\tool\Files::Get($file, 'file_sections');
     // Restore resized images
     if (count($file_sections)) {
         includeFile('image.php');
         \gp_resized::SetIndex();
         foreach ($file_sections as $section => $section_data) {
             if (!isset($section_data['resized_imgs'])) {
                 continue;
             }
             foreach ($section_data['resized_imgs'] as $image_index => $sizes) {
                 if (!isset(\gp_resized::$index[$image_index])) {
                     continue;
                 }
                 $img = \gp_resized::$index[$image_index];
                 foreach ($sizes as $size) {
                     list($width, $height) = explode('x', $size);
                     \gp\tool\Editing::CreateImage($img, $width, $height);
                 }
             }
             \gp\tool\Editing::ResizedImageUse(array(), $section_data['resized_imgs']);
         }
         \gp_resized::SaveIndex();
     }
     // Restore Galleries
     if (strpos($title_info['type'], 'gallery') !== false) {
         \gp\special\Galleries::UpdateGalleryInfo($title, $file_sections);
     }
 }