From 96dc977ebaaa464cf419ac1f0ee463014d2503f3 Mon Sep 17 00:00:00 2001 From: Filippo Ferrari Date: Tue, 25 Sep 2018 17:14:15 +0200 Subject: [PATCH] WP fix for correct functionality and https websites --- viewerjs-plugin.php.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/viewerjs-plugin.php.in b/viewerjs-plugin.php.in index 7566055..7034e49 100644 --- a/viewerjs-plugin.php.in +++ b/viewerjs-plugin.php.in @@ -123,8 +123,8 @@ function viewerjs_media_send_to_editor($html, $send_id, $attachment) { $post = get_post($pid, ARRAY_A); if (preg_match('/^application\/(vnd\.oasis\.opendocument|pdf)/', $post['post_mime_type'])) { // place shortcode - preg_match('/^http:\/\/[^\/]*(\/.*)$/', $attachment['url'], $matches); - $document_url = $matches[1]; + preg_match('/^http(s)?:\/\/[^\/]*(\/.*)$/', $attachment['url'], $matches); + $document_url = $matches[0]; return "[viewerjs ".$document_url."]"; } return $html;