Changeset 3232920
- Timestamp:
- 01/31/2025 08:56:16 PM (14 months ago)
- Location:
- quick-embed-pdf
- Files:
-
- 40 added
- 4 edited
-
assets/blueprints (added)
-
assets/blueprints/blueprint.json (added)
-
tags/1.0 (added)
-
tags/1.0/assets (added)
-
tags/1.0/assets/css (added)
-
tags/1.0/assets/css/viewer.css (added)
-
tags/1.0/assets/js (added)
-
tags/1.0/assets/js/pdfjs (added)
-
tags/1.0/assets/js/pdfjs/LICENSE (added)
-
tags/1.0/assets/js/pdfjs/pdf.js (added)
-
tags/1.0/assets/js/pdfjs/pdf.min.js (added)
-
tags/1.0/assets/js/pdfjs/pdf.worker.js (added)
-
tags/1.0/assets/js/pdfjs/pdf.worker.min.js (added)
-
tags/1.0/assets/js/viewer.jquery.js (added)
-
tags/1.0/includes (added)
-
tags/1.0/includes/class-qepw-admin.php (added)
-
tags/1.0/includes/class-qepw-viewer.php (added)
-
tags/1.0/quick-embed-pdf.php (added)
-
tags/1.0/readme.txt (added)
-
tags/1.1 (added)
-
tags/1.1/assets (added)
-
tags/1.1/assets/css (added)
-
tags/1.1/assets/css/block.css (added)
-
tags/1.1/assets/css/viewer.css (added)
-
tags/1.1/assets/js (added)
-
tags/1.1/assets/js/block.js (added)
-
tags/1.1/assets/js/pdfjs (added)
-
tags/1.1/assets/js/pdfjs/LICENSE (added)
-
tags/1.1/assets/js/pdfjs/pdf.js (added)
-
tags/1.1/assets/js/pdfjs/pdf.min.js (added)
-
tags/1.1/assets/js/pdfjs/pdf.worker.js (added)
-
tags/1.1/assets/js/pdfjs/pdf.worker.min.js (added)
-
tags/1.1/assets/js/viewer.jquery.js (added)
-
tags/1.1/includes (added)
-
tags/1.1/includes/class-qepw-admin.php (added)
-
tags/1.1/includes/class-qepw-viewer.php (added)
-
tags/1.1/quick-embed-pdf.php (added)
-
tags/1.1/readme.txt (added)
-
trunk/assets/css/block.css (added)
-
trunk/assets/js/block.js (added)
-
trunk/includes/class-qepw-admin.php (modified) (3 diffs)
-
trunk/includes/class-qepw-viewer.php (modified) (6 diffs)
-
trunk/quick-embed-pdf.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
quick-embed-pdf/trunk/includes/class-qepw-admin.php
r3215305 r3232920 42 42 } 43 43 44 public static function render_usage_instructions() { 45 ?> 46 <div> 47 <h3>1. Embedding in Classic Editor</h3> 48 <p>To embed a PDF file in a post or page using the plugin, use the following shortcode. Example:</p> 49 <code>[qepw_pdf_viewer file="YOUR_PDF_FILE_URL"]</code> 50 <p>Replace <code>YOUR_PDF_FILE_URL</code> with the actual URL of your PDF file.</p> 51 52 <h3>2. Embedding in Gutenberg Editor</h3> 53 <p>In the Gutenberg editor, use the "Quick Embed PDF" block. It is available in the "Embed" category in the block menu. After adding the block, select a PDF from your media library or upload a new one.</p> 54 55 <h3>3. Manually Embedding the Shortcode</h3> 56 <p>If you want to manually embed a PDF file at any place in the content, use the following shortcode:</p> 57 <code>[qepw_pdf_viewer file="YOUR_PDF_FILE_URL"]</code> 58 <p>Replace <code>YOUR_PDF_FILE_URL</code> with the link to your PDF file.</p> 59 </div> 60 <?php 61 } 62 44 63 public static function settings_page() { 45 64 ?> … … 49 68 <?php 50 69 settings_fields( 'qepw_settings' ); 51 do_settings_sections( 'qepw_settings' );52 70 ?> 53 71 <table class="form-table"> … … 74 92 <?php submit_button(); ?> 75 93 </form> 94 95 <h2>Plugin Usage</h2> 96 <div> 97 <?php self::render_usage_instructions(); ?> 98 </div> 76 99 </div> 77 100 <?php -
quick-embed-pdf/trunk/includes/class-qepw-viewer.php
r3215305 r3232920 9 9 add_action( 'wp_enqueue_scripts', [ self::class, 'conditionally_enqueue_assets' ] ); 10 10 add_filter( 'media_send_to_editor', [ self::class, 'replace_pdf_with_shortcode' ], 10, 3 ); 11 12 13 add_action( 'enqueue_block_editor_assets', [ self::class, 'enqueue_block_editor_assets' ] ); 14 } 15 16 public static function enqueue_block_editor_assets() { 17 18 wp_enqueue_script( 19 'qepw-gutenberg-block', 20 QEPW_PLUGIN_URL . 'assets/js/block.js', 21 [ 'wp-blocks', 'wp-element', 'wp-editor', 'wp-components' ], 22 QEPW_VERSION, 23 true 24 ); 25 26 27 wp_enqueue_style( 28 'qepw-gutenberg-block-style', 29 QEPW_PLUGIN_URL . 'assets/css/block.css', 30 [], 31 QEPW_VERSION 32 ); 11 33 } 12 34 … … 18 40 global $post; 19 41 if ( has_shortcode( $post->post_content, 'qepw_pdf_viewer' ) ) { 20 21 22 42 wp_register_style( 23 43 'qepw-viewer-css', … … 28 48 wp_enqueue_style( 'qepw-viewer-css' ); 29 49 30 31 50 wp_register_script( 32 51 'qepw-pdfjs-lib', … … 38 57 wp_enqueue_script( 'qepw-pdfjs-lib' ); 39 58 40 41 59 wp_register_script( 42 60 'qepw-viewer-js', … … 47 65 ); 48 66 49 50 67 wp_localize_script( 51 68 'qepw-viewer-js', … … 56 73 ); 57 74 58 59 75 wp_enqueue_script( 'qepw-viewer-js' ); 60 76 61 62 77 $pdf_width = intval( get_option( 'qepw_width', 800 ) ); 63 78 add_action( 'wp_head', function () use ( $pdf_width ) { -
quick-embed-pdf/trunk/quick-embed-pdf.php
r3215305 r3232920 3 3 * Plugin Name: Quick Embed PDF 4 4 * Description: A lightweight plugin to embed and display PDF files directly in WordPress posts and pages using a shortcode. 5 * Version: 1. 05 * Version: 1.1 6 6 * Author: Mark 7 7 * License: GPL-2.0+ … … 13 13 } 14 14 15 define( 'QEPW_VERSION', '1. 0.1' );15 define( 'QEPW_VERSION', '1.1' ); 16 16 define( 'QEPW_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 17 17 define( 'QEPW_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); -
quick-embed-pdf/trunk/readme.txt
r3215305 r3232920 1 === Quick Embed PDF ===1 === Quick Embed PDF - PDF viewer, PDF embeds, PDF Reader, PDF Embedder === 2 2 Contributors: devbook 3 Tags: pdf, pdf embed, pdf viewer, PDF Embedder, pdf download 4 Requires at least: 5.0 5 Tested up to: 6.7.1 6 Requires PHP: 7.2 7 Stable tag: 1.0 3 Tags: pdf reader, pdf embed, pdf viewer, PDF, pdf download, pdf 4 Tested up to: 6.7 5 Stable tag: 1.1 8 6 License: GPLv2 or later 9 7 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 8 11 Quickly embed and display (viewer) PDF files in WordPress posts and pages using a simple shortcode .9 Quickly embed and display (viewer) PDF files in WordPress posts and pages using a simple shortcode or Gutenberg block. 12 10 13 11 == Description == 14 12 15 Quick Embed PDF is a lightweight WordPress plugin that allows you to embed PDF files directly into your posts and pages using a simple shortcode. This plugin uses the PDF.js library to render PDF files and provides an easy-to-use admin interface for customizing the display. 13 **100% FREE** 14 15 Quick Embed PDF is a lightweight WordPress plugin that allows you to embed PDF files directly into your posts and pages using a simple shortcode or a Gutenberg block. 16 16 17 17 == Features == 18 18 19 * Embed PDF files using the `[qepw_pdf_viewer file="..."]` shortcode .19 * Embed PDF files using the `[qepw_pdf_viewer file="..."]` shortcode or the "Quick Embed PDF" block in Gutenberg. 20 20 * Customizable PDF viewer width through the admin settings. 21 21 * Supports media library integration for automatic shortcode insertion. … … 23 23 * Optional download button for users to download the PDF file. 24 24 * Lightweight and responsive design. 25 * Using [Mozilla's PDF.js](https://mozilla.github.io/pdf.js/) 25 * Improved Gutenberg support with a custom block for embedding PDFs. 26 * Option to disable the download button in the settings. 27 * Using [Mozilla's PDF.js](https://mozilla.github.io/pdf.js/). 28 * Best pdf reader wordpress plugin 26 29 30 == Usage == 31 32 ### Embedding a PDF using the Shortcode: 33 To embed a PDF file into your post or page using the plugin, use the following shortcode: 34 `[qepw_pdf_viewer file="YOUR_PDF_FILE_URL"]` 35 36 Replace `YOUR_PDF_FILE_URL` with the actual URL of the PDF file. 37 38 ### Embedding a PDF using the Gutenberg Block: 39 1. In the Gutenberg editor, add the "Quick Embed PDF" block from the "Embed" category. 40 2. Select the PDF file from your media library or upload a new one. 41 3. The PDF will be embedded and displayed directly in your post or page. 42 43 ### Customizing the PDF Viewer: 44 You can customize the width of the PDF viewer in the plugin's settings page. There, you can also enable or disable the download button. 27 45 28 46 == Installation == … … 31 49 2. Activate the plugin through the 'Plugins' menu in WordPress. 32 50 3. Go to the settings page under 'Settings > Quick Embed PDF' to configure options. 33 4. Use the `[qepw_pdf_viewer file="URL"]` shortcode to embed a PDF in your posts or pages. 51 4. Use the `[qepw_pdf_viewer file="YOUR_PDF_FILE_URL"]` shortcode to embed a PDF in your posts or pages. 52 5. Alternatively, use the "Quick Embed PDF" block in Gutenberg to insert PDF files directly. 34 53 35 54 == Frequently Asked Questions == 36 55 37 56 = How do I use the plugin? = 38 Use the `[pdf_viewer file="URL"]` shortcode in your post or page content, replacing `URL` with the URL of the PDF file you want to embed. 57 Use the `[qepw_pdf_viewer file="YOUR_PDF_FILE_URL"]` shortcode in your post or page content, replacing `YOUR_PDF_FILE_URL` with the URL of the PDF file you want to embed. Alternatively, use the "Quick Embed PDF" block in Gutenberg for easier embedding. 58 59 = How do I embed a PDF into WordPress? = 60 To embed a PDF into WordPress, you can use either the `[qepw_pdf_viewer file="YOUR_PDF_FILE_URL"]` shortcode or the "Quick Embed PDF" block in the Gutenberg editor. Replace `YOUR_PDF_FILE_URL` with the actual URL of your PDF file. 39 61 40 62 = Can I customize the PDF viewer's width? = … … 49 71 == Screenshots == 50 72 1. Admin page Quick Embed PDF 51 2. Example on the page73 2. Gutenberg block for embedding PDF files. 52 74 53 75 == Changelog == 54 76 55 = 1.0.0 = 77 = 1.1 – January 31, 2025 = 78 * Added Gutenberg block for embedding PDF files directly. 79 * Improved functionality for embedding PDFs through the block. 80 * Updated the settings page to allow disabling the download button. 81 * Minor bug fixes and performance improvements. 82 83 = 1.0 = 56 84 * Initial release. 57 85 * Added shortcode functionality to embed PDF files. … … 59 87 * Provided admin settings for customizing viewer width. 60 88 * Automatic shortcode insertion for PDFs added through the media library. 61 62 89 * Added Gutenberg block for embedding PDF files easily.
Note: See TracChangeset
for help on using the changeset viewer.