{
  "$schema": "https://playground.wordpress.net/blueprint-schema.json",
  "landingPage": "/wp-admin/post-new.php?post_type=page",
  "preferredVersions": {
    "php": "8.0",
    "wp": "latest"
  },
  "phpExtensionBundles": [
    "kitchen-sink"
  ],
  "features": {
    "networking": true
  },
  "steps": [
    {
      "step": "login",
      "username": "admin",
      "password": "password"
    },
    {
      "step": "installPlugin",
      "pluginZipFile": {
        "resource": "wordpress.org/plugins",
        "slug": "document-gallery"
      }
    },
    {
      "step": "activatePlugin",
      "pluginPath": "document-gallery/document-gallery.php"
    },
    {
      "step": "runPHP",
      "code": "<?php require_once 'wordpress/wp-load.php'; wp_set_current_user(1); $attachment_ids = []; $files = [ ['title' => 'Sample Report 2024', 'filename' => 'report-2024.pdf'], ['title' => 'Company Presentation', 'filename' => 'presentation.pdf'], ['title' => 'Technical Documentation', 'filename' => 'docs.pdf'], ['title' => 'Meeting Minutes Q4', 'filename' => 'minutes-q4.pdf'] ]; $upload_dir = wp_upload_dir(); foreach ($files as $file) { $filepath = $upload_dir['path'] . '/' . $file['filename']; $pdf_content = '%PDF-1.4\n1 0 obj\n<<\n/Type /Catalog\n/Pages 2 0 R\n>>\nendobj\n2 0 obj\n<<\n/Type /Pages\n/Kids [3 0 R]\n/Count 1\n>>\nendobj\n3 0 obj\n<<\n/Type /Page\n/Parent 2 0 R\n/Resources <<\n/Font <<\n/F1 4 0 R\n>>\n>>\n/MediaBox [0 0 612 792]\n/Contents 5 0 R\n>>\nendobj\n4 0 obj\n<<\n/Type /Font\n/Subtype /Type1\n/BaseFont /Helvetica\n>>\nendobj\n5 0 obj\n<<\n/Length 44\n>>\nstream\nBT\n/F1 24 Tf\n100 700 Td\n(' . $file['title'] . ') Tj\nET\nendstream\nendobj\nxref\n0 6\n0000000000 65535 f\n0000000009 00000 n\n0000000058 00000 n\n0000000115 00000 n\n0000000261 00000 n\n0000000340 00000 n\ntrailer\n<<\n/Size 6\n/Root 1 0 R\n>>\nstartxref\n433\n%%EOF'; file_put_contents($filepath, $pdf_content); $attachment = [ 'guid' => $upload_dir['url'] . '/' . basename($filepath), 'post_mime_type' => 'application/pdf', 'post_title' => $file['title'], 'post_content' => '', 'post_status' => 'inherit' ]; $attach_id = wp_insert_attachment($attachment, $filepath); require_once(ABSPATH . 'wp-admin/includes/image.php'); $attach_data = wp_generate_attachment_metadata($attach_id, $filepath); wp_update_attachment_metadata($attach_id, $attach_data); $attachment_ids[] = $attach_id; } update_option('dg_demo_attachment_ids', $attachment_ids);"
    },
    {
      "step": "runPHP",
      "code": "<?php require_once 'wordpress/wp-load.php'; wp_set_current_user(1); $page_content = '<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">Welcome to Document Gallery</h2>\n<!-- /wp:heading -->\n\n<!-- wp:paragraph -->\n<p>This demo showcases how Document Gallery displays your documents in a beautiful, gallery-style format. Below you will see automatically generated thumbnails for PDF files.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3 class=\"wp-block-heading\">Sample Document Library</h3>\n<!-- /wp:heading -->\n\n<!-- wp:document-gallery/document-gallery {\"columns\":3,\"fancy\":true,\"descriptions\":true} /-->\n\n<!-- wp:heading {\"level\":3} -->\n<h3 class=\"wp-block-heading\">Features</h3>\n<!-- /wp:heading -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\n<li><strong>Automatic Thumbnails</strong> - Generates preview images instead of generic icons</li>\n<!-- /wp:list-item -->\n\n<!-- wp:list-item -->\n<li><strong>Multiple Layouts</strong> - Grid or list view with customizable columns</li>\n<!-- /wp:list-item -->\n\n<!-- wp:list-item -->\n<li><strong>Smart Filtering</strong> - Display all attachments or filter by post/page</li>\n<!-- /wp:list-item -->\n\n<!-- wp:list-item -->\n<li><strong>Flexible Display</strong> - Show descriptions, control sorting, and open in new window</li>\n<!-- /wp:list-item --></ul>\n<!-- /wp:list -->\n\n<!-- wp:paragraph -->\n<p>Click any document thumbnail to open the file!</p>\n<!-- /wp:paragraph -->'; $page_id = wp_insert_post([ 'post_title' => 'Document Gallery Demo', 'post_content' => $page_content, 'post_status' => 'publish', 'post_type' => 'page' ]); update_option('page_on_front', $page_id); update_option('show_on_front', 'page');"
    },
    {
      "step": "runPHP",
      "code": "<?php require_once 'wordpress/wp-load.php'; if (extension_loaded('imagick')) { $dg_options = get_option('document_gallery', []); if (!isset($dg_options['thumber'])) { $dg_options['thumber'] = []; } if (!isset($dg_options['thumber']['active'])) { $dg_options['thumber']['active'] = []; } $dg_options['thumber']['active']['imagick'] = true; $dg_options['thumber']['active']['gs'] = false; $dg_options['thumber']['active']['av'] = false; if (!isset($dg_options['gallery'])) { $dg_options['gallery'] = []; } $dg_options['gallery']['fancy'] = true; update_option('document_gallery', $dg_options); }"
    }
  ]
}
