No Right Click Images Plugin - Version 2.4

Version Description

  • Added alternate replacement image url for webmasters who don't like the o-slash
  • Added an option to turn off IOS Android events that screwed up some web sites.
  • Added an extra Security check on plugin load.

=

Download this release

Release Info

Developer kpgraham
Plugin Icon wp plugin No Right Click Images Plugin
Version 2.4
Comparing to
See all releases

Code changes from version 2.3 to 2.4

no-right-click-images-plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: No Right Click Images Plugin
4
  Plugin URI: http://www.BlogsEye.com/
5
  Description: Uses Javascript to prevent right clicking of images to help keep leaches from copying images
6
- Version: 2.3
7
  Author: Keith P. Graham
8
  Author URI: http://www.BlogsEye.com/
9
 
@@ -11,7 +11,7 @@ This software is distributed in the hope that it will be useful,
11
  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
  */
14
-
15
  /************************************************************
16
  * kpg_no_rc_img_fixup()
17
  * Shows the javascript in the footer so that the image events can be adjusted
@@ -26,18 +26,23 @@ function kpg_no_rc_img_fixup() {
26
  $replace='N';
27
  $drag='Y';
28
  $allowforlogged='N';
 
29
  extract($options);
30
  if ($replace!='Y') $replace='N';
31
  if ($drag!='Y') $drag='N';
32
  if ($allowforlogged!='Y') $allowforlogged='N';
 
 
33
  // if the user is logged in and the option is set, let them copy images
34
  if ($allowforlogged=='Y' && is_user_logged_in() ) { return; }
35
  $dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
36
  $img = addslashes($dir.'not.gif');
37
  $js = addslashes($dir.'no-right-click-images.js');
 
 
38
 
39
  ?>
40
- <script language="javascript" type="text/javascript">var kpg_nrci_image="<?php echo $img; ?>";var kpg_nrci_extra="<?php echo $replace; ?>";var kpg_nrci_drag="<?php echo $drag; ?>";</script>
41
  <script language="javascript" type="text/javascript" src="<?php echo $js; ?>"></script>
42
  <?php
43
  }
@@ -47,10 +52,13 @@ function kpg_no_rc_img_control() {
47
  $replace='N';
48
  $drag='Y';
49
  $allowforlogged='N';
 
50
  extract($options);
51
  if ($replace!='Y') $replace='N';
52
  if (empty($drag)) $drag='Y';
53
  if ($drag!='Y') $drag='N';
 
 
54
  if ($allowforlogged!='Y') $allowforlogged='N';
55
  if (array_key_exists('kpg_no_rc_nonce',$_POST)&&wp_verify_nonce($_POST['kpg_no_rc_nonce'],'kpg_no_rc')) {
56
  // need to update replace
@@ -69,11 +77,25 @@ function kpg_no_rc_img_control() {
69
  } else {
70
  $allowforlogged='N';
71
  }
 
 
 
 
 
 
 
 
 
 
72
  if ($replace!='Y') $replace='N';
73
  if ($drag!='Y') $drag='N';
74
  if ($allowforlogged!='Y') $allowforlogged='N';
 
 
75
  $options['replace']=$replace;
76
  $options['drag']=$drag;
 
 
77
  $options['allowforlogged']=$allowforlogged;
78
  update_option('kpg_no_right_click_image', $options);
79
 
@@ -81,12 +103,14 @@ function kpg_no_rc_img_control() {
81
  $nonce=wp_create_nonce('kpg_no_rc');
82
  $dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
83
  $img = addslashes($dir.'not.gif');
 
 
84
 
85
  ?>
86
 
87
  <div class="wrap">
88
  <h2>No Right Click Images Plugin</h2>
89
- <h4 style="color:red;">Note: this new version of the plugin now has options that must be set to work correctly.</h4>
90
  <div style="position:relative;float:right;width:35%;background-color:ivory;border:#333333 medium groove;padding:4px;margin-left:4px;">
91
  <p>This plugin is free and I expect nothing in return. If you would like to support my programming, you can buy my book of short stories.</p>
92
  <p>Some plugin authors ask for a donation. I ask you to spend a very small amount for something that you will enjoy. eBook versions for the Kindle and other book readers start at 99&cent;. The book is much better than you might think, and it has some very good science fiction writers saying some very nice things. <br/>
@@ -102,7 +126,7 @@ function kpg_no_rc_img_control() {
102
  </div>
103
  <h4>The No Right Click Images Plugin is installed and working correctly.</h4>
104
  <p>This plugin installs some javascript in the footer of every page. When your page finishes loading, the javascript sets properties on the images to stop them from being dragged or right clicked. </p>
105
- <p><img width="80" src="<?php echo $img; ?>" align="left" style="margin:2px;"/>This is a major revision in the way the plugin works. <a href="mailto:bugs@blogseye.com">Please report all bugs</a> as soon as possible. </p>
106
  <p>There are many ways to bypass this plugin and it is impossible to prevent a determined and resourceful user from stealing images, but this plugin will prevent casual users from glomming your images. </p>
107
  <p>The context menu is disabled on simple elements with background images, but will not work in some cases depending on which element receives the mouse click. </p>
108
  <p>If you have uploaded your images to WordPress so that the images from the gallery can be opened in their own window, then this plugin will not work on the clicked image. Always upload images using FTP and insert the image via URL with no link to the image other than the IMG tag. </p>
@@ -129,6 +153,24 @@ function kpg_no_rc_img_control() {
129
  <td>You may wish to allow logged in users to copy images. You can do this by checking this box.
130
  </td>
131
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  </table>
133
  <p>
134
  <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
3
  Plugin Name: No Right Click Images Plugin
4
  Plugin URI: http://www.BlogsEye.com/
5
  Description: Uses Javascript to prevent right clicking of images to help keep leaches from copying images
6
+ Version: 2.4
7
  Author: Keith P. Graham
8
  Author URI: http://www.BlogsEye.com/
9
 
11
  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
  */
