Plugin Directory

Changeset 3265158


Ignore:
Timestamp:
04/01/2025 01:06:29 PM (10 months ago)
Author:
twkmedia
Message:

New "force protection" for elements like canvas

Location:
image-protection
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • image-protection/trunk/CHANGELOG.md

    r3260696 r3265158  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
    66and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     7
     8
     9## [1.0.1] - 2025-04-01
     10
     11### Added
     12- Added support for forcing protection on specific images or elements (like canvas)
    713
    814## [1.0.0] - 2025-03-13
  • image-protection/trunk/README.md

    r3260696 r3265158  
    55**Requires at least:** 5.0 
    66**Tested up to:** 6.7
    7 **Stable tag:** 1.0.0 
     7**Stable tag:** 1.0.1 
    88**Requires PHP:** 7.4 
    99**License:** GPLv2 or later 
     
    6262   ```
    6363
     64### Can I force protection on specific images or elements (like canvas)?
     65Yes, you can force protection on specific images or elements in two ways:
     661. Add the class `force-image-protection` to the image:
     67   ```html
     68   <img src="image.jpg" class="force-image-protection">
     69   ```
     702. Add the data attribute `data-image-protection="true"`:
     71   ```html
     72   <img src="image.jpg" data-image-protection="true">
     73   ```
     74This will ensure the image or element is protected even if it would normally be excluded (like SVG images).
     75
    6476### How can I uninstall the plugin?
    6577To uninstall, go to the Plugins page in your WordPress admin, find the Image Protection plugin, and click "Deactivate." You can then delete it if desired.
     78
  • image-protection/trunk/image-protection.php

    r3260696 r3265158  
    44 * Plugin URI: https://wordpress.org/plugins/image-protection
    55 * Description: Protects images from being copied, saved, or screenshot.
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Requires at least: 5.0
    88 * Requires PHP: 7.4
     
    2424 * Define plugin constants.
    2525 */
    26 define( 'IMAGE_PROTECTION_VERSION', '1.0.0' );
     26define( 'IMAGE_PROTECTION_VERSION', '1.0.1' );
    2727define( 'IMAGE_PROTECTION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    2828define( 'IMAGE_PROTECTION_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
  • image-protection/trunk/protection.js

    r3260696 r3265158  
    6868
    6969        getImages() {
     70            // Get all images except SVGs
    7071            const images = document.querySelectorAll("img:not([src$='.svg'])");
    7172            this.bgImages = Array.from(document.querySelectorAll('*')).filter(element => {
     
    7475            });
    7576
     77            // Combine and filter images
    7678            const allImages = [...images, ...this.bgImages];
    7779            this.filteredImages = allImages.filter((img) => {
    7880                return !img.classList.contains('no-image-protection') && img.getAttribute('data-image-protection') !== 'false';
    7981            });
     82
     83            // Add elements with data-image-protection="true" or class 'force-image-protection'
     84            const forcedProtectionElements = document.querySelectorAll('[data-image-protection="true"], .force-image-protection');
     85            this.filteredImages = [...this.filteredImages, ...forcedProtectionElements];
    8086        }
    8187
  • image-protection/trunk/readme.txt

    r3260696 r3265158  
    44Requires at least: 5.0
    55Tested up to: 6.7
    6 Stable tag: 1.0.0
     6Stable tag: 1.0.1
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    6060   <img src="image.jpg" data-image-protection="false">
    6161   ```
    62 You can also force protection on an image by using `data-image-protection="true"`, which will override any protection-disabling class.
     62
     63= Can I force protection on specific images or elements (like canvas)? =
     64Yes, you can force protection on specific images or elements in two ways:
     651. Add the class `force-image-protection` to the image:
     66   ```html
     67   <img src="image.jpg" class="force-image-protection">
     68   ```
     692. Add the data attribute `data-image-protection="true"`:
     70   ```html
     71   <img src="image.jpg" data-image-protection="true">
     72   ```
     73This will ensure the image or element is protected even if it would normally be excluded (like SVG images).
    6374
    6475= How can I uninstall the plugin? =
Note: See TracChangeset for help on using the changeset viewer.