Plugin Directory

Changeset 3414845


Ignore:
Timestamp:
12/09/2025 03:23:33 AM (4 months ago)
Author:
dan.rossiter
Message:

Testing revised blueprint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • document-gallery/assets/blueprints/blueprint.json

    r3414834 r3414845  
    2626    },
    2727    {
    28       "step": "runPHP",
    29       "code": "<?php require_once 'wordpress/wp-load.php'; wp_set_current_user(1); $attachment_ids = []; $files = [ ['title' => 'Sample Report 2024', 'filename' => 'report-2024.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(Sample Report 2024) 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', 'mime' => 'application/pdf'], ['title' => 'Company Presentation', 'filename' => 'presentation.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 51\\n>>\\nstream\\nBT\\n/F1 24 Tf\\n100 700 Td\\n(Company Presentation) 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\\n440\\n%%EOF', 'mime' => 'application/pdf'], ['title' => 'Technical Documentation', 'filename' => 'docs.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 56\\n>>\\nstream\\nBT\\n/F1 24 Tf\\n100 700 Td\\n(Technical Documentation) 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\\n445\\n%%EOF', 'mime' => 'application/pdf'], ['title' => 'Meeting Minutes Q4', 'filename' => 'minutes-q4.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 51\\n>>\\nstream\\nBT\\n/F1 24 Tf\\n100 700 Td\\n(Meeting Minutes Q4) 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\\n440\\n%%EOF', 'mime' => 'application/pdf'] ]; $upload_dir = wp_upload_dir(); foreach ($files as $file) { $filepath = $upload_dir['path'] . '/' . $file['filename']; file_put_contents($filepath, $file['content']); $attachment = [ 'guid' => $upload_dir['url'] . '/' . basename($filepath), 'post_mime_type' => $file['mime'], '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);"
     28      "step": "activatePlugin",
     29      "pluginPath": "document-gallery/document-gallery.php"
    3030    },
    3131    {
    3232      "step": "runPHP",
    33       "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\\'ll 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');"
     33      "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);"
    3434    },
    3535    {
    3636      "step": "runPHP",
    37       "code": "<?php require_once 'wordpress/wp-load.php'; wp_set_current_user(1); $attachment_ids = get_option('dg_demo_attachment_ids', []); if (!empty($attachment_ids)) { foreach ($attachment_ids as $id) { update_post_meta($id, '_wp_attachment_image_alt', 'Document thumbnail'); } }"
     37      "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');"
     38    },
     39    {
     40      "step": "runPHP",
     41      "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); }"
    3842    }
    3943  ]
Note: See TracChangeset for help on using the changeset viewer.