14
+ if (!defined('ABSPATH')) exit; // just in case
15
  /************************************************************
16
  * kpg_no_rc_img_fixup()
17
  * Shows the javascript in the footer so that the image events can be adjusted
26
  $replace='N';
27
  $drag='Y';
28
  $allowforlogged='N';
29
+ $altimg='';
30
  extract($options);
31
  if ($replace!='Y') $replace='N';
32
  if ($drag!='Y') $drag='N';
33
  if ($allowforlogged!='Y') $allowforlogged='N';
34
+ if (empty($cell)) $cell='N';
35
+ if ($cell!='Y') $cell='N';
36
  // if the user is logged in and the option is set, let them copy images
37
  if ($allowforlogged=='Y' && is_user_logged_in() ) { return; }
38
  $dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
39
  $img = addslashes($dir.'not.gif');
40
  $js = addslashes($dir.'no-right-click-images.js');
41
+ $altimg=trim($altimg);
42
+ if (!empty($altimg)) $img=$altimg;
43
 
44
  ?>
45
+ <script language="javascript" type="text/javascript">var kpg_cell="<?php echo $cell; ?>";var kpg_nrci_image="<?php echo $img; ?>";var kpg_nrci_extra="<?php echo $replace; ?>";var kpg_nrci_drag="<?php echo $drag; ?>";</script>
46
  <script language="javascript" type="text/javascript" src="<?php echo $js; ?>"></script>
47
  <?php
48
  }
52
  $replace='N';
53
  $drag='Y';
54
  $allowforlogged='N';
55
+ $altimg='';
56
  extract($options);
57
  if ($replace!='Y') $replace='N';
58
  if (empty($drag)) $drag='Y';
59
  if ($drag!='Y') $drag='N';
60
+ if (empty($cell)) $cell='N';
61
+ if ($cell!='Y') $cell='N';
62
  if ($allowforlogged!='Y') $allowforlogged='N';
63
  if (array_key_exists('kpg_no_rc_nonce',$_POST)&&wp_verify_nonce($_POST['kpg_no_rc_nonce'],'kpg_no_rc')) {
64
  // need to update replace
77
  } else {
78
  $allowforlogged='N';
79
  }
80
+ if (array_key_exists('kpg_cell',$_POST)) {
81
+ $cell=stripslashes($_POST['kpg_cell']);
82
+ } else {
83
+ $cell='N';
84
+ }
85
+ if (array_key_exists('altimg',$_POST)) {
86
+ $altimg=stripslashes($_POST['altimg']);
87
+ } else {
88
+ $altimg='';
89
+ }
90
  if ($replace!='Y') $replace='N';
91
  if ($drag!='Y') $drag='N';
92
  if ($allowforlogged!='Y') $allowforlogged='N';
93
+ if (empty($cell)) $cell='N';
94
+ if ($cell!='Y') $cell='N';
95
  $options['replace']=$replace;
96
  $options['drag']=$drag;
97
+ $options['cell']=$cell;
98
+ $options['altimg']=$altimg;
99
  $options['allowforlogged']=$allowforlogged;
100
  update_option('kpg_no_right_click_image', $options);
101
 
103
  $nonce=wp_create_nonce('kpg_no_rc');
104
  $dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
105
  $img = addslashes($dir.'not.gif');
106
+ $altimg=trim($altimg);
107
+ if (!empty($altimg)) $img=$altimg;
108
 
109
  ?>
110
 
111
  <div class="wrap">
112
  <h2>No Right Click Images Plugin</h2>
113
+
114
  <div style="position:relative;float:right;width:35%;background-color:ivory;border:#333333 medium groove;padding:4px;margin-left:4px;">
115
  <p>This plugin is free and I expect nothing in return. If you would like to support my programming, you can buy my book of short stories.</p>
116
  <p>Some plugin authors ask for a donation. I ask you to spend a very small amount for something that you will enjoy. eBook versions for the Kindle and other book readers start at 99&cent;. The book is much better than you might think, and it has some very good science fiction writers saying some very nice things. <br/>
126
  </div>
127
  <h4>The No Right Click Images Plugin is installed and working correctly.</h4>
128
  <p>This plugin installs some javascript in the footer of every page. When your page finishes loading, the javascript sets properties on the images to stop them from being dragged or right clicked. </p>
129
+ <p>This is a major revision in the way the plugin works. <a href="mailto:bugs@blogseye.com">Please report all bugs</a> as soon as possible. </p>
130
  <p>There are many ways to bypass this plugin and it is impossible to prevent a determined and resourceful user from stealing images, but this plugin will prevent casual users from glomming your images. </p>
131
  <p>The context menu is disabled on simple elements with background images, but will not work in some cases depending on which element receives the mouse click. </p>
132
  <p>If you have uploaded your images to WordPress so that the images from the gallery can be opened in their own window, then this plugin will not work on the clicked image. Always upload images using FTP and insert the image via URL with no link to the image other than the IMG tag. </p>
153
  <td>You may wish to allow logged in users to copy images. You can do this by checking this box.
154
  </td>
155
  </tr>
156
+ <tr>
157
+ <td>Stop saving on Smart Phones</td>
158
+ <td><input type="checkbox" <?php if ($cell=='Y') {echo 'checked="true"';} ?>value="Y" name="kpg_cell"></td>
159
+ <td>You can stop users from pressing and holding an image to get a save menu, but it may interfere with other gestures on some phones. Test this before allowing it on your site.
160
+ </td>
161
+ </tr>
162
+
163
+ <tr>
164
+ <td align="top">Use an alternate replacement image</td>
165
+ <td align="top"><input type="text" name="altimg" value="<?php echo $altimg; ?>"></td>
166
+ <td>If you don't like the alternate image then put the url of an alternat image here.<br/>
167
+ The image will display below after you save your changes. If no image displays then you typed the URL wrong.
168
+ <img width="80" src="<?php echo $img; ?>" style="margin:2px;"/>
169
+ </td>
170
+ </tr>
171
+
172
+
173
+
174
  </table>
175
  <p>
176
  <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
no-right-click-images.js CHANGED
@@ -1,6 +1,6 @@
1
  /**************************************************************************
2
  This javascript is used by the no-right-click-images plugin for wordpress.
3
- Version 2.3
4
  Please give credit as no-right-click-images.js by Keith P. Graham
5
  http://www.blogseye.com
6
  **************************************************************************/
