PHP 356
Wordpress Plugin that will disable text Selection, right click and CTRL + S, U, I, A, P etc. Guest on 13th June 2021 12:43:13 PM
  • Copy
  1. <?php
  2.  
  3. /**
  4.  
  5.  * @link              razvancilibeanu.com
  6.  * @since             1.0.0
  7.  * @package           No_Copy
  8.  *
  9.  * @wordpress-plugin
  10.  * Plugin Name:       RC - NoCopy
  11.  * Plugin URI:        razvancilibeanu.com
  12.  * Description:       Disable Text Selection,Right Click and CTRL + S, U, I, A, P etc.
  13.  * Version:           3.0.0
  14.  * Author:            Razvan Cilibeanu
  15.  * Author URI:        razvancilibeanu.com
  16.  * License:           GPL-2.0+
  17.  * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
  18.  * Text Domain:       no-copy
  19.  * Domain Path:       /languages
  20.  */
  21.  
  22. if ( ! defined( 'WPINC' ) ) {
  23.         die;
  24. }
  25. add_action('wp_head', 'your_function');
  26.    function your_function()
  27.       {
  28.        
  29.          echo "   <SCRIPT>document.addEventListener('contextmenu', event => event.preventDefault());
  30. document.onkeydown = function (e) {
  31.    e = e || window.event;
  32.    if (!e.ctrlKey) return;
  33.    var code = e.which || e.keyCode;
  34.    switch (code) {
  35.        case 83://S
  36.                 case 85://u
  37.                 case 73:// I
  38.                 case 67://C
  39.                 case 65://A
  40.                 case 80://P
  41.        case 87://W
  42.            e.preventDefault();
  43.            e.stopPropagation();
  44.            break;
  45.    }
  46. };
  47. </SCRIPT>
  48. <style>* {-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: -moz-none;-o-user-select: none;user-select: none;}</Style>";
  49.  
  50.            
  51.       }