Title: JVM Protected Media
Author: Joris van Montfort
Published: <strong>21 ກຸມພາ 2018</strong>
Last modified: 28 ກັນຍາ 2022

---

ຄົ້ນຫາປລັກອິນ

ປລັກອິນນີ້ **ຍັງບໍ່ທັນໄດ້ຮັບການທົດສອບກັບ WordPress 3 ເວີຊັນຫຼັກຫຼ້າສຸດ**. ມັນອາດຈະ
ບໍ່ໄດ້ຮັບການເບິ່ງແຍງ ຫຼື ສະໜັບສະໜູນອີກຕໍ່ໄປ ແລະ ອາດມີບັນຫາການເຮັດວຽກຮ່ວມກັນເມື່ອ
ໃຊ້ກັບ WordPress ເວີຊັນທີ່ໃໝ່ກວ່າ.

![](https://s.w.org/plugins/geopattern-icon/jvm-protected-media.svg)

# JVM Protected Media

 ໂດຍ [Joris van Montfort](https://profiles.wordpress.org/jorisvanmontfort/)

[ດາວໂຫຼດ](https://downloads.wordpress.org/plugin/jvm-protected-media.zip)

 * [ລາຍລອຽດ](https://lo.wordpress.org/plugins/jvm-protected-media/#description)
 * [ການຣີວິວ](https://lo.wordpress.org/plugins/jvm-protected-media/#reviews)
 *  [ການຕິດຕັ້ງ](https://lo.wordpress.org/plugins/jvm-protected-media/#installation)
 * [ການພັດທະນາ](https://lo.wordpress.org/plugins/jvm-protected-media/#developers)

 [ການຊ່ວຍເຫຼືອ](https://wordpress.org/support/plugin/jvm-protected-media/)

## ຄຳອະທິບາຍ

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)
    ```

## ການຕິດຕັ້ງ

 1. Install the plugin from the Plugins or upload the plugin folder to the `/wp-content/
    plugins/` directory menu and then activate it. If your server does not meet the
    requirements the plugin will show a notification.
 2. Define your own access rules in your themes functions.php

## ການຣີວິວ

ບໍ່ມີການຣີວິວສຳລັບປລັກອິນນີ້.

## ຜູ້ຮ່ວມພັດທະນາ ແລະ ຜູ້ພັດທະນາ

“JVM Protected Media” ແມ່ນຊອຟແວໂອເພັນຊອດ (Open Source). ບຸກຄົນຕໍ່ໄປນີ້ໄດ້ມີສ່ວນຮ່ວມ
ໃນການພັດທະນາປລັກອິນນີ້.

ຜູ້ຮ່ວມພັດທະນາ

 *   [ Joris van Montfort ](https://profiles.wordpress.org/jorisvanmontfort/)

[ແປ “JVM Protected Media” ເປັນພາສາຂອງເຈົ້າ.](https://translate.wordpress.org/projects/wp-plugins/jvm-protected-media)

### ສົນໃຈຮ່ວມພັດທະນາບໍ່?

[ເບິ່ງລະຫັດ](https://plugins.trac.wordpress.org/browser/jvm-protected-media/), ກວດເບິ່ງ
[ຄັງເກັບ SVN](https://plugins.svn.wordpress.org/jvm-protected-media/), ຫຼື ຕິດຕາມ
[ບັນທຶກການພັດທະນາ](https://plugins.trac.wordpress.org/log/jvm-protected-media/) 
ຜ່ານ [RSS](https://plugins.trac.wordpress.org/log/jvm-protected-media/?limit=100&mode=stop_on_copy&format=rss).

## ບັນທຶກການປ່ຽນແປງ

#### 1.0.6

Added nginx check and admin notice for nginx users.

#### 1.0.5

Tested up to 5.2.2 and added a comment for nginx usage.

#### 1.0.4

Better flushing of rewrite rules and plugin tested up to 5.0.3

#### 1.0.3

Fix for the .htaccess file being reset in some situations.

#### 1.0.2

Added a 24 hour cache time to the output. This effectivly trigger the 304 not modified
header if the file is indeed not modified.

#### 1.0.1

Bug fix: When requesting files that are not in the media library the plugin was 
not calling the jvm_protected_media_file action. Fixed this. In this case the action
is called but the file_id will remain empty.

#### 1.0.0

Initial release

#### Stable

1.0.3

## ຂໍ້ມູນກຳກັບ (Meta)

 *  ເວີຊັນ **1.0.6**
 *  ອັບເດດຫຼ້າສຸດເມື່ອ **4 ປີ ທີ່ຜ່ານມາ** ທີ່ຜ່ານມາ
 *  ການຕິດຕັ້ງທີ່ໃຊ້ງານຢູ່ **ໜ້ອຍກວ່າ 10**
 *  ເວີຊັນ WordPress ** 4.4.1 ຫຼື ສູງກວ່າ **
 *  ທົດສອບເຖິງເວີຊັນ **6.0.11**
 *  ພາສາ
 * [English (US)](https://wordpress.org/plugins/jvm-protected-media/)
 * ແທັກ
 * [attachments](https://lo.wordpress.org/plugins/tags/attachments/)[files](https://lo.wordpress.org/plugins/tags/files/)
   [media](https://lo.wordpress.org/plugins/tags/media/)[protect](https://lo.wordpress.org/plugins/tags/protect/)
   [protection](https://lo.wordpress.org/plugins/tags/protection/)
 *  [ມຸມມອງຂັ້ນສູງ](https://lo.wordpress.org/plugins/jvm-protected-media/advanced/)

## ການໃຫ້ຄະແນນ

ຍັງບໍ່ມີການສົ່ງຄຳວິຈານເທື່ອ.

[Your review](https://wordpress.org/support/plugin/jvm-protected-media/reviews/#new-post)

[ເບິ່ງ ຄຳຄິດເຫັນ ທັງໝົດ](https://wordpress.org/support/plugin/jvm-protected-media/reviews/)

## ຜູ້ຮ່ວມພັດທະນາ

 *   [ Joris van Montfort ](https://profiles.wordpress.org/jorisvanmontfort/)

## ການຊ່ວຍເຫຼືອ

ມີຄຳຖາມ ຫຼື ຕ້ອງການຄວາມຊ່ວຍເຫຼືອບໍ່?

 [ເບິ່ງຟໍຣັມການຊ່ວຍເຫຼືອ](https://wordpress.org/support/plugin/jvm-protected-media/)

## ບໍລິຈາກ

ເຈົ້າຕ້ອງການສະໜັບສະໜູນການພັດທະນາຂອງປລັກອິນນີ້ບໍ່?

 [ ບໍລິຈາກໃຫ້ປລັກອິນນີ້ ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VXZJG9GC34JJU)