@@ -193,12 +193,14 @@ function kpg_nrci_action(event) {
193
  b[i].oncontextmenu=function(event) { return kpg_nrci_context(event);}
194
  b[i].oncopy=function(event) { return kpg_nrci_context(event);}
195
  b[i].onmousedown=function(event) { return kpg_nrc1_mousedown(event);}
196
- b[i].onlongpress=function(event) { return kpg_nrci_context(event);}
197
- b[i].ontouchstart = b[i].onclick;
198
- //b[i].ontouchstart=function(event) { return kpg_nrc1_mousedown(event);}
199
- b[i].ontouchmove=function(event) { return kpg_nrci_context(event);}
200
- b[i].ontouchend=function(event) { return kpg_nrci_context(event);}
201
- b[i].ontouchcancel=function(event) { return kpg_nrci_context(event);}
 
 
202
  if (kpg_nrci_drag=='Y') b[i].ondragstart=function(event) { return kpg_nrci_dragdrop(event);}
203
  }
204
  } catch (er) {
1
  /**************************************************************************
2
  This javascript is used by the no-right-click-images plugin for wordpress.
3
+ Version 2.4
4
  Please give credit as no-right-click-images.js by Keith P. Graham
5
  http://www.blogseye.com
6
  **************************************************************************/
193
  b[i].oncontextmenu=function(event) { return kpg_nrci_context(event);}
194
  b[i].oncopy=function(event) { return kpg_nrci_context(event);}
195
  b[i].onmousedown=function(event) { return kpg_nrc1_mousedown(event);}
196
+ if (kpg_cell=='Y') {
197
+ b[i].onlongpress=function(event) { return kpg_nrci_context(event);} // ?
198
+ b[i].ontouchstart = b[i].onclick;
199
+ //b[i].ontouchstart=function(event) { return kpg_nrc1_mousedown(event);}
200
+ b[i].ontouchmove=function(event) { return kpg_nrci_context(event);}
201
+ b[i].ontouchend=function(event) { return kpg_nrci_context(event);}
202
+ b[i].ontouchcancel=function(event) { return kpg_nrci_context(event);}
203
+ }
204
  if (kpg_nrci_drag=='Y') b[i].ondragstart=function(event) { return kpg_nrci_dragdrop(event);}
205
  }
