[WordPress] 外掛分享: JVM Protected Media

前言介紹

  • 這款 WordPress 外掛「JVM Protected Media」是 2018-02-20 上架。
  • 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
  • 上一次更新是 2022-09-28,距離現在已有 949 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.4.1 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

jorisvanmontfort |

外掛標籤

files | media | protect | protection | attachments |

內容簡介

使用鉤子保護所有媒體檔案的存取權並實施自己的自訂檔案存取規則。適用於具備 mod rewrite 的 Apache 或透過一些自訂配置的 Nginx。不支援多站點。此外掛程式更多的是一個開發工具,用來定義自己的自訂檔案存取規則。

對於 Nginx,您需要修改設定檔,因為 Nginx 無法處理 .htaccess 檔案。請添加以下程式碼:

location ~ "^/wp-content/uploads/(.*)$" {
rewrite ^/wp-content/uploads(/.*\.\w+)$ /index.php?jvm_protected_media_file=$1;
}

鉤子

若沒有自訂鉤子,所有檔案存取都會被禁用。使用鉤子處理自己的檔案存取規則是必須的。以下是一個簡單的範例,可放在您的 functions.php 中:

function my_file_access_rule($file_info) {
// 在這裡實作您自己的邏輯
$userHasAccess = true;

if($userHasAccess) {
// 如果使用者有權存取檔案,則傳送檔案輸出
JVM_Protected_Media::send_file_output($file_info['path']);
}
}

add_action( 'jvm_protected_media_file', 'my_file_access_rule');

jvm_protected_media_file 鉤子有一個帶有以下檔案資訊的參數:

Array
(
[id] => 檔案的 ID
[url] => 檔案的完整 URL
[path] => 檔案的完整路徑
[is_resized_image] => 布林值(如果請求的檔案是圖片縮略圖或圖片的調整大小版本,則為 true)
)

鉤子

可用的鉤子:

jvm_protected_media_loaded(當外掛程式加載時觸發)
jvm_protected_media_file(當有檔案被請求時觸發)

函式

要將檔案的輸出傳送到您的函式時,可以呼叫:

JVM_Protected_Media::send_file_output($fullPathToFile)

原文外掛簡介

Protect access to all your media files and implement your own custom file access rules using a hook. Works for apache with mod rewrite or nginx with some custom configuration. No Multisite support. This plugin is more or less a development tool for defining your own custom file access rules.
For nginx you will need to modify the config file as nginx does not handle .htacess files. Add the following code:
location ~ "^/wp-content/uploads/(.*)$" {
rewrite ^/wp-content/uploads(/.*\.\w+)$ /index.php?jvm_protected_media_file=$1;
}

Hooks
Without a custom hook all file access will be disabled. The user will see the 404 page for all requested files. Adding a hook is needed to handle your own file access rules. A simple example that could go into your functions.php:
function my_file_access_rule($file_info) {
// Implement your own logic here
$userHasAccess = true;

if($userHasAccess) {
// Send the file output if users has access to the file
JVM_Protected_Media::send_file_output($file_info['path']);
}
}

add_action( 'jvm_protected_media_file', 'my_file_access_rule');

The jvm_protected_media_file action has one parameter with the following file information:
Array
(
[id] => id_of_the_file
[url] => full/url/to/your/file
[path] => full/path/to/your/file
[is_resized_image] => bool (true if the requested file is a image thumbnail or resized version of an image)
)

Actions
Available actions:

jvm_protected_media_loaded (fires as soon as the plugin is loaded)
jvm_protected_media_file (fires when a file is requested)

Functions
To send the output of a file to you can call:
JVM_Protected_Media::send_file_output($fullPathToFile)

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「JVM Protected Media」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


最新版本

延伸相關外掛(你可能也想知道)

  • Export media with selected content 》在 WordPress 的匯出畫面中,當選擇一種文章類型時,預設情況下不會將其連結的媒體(附件)包含在內。本外掛程式則新增了一個「匯出選定內容時包含媒體」的選...。
  • File Upload Types by WPForms 》WordPress 檔案上傳類型外掛, 您是否希望您的 WordPress 網站接受更多類型、更自由地上傳檔案?我們創建了『File Upload Types』外掛,讓任何人都可以輕鬆地...。
  • Lightbox with PhotoSwipe 》這個外掛在 WordPress 中整合了擴展版的 PhotoSwipe 4 或官方發行的 PhotoSwipe 5。發布或頁面中所有連結的圖像將使用 PhotoSwipe 顯示,而不管它們是圖片庫...。
  • Responsive WordPress Slider – HG Slider 》HG Slider 在您的 WordPress 管理員中創建一個新的「Slides」區域,並允許您輕鬆設置網站周圍的多個幻燈片。它使用標準的 WordPress 用戶界面,因此您(以及...。
  • Download Attachments 》Download Attachments 是 WordPress 的新型下載管理工具,它可以簡化界面、提供拖放和 AJAX 驅動的 metabox 來插入和管理您的媒體庫文件,然後通過自動或手動...。
  • Document Gallery 》這個外掛可讓使用者毫不費力地建立文件和其他附加媒體的圖庫,就像現有的圖像附件圖庫選項一樣。, 觀看以下視頻以瞭解 Document Gallery 如何運作:, , 在設...。
  • DeMomentSomTres WordPress Export Posts With Images 》DeMomentSomTres WordPress Export Posts With Images是為了因應DeMomentSomTres數位行銷代理公司的客戶需求而開發的。該客戶有一個非常龐大的部落格,需要將...。
  • Media Deduper 》媒體 Deduper 可以從您的 WordPress 媒體庫中找到並刪除重複的圖片和附件。安裝後,您將在媒體部分中擁有一個新的「管理重複項目」選項。, 在 Media Deduper ...。
  • File Away 》從您的伺服器目錄或頁面附件上傳、管理和顯示檔案,以時尚的清單或可排序的資料表方式呈現,還有更多更多的功能。。
  • Import External Images 》此外掛會將文章中所有連結的圖片下載到本地並該圖片添加至相簿附件中。, 特色功能, 感謝, 此外掛是基於 http://www.bbqiguana.com/ 的「Add Linked Images to...。
  • GD bbPress Attachments 》GD bbPress Attachments是一款易於使用的WordPress和bbPress插件,可用於實現bbPress論壇主題和回復的文件上傳。您可以從主插件設置面板控制文件大小,或者您...。
  • WP Attachments 》WP Attachments 是一個 WordPress 的外掛,可增強下載體驗和檔案管理的功能。它為附件添加了一些功能,並自動在文章和頁面中顯示它們。, 當您上傳一個檔案時...。
  • Sensei LMS Media Attachments 》Sensei LMS 媒體附件讓您可以將媒體檔案附加到 Sensei LMS 課程和課程主題。, 例如,您可能會有一些閱讀材料是以 PDF 格式提供給您的學生。, 有了 Sensei LMS...。
  • Attachment Importer 》這是什麼?, 我發現 WordPress Importer 外掛在匯入文章和評論時非常好用,但在匯入大型網站的大型附件(例如圖片)時有所不足。我的匯入常常會逾時並崩潰。...。
  • WP Document Revisions 》WP Document Revisions 是一款文件管理和版本控制外掛,適用於時間敏感和任務關鍵項目。團隊可以共同編輯任何格式的文件,包括文字文檔、電子表格、圖像、樂...。

文章
Filter
Apply Filters
Mastodon