Version Description
- Added a CSS option for IOS to suppress the context menu on long presses and selects.
- Reworked the get_options method to remove redundancies.
Download this release
Release Info
Developer | willjenkins |
Plugin | No Right Click Images Plugin |
Version | 3.2 |
Comparing to | |
See all releases |
Code changes from version 3.1 to 3.2
- includes/nrci_options.php +10 -5
- no-right-click-images-plugin.php +24 -20
- no-right-click-images.css +27 -0
- no-right-click-images.js +2 -1
- readme.txt +8 -14
includes/nrci_options.php
CHANGED
@@ -8,10 +8,6 @@ function kpg_no_rc_img_control_2() {
|
|
8 |
if(!current_user_can('manage_options')) {
|
9 |
die('Access Denied');
|
10 |
}
|
11 |
-
$drag="Y";
|
12 |
-
$touch="Y";
|
13 |
-
$gesture="Y";
|
14 |
-
$allowforlogged="N";
|
15 |
$options=kpg_nrci_get_options();
|
16 |
extract($options);
|
17 |
// check for update submit
|
@@ -37,11 +33,17 @@ function kpg_no_rc_img_control_2() {
|
|
37 |
} else {
|
38 |
$allowforlogged='N';
|
39 |
}
|
|
|
|
|
|
|
|
|
|
|
40 |
// update options
|
41 |
$options['drag']=$drag;
|
42 |
$options['touch']=$touch;
|
43 |
$options['gesture']=$gesture;
|
44 |
$options['allowforlogged']=$allowforlogged;
|
|
|
45 |
update_option('kpg_no_right_click_image',$options);
|
46 |
|
47 |
}
|
@@ -68,9 +70,12 @@ function kpg_no_rc_img_control_2() {
|
|
68 |
Disable Touch events:
|
69 |
<input type="checkbox" <?php if ($touch=='Y') {echo 'checked="true"';} ?> value="Y" name="kpg_touch" />
|
70 |
Prevents touch events on images, but if images are used as links or buttons this may cause problems. <br />
|
71 |
-
|
72 |
<input type="checkbox" <?php if ($gesture=='Y') {echo 'checked="true"';} ?> value="Y" name="kpg_gesture" />
|
73 |
Prevents some gestures. If you site uses image gestures for images this may cause problems. <br />
|
|
|
|
|
|
|
74 |
</fieldset>
|
75 |
<br>
|
76 |
<input type="submit" name="Submit" class="button-primary" value="<?php echo("Save Changes"); ?>" />
|
8 |
if(!current_user_can('manage_options')) {
|
9 |
die('Access Denied');
|
10 |
}
|
|
|
|
|
|
|
|
|
11 |
$options=kpg_nrci_get_options();
|
12 |
extract($options);
|
13 |
// check for update submit
|
33 |
} else {
|
34 |
$allowforlogged='N';
|
35 |
}
|
36 |
+
if (array_key_exists('kpg_ios',$_POST)) {
|
37 |
+
$ios=stripslashes($_POST['kpg_ios']);
|
38 |
+
} else {
|
39 |
+
$ios='N';
|
40 |
+
}
|
41 |
// update options
|
42 |
$options['drag']=$drag;
|
43 |
$options['touch']=$touch;
|
44 |
$options['gesture']=$gesture;
|
45 |
$options['allowforlogged']=$allowforlogged;
|
46 |
+
$options['ios']=$ios;
|
47 |
update_option('kpg_no_right_click_image',$options);
|
48 |
|
49 |
}
|
70 |
Disable Touch events:
|
71 |
<input type="checkbox" <?php if ($touch=='Y') {echo 'checked="true"';} ?> value="Y" name="kpg_touch" />
|
72 |
Prevents touch events on images, but if images are used as links or buttons this may cause problems. <br />
|
73 |
+
Disable Gesture events:
|
74 |
<input type="checkbox" <?php if ($gesture=='Y') {echo 'checked="true"';} ?> value="Y" name="kpg_gesture" />
|
75 |
Prevents some gestures. If you site uses image gestures for images this may cause problems. <br />
|
76 |
+
Disable context menu on Apple devices:
|
77 |
+
<input type="checkbox" <?php if ($ios=='Y') {echo 'checked="true"';} ?> value="Y" name="kpg_ios" />
|
78 |
+
Adds a style to images on Apple IOS devices to prevent the context menu<br />
|
79 |
</fieldset>
|
80 |
<br>
|
81 |
<input type="submit" name="Submit" class="button-primary" value="<?php echo("Save Changes"); ?>" />
|
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: 3.
|
7 |
Author: Keith P. Graham
|
8 |
Author URI: http://www.BlogsEye.com/
|
9 |
|
@@ -31,10 +31,14 @@ function nrci_scripts() {
|
|
31 |
$opts=array(
|
32 |
'gesture'=>$gesture,
|
33 |
'drag'=>$drag,
|
34 |
-
'allowforlogged'=>$allowforlogged,
|
35 |
'touch'=>$touch
|
36 |
);
|
37 |
wp_localize_script( 'nrci_methods', 'nrci_opts', $opts );
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
function kpg_no_rc_img_control() {
|
40 |
nrci_load_control();
|
@@ -61,32 +65,32 @@ function kpg_no_rc_img_uninstall() {
|
|
61 |
function kpg_nrci_get_options() {
|
62 |
// before we begin we need to check if we need to redirect the options to blog 1
|
63 |
$opts=get_option('kpg_no_right_click_image');
|
|
|
64 |
if (empty($opts)||!is_array($opts)) {
|
65 |
$opts=array();
|
66 |
$opts['gesture']='Y';
|
67 |
$opts['drag']='Y';
|
68 |
$opts['touch']='Y';
|
69 |
$opts['allowforlogged']='N';
|
70 |
-
|
71 |
}
|
72 |
-
$
|
73 |
-
'
|
74 |
-
'
|
75 |
-
'
|
76 |
-
'
|
77 |
-
);
|
78 |
-
$ansa=array_merge($options,$opts);
|
79 |
-
if (!array_key_exists('gesture',$ansa)||empty($ansa['gesture'])) $ansa['gesture']='Y';
|
80 |
-
if (!array_key_exists('drag',$ansa)||empty($ansa['drag'])) $ansa['drag']='Y';
|
81 |
-
if (!array_key_exists('touch',$ansa)||empty($ansa['touch'])) $ansa['touch']='Y';
|
82 |
-
if (!array_key_exists('allowforlogged',$ansa)||empty($ansa['allowforlogged'])) $ansa['allowforlogged']='N';
|
83 |
|
84 |
-
if ($
|
85 |
-
if ($
|
86 |
-
if ($
|
87 |
-
if ($
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
90 |
}// done
|
91 |
|
92 |
// bottom
|
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: 3.2
|
7 |
Author: Keith P. Graham
|
8 |
Author URI: http://www.BlogsEye.com/
|
9 |
|
31 |
$opts=array(
|
32 |
'gesture'=>$gesture,
|
33 |
'drag'=>$drag,
|
|
|
34 |
'touch'=>$touch
|
35 |
);
|
36 |
wp_localize_script( 'nrci_methods', 'nrci_opts', $opts );
|
37 |
+
if ($ios=='Y') {
|
38 |
+
wp_register_style('nrci_methods', plugin_dir_url( __FILE__ ) . 'no-right-click-images.css');
|
39 |
+
wp_enqueue_style( 'nrci_methods' );
|
40 |
+
}
|
41 |
+
|
42 |
}
|
43 |
function kpg_no_rc_img_control() {
|
44 |
nrci_load_control();
|
65 |
function kpg_nrci_get_options() {
|
66 |
// before we begin we need to check if we need to redirect the options to blog 1
|
67 |
$opts=get_option('kpg_no_right_click_image');
|
68 |
+
$opts1=$opts;
|
69 |
if (empty($opts)||!is_array($opts)) {
|
70 |
$opts=array();
|
71 |
$opts['gesture']='Y';
|
72 |
$opts['drag']='Y';
|
73 |
$opts['touch']='Y';
|
74 |
$opts['allowforlogged']='N';
|
75 |
+
$opts['ios']='Y';
|
76 |
}
|
77 |
+
if (!array_key_exists('gesture',$opts)||empty($opts['gesture'])) $opts['gesture']='Y';
|
78 |
+
if (!array_key_exists('drag',$opts)||empty($opts['drag'])) $opts['drag']='Y';
|
79 |
+
if (!array_key_exists('touch',$opts)||empty($opts['touch'])) $opts['touch']='Y';
|
80 |
+
if (!array_key_exists('ios',$opts)||empty($opts['ios'])) $opts['ios']='Y';
|
81 |
+
if (!array_key_exists('allowforlogged',$opts)||empty($opts['allowforlogged'])) $opts['allowforlogged']='N';
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
if ($opts['gesture']!='Y') $opts['gesture']='N';
|
84 |
+
if ($opts['drag']!='Y') $opts['drag']='N';
|
85 |
+
if ($opts['allowforlogged']!='Y') $opts['allowforlogged']='N';
|
86 |
+
if ($opts['touch']!='Y') $opts['touch']='N';
|
87 |
+
if ($opts['ios']!='Y') $opts['ios']='N';
|
88 |
+
if ($opts1!==$opts) {
|
89 |
+
update_option('kpg_no_right_click_image',$opts);
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
return $opts;
|
94 |
}// done
|
95 |
|
96 |
// bottom
|
no-right-click-images.css
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**********************************************
|
2 |
+
|
3 |
+
No Right Click Images plugin
|
4 |
+
by Keith P. Graham
|
5 |
+
|
6 |
+
Plugin URI: http://www.BlogsEye.com/
|
7 |
+
Description: Uses Javascript to prevent right clicking of images to help keep leaches from copying images
|
8 |
+
Version: 3.2
|
9 |
+
Author: Keith P. Graham
|
10 |
+
Author URI: http://www.BlogsEye.com/
|
11 |
+
|
12 |
+
This software is distributed in the hope that it will be useful,
|
13 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
15 |
+
|
16 |
+
|
17 |
+
***********************************************/
|
18 |
+
|
19 |
+
img {
|
20 |
+
-webkit-touch-callout: none;
|
21 |
+
-webkit-user-select: none;
|
22 |
+
}
|
23 |
+
*[background-image] {
|
24 |
+
-webkit-touch-callout: none;
|
25 |
+
-webkit-user-select: none;
|
26 |
+
}
|
27 |
+
|
no-right-click-images.js
CHANGED
@@ -5,7 +5,7 @@ by Keith P. Graham
|
|
5 |
|
6 |
Plugin URI: http://www.BlogsEye.com/
|
7 |
Description: Uses Javascript to prevent right clicking of images to help keep leaches from copying images
|
8 |
-
Version: 3.
|
9 |
Author: Keith P. Graham
|
10 |
Author URI: http://www.BlogsEye.com/
|
11 |
|
@@ -19,6 +19,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
19 |
|
20 |
if (nrci_opts['drag']=='Y') {
|
21 |
document.addEventListener("dragstart",kpg_nrci_cm, false);
|
|
|
22 |
}
|
23 |
if (nrci_opts['touch']=='Y') {
|
24 |
document.addEventListener("touchstart",kpg_nrci_cm, false);
|
5 |
|
6 |
Plugin URI: http://www.BlogsEye.com/
|
7 |
Description: Uses Javascript to prevent right clicking of images to help keep leaches from copying images
|
8 |
+
Version: 3.2
|
9 |
Author: Keith P. Graham
|
10 |
Author URI: http://www.BlogsEye.com/
|
11 |
|
19 |
|
20 |
if (nrci_opts['drag']=='Y') {
|
21 |
document.addEventListener("dragstart",kpg_nrci_cm, false);
|
22 |
+
document.addEventListener("touchmove",kpg_nrci_cm, false); /* same as drag? */
|
23 |
}
|
24 |
if (nrci_opts['touch']=='Y') {
|
25 |
document.addEventListener("touchstart",kpg_nrci_cm, false);
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.blogseye.com/buy-the-book/
|
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.0
|
6 |
Contributors: Keith Graham
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -34,6 +34,10 @@ The plugin no longer tries to replace images with a dummy image. This method har
|
|
34 |
|
35 |
== Changelog ==
|
36 |
|
|
|
|
|
|
|
|
|
37 |
= 3.1 =
|
38 |
* Fixed Option initialization
|
39 |
|
@@ -92,16 +96,6 @@ This plugin is free and I expect nothing in return. Please rate the plugin at: h
|
|
92 |
= Buy my book =
|
93 |
If you wish to support my programming, buy my book:
|
94 |
http://www.blogseye.com/buy-the-book/ : Error Message Eyes: A Programmer's Guide to the Digital Soul
|
95 |
-
=
|
96 |
-
|
97 |
-
|
98 |
-
http://wordpress.org/extend/plugins/open-in-new-window-plugin/ : Open in New Window Plugin
|
99 |
-
|
100 |
-
http://wordpress.org/extend/plugins/kindle-this/ : Kindle This - publish blog to user's Kindle
|
101 |
-
|
102 |
-
http://wordpress.org/extend/plugins/stop-spammer-registrations-plugin/ : Stop Spammer Registrations Plugin
|
103 |
-
|
104 |
-
http://wordpress.org/extend/plugins/collapse-page-and-category-plugin/ : Collapse Page and Category Plugin
|
105 |
-
|
106 |
-
http://wordpress.org/extend/plugins/custom-post-type-list-widget/ : Custom Post Type List Widget
|
107 |
-
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.0
|
6 |
Contributors: Keith Graham
|
7 |
+
Stable tag: 3.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
34 |
|
35 |
== Changelog ==
|
36 |
|
37 |
+
= 3.2 =
|
38 |
+
* Added a CSS option for IOS to suppress the context menu on long presses and selects.
|
39 |
+
* Reworked the get_options method to remove redundancies.
|
40 |
+
|
41 |
= 3.1 =
|
42 |
* Fixed Option initialization
|
43 |
|
96 |
= Buy my book =
|
97 |
If you wish to support my programming, buy my book:
|
98 |
http://www.blogseye.com/buy-the-book/ : Error Message Eyes: A Programmer's Guide to the Digital Soul
|
99 |
+
= Other Plugins =
|
100 |
+
* I am a contributor to https://wordpress.org/plugins/astounding-spam-prevention which is a very powerful anti spam plugin.
|
101 |
+
* I have also written https://wordpress.org/plugins/open-in-new-window-plugin which forces external links to open in a new window.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|