206
  } catch (er) {
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Tags: images, image, right click, stealing
3
  Donate link: http://www.blogseye.com/buy-the-book/
4
  Requires at least: 3.0
5
- Tested up to: 3.4
6
  Contributors: Keith Graham
7
- Stable tag: 2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -46,15 +46,21 @@ It is impossible to keep people from stealing images that appear in web pages, b
46
  * Added option so that logged in users are allowed to copy images. Disables the plugin for logged in users. Captured copy to clipboard events to prevent another way of copying in some browsers. Fixed a problem in image replacement that prevented an image from being restored when another image was right clicked before the image times out.
47
 
48
  = 2.2 =
49
- * Changed the default so that logged in users cannot copy images. Too many people tested the plugin without checking the settings and assumed that the plugin was broken. They did not read the documentation, try the settings, or check the WordPress forums. I am sorry that I had to do this, but people were indicating on the WordPress plugin page that it didn't work.
50
 
51
  = 2.3 =
52
  * Added support for longclick and touch interface for android and ipad/iphone.
53
 
 
 
 
 
 
54
  == Frequently Asked Questions ==
55
- = I click on an image and the image to open it and then save it =
56
- When you added the image to WordPress you specified this behavior. When you insert an image you have to specify that you don't want to have a click on the image open the image. If I stopped all links attached to images, half the web pages would not be able to function. It is up to you to protect your images by not opening the image on a click.
57
- = I have a Slideshow or Gallery and people can right click on the images in the gallery. =
 
58
  Special image presentation plugins that use jQuery or other Javascript systems override the behavior of this plugin. When they load they take over and my plugin can't help you. You need to contact the authors of the gallery and ask they they disable the right click event and drag events inside their plugin.
59
 
60
 
2
  Tags: images, image, right click, stealing
3
  Donate link: http://www.blogseye.com/buy-the-book/
4
  Requires at least: 3.0
5
+ Tested up to: 3.5
6
  Contributors: Keith Graham
7
+ Stable tag: 2.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
46
  * Added option so that logged in users are allowed to copy images. Disables the plugin for logged in users. Captured copy to clipboard events to prevent another way of copying in some browsers. Fixed a problem in image replacement that prevented an image from being restored when another image was right clicked before the image times out.
47
 
48
  = 2.2 =
49
+ * Changed the default so that logged in users cannot copy images. Too many people tested the plugin without checking the settings and assumed that the plugin was broken. They did not read the documentation, try the settings, or check the WordPress forums. I am sorry that I had to do this, but users were indicating on the WordPress plugin page that it didn't work.
50
 
51
  = 2.3 =
52
  * Added support for longclick and touch interface for android and ipad/iphone.
53
 
54
+ = 2.4 =
55
+ * Added alternate replacement image url for webmasters who don't like the o-slash
56
+ * Added an option to turn off IOS Android events that screwed up some web sites.
57
+ * Added an extra Security check on plugin load.
58
+
59
  == Frequently Asked Questions ==
60
+ = I click on an image to open it and then I can save it =
61
+ When you added the image to WordPress you specified this behavior. When you insert an image you have to specify that you don't want to have a click on the image open the image. It is up to you to protect your images by not opening the image on a click.
62
+ If you are able to click on an image to display the image in a new window, it is then outside of Wordpress and can't be protected.
63
+ = I have a Slideshow or Gallery and users can right click on the images in the gallery. =
64
  Special image presentation plugins that use jQuery or other Javascript systems override the behavior of this plugin. When they load they take over and my plugin can't help you. You need to contact the authors of the gallery and ask they they disable the right click event and drag events inside their plugin.
65
 
66