Changeset 3406443
- Timestamp:
- 12/01/2025 05:16:19 AM (11 months ago)
- Location:
- embed-any-document
- Files:
-
- 73 added
- 4 edited
-
tags/2.7.10 (added)
-
tags/2.7.10/awsm-embed.php (added)
-
tags/2.7.10/blocks (added)
-
tags/2.7.10/blocks/document (added)
-
tags/2.7.10/blocks/document.php (added)
-
tags/2.7.10/blocks/document/document-block.js (added)
-
tags/2.7.10/blocks/document/editor.css (added)
-
tags/2.7.10/blocks/document/index.php (added)
-
tags/2.7.10/blocks/document/main.js (added)
-
tags/2.7.10/blocks/document/modules (added)
-
tags/2.7.10/blocks/document/modules/ead-server-side-render.js (added)
-
tags/2.7.10/blocks/document/modules/helper.js (added)
-
tags/2.7.10/blocks/document/modules/icon.js (added)
-
tags/2.7.10/blocks/document/modules/index.php (added)
-
tags/2.7.10/blocks/document/modules/inspector.js (added)
-
tags/2.7.10/blocks/index.php (added)
-
tags/2.7.10/css (added)
-
tags/2.7.10/css/embed-public.css (added)
-
tags/2.7.10/css/embed-public.min.css (added)
-
tags/2.7.10/css/embed.css (added)
-
tags/2.7.10/css/embed.min.css (added)
-
tags/2.7.10/css/index.php (added)
-
tags/2.7.10/css/settings.css (added)
-
tags/2.7.10/css/settings.min.css (added)
-
tags/2.7.10/images (added)
-
tags/2.7.10/images/EAD-logo.svg (added)
-
tags/2.7.10/images/admin-media.svg (added)
-
tags/2.7.10/images/awsm-logo.png (added)
-
tags/2.7.10/images/ead-button.png (added)
-
tags/2.7.10/images/ead-icon-sprite.jpg (added)
-
tags/2.7.10/images/ead-small.png (added)
-
tags/2.7.10/images/eadplus-banner.png (added)
-
tags/2.7.10/images/icon-box.png (added)
-
tags/2.7.10/images/icon-box.svg (added)
-
tags/2.7.10/images/icon-close.png (added)
-
tags/2.7.10/images/icon-drive.png (added)
-
tags/2.7.10/images/icon-drive.svg (added)
-
tags/2.7.10/images/icon-dropbox.png (added)
-
tags/2.7.10/images/icon-dropbox.svg (added)
-
tags/2.7.10/images/icon-ead.png (added)
-
tags/2.7.10/images/icon-link.png (added)
-
tags/2.7.10/images/icon-no.png (added)
-
tags/2.7.10/images/icon-onedrive.png (added)
-
tags/2.7.10/images/icon-onedrive.svg (added)
-
tags/2.7.10/images/icon-sprite.png (added)
-
tags/2.7.10/images/icon-success.png (added)
-
tags/2.7.10/images/icon-upload.png (added)
-
tags/2.7.10/images/icon-yes.png (added)
-
tags/2.7.10/images/iconmonstr-link-1.svg (added)
-
tags/2.7.10/images/iconmonstr-upload-17.svg (added)
-
tags/2.7.10/images/index.php (added)
-
tags/2.7.10/images/loading.svg (added)
-
tags/2.7.10/images/open.svg (added)
-
tags/2.7.10/images/reload.svg (added)
-
tags/2.7.10/images/star.gif (added)
-
tags/2.7.10/images/ticket.gif (added)
-
tags/2.7.10/inc (added)
-
tags/2.7.10/inc/index.php (added)
-
tags/2.7.10/inc/popup.php (added)
-
tags/2.7.10/inc/settings.php (added)
-
tags/2.7.10/index.php (added)
-
tags/2.7.10/js (added)
-
tags/2.7.10/js/embed-public.js (added)
-
tags/2.7.10/js/embed-public.min.js (added)
-
tags/2.7.10/js/embed.js (added)
-
tags/2.7.10/js/embed.min.js (added)
-
tags/2.7.10/js/index.php (added)
-
tags/2.7.10/js/pdfobject.js (added)
-
tags/2.7.10/js/pdfobject.min.js (added)
-
tags/2.7.10/language (added)
-
tags/2.7.10/language/embed-any-document.pot (added)
-
tags/2.7.10/language/index.php (added)
-
tags/2.7.10/readme.txt (added)
-
trunk/awsm-embed.php (modified) (3 diffs)
-
trunk/js/embed-public.js (modified) (1 diff)
-
trunk/language/embed-any-document.pot (modified) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
embed-any-document/trunk/awsm-embed.php
r3399946 r3406443 4 4 * Plugin URI: http://awsm.in/embed-any-documents 5 5 * Description: Embed Any Document WordPress plugin lets you upload and embed your documents easily in your WordPress website without any additional browser plugins like Flash or Acrobat reader. The plugin lets you choose between Google Docs Viewer and Microsoft Office Online to display your documents. 6 * Version: 2.7.1 06 * Version: 2.7.11 7 7 * Author: Awsm Innovations 8 8 * Author URI: https://awsm.in … … 20 20 21 21 if ( ! defined( 'AWSM_EMBED_VERSION' ) ) { 22 define( 'AWSM_EMBED_VERSION', '2.7. 8' );22 define( 'AWSM_EMBED_VERSION', '2.7.11' ); 23 23 } 24 24 … … 563 563 } 564 564 565 /** 566 * Sanitizes the ead-document wrapper to remove unsafe attributes and prevent XSS. 567 * 568 * @param string $content The post content being filtered. 569 * @return string The sanitized post content. 570 */ 565 571 public function sanitize_pdf_src( $content ) { 566 $pattern = '/(<div[^>]*class=["\']?ead-document[^>]*data-pdf-src=)(["\'])(.*?)\2([^>]*>)/i'; 567 568 $content = preg_replace_callback( 572 if ( stripos( $content, 'ead-document' ) === false ) { 573 return $content; } 574 575 // Match any <div> with class containing 'ead-document'. 576 $pattern = '/(<div\b[^>]*?\bclass\s*=\s*["\'][^"\']*\bead-document\b[^"\']*["\'][^>]*>)/is'; 577 578 return preg_replace_callback( 569 579 $pattern, 570 function ( $matches ) { 571 $prefix = $matches[1]; 572 $quote = $matches[2]; 573 $src = $matches[3]; 574 $suffix = $matches[4]; 575 576 if ( ! preg_match( '#^https?://#i', $src ) ) { 577 $clean_src = ''; 578 } else { 579 $clean_src = esc_url_raw( $src ); 580 } 581 582 return $prefix . $quote . $clean_src . $quote . $suffix; 580 function( $matches ) { 581 $full_tag = $matches[1]; 582 583 // --------------------------------------------------- 584 // Remove on* js events (onclick, onload, onfocus, etc.) 585 // --------------------------------------------------- 586 $full_tag = preg_replace( 587 '/\s+on\w+\s*=\s*(["\'])[^"\']*\1/i', 588 '', 589 $full_tag 590 ); 591 592 // --------------------------------------------------- 593 // Remove action / formaction 594 // --------------------------------------------------- 595 $full_tag = preg_replace( 596 '/\s+(action|formaction)\s*=\s*(["\'])[^"\']*\2/i', 597 '', 598 $full_tag 599 ); 600 601 // --------------------------------------------------- 602 // Remove dangerous boolean attributes 603 // --------------------------------------------------- 604 $full_tag = preg_replace( 605 '/\s+(autofocus|autoplay|formnovalidate)(?=\s|>|\/)/i', 606 '', 607 $full_tag 608 ); 609 610 // --------------------------------------------------- 611 // Remove tabindex that could be used with autofocus 612 // --------------------------------------------------- 613 $full_tag = preg_replace( 614 '/\s+tabindex\s*=\s*(["\'])[^"\']*\1/i', 615 '', 616 $full_tag 617 ); 618 619 // --------------------------------------------------- 620 // Sanitize style="" 621 // --------------------------------------------------- 622 $full_tag = preg_replace_callback( 623 '/\s+style\s*=\s*(["\'])([^"\']*)\1/i', 624 function( $m ) { 625 $clean_style = safecss_filter_attr( $m[2] ); 626 return $clean_style ? ' style="' . $clean_style . '"' : ''; 627 }, 628 $full_tag 629 ); 630 631 // --------------------------------------------------- 632 // Specifically sanitize data-pdf-src if present 633 // --------------------------------------------------- 634 $full_tag = preg_replace_callback( 635 '/(\s+data-pdf-src\s*=\s*)(["\'])([^"\']*)\2/i', 636 function( $m ) { 637 $prefix = $m[1]; 638 $quote = $m[2]; 639 $src = $m[3]; 640 641 // Only allow http/https URLs. 642 if ( ! preg_match( '#^https?://#i', $src ) ) { 643 $clean_src = ''; 644 } else { 645 $clean_src = esc_url_raw( $src ); 646 } 647 648 return $prefix . $quote . $clean_src . $quote; 649 }, 650 $full_tag 651 ); 652 653 // --------------------------------------------------- 654 // Remove any malformed attributes (like class="ead-document=a") 655 // --------------------------------------------------- 656 $full_tag = preg_replace_callback( 657 '/\bclass\s*=\s*(["\'])([^"\']*=+[^"\']*)\1/i', 658 function( $m ) { 659 $quote = $m[1]; 660 // Keep only the part before any '=' character. 661 $class_value = preg_replace( '/=.*$/', '', $m[2] ); 662 $class_value = trim( $class_value ); 663 return $class_value ? 'class=' . $quote . esc_attr( $class_value ) . $quote : ''; 664 }, 665 $full_tag 666 ); 667 668 return $full_tag; 583 669 }, 584 670 $content 585 671 ); 586 587 return $content;588 672 } 589 673 -
embed-any-document/trunk/js/embed-public.js
r3370262 r3406443 71 71 }); 72 72 73 $(document).on('click', '.ead-reload-btn', function(e) { 73 $(document).on('click', '.ead-reload-btn', function(e) { 74 74 e.preventDefault(); 75 75 var $wrapper = $(this).parents('.ead-document'); -
embed-any-document/trunk/language/embed-any-document.pot
r3399946 r3406443 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Embed Any Document 2.7. 7\n"5 "Project-Id-Version: Embed Any Document 2.7.11\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/embed-any-document\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025- 05-02T04:22:46+00:00\n"12 "POT-Creation-Date: 2025-11-28T05:10:04+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.6.0\n" … … 16 16 17 17 #. Plugin Name of the plugin 18 #: awsm-embed.php: 56718 #: awsm-embed.php:678 19 19 #: blocks/document/main.js:144 20 20 msgid "Embed Any Document" … … 37 37 msgstr "" 38 38 39 #: awsm-embed.php:14 539 #: awsm-embed.php:147 40 40 #: inc/popup.php:18 41 41 msgid "Add Document" 42 42 msgstr "" 43 43 44 #: awsm-embed.php:1 5844 #: awsm-embed.php:160 45 45 msgid "Settings" 46 46 msgstr "" 47 47 48 #: awsm-embed.php:19 749 #: awsm-embed.php:40 548 #: awsm-embed.php:199 49 #: awsm-embed.php:407 50 50 msgid "Download" 51 51 msgstr "" 52 52 53 #: awsm-embed.php:20 453 #: awsm-embed.php:206 54 54 msgid "Nothing to insert" 55 55 msgstr "" 56 56 57 #: awsm-embed.php:20 557 #: awsm-embed.php:207 58 58 msgid "Invalid URL" 59 59 msgstr "" 60 60 61 #: awsm-embed.php:20 661 #: awsm-embed.php:208 62 62 #: inc/popup.php:39 63 63 msgid "Add URL" 64 64 msgstr "" 65 65 66 #: awsm-embed.php:20 766 #: awsm-embed.php:209 67 67 msgid "Verifying..." 68 68 msgstr "" 69 69 70 #: awsm-embed.php:2 0870 #: awsm-embed.php:210 71 71 msgid "From URL" 72 72 msgstr "" 73 73 74 #: awsm-embed.php:2 0974 #: awsm-embed.php:211 75 75 msgid "Select" 76 76 msgstr "" 77 77 78 #: awsm-embed.php:2 5978 #: awsm-embed.php:261 79 79 msgid "Loader" 80 80 msgstr "" 81 81 82 #: awsm-embed.php:26 082 #: awsm-embed.php:262 83 83 #: inc/popup.php:117 84 84 msgid "Loading..." 85 85 msgstr "" 86 86 87 #: awsm-embed.php:26 587 #: awsm-embed.php:267 88 88 msgid "EAD Logo" 89 89 msgstr "" 90 90 91 #: awsm-embed.php:26 691 #: awsm-embed.php:268 92 92 msgid "Taking too long?" 93 93 msgstr "" 94 94 95 #: awsm-embed.php:27 095 #: awsm-embed.php:272 96 96 msgid "Reload" 97 97 msgstr "" 98 98 99 #: awsm-embed.php:27 099 #: awsm-embed.php:272 100 100 msgid "Reload document" 101 101 msgstr "" 102 102 103 #: awsm-embed.php:27 4103 #: awsm-embed.php:276 104 104 msgid "Open" 105 105 msgstr "" 106 106 107 #: awsm-embed.php:27 4107 #: awsm-embed.php:276 108 108 msgid "Open in new tab" 109 109 msgstr "" 110 110 111 #: awsm-embed.php:34 7111 #: awsm-embed.php:349 112 112 #: blocks/document/modules/inspector.js:43 113 113 msgid "Google Docs Viewer" 114 114 msgstr "" 115 115 116 #: awsm-embed.php:3 48116 #: awsm-embed.php:350 117 117 #: blocks/document/modules/inspector.js:51 118 118 msgid "Browser Based" 119 119 msgstr "" 120 120 121 #: awsm-embed.php:3 49121 #: awsm-embed.php:351 122 122 #: blocks/document/modules/inspector.js:46 123 123 msgid "Microsoft Office Online" 124 124 msgstr "" 125 125 126 #: awsm-embed.php:5 38126 #: awsm-embed.php:540 127 127 msgid "Embedded Document" 128 128 msgstr "" 129 129 130 #: awsm-embed.php:54 7130 #: awsm-embed.php:549 131 131 msgid "No Url Found" 132 132 msgstr "" 133 133 134 #: awsm-embed.php: 623134 #: awsm-embed.php:734 135 135 msgid "The third party tools we are using to display your documents easily may use cookies or similar technologies for technical purposes.These third-party services may set their own cookies on your device to provide additional functionality or integrate certain features.The use of third-party cookies is subject to the respective third party privacy and cookie policies." 136 136 msgstr "" 137 137 138 #: awsm-embed.php: 694138 #: awsm-embed.php:805 139 139 msgid "Unsupported file content detected. Sorry, you are not allowed to upload this file." 140 140 msgstr "" 141 141 142 #: awsm-embed.php: 708142 #: awsm-embed.php:819 143 143 msgid "Buy Pro Version" 144 144 msgstr "" 145 145 146 146 #. translators: %1$s: Service provider 147 #: awsm-embed.php: 711147 #: awsm-embed.php:822 148 148 msgid "Add From %1$s" 149 149 msgstr "" -
embed-any-document/trunk/readme.txt
r3399946 r3406443 4 4 Author URI: http://awsm.in 5 5 Requires at least: 4.0 6 Tested up to: 6.8. 26 Tested up to: 6.8.3 7 7 Stable tag: trunk 8 8 License: GPLv2 … … 114 114 == Changelog == 115 115 116 = V 2.7.11 - 2025-11-28 = 117 * FIX: Enhanced sanitization of document embed attributes to prevent XSS. 118 * Code improvements. 119 116 120 = V 2.7.8 - 2025-09-30 = 117 121 * FIX: Security vulnerability in PDF embed sanitized. 118 122 119 123 = V 2.7.7 - 2025-05-02 = 120 * Vulner bility fix.124 * Vulnerability fix. 121 125 * Corrected load_plugin_textdomain() for compatibility with WP 6.8+. 122 126 * Code improvements. … … 129 133 * Security fixes and code improvements. 130 134 131 = V 2.7.4 - 2023-08-07 =132 * Added: Cookie Policy section.133 * Code improvements.134 135 = V 2.7.3 - 2023-07-12 =136 * Improved security.137 * Code improvements.138 139 135 [See changelog of previous versions](https://raw.githubusercontent.com/awsmin/Embed-Any-Documents/master/CHANGELOG.md) 140 136 141 137 == Upgrade Notice == 142 138 143 = 2.7. 6=144 Improved securityand code improvements.139 = 2.7.11 = 140 Enhanced sanitization of document embed attributes to prevent XSS and code improvements. 145 141
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)