Version Description
- PLEASE READ BEFORE UPDATING
- THIS IS A COMPLETELY REFACTORED VERSION OF THE PLUGIN. EVEN WITH INVESTING TONS OF TIME INTO MAKING THIS PLUGIN AS MUCH BACKWARDS COMPATIBLE AS POSSIBLE, WE WOULD STILL APPRECIATE IF YOU TEST THIS VERSION BEFORE YPU UPDATE.
- THE PLUGIN GOT A COMPLETE OVERHAUL AND OFFERS NOW MORE OPTIMIZED FEATURES AND A SUPER SIMPLE USER INTERFACE. PLEASE FIND ALL CHANGES DOWN BELOW.
- Feature: Completely rewritten version of your beloved plugin
- Feature: Introduce FULL SITE PROTECTION (Automatically protect ALL emails within your page)
- Feature: Simplified settings (We cleaned the settings a lot, but you can still get some your old settings page back by activating the advanced checkbox :) )
- Feature: Feature to automatically detect the best protection method
- Feature: Choose from four new settings the strength of your protections
- Feature: Added admin security check icon to encoded input fields and encoded plain emails/texts, as well as to all shortcodes
- Feature: Also protect every single shortcode content
- Feature: Create images out of email addresses
- Feature: Protect header section automatically
- Feature: Added and refactored shortcodes. For a full list of shortcodes, please check this article: https://ironikus.com/docs/knowledge-base/available-shortcodes/
- Feature: Setting to deactivate the Encoder Form completely
- Feature: Choose converting plain emails to mailto links as an additional feature
- Feature: Change filter apply from "wp" to "init" (This allows you to also grab some ajax values to parse them directy encoded)
- Feature: Website checker to search your site for unprotected emails. Follow this URL for more information: https://ironikus.com/email-checker/
- Tweak: Backward compatibility to the new plugin settings
- Tweak: Completely performance optimized (We removed everything that is not necessary, included a better object caching and much more)
- Tweak: Optimized filter combinations
- Fix: The old logic broke some email encodings, especially with custom tags. We fixed all of them
- Fix: We fixed tons of bugs from the previous version
- Dev: Code rewritten on the newest WordPress standards
- Dev: Tons of new WordPress filters and actions. For a full list, please check https://ironikus.com/docs/article-categories/email-encoder/
- Deprecated: We removed the deprecated functions. Please make sure to update your custom logic to the newest standards.
Download this release
Release Info
Developer | ironikus |
Plugin | Email Encoder Bundle – Protect Email Address |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.53 to 2.0.0
- core/class-email-encoder-bundle.php +149 -0
- core/includes/assets/css/style-admin.css +6 -0
- core/includes/assets/css/style.css +23 -0
- images/icon-email-encoder-16.png → core/includes/assets/img/icon-email-encoder-bundle.png +0 -0
- {images → core/includes/assets/img}/icon-email-encoder.png +0 -0
- {images → core/includes/assets/img}/icon-wp-snow.png +0 -0
- {images → core/includes/assets/img}/icon-wp-webhooks.png +0 -0
- {images → core/includes/assets/img}/quick-start.png +0 -0
- core/includes/assets/index.php +1 -0
- core/includes/assets/js/custom-admin.js +9 -0
- core/includes/assets/js/custom.js +98 -0
- js/email-encoder-bundle.js → core/includes/assets/js/encoder-form.js +9 -8
- core/includes/classes/class-email-encoder-bundle-ajax.php +121 -0
- core/includes/classes/class-email-encoder-bundle-helpers.php +240 -0
- core/includes/classes/class-email-encoder-bundle-run-admin.php +250 -0
- core/includes/classes/class-email-encoder-bundle-run.php +593 -0
- core/includes/classes/class-email-encoder-bundle-settings.php +773 -0
- core/includes/classes/class-email-encoder-bundle-validate.php +865 -0
- core/includes/classes/index.php +1 -0
- core/includes/functions/template-tags.php +139 -0
- core/includes/index.php +1 -0
- includes/integrations.php → core/includes/integrations/classes/mailoptin.php +2 -8
- core/includes/integrations/loader.php +44 -0
- core/includes/partials/eeb-page-display.php +42 -0
- core/includes/partials/help-tabs/general.php +15 -0
- core/includes/partials/help-tabs/shortcodes.php +12 -0
- core/includes/partials/help-tabs/template-tags.php +35 -0
- core/includes/partials/index.php +1 -0
- core/includes/partials/widgets/main.php +105 -0
- core/includes/partials/widgets/sidebar.php +47 -0
- core/index.php +1 -0
- email-encoder-bundle.php +57 -72
- includes/class-eeb-admin.php +0 -851
- includes/class-eeb-site.php +0 -586
- includes/deprecated.php +0 -64
- includes/template-functions.php +0 -76
- index.php +1 -0
- js/email-encoder-bundle-admin.js +0 -59
- languages/index.php +1 -0
- languages/wp-mailto-links.mo +0 -0
- languages/wp-mailto-links.po +14 -0
- license.txt +674 -0
- readme.txt +326 -319
core/class-email-encoder-bundle.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists( 'Email_Encoder' ) ) :
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Main Email_Encoder Class.
|
6 |
+
*
|
7 |
+
* @since 2.0.0
|
8 |
+
* @package EEB
|
9 |
+
* @author Ironikus <info@ironikus.com>
|
10 |
+
*/
|
11 |
+
final class Email_Encoder {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The real instance
|
15 |
+
*
|
16 |
+
* @var Email_Encoder
|
17 |
+
* @since 2.0.0
|
18 |
+
*/
|
19 |
+
private static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* EEB settings Object.
|
23 |
+
*
|
24 |
+
* @var object|Email_Encoder_Settings
|
25 |
+
* @since 2.0.0
|
26 |
+
*/
|
27 |
+
public $settings;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* EEB helpers Object.
|
31 |
+
*
|
32 |
+
* @var object|Email_Encoder_Helpers
|
33 |
+
* @since 2.0.0
|
34 |
+
*/
|
35 |
+
public $helpers;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* EEB validate Object.
|
39 |
+
*
|
40 |
+
* @var object|Email_Encoder_Validate
|
41 |
+
* @since 2.0.0
|
42 |
+
*/
|
43 |
+
public $validate;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Throw error on object clone.
|
47 |
+
*
|
48 |
+
* Cloning instances of the class is forbidden.
|
49 |
+
*
|
50 |
+
* @since 2.0.0
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
public function __clone() {
|
54 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'ironikus' ), '2.0.0' );
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Disable unserializing of the class.
|
59 |
+
*
|
60 |
+
* @since 2.0.0
|
61 |
+
* @return void
|
62 |
+
*/
|
63 |
+
public function __wakeup() {
|
64 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'ironikus' ), '2.0.0' );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Main Email_Encoder Instance.
|
69 |
+
*
|
70 |
+
* Insures that only one instance of Email_Encoder exists in memory at any one
|
71 |
+
* time. Also prevents needing to define globals all over the place.
|
72 |
+
*
|
73 |
+
* @since 2.0.0
|
74 |
+
* @static
|
75 |
+
* @staticvar array $instance
|
76 |
+
* @return object|Email_Encoder The one true Email_Encoder
|
77 |
+
*/
|
78 |
+
public static function instance() {
|
79 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Email_Encoder ) ) {
|
80 |
+
self::$instance = new Email_Encoder;
|
81 |
+
self::$instance->base_hooks();
|
82 |
+
self::$instance->includes();
|
83 |
+
self::$instance->helpers = new Email_Encoder_Helpers();
|
84 |
+
self::$instance->settings = new Email_Encoder_Settings();
|
85 |
+
self::$instance->validate = new Email_Encoder_Validate();
|
86 |
+
|
87 |
+
new Email_Encoder_Ajax();
|
88 |
+
new EEB_Integrations_Loader();
|
89 |
+
new Email_Encoder_Run();
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Fire a custom action to allow extensions to register
|
93 |
+
* after Email Encoder was successfully registered
|
94 |
+
*/
|
95 |
+
do_action( 'eeb_plugin_loaded' );
|
96 |
+
}
|
97 |
+
|
98 |
+
return self::$instance;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Include required files.
|
103 |
+
*
|
104 |
+
* @access private
|
105 |
+
* @since 2.0.0
|
106 |
+
* @return void
|
107 |
+
*/
|
108 |
+
private function includes() {
|
109 |
+
require_once EEB_PLUGIN_DIR . 'core/includes/classes/class-email-encoder-bundle-helpers.php';
|
110 |
+
require_once EEB_PLUGIN_DIR . 'core/includes/classes/class-email-encoder-bundle-settings.php';
|
111 |
+
require_once EEB_PLUGIN_DIR . 'core/includes/classes/class-email-encoder-bundle-validate.php';
|
112 |
+
|
113 |
+
require_once EEB_PLUGIN_DIR . 'core/includes/classes/class-email-encoder-bundle-ajax.php';
|
114 |
+
|
115 |
+
require_once EEB_PLUGIN_DIR . 'core/includes/integrations/loader.php';
|
116 |
+
|
117 |
+
if( is_admin() ){
|
118 |
+
require_once EEB_PLUGIN_DIR . 'core/includes/classes/class-email-encoder-bundle-run-admin.php';
|
119 |
+
} else {
|
120 |
+
require_once EEB_PLUGIN_DIR . 'core/includes/classes/class-email-encoder-bundle-run.php';
|
121 |
+
}
|
122 |
+
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Add base hooks for the core functionality
|
127 |
+
*
|
128 |
+
* @access private
|
129 |
+
* @since 2.0.0
|
130 |
+
* @return void
|
131 |
+
*/
|
132 |
+
private function base_hooks() {
|
133 |
+
add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Loads the plugin language files.
|
138 |
+
*
|
139 |
+
* @access public
|
140 |
+
* @since 2.0.0
|
141 |
+
* @return void
|
142 |
+
*/
|
143 |
+
public function load_textdomain() {
|
144 |
+
load_plugin_textdomain( EEB_TEXTDOMAIN, FALSE, dirname( plugin_basename( EEB_PLUGIN_FILE ) ) . '/languages/' );
|
145 |
+
}
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
endif; // End if class_exists check.
|
core/includes/assets/css/style-admin.css
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#other_plugins img {
|
2 |
+
vertical-align: middle;
|
3 |
+
height: 24px;
|
4 |
+
width: auto;
|
5 |
+
padding: 0 5px 0 0;
|
6 |
+
}
|
core/includes/assets/css/style.css
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
span.eeb-nodis {
|
2 |
+
display:none !important;
|
3 |
+
}
|
4 |
+
|
5 |
+
span.eeb-rtl {
|
6 |
+
unicode-bidi:bidi-override !important;
|
7 |
+
direction:rtl !important;
|
8 |
+
display:inline !important;
|
9 |
+
}
|
10 |
+
span.eeb-rtl span.eeb-sd, span.eeb-nrtl span.eeb-sd{
|
11 |
+
display:inline !important;
|
12 |
+
padding-left:0 !important;
|
13 |
+
}
|
14 |
+
span.eeb-nrtl {
|
15 |
+
word-break: break-all !important;
|
16 |
+
}
|
17 |
+
|
18 |
+
.eeb-encoded {
|
19 |
+
position:relative;
|
20 |
+
margin-top:-0.3em;
|
21 |
+
z-index:1000;
|
22 |
+
color:green;
|
23 |
+
}
|
images/icon-email-encoder-16.png → core/includes/assets/img/icon-email-encoder-bundle.png
RENAMED
File without changes
|
{images → core/includes/assets/img}/icon-email-encoder.png
RENAMED
File without changes
|
{images → core/includes/assets/img}/icon-wp-snow.png
RENAMED
File without changes
|
{images → core/includes/assets/img}/icon-wp-webhooks.png
RENAMED
File without changes
|
{images → core/includes/assets/img}/quick-start.png
RENAMED
File without changes
|
core/includes/assets/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php //Silence is golden
|
core/includes/assets/js/custom-admin.js
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Email Encoder Admin */
|
2 |
+
jQuery(function ($) {
|
3 |
+
|
4 |
+
'use strict';
|
5 |
+
|
6 |
+
// add form-table class to Encoder Form tables
|
7 |
+
$('.eeb-form table').addClass('form-table');
|
8 |
+
|
9 |
+
});
|
core/includes/assets/js/custom.js
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Email Encoder */
|
2 |
+
/*global jQuery, window*/
|
3 |
+
jQuery(function ($) {
|
4 |
+
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
// encoding method
|
8 |
+
function rot13(s) {
|
9 |
+
// source: http://jsfromhell.com/string/rot13
|
10 |
+
return s.replace(/[a-zA-Z]/g, function (c) {
|
11 |
+
return String.fromCharCode((c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
|
12 |
+
});
|
13 |
+
}
|
14 |
+
|
15 |
+
// fetch email from data attribute
|
16 |
+
function fetchEmail(el) {
|
17 |
+
var email = el.getAttribute('data-enc-email');
|
18 |
+
|
19 |
+
if (!email) {
|
20 |
+
return null;
|
21 |
+
}
|
22 |
+
|
23 |
+
// replace [at] sign
|
24 |
+
email = email.replace(/\[at\]/g, '@');
|
25 |
+
|
26 |
+
// encode
|
27 |
+
email = rot13(email);
|
28 |
+
|
29 |
+
return email;
|
30 |
+
}
|
31 |
+
|
32 |
+
// replace email in title attribute
|
33 |
+
function parseTitle(el) {
|
34 |
+
var title = el.getAttribute('title');
|
35 |
+
var email = fetchEmail(el);
|
36 |
+
|
37 |
+
if (title && email) {
|
38 |
+
title = title.replace('{{email}}', email);
|
39 |
+
el.setAttribute('title', title);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
// set input value attribute
|
44 |
+
function setInputValue(el) {
|
45 |
+
var email = fetchEmail(el);
|
46 |
+
|
47 |
+
if (email) {
|
48 |
+
el.setAttribute('value', email);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
// open mailto link
|
53 |
+
function mailto(el) {
|
54 |
+
var email = fetchEmail(el);
|
55 |
+
|
56 |
+
if (email) {
|
57 |
+
window.location.href = 'mailto:' + email;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
// revert
|
62 |
+
function revert(el, rtl) {
|
63 |
+
var email = fetchEmail(el);
|
64 |
+
|
65 |
+
if (email) {
|
66 |
+
rtl.text(email);
|
67 |
+
rtl.removeClass('eeb-rtl');
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
// prepare for copying email
|
72 |
+
document.addEventListener('copy', function(e){
|
73 |
+
$('a[data-enc-email]').each(function () {
|
74 |
+
var rtl = $(this).find('.eeb-rtl');
|
75 |
+
|
76 |
+
if (rtl.text()) {
|
77 |
+
revert(this, rtl);
|
78 |
+
}
|
79 |
+
});
|
80 |
+
console.log('copy');
|
81 |
+
});
|
82 |
+
|
83 |
+
// set mailto click
|
84 |
+
$('body').on('click', 'a[data-enc-email]', function () {
|
85 |
+
mailto(this);
|
86 |
+
});
|
87 |
+
|
88 |
+
// parse title attirbute
|
89 |
+
$('a[data-enc-email]').each(function () {
|
90 |
+
parseTitle(this);
|
91 |
+
});
|
92 |
+
|
93 |
+
// parse input fields
|
94 |
+
$('input[data-enc-email]').each(function () {
|
95 |
+
setInputValue(this);
|
96 |
+
});
|
97 |
+
|
98 |
+
});
|
js/email-encoder-bundle.js → core/includes/assets/js/encoder-form.js
RENAMED
@@ -1,6 +1,5 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
jQuery(function ($) {
|
4 |
'use strict';
|
5 |
|
6 |
var $wrap = $('.eeb-form');
|
@@ -19,15 +18,17 @@ jQuery(function ($) {
|
|
19 |
$wrap.find('#eeb-encoded-output').val('');
|
20 |
|
21 |
// get the encoded email link
|
22 |
-
$.post(
|
23 |
-
|
|
|
24 |
eebEmail: $email.val(),
|
25 |
eebDisplay: $display.val() || $email.val(),
|
26 |
eebMethod: $wrap.find('#eeb-encode-method').val()
|
27 |
-
}, function (
|
28 |
-
$wrap.find('#eeb-encoded-output').val(
|
29 |
$wrap.find('.eeb-output').fadeIn();
|
30 |
});
|
|
|
31 |
};
|
32 |
|
33 |
// hide output
|
@@ -71,4 +72,4 @@ jQuery(function ($) {
|
|
71 |
getEncoded();
|
72 |
});
|
73 |
|
74 |
-
});
|
1 |
+
jQuery( document ).ready( function( $ ) {
|
2 |
+
|
|
|
3 |
'use strict';
|
4 |
|
5 |
var $wrap = $('.eeb-form');
|
18 |
$wrap.find('#eeb-encoded-output').val('');
|
19 |
|
20 |
// get the encoded email link
|
21 |
+
$.post( eeb_ef.ajaxurl, {
|
22 |
+
action: 'eeb_get_email_form_output',
|
23 |
+
eebsec : eeb_ef.security,
|
24 |
eebEmail: $email.val(),
|
25 |
eebDisplay: $display.val() || $email.val(),
|
26 |
eebMethod: $wrap.find('#eeb-encode-method').val()
|
27 |
+
}, function ( response ) {
|
28 |
+
$wrap.find('#eeb-encoded-output').val( response );
|
29 |
$wrap.find('.eeb-output').fadeIn();
|
30 |
});
|
31 |
+
|
32 |
};
|
33 |
|
34 |
// hide output
|
72 |
getEncoded();
|
73 |
});
|
74 |
|
75 |
+
});
|
core/includes/classes/class-email-encoder-bundle-ajax.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Email_Encoder_Ajax
|
5 |
+
*
|
6 |
+
* Thats where we bring the plugin to life
|
7 |
+
*
|
8 |
+
* @since 2.0.0
|
9 |
+
* @package EEB
|
10 |
+
* @author Ironikus <info@ironikus.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Email_Encoder_Ajax{
|
14 |
+
|
15 |
+
/**
|
16 |
+
* The main page name for our admin page
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
* @since 2.0.0
|
20 |
+
*/
|
21 |
+
private $page_name;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The main page title for our admin page
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
* @since 2.0.0
|
28 |
+
*/
|
29 |
+
private $page_title;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Our Email_Encoder_Run constructor.
|
33 |
+
*/
|
34 |
+
function __construct(){
|
35 |
+
$this->page_name = EEB()->settings->get_page_name();
|
36 |
+
$this->page_title = EEB()->settings->get_page_title();
|
37 |
+
$this->add_hooks();
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Define all of our necessary hooks
|
42 |
+
*/
|
43 |
+
private function add_hooks(){
|
44 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'load_ajax_scripts_styles' ), EEB()->settings->get_hook_priorities( 'load_ajax_scripts_styles' ) );
|
45 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'load_ajax_scripts_styles' ), EEB()->settings->get_hook_priorities( 'load_ajax_scripts_styles_admin' ) );
|
46 |
+
|
47 |
+
add_action( 'wp_ajax_eeb_get_email_form_output', array( $this, 'eeb_ajax_email_encoder_response' ) );
|
48 |
+
add_action( 'wp_ajax_nopriv_eeb_get_email_form_output', array( $this, 'eeb_ajax_email_encoder_response' ) );
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* ######################
|
53 |
+
* ###
|
54 |
+
* #### SCRIPTS & STYLES
|
55 |
+
* ###
|
56 |
+
* ######################
|
57 |
+
*/
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Register all necessary scripts and styles
|
61 |
+
*
|
62 |
+
* @since 2.0.0
|
63 |
+
*/
|
64 |
+
public function load_ajax_scripts_styles() {
|
65 |
+
$display_encoder_form = (bool) EEB()->settings->get_setting( 'display_encoder_form', true, 'encoder_form' );
|
66 |
+
|
67 |
+
if( $display_encoder_form ){
|
68 |
+
$js_version_form = date( "ymd-Gis", filemtime( EEB_PLUGIN_DIR . 'core/includes/assets/js/encoder-form.js' ));
|
69 |
+
wp_enqueue_script( 'eeb-js-ajax-ef', EEB_PLUGIN_URL . 'core/includes/assets/js/encoder-form.js', array('jquery'), $js_version_form, true );
|
70 |
+
wp_localize_script( 'eeb-js-ajax-ef', 'eeb_ef', array(
|
71 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
72 |
+
'security' => wp_create_nonce( $this->page_name )
|
73 |
+
));
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* ######################
|
80 |
+
* ###
|
81 |
+
* #### CORE LOGIC
|
82 |
+
* ###
|
83 |
+
* ######################
|
84 |
+
*/
|
85 |
+
|
86 |
+
public function eeb_ajax_email_encoder_response(){
|
87 |
+
check_ajax_referer( $this->page_name, 'eebsec' );
|
88 |
+
|
89 |
+
$email = html_entity_decode( sanitize_email( $_POST['eebEmail'] ) );
|
90 |
+
$method = sanitize_text_field( $_POST['eebMethod'] );
|
91 |
+
$display = wp_kses_post( $_POST['eebDisplay'] );
|
92 |
+
$custom_class = (string) EEB()->settings->get_setting( 'class_name', true );
|
93 |
+
$protection_text = EEB()->helpers->translate( EEB()->settings->get_setting( 'protection_text', true ), 'email-protection-text' );
|
94 |
+
|
95 |
+
if( empty( $display ) ) {
|
96 |
+
$display = $email;
|
97 |
+
} else {
|
98 |
+
$display = html_entity_decode($display);
|
99 |
+
}
|
100 |
+
|
101 |
+
$class_name = ' class="' . esc_attr( $custom_class ) . '"';
|
102 |
+
$mailto = '<a href="mailto:' . $email . '"'. $class_name . '>' . $display . '</a>';
|
103 |
+
|
104 |
+
switch( $method ){
|
105 |
+
case 'rot13':
|
106 |
+
$mailto = EEB()->validate->encode_ascii( $mailto, $protection_text );
|
107 |
+
break;
|
108 |
+
case 'escape':
|
109 |
+
$mailto = EEB()->validate->encode_escape( $mailto, $protection_text );
|
110 |
+
break;
|
111 |
+
case 'encode':
|
112 |
+
default:
|
113 |
+
$mailto = '<a href="mailto:' . antispambot( $email ) . '"'. $class_name . '>' . antispambot( $display ) . '</a>';
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
|
117 |
+
echo apply_filters( 'eeb/ajax/encoder_form_response', $mailto );
|
118 |
+
exit;
|
119 |
+
}
|
120 |
+
|
121 |
+
}
|
core/includes/classes/class-email-encoder-bundle-helpers.php
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Email_Encoder_Helpers Class
|
5 |
+
*
|
6 |
+
* This class contains all of the available helper functions
|
7 |
+
*
|
8 |
+
* @since 2.0.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* The helpers of the plugin.
|
13 |
+
*
|
14 |
+
* @since 2.0.0
|
15 |
+
* @package EEB
|
16 |
+
* @author Ironikus <info@ironikus.com>
|
17 |
+
*/
|
18 |
+
class Email_Encoder_Helpers {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Translate custom Strings
|
22 |
+
*
|
23 |
+
* @param $string - The language string
|
24 |
+
* @param null $cname - If no custom name is set, return the default one
|
25 |
+
* @return string - The translated language string
|
26 |
+
*/
|
27 |
+
public function translate( $string, $cname = null, $prefix = null ){
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Filter to control the translation and optimize
|
31 |
+
* them to a specific output
|
32 |
+
*/
|
33 |
+
$trigger = apply_filters( 'eeb/helpers/control_translations', true, $string, $cname );
|
34 |
+
if( empty( $trigger ) ){
|
35 |
+
return $string;
|
36 |
+
}
|
37 |
+
|
38 |
+
if( empty( $string ) ){
|
39 |
+
return $string;
|
40 |
+
}
|
41 |
+
|
42 |
+
if( ! empty( $cname ) ){
|
43 |
+
$context = $cname;
|
44 |
+
} else {
|
45 |
+
$context = 'default';
|
46 |
+
}
|
47 |
+
|
48 |
+
if( $prefix == 'default' ){
|
49 |
+
$front = 'EEB: ';
|
50 |
+
} elseif ( ! empty( $prefix ) ){
|
51 |
+
$front = $prefix;
|
52 |
+
} else {
|
53 |
+
$front = '';
|
54 |
+
}
|
55 |
+
|
56 |
+
// WPML String Translation Logic (WPML itself has problems with _x in some versions)
|
57 |
+
if( function_exists( 'icl_t' ) ){
|
58 |
+
return icl_t( (string) 'email-encoder-bundle', $context, $string );
|
59 |
+
} else {
|
60 |
+
return $front . _x( $string, $context, (string) 'email-encoder-bundle' );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Checks if the parsed param is available on the current site
|
66 |
+
*
|
67 |
+
* @param $param
|
68 |
+
* @return bool
|
69 |
+
*/
|
70 |
+
public function is_page( $param ){
|
71 |
+
if( empty( $param ) ){
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
|
75 |
+
if( isset( $_GET['page'] ) ){
|
76 |
+
if( $_GET['page'] == $param ){
|
77 |
+
return true;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Creates a formatted admin notice
|
86 |
+
*
|
87 |
+
* @param $content - notice content
|
88 |
+
* @param string $type - Status of the specified notice
|
89 |
+
* @param bool $is_dismissible - If the message should be dismissible
|
90 |
+
* @return string - The formatted admin notice
|
91 |
+
*/
|
92 |
+
public function create_admin_notice($content, $type = 'info', $is_dismissible = true){
|
93 |
+
if(empty($content))
|
94 |
+
return '';
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Block an admin notice based onn the specified values
|
98 |
+
*/
|
99 |
+
$throwit = apply_filters('eeb/helpers/throw_admin_notice', true, $content, $type, $is_dismissible);
|
100 |
+
if(!$throwit)
|
101 |
+
return '';
|
102 |
+
|
103 |
+
if($is_dismissible !== true){
|
104 |
+
$isit = '';
|
105 |
+
} else {
|
106 |
+
$isit = 'is-dismissible';
|
107 |
+
}
|
108 |
+
|
109 |
+
|
110 |
+
switch($type){
|
111 |
+
case 'info':
|
112 |
+
$notice = 'notice-info';
|
113 |
+
break;
|
114 |
+
case 'success':
|
115 |
+
$notice = 'notice-success';
|
116 |
+
break;
|
117 |
+
case 'warning':
|
118 |
+
$notice = 'notice-warning';
|
119 |
+
break;
|
120 |
+
case 'error':
|
121 |
+
$notice = 'notice-error';
|
122 |
+
break;
|
123 |
+
default:
|
124 |
+
$notice = 'notice-info';
|
125 |
+
break;
|
126 |
+
}
|
127 |
+
|
128 |
+
if( is_array( $content ) ){
|
129 |
+
$validated_content = sprintf( $this->translate($content[0], 'create-admin-notice'), $content[1] );
|
130 |
+
} else {
|
131 |
+
$validated_content = $this->translate($content, 'create-admin-notice');
|
132 |
+
}
|
133 |
+
|
134 |
+
ob_start();
|
135 |
+
?>
|
136 |
+
<div class="notice <?php echo $notice; ?> <?php echo $isit; ?>">
|
137 |
+
<p><?php echo $validated_content; ?></p>
|
138 |
+
</div>
|
139 |
+
<?php
|
140 |
+
$res = ob_get_clean();
|
141 |
+
|
142 |
+
return $res;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Formats a specific date to datetime
|
147 |
+
*
|
148 |
+
* @param $date
|
149 |
+
* @return DateTime
|
150 |
+
*/
|
151 |
+
public function get_datetime($date){
|
152 |
+
$date_new = date('Y-m-d H:i:s', strtotime($date));
|
153 |
+
$date_new_formatted = new DateTime($date_new);
|
154 |
+
|
155 |
+
return $date_new_formatted;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Builds an url out of the mai values
|
160 |
+
*
|
161 |
+
* @param $url - the default url to set the params to
|
162 |
+
* @param $args - the available args
|
163 |
+
* @return string - the url
|
164 |
+
*/
|
165 |
+
public function built_url( $url, $args ){
|
166 |
+
if(!empty($args)){
|
167 |
+
$url .= '?' . http_build_query($args);
|
168 |
+
}
|
169 |
+
|
170 |
+
return $url;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Get Parameters from URL string
|
175 |
+
*
|
176 |
+
* @param $url - the url
|
177 |
+
*
|
178 |
+
* @return array - the parameters of the url
|
179 |
+
*/
|
180 |
+
public function get_parameters_from_url( $url ){
|
181 |
+
|
182 |
+
$parts = parse_url($url);
|
183 |
+
|
184 |
+
parse_str($parts['query'], $url_parameter);
|
185 |
+
|
186 |
+
return empty( $url_parameter ) ? array() : $url_parameter;
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Builds an url out of the main values
|
192 |
+
*
|
193 |
+
* @param $url - the default url to set the params to
|
194 |
+
* @param $args - the available args
|
195 |
+
* @return string - the url
|
196 |
+
*/
|
197 |
+
public function get_current_url($with_args = true){
|
198 |
+
|
199 |
+
$current_url = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ? 'https://' : 'http://';
|
200 |
+
|
201 |
+
$host_part = $_SERVER['SERVER_NAME'];
|
202 |
+
if( strpos( $host_part, $_SERVER['HTTP_HOST'] ) === false ){
|
203 |
+
|
204 |
+
//Validate against HTTP_HOST in case SERVER_NAME has no "www" set
|
205 |
+
if( strpos( $_SERVER['HTTP_HOST'], '://www.' ) !== false && strpos( $host_part, '://www.' ) === false ){
|
206 |
+
$host_part = str_replace( '://', '://www.', $host_part );
|
207 |
+
}
|
208 |
+
|
209 |
+
}
|
210 |
+
|
211 |
+
$current_url .= sanitize_text_field( $host_part ) . sanitize_text_field( $_SERVER['REQUEST_URI'] );
|
212 |
+
|
213 |
+
if($with_args){
|
214 |
+
return $current_url;
|
215 |
+
} else {
|
216 |
+
return strtok( $current_url, '?' );
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* This is the opponent of JavaScripts decodeURIComponent()
|
222 |
+
* @link http://stackoverflow.com/questions/1734250/what-is-the-equivalent-of-javascripts-encodeuricomponent-in-php
|
223 |
+
* @param string $str
|
224 |
+
* @return string
|
225 |
+
*/
|
226 |
+
public function encode_uri_components( $content ) {
|
227 |
+
$revert = array( '%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')' );
|
228 |
+
return strtr( rawurlencode( $content ), $revert );
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Generate a random bool value
|
233 |
+
*
|
234 |
+
* @return bool
|
235 |
+
*/
|
236 |
+
public function get_random_bool(){
|
237 |
+
return ( rand(0,1) == 1 ) ? true : false;
|
238 |
+
}
|
239 |
+
|
240 |
+
}
|
core/includes/classes/class-email-encoder-bundle-run-admin.php
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Email_Encoder_Run
|
5 |
+
*
|
6 |
+
* Thats where we bring the plugin to life
|
7 |
+
*
|
8 |
+
* @since 2.0.0
|
9 |
+
* @package EEB
|
10 |
+
* @author Ironikus <info@ironikus.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Email_Encoder_Run{
|
14 |
+
|
15 |
+
/**
|
16 |
+
* The main page name for our admin page
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
* @since 2.0.0
|
20 |
+
*/
|
21 |
+
private $page_name;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The main page title for our admin page
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
* @since 2.0.0
|
28 |
+
*/
|
29 |
+
private $page_title;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The page hook itself for registering the meta boxes
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
* @since 2.0.0
|
36 |
+
*/
|
37 |
+
private $pagehook;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Our Email_Encoder_Run constructor.
|
41 |
+
*/
|
42 |
+
function __construct(){
|
43 |
+
$this->page_name = EEB()->settings->get_page_name();
|
44 |
+
$this->page_title = EEB()->settings->get_page_title();
|
45 |
+
$this->settings_key = EEB()->settings->get_settings_key();
|
46 |
+
$this->display_notices = array();
|
47 |
+
$this->add_hooks();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Define all of our necessary hooks
|
52 |
+
*/
|
53 |
+
private function add_hooks(){
|
54 |
+
|
55 |
+
add_action( 'plugin_action_links_' . EEB_PLUGIN_BASE, array($this, 'plugin_action_links') );
|
56 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_and_styles' ) );
|
57 |
+
add_action( 'admin_menu', array( $this, 'add_user_submenu' ), 150 );
|
58 |
+
add_action( 'admin_init', array( $this, 'save_settings' ), 10 );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Plugin action links.
|
63 |
+
*
|
64 |
+
* Adds action links to the plugin list table
|
65 |
+
*
|
66 |
+
* Fired by `plugin_action_links` filter.
|
67 |
+
*
|
68 |
+
* @since 2.0.0
|
69 |
+
* @access public
|
70 |
+
*
|
71 |
+
* @param array $links An array of plugin action links.
|
72 |
+
*
|
73 |
+
* @return array An array of plugin action links.
|
74 |
+
*/
|
75 |
+
public function plugin_action_links( $links ) {
|
76 |
+
$settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . $this->page_name ), EEB()->helpers->translate('Settings', 'plugin-page') );
|
77 |
+
|
78 |
+
array_unshift( $links, $settings_link );
|
79 |
+
|
80 |
+
$links['visit_us'] = sprintf( '<a href="%s" target="_blank" style="font-weight:700;color:#f1592a;">%s</a>', 'https://ironikus.com/?utm_source=email-encoder-bundle&utm_medium=plugin-overview-website-button&utm_campaign=WP%20Mailto%20Links', EEB()->helpers->translate('Visit us', 'plugin-page') );
|
81 |
+
|
82 |
+
return $links;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* ######################
|
87 |
+
* ###
|
88 |
+
* #### SCRIPTS & STYLES
|
89 |
+
* ###
|
90 |
+
* ######################
|
91 |
+
*/
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Register all necessary scripts and styles
|
95 |
+
*
|
96 |
+
* @since 2.0.0
|
97 |
+
*/
|
98 |
+
public function enqueue_scripts_and_styles() {
|
99 |
+
if( EEB()->helpers->is_page( $this->page_name ) ) {
|
100 |
+
$js_version = date( "ymd-Gis", filemtime( EEB_PLUGIN_DIR . 'core/includes/assets/js/custom-admin.js' ));
|
101 |
+
$css_version = date( "ymd-Gis", filemtime( EEB_PLUGIN_DIR . 'core/includes/assets/css/style-admin.css' ));
|
102 |
+
|
103 |
+
wp_enqueue_script( 'eeb-admin-scripts', EEB_PLUGIN_URL . 'core/includes/assets/js/custom-admin.js', array( 'jquery' ), $js_version, true );
|
104 |
+
wp_register_style( 'eeb-css-backend', EEB_PLUGIN_URL . 'core/includes/assets/css/style-admin.css', false, $css_version );
|
105 |
+
wp_enqueue_style ( 'eeb-css-backend' );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* ######################
|
111 |
+
* ###
|
112 |
+
* #### MENU TEMPLATE ITEMS
|
113 |
+
* ###
|
114 |
+
* ######################
|
115 |
+
*/
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Add our custom admin user page
|
119 |
+
*/
|
120 |
+
public function add_user_submenu(){
|
121 |
+
|
122 |
+
if( (string) EEB()->settings->get_setting( 'own_admin_menu', true ) !== '1' ){
|
123 |
+
$this->pagehook = add_submenu_page( 'options-general.php', EEB()->helpers->translate( $this->page_title, 'admin-add-submenu-page-title' ), EEB()->helpers->translate( $this->page_title, 'admin-add-submenu-page-site-title' ), EEB()->settings->get_admin_cap( 'admin-add-submenu-page-item' ), $this->page_name, array( $this, 'render_admin_menu_page' ) );
|
124 |
+
} else {
|
125 |
+
$this->pagehook = add_menu_page( EEB()->helpers->translate( $this->page_title, 'admin-add-menu-page-title' ), EEB()->helpers->translate( $this->page_title, 'admin-add-menu-page-site-title' ), EEB()->settings->get_admin_cap( 'admin-add-menu-page-item' ), $this->page_name, array( $this, 'render_admin_menu_page' ), plugins_url( 'core/includes/assets/img/icon-email-encoder-bundle.png', EEB_PLUGIN_FILE ) );
|
126 |
+
}
|
127 |
+
|
128 |
+
add_action( 'load-' . $this->pagehook, array( $this, 'add_help_tabs' ) );
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Render the admin submenu page
|
133 |
+
*
|
134 |
+
* You need the specified capability to edit it.
|
135 |
+
*/
|
136 |
+
public function render_admin_menu_page(){
|
137 |
+
if( ! current_user_can( EEB()->settings->get_admin_cap('admin-menu-page') ) ){
|
138 |
+
wp_die( EEB()->helpers->translate( EEB()->settings->get_default_string( 'insufficient-permissions' ), 'admin-submenu-page-insufficient-permissions' ) );
|
139 |
+
}
|
140 |
+
|
141 |
+
include( EEB_PLUGIN_DIR . 'core/includes/partials/eeb-page-display.php' );
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* ######################
|
147 |
+
* ###
|
148 |
+
* #### SETTINGS LOGIC
|
149 |
+
* ###
|
150 |
+
* ######################
|
151 |
+
*/
|
152 |
+
|
153 |
+
public function save_settings(){
|
154 |
+
|
155 |
+
if( isset( $_POST[ $this->page_name . '_nonce' ] ) ){
|
156 |
+
if( ! wp_verify_nonce( $_POST[ $this->page_name . '_nonce' ], $this->page_name ) ){
|
157 |
+
wp_die( EEB()->helpers->translate( 'You don\'t have permission to update these settings.', 'admin-settings' ) );
|
158 |
+
}
|
159 |
+
|
160 |
+
if( ! current_user_can( EEB()->settings->get_admin_cap( 'admin-update-settings' ) ) ){
|
161 |
+
wp_die( EEB()->helpers->translate( 'You don\'t have permission to update these settings.', 'admin-settings' ) );
|
162 |
+
}
|
163 |
+
|
164 |
+
if( isset( $_POST[ $this->settings_key ] ) && is_array( $_POST[ $this->settings_key ] ) ){
|
165 |
+
$check = update_option( $this->settings_key, $_POST[ $this->settings_key ] );
|
166 |
+
if( $check ){
|
167 |
+
EEB()->settings->reload_settings();
|
168 |
+
$update_notice = EEB()->helpers->create_admin_notice( 'Settings successfully saved.', 'success', true );
|
169 |
+
$this->display_notices[] = $update_notice;
|
170 |
+
} else {
|
171 |
+
$update_notice = EEB()->helpers->create_admin_notice( 'No changes were made to your settings with your last save.', 'info', true );
|
172 |
+
$this->display_notices[] = $update_notice;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* ######################
|
182 |
+
* ###
|
183 |
+
* #### HELP TABS TEMPLATE ITEMS
|
184 |
+
* ###
|
185 |
+
* ######################
|
186 |
+
*/
|
187 |
+
public function add_help_tabs(){
|
188 |
+
$screen = get_current_screen();
|
189 |
+
$display_encoder_form = (bool) EEB()->settings->get_setting( 'display_encoder_form', true, 'encoder_form' );
|
190 |
+
|
191 |
+
$defaults = array(
|
192 |
+
'content' => '',
|
193 |
+
'callback' => array( $this, 'load_help_tabs' ),
|
194 |
+
);
|
195 |
+
|
196 |
+
$screen->add_help_tab(wp_parse_args(array(
|
197 |
+
'id' => 'general',
|
198 |
+
'title' => __('General', 'email-encoder-bundle'),
|
199 |
+
), $defaults));
|
200 |
+
|
201 |
+
$screen->add_help_tab(wp_parse_args(array(
|
202 |
+
'id' => 'shortcodes',
|
203 |
+
'title' => __('Shortcode', 'email-encoder-bundle'),
|
204 |
+
), $defaults));
|
205 |
+
|
206 |
+
$screen->add_help_tab(wp_parse_args(array(
|
207 |
+
'id' => 'template-tags',
|
208 |
+
'title' => __('Template Tags', 'email-encoder-bundle'),
|
209 |
+
), $defaults));
|
210 |
+
|
211 |
+
//Add widgets
|
212 |
+
if( $display_encoder_form ){
|
213 |
+
add_meta_box( 'encode_form', EEB()->helpers->translate( $this->page_title, 'admin-add-encoder-widget' ), array( $this, 'show_meta_box_content' ), null, 'normal', 'core', array( 'encode_form' ) );
|
214 |
+
}
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
public function load_help_tabs($screen, array $args){
|
219 |
+
|
220 |
+
if( ! empty( $args['id'] ) ){
|
221 |
+
include( EEB_PLUGIN_DIR . 'core/includes/partials/help-tabs/' . $args['id'] . '.php' );
|
222 |
+
}
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Show content of metabox (callback)
|
228 |
+
* @param array $post
|
229 |
+
* @param array $meta_box
|
230 |
+
*/
|
231 |
+
public function show_meta_box_content( $post, $meta_box ) {
|
232 |
+
$key = $meta_box['args'][0];
|
233 |
+
|
234 |
+
if ($key === 'encode_form') {
|
235 |
+
?>
|
236 |
+
<p><?php _e('If you like you can also create you own secured emails manually with this form. Just copy/paste the generated code and put it in your post, page or template. We choose automatically the best method for you, based on your settings.', 'email-encoder-bundle') ?></p>
|
237 |
+
|
238 |
+
<hr style="border:1px solid #FFF; border-top:1px solid #EEE;" />
|
239 |
+
|
240 |
+
<?php echo EEB()->validate->get_encoder_form(); ?>
|
241 |
+
|
242 |
+
<hr style="border:1px solid #FFF; border-top:1px solid #EEE;"/>
|
243 |
+
|
244 |
+
<p class="description"><?php _e('You can also put the encoder form on your site by using the shortcode <code>[eeb_form]</code> or the template function <code>eeb_form()</code>.', 'email-encoder-bundle') ?></p>
|
245 |
+
<?php
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
249 |
+
|
250 |
+
}
|
core/includes/classes/class-email-encoder-bundle-run.php
ADDED
@@ -0,0 +1,593 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Email_Encoder_Run
|
5 |
+
*
|
6 |
+
* Thats where we bring the plugin to life
|
7 |
+
*
|
8 |
+
* @since 2.0.0
|
9 |
+
* @package EEB
|
10 |
+
* @author Ironikus <info@ironikus.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Email_Encoder_Run{
|
14 |
+
|
15 |
+
/**
|
16 |
+
* The main page name for our admin page
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
* @since 2.0.0
|
20 |
+
*/
|
21 |
+
private $page_name;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The main page title for our admin page
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
* @since 2.0.0
|
28 |
+
*/
|
29 |
+
private $page_title;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Our Email_Encoder_Run constructor.
|
33 |
+
*/
|
34 |
+
function __construct(){
|
35 |
+
$this->page_name = EEB()->settings->get_page_name();
|
36 |
+
$this->page_title = EEB()->settings->get_page_title();
|
37 |
+
$this->final_outout_buffer_hook = EEB()->settings->get_final_outout_buffer_hook();
|
38 |
+
$this->widget_callback_hook = EEB()->settings->get_widget_callback_hook();
|
39 |
+
$this->add_hooks();
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Define all of our necessary hooks
|
44 |
+
*/
|
45 |
+
private function add_hooks(){
|
46 |
+
$filter_hook = (bool) EEB()->settings->get_setting( 'filter_hook', true, 'filter_body' );
|
47 |
+
if( $filter_hook ){
|
48 |
+
$hook_name = 'init';
|
49 |
+
} else {
|
50 |
+
$hook_name = 'wp';
|
51 |
+
}
|
52 |
+
|
53 |
+
add_action( 'wp', array( $this, 'display_email_image' ), EEB()->settings->get_hook_priorities( 'display_email_image' ) );
|
54 |
+
add_action( 'init', array( $this, 'buffer_final_output' ), EEB()->settings->get_hook_priorities( 'buffer_final_output' ) );
|
55 |
+
add_action( 'init', array( $this, 'add_custom_template_tags' ), EEB()->settings->get_hook_priorities( 'add_custom_template_tags' ) );
|
56 |
+
add_action( $hook_name, array( $this, 'setup_single_filter_hooks' ), EEB()->settings->get_hook_priorities( 'setup_single_filter_hooks' ) );
|
57 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'load_frontend_header_styling' ), EEB()->settings->get_hook_priorities( 'load_frontend_header_styling' ) );
|
58 |
+
add_filter( 'dynamic_sidebar_params', array( $this, 'eeb_dynamic_sidebar_params' ), EEB()->settings->get_hook_priorities( 'eeb_dynamic_sidebar_params' ) );
|
59 |
+
|
60 |
+
//Add shortcodes
|
61 |
+
add_shortcode( 'eeb_protect_emails', array( $this, 'protect_content_shortcode' ) );
|
62 |
+
add_shortcode( 'eeb_protect_content', array( $this, 'shortcode_eeb_content' ) );
|
63 |
+
add_shortcode( 'eeb_mailto', array( $this, 'shortcode_eeb_email' ) );
|
64 |
+
add_shortcode( 'eeb_form', array( $this, 'shortcode_email_encoder_form' ) );
|
65 |
+
|
66 |
+
//BAckwards compatibility
|
67 |
+
add_shortcode( 'eeb_content', array( $this, 'shortcode_eeb_content' ) );
|
68 |
+
add_shortcode( 'eeb_email', array( $this, 'shortcode_eeb_email' ) );
|
69 |
+
|
70 |
+
do_action('eeb_ready', array($this, 'eeb_ready_callback_filter'), $this);
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* ######################
|
76 |
+
* ###
|
77 |
+
* #### CALLBACK FILTERS
|
78 |
+
* ###
|
79 |
+
* ######################
|
80 |
+
*/
|
81 |
+
|
82 |
+
/**
|
83 |
+
* WP filter callback
|
84 |
+
* @param string $content
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
public function eeb_ready_callback_filter( $content ) {
|
88 |
+
|
89 |
+
if( EEB()->validate->is_post_excluded() ){
|
90 |
+
return $content;
|
91 |
+
}
|
92 |
+
|
93 |
+
$protect_using = (string) EEB()->settings->get_setting( 'protect_using', true );
|
94 |
+
|
95 |
+
return EEB()->validate->filter_content( $content, $protect_using );
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* ######################
|
100 |
+
* ###
|
101 |
+
* #### PAGE BUFFERING & WIDGET FILTER
|
102 |
+
* ###
|
103 |
+
* ######################
|
104 |
+
*/
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Buffer the final output on the init hook
|
108 |
+
*
|
109 |
+
* @return void
|
110 |
+
*/
|
111 |
+
public function buffer_final_output(){
|
112 |
+
ob_start( array( $this, 'apply_content_filter' ) );
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Apply the callabla function for ob_start()
|
117 |
+
*
|
118 |
+
* @param string $content
|
119 |
+
* @return string - the filtered content
|
120 |
+
*/
|
121 |
+
public function apply_content_filter( $content ){
|
122 |
+
$filteredContent = apply_filters( $this->final_outout_buffer_hook, $content );
|
123 |
+
|
124 |
+
// remove filters after applying to prevent multiple applies
|
125 |
+
remove_all_filters( $this->final_outout_buffer_hook );
|
126 |
+
|
127 |
+
return $filteredContent;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Filter for "dynamic_sidebar_params" hook
|
132 |
+
*
|
133 |
+
* @global array $wp_registered_widgets
|
134 |
+
* @param array $params
|
135 |
+
* @return array
|
136 |
+
*/
|
137 |
+
public function eeb_dynamic_sidebar_params( $params){
|
138 |
+
global $wp_registered_widgets;
|
139 |
+
|
140 |
+
if ( is_admin() ) {
|
141 |
+
return $params;
|
142 |
+
}
|
143 |
+
|
144 |
+
$widget_id = $params[0]['widget_id'];
|
145 |
+
|
146 |
+
// prevent overwriting when already set by another version of the widget output class
|
147 |
+
if ( isset( $wp_registered_widgets[ $widget_id ]['_wo_original_callback'] ) ) {
|
148 |
+
return $params;
|
149 |
+
}
|
150 |
+
|
151 |
+
$wp_registered_widgets[ $widget_id ]['_wo_original_callback'] = $wp_registered_widgets[ $widget_id ]['callback'];
|
152 |
+
$wp_registered_widgets[ $widget_id ]['callback'] = array( $this, 'call_widget_callback' );
|
153 |
+
|
154 |
+
return $params;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* The Widget Callback
|
159 |
+
* @global array $wp_registered_widgets
|
160 |
+
*/
|
161 |
+
public function call_widget_callback(){
|
162 |
+
global $wp_registered_widgets;
|
163 |
+
|
164 |
+
$original_callback_params = func_get_args();
|
165 |
+
$original_callback = null;
|
166 |
+
|
167 |
+
$widget_id = $original_callback_params[0]['widget_id'];
|
168 |
+
|
169 |
+
$original_callback = $wp_registered_widgets[ $widget_id ]['_wo_original_callback'];
|
170 |
+
$wp_registered_widgets[ $widget_id ]['callback'] = $original_callback;
|
171 |
+
|
172 |
+
$widget_id_base = $wp_registered_widgets[ $widget_id ]['callback'][0]->id_base;
|
173 |
+
|
174 |
+
if ( is_callable( $original_callback ) ) {
|
175 |
+
ob_start();
|
176 |
+
call_user_func_array( $original_callback, $original_callback_params );
|
177 |
+
$widget_output = ob_get_clean();
|
178 |
+
|
179 |
+
echo apply_filters( $this->widget_callback_hook, $widget_output, $widget_id_base, $widget_id );
|
180 |
+
|
181 |
+
// remove filters after applying to prevent multiple applies
|
182 |
+
remove_all_filters( $this->widget_callback_hook );
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* ######################
|
188 |
+
* ###
|
189 |
+
* #### SCRIPT ENQUEUEMENTS
|
190 |
+
* ###
|
191 |
+
* ######################
|
192 |
+
*/
|
193 |
+
|
194 |
+
public function load_frontend_header_styling(){
|
195 |
+
|
196 |
+
$js_version_form = date( "ymd-Gis", filemtime( EEB_PLUGIN_DIR . 'core/includes/assets/js/encoder-form.js' ));
|
197 |
+
$js_version = date( "ymd-Gis", filemtime( EEB_PLUGIN_DIR . 'core/includes/assets/js/custom.js' ));
|
198 |
+
$css_version = date( "ymd-Gis", filemtime( EEB_PLUGIN_DIR . 'core/includes/assets/css/style.css' ));
|
199 |
+
$protection_activated = (int) EEB()->settings->get_setting( 'protect', true );
|
200 |
+
$without_javascript = (string) EEB()->settings->get_setting( 'protect_using', true );
|
201 |
+
|
202 |
+
if( $protection_activated === 2 || $protection_activated === 1 ){
|
203 |
+
|
204 |
+
if( (string) EEB()->settings->get_setting( 'show_encoded_check', true ) === '1' ){
|
205 |
+
wp_enqueue_style('dashicons');
|
206 |
+
}
|
207 |
+
|
208 |
+
if( $without_javascript !== 'without_javascript' ){
|
209 |
+
wp_enqueue_script( 'eeb-js-frontend', EEB_PLUGIN_URL . 'core/includes/assets/js/custom.js', array( 'jquery' ), $js_version );
|
210 |
+
}
|
211 |
+
|
212 |
+
wp_register_style( 'eeb-css-frontend', EEB_PLUGIN_URL . 'core/includes/assets/css/style.css', false, $css_version );
|
213 |
+
wp_enqueue_style ( 'eeb-css-frontend' );
|
214 |
+
|
215 |
+
}
|
216 |
+
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* ######################
|
221 |
+
* ###
|
222 |
+
* #### CORE LOGIC
|
223 |
+
* ###
|
224 |
+
* ######################
|
225 |
+
*/
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Register all single filters to protect your content
|
229 |
+
*
|
230 |
+
* @return void
|
231 |
+
*/
|
232 |
+
public function setup_single_filter_hooks(){
|
233 |
+
|
234 |
+
if( EEB()->validate->is_post_excluded() ){
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
|
238 |
+
$protection_method = (int) EEB()->settings->get_setting( 'protect', true );
|
239 |
+
$filter_rss = (int) EEB()->settings->get_setting( 'filter_rss', true, 'filter_body' );
|
240 |
+
$remove_shortcodes_rss = (int) EEB()->settings->get_setting( 'remove_shortcodes_rss', true, 'filter_body' );
|
241 |
+
$protect_shortcode_tags = (bool) EEB()->settings->get_setting( 'protect_shortcode_tags', true, 'filter_body' );
|
242 |
+
$protect_shortcode_tags_valid = false;
|
243 |
+
|
244 |
+
if ( is_feed() ) {
|
245 |
+
|
246 |
+
if( $filter_rss === 1 ){
|
247 |
+
add_filter( $this->final_outout_buffer_hook, array( $this, 'filter_rss' ), EEB()->settings->get_hook_priorities( 'filter_rss' ) );
|
248 |
+
}
|
249 |
+
|
250 |
+
if ( $remove_shortcodes_rss ) {
|
251 |
+
add_filter( $this->final_outout_buffer_hook, array( $this, 'callback_rss_remove_shortcodes' ), EEB()->settings->get_hook_priorities( 'callback_rss_remove_shortcodes' ) );
|
252 |
+
}
|
253 |
+
|
254 |
+
}
|
255 |
+
|
256 |
+
if ( $protection_method === 2 ) {
|
257 |
+
$protect_shortcode_tags_valid = true;
|
258 |
+
|
259 |
+
$filter_hooks = array(
|
260 |
+
'the_title',
|
261 |
+
'the_content',
|
262 |
+
'the_excerpt',
|
263 |
+
'get_the_excerpt',
|
264 |
+
|
265 |
+
//Comment related
|
266 |
+
'comment_text',
|
267 |
+
'comment_excerpt',
|
268 |
+
'comment_url',
|
269 |
+
'get_comment_author_url',
|
270 |
+
'get_comment_author_url_link',
|
271 |
+
|
272 |
+
//Widgets
|
273 |
+
'widget_title',
|
274 |
+
'widget_text',
|
275 |
+
'widget_content',
|
276 |
+
'widget_output',
|
277 |
+
);
|
278 |
+
|
279 |
+
$filter_hooks = apply_filters( 'eeb/frontend/wordpress_filters', $filter_hooks );
|
280 |
+
|
281 |
+
foreach ( $filter_hooks as $hook ) {
|
282 |
+
add_filter( $hook, array( $this, 'filter_content' ), EEB()->settings->get_hook_priorities( 'filter_content' ) );
|
283 |
+
}
|
284 |
+
} elseif( $protection_method === 1 ){
|
285 |
+
$protect_shortcode_tags_valid = true;
|
286 |
+
|
287 |
+
add_filter( $this->final_outout_buffer_hook, array( $this, 'filter_page' ), EEB()->settings->get_hook_priorities( 'filter_page' ) );
|
288 |
+
}
|
289 |
+
|
290 |
+
if( $protect_shortcode_tags_valid ){
|
291 |
+
if( $protect_shortcode_tags ){
|
292 |
+
add_filter( 'do_shortcode_tag', array( $this, 'filter_content' ), EEB()->settings->get_hook_priorities( 'do_shortcode_tag' ) );
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Filter the page itself
|
300 |
+
*
|
301 |
+
* @param string $content
|
302 |
+
* @return string
|
303 |
+
*/
|
304 |
+
public function filter_page( $content ){
|
305 |
+
$protect_using = (string) EEB()->settings->get_setting( 'protect_using', true );
|
306 |
+
|
307 |
+
return EEB()->validate->filter_page( $content, $protect_using );
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Filter the whole content
|
312 |
+
*
|
313 |
+
* @param string $content
|
314 |
+
* @return string
|
315 |
+
*/
|
316 |
+
public function filter_content( $content ){
|
317 |
+
$protect_using = (string) EEB()->settings->get_setting( 'protect_using', true );
|
318 |
+
return EEB()->validate->filter_content( $content, $protect_using );
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Filter the rss content
|
323 |
+
*
|
324 |
+
* @param string $content
|
325 |
+
* @return string
|
326 |
+
*/
|
327 |
+
public function filter_rss( $content ){
|
328 |
+
$protection_type = (string) EEB()->settings->get_setting( 'protect_using', true );
|
329 |
+
return EEB()->validate->filter_rss( $content, $protection_type );
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* RSS Callback Remove shortcodes
|
334 |
+
* @param string $content
|
335 |
+
* @return string
|
336 |
+
*/
|
337 |
+
public function callback_rss_remove_shortcodes( $content ) {
|
338 |
+
// strip shortcodes like [eeb_content], [eeb_form]
|
339 |
+
$content = strip_shortcodes($content);
|
340 |
+
|
341 |
+
return $content;
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* ######################
|
346 |
+
* ###
|
347 |
+
* #### SHORTCODES
|
348 |
+
* ###
|
349 |
+
* ######################
|
350 |
+
*/
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Handle content filter shortcode
|
354 |
+
* @param array $atts
|
355 |
+
* @param string $content
|
356 |
+
*/
|
357 |
+
public function protect_content_shortcode( $atts, $content = null ){
|
358 |
+
$protect = (int) EEB()->settings->get_setting( 'protect', true );
|
359 |
+
$protect_using = (string) EEB()->settings->get_setting( 'protect_using', true );
|
360 |
+
$protection_activated = ( $protect === 1 || $protect === 2 ) ? true : false;
|
361 |
+
|
362 |
+
if ( ! $protection_activated ) {
|
363 |
+
return $content;
|
364 |
+
}
|
365 |
+
|
366 |
+
if( isset( $atts['protect_using'] ) ){
|
367 |
+
$protect_using = $atts['protect_using'];
|
368 |
+
}
|
369 |
+
|
370 |
+
$content = EEB()->validate->filter_content( $content, $protect_using );
|
371 |
+
|
372 |
+
return $content;
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Return the email encoder form
|
377 |
+
* @param array $atts
|
378 |
+
* @param string $content
|
379 |
+
*/
|
380 |
+
public function shortcode_email_encoder_form( $atts = array(), $content = null ){
|
381 |
+
$display_encoder_form = (bool) EEB()->settings->get_setting( 'display_encoder_form', true, 'encoder_form' );
|
382 |
+
|
383 |
+
if( $display_encoder_form ){
|
384 |
+
return EEB()->validate->get_encoder_form();
|
385 |
+
}
|
386 |
+
|
387 |
+
return '';
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Return the encoded content
|
392 |
+
* @param array $atts
|
393 |
+
* @param string $content
|
394 |
+
*/
|
395 |
+
public function shortcode_eeb_content( $atts = array(), $content = null ){
|
396 |
+
|
397 |
+
$show_encoded_check = (string) EEB()->settings->get_setting( 'show_encoded_check', true );
|
398 |
+
|
399 |
+
if( ! isset( $atts['protection_text'] ) ){
|
400 |
+
$protection_text = EEB()->helpers->translate( EEB()->settings->get_setting( 'protection_text', true ), 'email-protection-text-eeb-content' );
|
401 |
+
} else {
|
402 |
+
$protection_text = wp_kses_post( $atts['protection_text'] );
|
403 |
+
}
|
404 |
+
|
405 |
+
if( isset( $atts['method'] ) ){
|
406 |
+
$method = sanitize_title( $atts['method'] );
|
407 |
+
} else {
|
408 |
+
$method = 'rot13';
|
409 |
+
}
|
410 |
+
|
411 |
+
switch( $method ){
|
412 |
+
case 'enc_ascii':
|
413 |
+
case 'rot13':
|
414 |
+
$content = EEB()->validate->encode_ascii( $content, $protection_text );
|
415 |
+
break;
|
416 |
+
case 'enc_escape':
|
417 |
+
case 'escape':
|
418 |
+
$content = EEB()->validate->encode_escape( $content, $protection_text );
|
419 |
+
break;
|
420 |
+
case 'enc_html':
|
421 |
+
case 'encode':
|
422 |
+
default:
|
423 |
+
$content = antispambot( $content );
|
424 |
+
break;
|
425 |
+
}
|
426 |
+
|
427 |
+
// mark link as successfullly encoded (for admin users)
|
428 |
+
if ( current_user_can( EEB()->settings->get_admin_cap( 'frontend-display-security-check' ) ) && $show_encoded_check ) {
|
429 |
+
$content .= '<i class="eeb-encoded dashicons-before dashicons-lock" title="' . EEB()->helpers->translate( 'Email encoded successfully!', 'frontend-security-check-title' ) . '"></i>';
|
430 |
+
}
|
431 |
+
|
432 |
+
return apply_filters( 'eeb/frontend/shortcode/eeb_protect_content', $content, $atts );
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Return the encoded email
|
437 |
+
* @param array $atts
|
438 |
+
* @param string $content
|
439 |
+
*/
|
440 |
+
public function shortcode_eeb_email( $atts = array(), $content = null ){
|
441 |
+
|
442 |
+
$show_encoded_check = (string) EEB()->settings->get_setting( 'show_encoded_check', true );
|
443 |
+
|
444 |
+
if( empty( $atts['email'] ) ){
|
445 |
+
return '';
|
446 |
+
} else {
|
447 |
+
$email = $atts['email'];
|
448 |
+
}
|
449 |
+
|
450 |
+
if( empty( $atts['extra_attrs'] ) ){
|
451 |
+
$extra_attrs = '';
|
452 |
+
} else {
|
453 |
+
$extra_attrs = $atts['extra_attrs'];
|
454 |
+
}
|
455 |
+
|
456 |
+
if( empty( $atts['method'] ) ){
|
457 |
+
$method = 'rot13';
|
458 |
+
} else {
|
459 |
+
$method = sanitize_title( $atts['method'] );
|
460 |
+
}
|
461 |
+
|
462 |
+
$custom_class = (string) EEB()->settings->get_setting( 'class_name', true );
|
463 |
+
|
464 |
+
if( empty( $atts['display'] ) ) {
|
465 |
+
$display = $email;
|
466 |
+
} else {
|
467 |
+
$display = html_entity_decode( $atts['display'] );
|
468 |
+
}
|
469 |
+
|
470 |
+
$class_name = ' ' . trim( $extra_attrs );
|
471 |
+
$class_name .= ' class="' . esc_attr( $custom_class ) . '"';
|
472 |
+
$mailto = '<a href="mailto:' . $email . '"'. $class_name . '>' . $display . '</a>';
|
473 |
+
|
474 |
+
switch( $method ){
|
475 |
+
case 'enc_ascii':
|
476 |
+
case 'rot13':
|
477 |
+
$mailto = EEB()->validate->encode_ascii( $mailto, $display );
|
478 |
+
break;
|
479 |
+
case 'enc_escape':
|
480 |
+
case 'escape':
|
481 |
+
$mailto = EEB()->validate->encode_escape( $mailto, $display );
|
482 |
+
break;
|
483 |
+
case 'enc_html':
|
484 |
+
case 'encode':
|
485 |
+
default:
|
486 |
+
$mailto = '<a href="mailto:' . antispambot( $email ) . '"'. $class_name . '>' . antispambot( $display ) . '</a>';
|
487 |
+
break;
|
488 |
+
}
|
489 |
+
|
490 |
+
// mark link as successfullly encoded (for admin users)
|
491 |
+
if ( current_user_can( EEB()->settings->get_admin_cap( 'frontend-display-security-check' ) ) && $show_encoded_check ) {
|
492 |
+
$mailto .= '<i class="eeb-encoded dashicons-before dashicons-lock" title="' . EEB()->helpers->translate( 'Email encoded successfully!', 'frontend-security-check-title' ) . '"></i>';
|
493 |
+
}
|
494 |
+
|
495 |
+
return apply_filters( 'eeb/frontend/shortcode/eeb_mailto', $mailto );
|
496 |
+
}
|
497 |
+
|
498 |
+
/**
|
499 |
+
* ######################
|
500 |
+
* ###
|
501 |
+
* #### EMAIL IMAGE
|
502 |
+
* ###
|
503 |
+
* ######################
|
504 |
+
*/
|
505 |
+
|
506 |
+
public function display_email_image(){
|
507 |
+
|
508 |
+
if( ! isset( $_GET['eeb_mail'] ) ){
|
509 |
+
return;
|
510 |
+
}
|
511 |
+
|
512 |
+
$email = sanitize_email( base64_decode( $_GET['eeb_mail'] ) );
|
513 |
+
|
514 |
+
if( ! is_email( $email ) || ! isset( $_GET['eeb_hash'] ) ){
|
515 |
+
return;
|
516 |
+
}
|
517 |
+
|
518 |
+
$hash = (string) $_GET['eeb_hash'];
|
519 |
+
$secret = EEB()->settings->get_email_image_secret();
|
520 |
+
|
521 |
+
if( EEB()->validate->generate_email_signature( $email, $secret ) !== $hash ){
|
522 |
+
wp_die( EEB()->helpers->translate('Your signture is invalid.', 'plugin-frontend') );
|
523 |
+
}
|
524 |
+
|
525 |
+
$image = EEB()->validate->email_to_image( $email );
|
526 |
+
|
527 |
+
if( empty( $image ) ){
|
528 |
+
wp_die( EEB()->helpers->translate('Your email could not be converted.', 'plugin-frontend') );
|
529 |
+
}
|
530 |
+
|
531 |
+
header('Content-type: image/png');
|
532 |
+
echo $image;
|
533 |
+
die();
|
534 |
+
|
535 |
+
}
|
536 |
+
|
537 |
+
/**
|
538 |
+
* ######################
|
539 |
+
* ###
|
540 |
+
* #### TEMPLATE TAGS
|
541 |
+
* ###
|
542 |
+
* ######################
|
543 |
+
*/
|
544 |
+
|
545 |
+
public function add_custom_template_tags(){
|
546 |
+
$template_tags = EEB()->settings->get_template_tags();
|
547 |
+
|
548 |
+
foreach( $template_tags as $hook => $callback ){
|
549 |
+
|
550 |
+
//Make sure we only call our own custom template tags
|
551 |
+
if( is_callable( array( $this, $callback ) ) ){
|
552 |
+
apply_filters( $hook, array( $this, $callback ), 10 );
|
553 |
+
}
|
554 |
+
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
+
/**
|
559 |
+
* Filter for the eeb_filter template tag
|
560 |
+
*
|
561 |
+
* This function is called dynamically by add_custom_template_tags
|
562 |
+
* using the EEB()->settings->get_template_tags() callback.
|
563 |
+
*
|
564 |
+
* @param string $content - the default content
|
565 |
+
* @return string - the filtered content
|
566 |
+
*/
|
567 |
+
public function template_tag_eeb_filter( $content ){
|
568 |
+
$protect_using = (string) EEB()->settings->get_setting( 'protect_using', true );
|
569 |
+
return EEB()->validate->filter_content( $content, $protect_using );
|
570 |
+
}
|
571 |
+
|
572 |
+
/**
|
573 |
+
* Filter for the eeb_filter template tag
|
574 |
+
*
|
575 |
+
* This function is called dynamically by add_custom_template_tags
|
576 |
+
* using the EEB()->settings->get_template_tags() callback.
|
577 |
+
*
|
578 |
+
* @param string $content - the default content
|
579 |
+
* @return string - the filtered content
|
580 |
+
*/
|
581 |
+
public function template_tag_eeb_mailto( $email, $display = null, $atts = array() ){
|
582 |
+
if ( is_array( $display ) ) {
|
583 |
+
// backwards compatibility (old params: $display, $attrs = array())
|
584 |
+
$atts = $display;
|
585 |
+
$display = $email;
|
586 |
+
} else {
|
587 |
+
$atts['href'] = 'mailto:'.$email;
|
588 |
+
}
|
589 |
+
|
590 |
+
return EEB()->validate->create_protected_mailto( $display, $atts );
|
591 |
+
}
|
592 |
+
|
593 |
+
}
|
core/includes/classes/class-email-encoder-bundle-settings.php
ADDED
@@ -0,0 +1,773 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Email_Encoder_Settings
|
5 |
+
*
|
6 |
+
* This class contains all of our important settings
|
7 |
+
* Here you can configure the whole plugin behavior.
|
8 |
+
*
|
9 |
+
* @since 2.0.0
|
10 |
+
* @package EEB
|
11 |
+
* @author Ironikus <info@ironikus.com>
|
12 |
+
*/
|
13 |
+
class Email_Encoder_Settings{
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Our globally used capability
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
* @since 2.0.0
|
20 |
+
*/
|
21 |
+
private $admin_cap;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The main page name
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
* @since 2.0.0
|
28 |
+
*/
|
29 |
+
private $page_name;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Email_Encoder_Settings constructor.
|
33 |
+
*
|
34 |
+
* We define all of our necessary settings in here.
|
35 |
+
* If you need to do plugin related changes, everything will
|
36 |
+
* be available in this file.
|
37 |
+
*/
|
38 |
+
function __construct(){
|
39 |
+
$this->admin_cap = 'manage_options';
|
40 |
+
$this->page_name = 'email-encoder-bundle-option-page';
|
41 |
+
$this->page_title = EEB_NAME;
|
42 |
+
$this->final_outout_buffer_hook = 'final_output';
|
43 |
+
$this->widget_callback_hook = 'widget_output';
|
44 |
+
$this->template_tags = array( 'eeb_filter' => 'template_tag_eeb_filter', 'eeb_mailto' => 'template_tag_eeb_mailto' );
|
45 |
+
$this->settings_key = 'WP_Email_Encoder_Bundle_options';
|
46 |
+
$this->version_key = 'email-encoder-bundle-version';
|
47 |
+
$this->image_secret_key = 'email-encoder-bundle-img-key';
|
48 |
+
$this->previous_version = null;
|
49 |
+
$this->hook_priorities = array(
|
50 |
+
'buffer_final_output' => 1000,
|
51 |
+
'setup_single_filter_hooks' => 100,
|
52 |
+
'add_custom_template_tags' => 10,
|
53 |
+
'load_frontend_header_styling' => 10,
|
54 |
+
'eeb_dynamic_sidebar_params' => 100,
|
55 |
+
'filter_rss' => 100,
|
56 |
+
'filter_page' => 100,
|
57 |
+
'filter_content' => 100,
|
58 |
+
'first_version_init' => 100,
|
59 |
+
'version_update' => 100,
|
60 |
+
'display_email_image' => 10,
|
61 |
+
'callback_rss_remove_shortcodes' => 10,
|
62 |
+
'load_ajax_scripts_styles' => 10,
|
63 |
+
'load_ajax_scripts_styles_admin' => 10,
|
64 |
+
);
|
65 |
+
|
66 |
+
//Regex
|
67 |
+
$this->email_regex = '([_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,}))';
|
68 |
+
$this->soft_attribute_regex = array(
|
69 |
+
'woocommerce_variation_attribute_tag' => '/data-product_variations="([^"]*)"/i',
|
70 |
+
);
|
71 |
+
|
72 |
+
//Load data
|
73 |
+
$this->settings = $this->load_settings();
|
74 |
+
$this->version = $this->load_version();
|
75 |
+
$this->email_image_secret = $this->load_email_image_secret();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* ######################
|
80 |
+
* ###
|
81 |
+
* #### MAIN SETTINGS
|
82 |
+
* ###
|
83 |
+
* ######################
|
84 |
+
*/
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Load the settings for our admin settings page
|
88 |
+
*
|
89 |
+
* @return array - An array with all available settings and filled values
|
90 |
+
*/
|
91 |
+
private function load_settings(){
|
92 |
+
$fields = array(
|
93 |
+
|
94 |
+
'protect' => array(
|
95 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
96 |
+
'id' => 'protect',
|
97 |
+
'type' => 'multi-input',
|
98 |
+
'input-type' => 'radio',
|
99 |
+
'title' => EEB()->helpers->translate( 'Protect emails', 'eeb-settings-protect' ),
|
100 |
+
'inputs' => array(
|
101 |
+
1 => array(
|
102 |
+
'label' => EEB()->helpers->translate( 'Full-page scan', 'eeb-settings-protect-label' ),
|
103 |
+
'description' => EEB()->helpers->translate('This will check the whole page against any mails and secures them.', 'eeb-settings-protect-tip')
|
104 |
+
),
|
105 |
+
2 => array(
|
106 |
+
'label' => EEB()->helpers->translate( 'Wordpress filters', 'eeb-settings-protect-label' ),
|
107 |
+
'description' => EEB()->helpers->translate('Secure only mails that occur within WordPress filters. (Not recommended)', 'eeb-settings-protect-tip'),
|
108 |
+
'advanced' => true,
|
109 |
+
),
|
110 |
+
3 => array(
|
111 |
+
'label' => EEB()->helpers->translate( 'Don\'t do anything.', 'eeb-settings-protect-label' ),
|
112 |
+
'description' => EEB()->helpers->translate('This turns off the protection for emails. (Not recommended)', 'eeb-settings-protect-tip')
|
113 |
+
),
|
114 |
+
),
|
115 |
+
'required' => false
|
116 |
+
),
|
117 |
+
|
118 |
+
'protect_using' => array(
|
119 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
120 |
+
'id' => 'protect_using',
|
121 |
+
'type' => 'multi-input',
|
122 |
+
'input-type' => 'radio',
|
123 |
+
'title' => EEB()->helpers->translate( 'Protect emails using', 'eeb-settings-protect_using' ),
|
124 |
+
'inputs' => array(
|
125 |
+
'with_javascript' => array(
|
126 |
+
'label' => EEB()->helpers->translate( 'automatically the best method (including javascript)', 'eeb-settings-protect_using-label' )
|
127 |
+
),
|
128 |
+
'without_javascript' => array(
|
129 |
+
'label' => EEB()->helpers->translate( 'automatically the best method (excluding javascript)', 'eeb-settings-protect_using-label' ),
|
130 |
+
),
|
131 |
+
'strong_method' => array(
|
132 |
+
'label' => EEB()->helpers->translate( 'a strong method that replaces all emails with a "*protection text*".', 'eeb-settings-protect_using-label' ),
|
133 |
+
'description' => EEB()->helpers->translate('You can configure the protection text within the advanced settings.', 'eeb-settings-protect_using-tip')
|
134 |
+
),
|
135 |
+
'char_encode' => array(
|
136 |
+
'label' => EEB()->helpers->translate( 'simple HTML character encoding.', 'eeb-settings-protect_using-label' ),
|
137 |
+
'description' => EEB()->helpers->translate('Offers good (but not the best) protection, which saves you in most scenarios.', 'eeb-settings-protect_using-tip')
|
138 |
+
),
|
139 |
+
),
|
140 |
+
'required' => false
|
141 |
+
),
|
142 |
+
|
143 |
+
'filter_body' => array(
|
144 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
145 |
+
'id' => 'filter_body',
|
146 |
+
'type' => 'multi-input',
|
147 |
+
'input-type' => 'checkbox',
|
148 |
+
'advanced' => true,
|
149 |
+
'title' => EEB()->helpers->translate( 'Protect...', 'eeb-settings-filter_body' ),
|
150 |
+
'label' => EEB()->helpers->translate( 'Customize what this plugin protects.', 'eeb-settings-filter_body-label' ),
|
151 |
+
'inputs' => array(
|
152 |
+
'filter_rss' => array(
|
153 |
+
'advanced' => true,
|
154 |
+
'label' => EEB()->helpers->translate( 'RSS feed', 'eeb-settings-filter_rss-label' ),
|
155 |
+
'description' => EEB()->helpers->translate( 'Activating this option results in protecting the rss feed based on the given protection method.', 'eeb-settings-filter_rss-tip' )
|
156 |
+
),
|
157 |
+
'remove_shortcodes_rss' => array(
|
158 |
+
'advanced' => true,
|
159 |
+
'label' => EEB()->helpers->translate( 'Remove all shortcodes from the RSS feeds', 'eeb-settings-remove_shortcodes_rss-label' ),
|
160 |
+
'description' => EEB()->helpers->translate( 'Activating this option results in protecting the rss feed based on the given protection method.', 'eeb-settings-remove_shortcodes_rss-tip' )
|
161 |
+
),
|
162 |
+
'input_strong_protection' => array(
|
163 |
+
'advanced' => true,
|
164 |
+
'label' => EEB()->helpers->translate( 'input form email fields using strong protection.', 'eeb-settings-input_strong_protection-label' ),
|
165 |
+
'description' => EEB()->helpers->translate( 'Warning: this option could conflict with certain form plugins. Test it first. (Requires javascript)', 'eeb-settings-input_strong_protection-tip' )
|
166 |
+
),
|
167 |
+
'encode_mailtos' => array(
|
168 |
+
'advanced' => true,
|
169 |
+
'label' => EEB()->helpers->translate( 'plain emails by converting them to mailto links', 'eeb-settings-encode_mailtos-label' ),
|
170 |
+
'description' => EEB()->helpers->translate( 'Plain emails will be automatically converted to mailto links where possible.', 'eeb-settings-encode_mailtos-tip' )
|
171 |
+
),
|
172 |
+
'convert_plain_to_image' => array(
|
173 |
+
'advanced' => true,
|
174 |
+
'label' => EEB()->helpers->translate( 'plain emails by converting them to png images', 'eeb-settings-convert_plain_to_image-label' ),
|
175 |
+
'description' => EEB()->helpers->translate( 'Plain emails will be automatically converted to png images where possible.', 'eeb-settings-convert_plain_to_image-tip' )
|
176 |
+
),
|
177 |
+
'protect_shortcode_tags' => array(
|
178 |
+
'advanced' => true,
|
179 |
+
'label' => EEB()->helpers->translate( 'shortcode content', 'eeb-settings-protect_shortcode_tags-label' ),
|
180 |
+
'description' => EEB()->helpers->translate( 'Protect every shortcode content separately. (This may slows down your site)', 'eeb-settings-protect_shortcode_tags-tip' )
|
181 |
+
),
|
182 |
+
'filter_hook' => array(
|
183 |
+
'advanced' => true,
|
184 |
+
'label' => EEB()->helpers->translate( 'emails from "init" hook', 'eeb-settings-filter_hook-label' ),
|
185 |
+
'description' => EEB()->helpers->translate( 'Check this option if you want to register the email filters on the "init" hook instead of the "wp" hook.', 'eeb-settings-filter_hook-tip' )
|
186 |
+
),
|
187 |
+
'deactivate_rtl' => array(
|
188 |
+
'advanced' => true,
|
189 |
+
'label' => EEB()->helpers->translate( 'mailto links without CSS direction', 'eeb-settings-filter_hook-label' ),
|
190 |
+
'description' => EEB()->helpers->translate( 'Check this option if your site does not support CSS directions.', 'eeb-settings-filter_hook-tip' )
|
191 |
+
),
|
192 |
+
),
|
193 |
+
'required' => false,
|
194 |
+
),
|
195 |
+
|
196 |
+
'image_settings' => array(
|
197 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
198 |
+
'id' => 'image_settings',
|
199 |
+
'type' => 'multi-input',
|
200 |
+
'input-type' => 'text',
|
201 |
+
'advanced' => true,
|
202 |
+
'title' => EEB()->helpers->translate( 'Image settings', 'eeb-settings-filter_body' ),
|
203 |
+
'label' => EEB()->helpers->translate( 'Customize the settings for dynamically created images.', 'eeb-settings-filter_body-label' ),
|
204 |
+
'inputs' => array(
|
205 |
+
'image_color' => array(
|
206 |
+
'advanced' => true,
|
207 |
+
'label' => EEB()->helpers->translate( 'Image Colors', 'eeb-settings-image_color-label' ),
|
208 |
+
'description' => EEB()->helpers->translate( 'Please include RGB colors, comme saparated. E.g.: 0,0,255', 'eeb-settings-image_color-tip' )
|
209 |
+
),
|
210 |
+
'image_background_color' => array(
|
211 |
+
'advanced' => true,
|
212 |
+
'label' => EEB()->helpers->translate( 'Image Background Colors', 'eeb-settings-image_background_color-label' ),
|
213 |
+
'description' => EEB()->helpers->translate( 'Please include RGB colors, comme saparated. E.g.: 0,0,255', 'eeb-settings-image_background_color-tip' )
|
214 |
+
),
|
215 |
+
'image_text_opacity' => array(
|
216 |
+
'advanced' => true,
|
217 |
+
'label' => EEB()->helpers->translate( 'Text Opacity', 'eeb-settings-image_text_opacity-label' ),
|
218 |
+
'description' => EEB()->helpers->translate( 'Change the text opacity for the created images. 0 = not transparent - 127 = completely transprent', 'eeb-settings-image_text_opacity-tip' )
|
219 |
+
),
|
220 |
+
'image_background_opacity' => array(
|
221 |
+
'advanced' => true,
|
222 |
+
'label' => EEB()->helpers->translate( 'Background Opacity', 'eeb-settings-image_background_opacity-label' ),
|
223 |
+
'description' => EEB()->helpers->translate( 'Change the background opacity for the created images. 0 = not transparent - 127 = completely transprent', 'eeb-settings-image_background_opacity-tip' )
|
224 |
+
),
|
225 |
+
'image_font_size' => array(
|
226 |
+
'advanced' => true,
|
227 |
+
'label' => EEB()->helpers->translate( 'Font Size', 'eeb-settings-image_font_size-label' ),
|
228 |
+
'description' => EEB()->helpers->translate( 'Change the font size of the image text. Default: 4 - You can choose from 1 - 5', 'eeb-settings-image_font_size-tip' )
|
229 |
+
),
|
230 |
+
),
|
231 |
+
'required' => false,
|
232 |
+
),
|
233 |
+
|
234 |
+
'skip_posts' => array(
|
235 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
236 |
+
'id' => 'skip_posts',
|
237 |
+
'type' => 'text',
|
238 |
+
'advanced' => true,
|
239 |
+
'title' => EEB()->helpers->translate('Exclude post id\'s from protection', 'eeb-settings-skip_posts'),
|
240 |
+
'placeholder' => '',
|
241 |
+
'required' => false,
|
242 |
+
'description' => EEB()->helpers->translate('By comma separating post id\'s ( e.g. 123,4535,643), you are able to exclude these posts from the logic protection.', 'eeb-settings-skip_posts-tip')
|
243 |
+
),
|
244 |
+
|
245 |
+
'protection_text' => array(
|
246 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
247 |
+
'id' => 'protection_text',
|
248 |
+
'type' => 'text',
|
249 |
+
'advanced' => true,
|
250 |
+
'title' => EEB()->helpers->translate('Set protection text *', 'eeb-settings-class_name'),
|
251 |
+
'placeholder' => '',
|
252 |
+
'required' => false,
|
253 |
+
'description' => EEB()->helpers->translate('This text will be shown for protected email addresses and within noscript tags.', 'eeb-settings-class_name-tip')
|
254 |
+
),
|
255 |
+
|
256 |
+
'class_name' => array(
|
257 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
258 |
+
'id' => 'class_name',
|
259 |
+
'type' => 'text',
|
260 |
+
'advanced' => true,
|
261 |
+
'title' => EEB()->helpers->translate('Additional classes', 'eeb-settings-class_name'),
|
262 |
+
'label' => EEB()->helpers->translate('Add extra classes to mailto links.', 'eeb-settings-class_name-label'),
|
263 |
+
'placeholder' => '',
|
264 |
+
'required' => false,
|
265 |
+
'description' => EEB()->helpers->translate('Leave blank for none', 'eeb-settings-class_name-tip')
|
266 |
+
),
|
267 |
+
|
268 |
+
'disable_marketing' => array(
|
269 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
270 |
+
'id' => 'disable_marketing',
|
271 |
+
'type' => 'checkbox',
|
272 |
+
'advanced' => true,
|
273 |
+
'title' => EEB()->helpers->translate('Disable Marketing', 'eeb-settings-disable_marketing'),
|
274 |
+
'label' => EEB()->helpers->translate('Disable all marketing notifications', 'eeb-settings-disable_marketing-label'),
|
275 |
+
'placeholder' => '',
|
276 |
+
'required' => false,
|
277 |
+
'description' => EEB()->helpers->translate('If you are not satisfied with our marketing recommendations, check this box.', 'eeb-settings-disable_marketing-tip')
|
278 |
+
),
|
279 |
+
|
280 |
+
'show_encoded_check' => array(
|
281 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
282 |
+
'id' => 'show_encoded_check',
|
283 |
+
'type' => 'checkbox',
|
284 |
+
'title' => EEB()->helpers->translate('Security Check', 'eeb-settings-show_encoded_check'),
|
285 |
+
'label' => EEB()->helpers->translate('Mark emails on the site as successfully encoded', 'eeb-settings-show_encoded_check-label') . '<i class="dashicons-before dashicons-lock" style="color:green;"></i>',
|
286 |
+
'placeholder' => '',
|
287 |
+
'required' => false,
|
288 |
+
'description' => EEB()->helpers->translate('Only visible for admin users. If your emails look broken, simply deactivate this feature.', 'eeb-settings-show_encoded_check-tip')
|
289 |
+
),
|
290 |
+
|
291 |
+
'own_admin_menu' => array(
|
292 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
293 |
+
'id' => 'own_admin_menu',
|
294 |
+
'type' => 'checkbox',
|
295 |
+
'advanced' => true,
|
296 |
+
'title' => EEB()->helpers->translate('Admin Menu', 'eeb-settings-own_admin_menu'),
|
297 |
+
'label' => EEB()->helpers->translate('Show this page in the main menu item', 'eeb-settings-own_admin_menu-label'),
|
298 |
+
'placeholder' => '',
|
299 |
+
'required' => false,
|
300 |
+
'description' => EEB()->helpers->translate('Otherwise it will be shown in "Settings"-menu.', 'eeb-settings-own_admin_menu-tip')
|
301 |
+
),
|
302 |
+
|
303 |
+
'encoder_form' => array(
|
304 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
305 |
+
'id' => 'encoder_form',
|
306 |
+
'type' => 'multi-input',
|
307 |
+
'input-type' => 'checkbox',
|
308 |
+
'advanced' => true,
|
309 |
+
'title' => EEB()->helpers->translate( 'Encoder form settings', 'eeb-settings-encoder_form' ),
|
310 |
+
'inputs' => array(
|
311 |
+
'display_encoder_form' => array(
|
312 |
+
'label' => EEB()->helpers->translate( 'Activate the encoder form.', 'eeb-settings-display_encoder_form-label' ),
|
313 |
+
'description' => EEB()->helpers->translate( 'This allows you to use the email encoder form, as well as the shortcode and template tag.', 'eeb-settings-display_encoder_form-tip' )
|
314 |
+
),
|
315 |
+
'powered_by' => array(
|
316 |
+
'label' => EEB()->helpers->translate( 'Show a "powered by" link on bottom of the encoder form', 'eeb-settings-powered_by-label' ),
|
317 |
+
),
|
318 |
+
),
|
319 |
+
'required' => false
|
320 |
+
),
|
321 |
+
|
322 |
+
'advanced_settings' => array(
|
323 |
+
'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
|
324 |
+
'id' => 'advanced_settings',
|
325 |
+
'type' => 'checkbox',
|
326 |
+
'title' => EEB()->helpers->translate('Advanced Settings', 'eeb-settings-advanced_settings'),
|
327 |
+
'label' => EEB()->helpers->translate('Show advanced settings for more configuration possibilities.', 'eeb-settings-advanced_settings-label'),
|
328 |
+
'placeholder' => '',
|
329 |
+
'required' => false,
|
330 |
+
'description' => EEB()->helpers->translate('Activate the advanced settings in case you want to customize the default logic or you want to troubleshoot the plugin.', 'eeb-settings-advanced_settings-tip')
|
331 |
+
),
|
332 |
+
|
333 |
+
);
|
334 |
+
|
335 |
+
//End Migrate Old Plugin
|
336 |
+
|
337 |
+
$default_values = array(
|
338 |
+
'protect' => 1,
|
339 |
+
'filter_rss' => 1,
|
340 |
+
'display_encoder_form' => 1,
|
341 |
+
'powered_by' => 1,
|
342 |
+
'protect_using' => 'with_javascript',
|
343 |
+
'class_name' => 'mail-link',
|
344 |
+
'protection_text' => '*protected email*',
|
345 |
+
'image_color' => '0,0,0',
|
346 |
+
'image_background_color'=> '0,0,0',
|
347 |
+
'image_text_opacity' => '0',
|
348 |
+
'image_background_opacity' => '127',
|
349 |
+
'image_font_size' => '4',
|
350 |
+
);
|
351 |
+
$values = get_option( $this->settings_key );
|
352 |
+
|
353 |
+
if( empty( $values ) && ! is_array( $values ) ){
|
354 |
+
update_option( $this->settings_key, $default_values );
|
355 |
+
$values = $default_values;
|
356 |
+
}
|
357 |
+
|
358 |
+
//Bakwards compatibility
|
359 |
+
if( ! isset( $values['protect_using'] ) ){
|
360 |
+
$values['protect_using'] = 'with_javascript';
|
361 |
+
$values['display_encoder_form'] = 1;
|
362 |
+
}
|
363 |
+
|
364 |
+
//In case the mailto functiinality was deactivated, we will set it do "Do nothing" as well.
|
365 |
+
if( ! isset( $values['protect'] ) ){
|
366 |
+
$values['protect'] = 1;
|
367 |
+
}
|
368 |
+
///Backwards compatibility
|
369 |
+
|
370 |
+
//Value corrections
|
371 |
+
if( ! isset( $values['image_color'] ) ){
|
372 |
+
$values['image_color'] = $default_values['image_color'];
|
373 |
+
}
|
374 |
+
$image_color = explode( ',', $values['image_color'] );
|
375 |
+
if( count( $image_color ) != 3 ){
|
376 |
+
$values['image_color'] = $default_values['image_color'];
|
377 |
+
}
|
378 |
+
foreach( explode( ',', $values['image_color'] ) as $image_color_key => $image_color_single ){
|
379 |
+
if( ! is_numeric( trim( $image_color_single ) ) ){
|
380 |
+
$values['image_color'] = $default_values['image_color'];
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
if( ! isset( $values['image_background_color'] ) ){
|
385 |
+
$values['image_background_color'] = $default_values['image_background_color'];
|
386 |
+
}
|
387 |
+
$image_background_color = explode( ',', $values['image_background_color'] );
|
388 |
+
if( count( $image_background_color ) != 3 ){
|
389 |
+
$values['image_background_color'] = $default_values['image_background_color'];
|
390 |
+
}
|
391 |
+
foreach( explode( ',', $values['image_background_color'] ) as $image_background_color_key => $image_background_color_single ){
|
392 |
+
if( ! is_numeric( trim( $image_background_color_single ) ) ){
|
393 |
+
$values['image_background_color'] = $default_values['image_background_color'];
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
if( ! isset( $values['image_text_opacity'] ) || ! is_numeric( $values['image_text_opacity'] ) ){
|
398 |
+
$values['image_text_opacity'] = $default_values['image_text_opacity'];
|
399 |
+
}
|
400 |
+
if( ! isset( $values['image_background_opacity'] ) || ! is_numeric( $values['image_background_opacity'] ) ){
|
401 |
+
$values['image_background_opacity'] = $default_values['image_background_opacity'];
|
402 |
+
}
|
403 |
+
if( ! isset( $values['image_font_size'] ) || ! is_numeric( $values['image_font_size'] ) ){
|
404 |
+
$values['image_font_size'] = $default_values['image_font_size'];
|
405 |
+
}
|
406 |
+
///Value corrections
|
407 |
+
|
408 |
+
foreach( $fields as $key => $field ){
|
409 |
+
if( $field['type'] === 'multi-input' ){
|
410 |
+
foreach( $field['inputs'] as $smi_key => $smi_data ){
|
411 |
+
|
412 |
+
if( $field['input-type'] === 'radio' ){
|
413 |
+
if( isset( $values[ $key ] ) && (string) $values[ $key ] === (string) $smi_key ){
|
414 |
+
$fields[ $key ]['value'] = $values[ $key ];
|
415 |
+
}
|
416 |
+
} else {
|
417 |
+
if( isset( $values[ $smi_key ] ) ){
|
418 |
+
$fields[ $key ]['inputs'][ $smi_key ]['value'] = $values[ $smi_key ];
|
419 |
+
}
|
420 |
+
}
|
421 |
+
|
422 |
+
}
|
423 |
+
} else {
|
424 |
+
if( isset( $values[ $key ] ) ){
|
425 |
+
$fields[ $key ]['value'] = $values[ $key ];
|
426 |
+
}
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
+
return apply_filters( 'eeb/settings/fields', $fields );
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* ######################
|
435 |
+
* ###
|
436 |
+
* #### VERSIONING
|
437 |
+
* ###
|
438 |
+
* ######################
|
439 |
+
*/
|
440 |
+
|
441 |
+
public function load_version(){
|
442 |
+
|
443 |
+
$current_version = get_option( $this->get_version_key() );
|
444 |
+
|
445 |
+
if( empty( $current_version ) ){
|
446 |
+
$current_version = EEB_VERSION;
|
447 |
+
update_option( $this->get_version_key(), $current_version );
|
448 |
+
|
449 |
+
add_action( 'init', array( $this, 'first_version_init' ), $this->get_hook_priorities( 'first_version_init' ) );
|
450 |
+
} else {
|
451 |
+
if( $current_version !== EEB_VERSION ){
|
452 |
+
$this->previous_version = $current_version;
|
453 |
+
$current_version = EEB_VERSION;
|
454 |
+
update_option( $this->get_version_key(), $current_version );
|
455 |
+
|
456 |
+
add_action( 'init', array( $this, 'version_update' ), $this->get_hook_priorities( 'version_update' ) );
|
457 |
+
}
|
458 |
+
}
|
459 |
+
|
460 |
+
return $current_version;
|
461 |
+
}
|
462 |
+
|
463 |
+
public function load_email_image_secret(){
|
464 |
+
|
465 |
+
if( ! (bool) $this->get_setting( 'convert_plain_to_image', true, 'filter_body' ) ){
|
466 |
+
return false;
|
467 |
+
}
|
468 |
+
|
469 |
+
$image_descret = get_option( $this->get_image_secret_key() );
|
470 |
+
|
471 |
+
if( ! empty( $image_descret ) ){
|
472 |
+
return $image_descret;
|
473 |
+
}
|
474 |
+
|
475 |
+
$key = '';
|
476 |
+
|
477 |
+
for ($i = 0; $i < 265; $i++) {
|
478 |
+
$key .= chr(mt_rand(33, 126));
|
479 |
+
}
|
480 |
+
|
481 |
+
update_option( $this->get_image_secret_key(), $key );
|
482 |
+
|
483 |
+
return $key;
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Fires an action after our settings key was initially set
|
488 |
+
* the very first time.
|
489 |
+
*
|
490 |
+
* @return void
|
491 |
+
*/
|
492 |
+
public function first_version_init(){
|
493 |
+
do_action( 'eeb/settings/first_version_init', EEB_VERSION );
|
494 |
+
}
|
495 |
+
|
496 |
+
/**
|
497 |
+
* Fires after the version of the plugin is initially updated
|
498 |
+
*
|
499 |
+
* @return void
|
500 |
+
*/
|
501 |
+
public function version_update(){
|
502 |
+
do_action( 'eeb/settings/version_update', EEB_VERSION, $this->previous_version );
|
503 |
+
}
|
504 |
+
|
505 |
+
/**
|
506 |
+
* ######################
|
507 |
+
* ###
|
508 |
+
* #### CALLABLE FUNCTIONS
|
509 |
+
* ###
|
510 |
+
* ######################
|
511 |
+
*/
|
512 |
+
|
513 |
+
/**
|
514 |
+
* Our admin cap handler function
|
515 |
+
*
|
516 |
+
* This function handles the admin capability throughout
|
517 |
+
* the whole plugin.
|
518 |
+
*
|
519 |
+
* $target - With the target function you can make a more precised filtering
|
520 |
+
* by changing it for specific actions.
|
521 |
+
*
|
522 |
+
* @param string $target - A identifier where the call comes from
|
523 |
+
* @return mixed
|
524 |
+
*/
|
525 |
+
public function get_admin_cap( $target = 'main' ){
|
526 |
+
/**
|
527 |
+
* Customize the globally used capability for this plugin
|
528 |
+
*
|
529 |
+
* This filter is called every time the capability is needed.
|
530 |
+
*/
|
531 |
+
return apply_filters( 'eeb/settings/capability', $this->admin_cap, $target );
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* Return the page name for our admin page
|
536 |
+
*
|
537 |
+
* @return string - the page name
|
538 |
+
*/
|
539 |
+
public function get_page_name(){
|
540 |
+
/*
|
541 |
+
* Filter the page name based on your needs
|
542 |
+
*/
|
543 |
+
return apply_filters( 'eeb/settings/page_name', $this->page_name );
|
544 |
+
}
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Return the page title for our admin page
|
548 |
+
*
|
549 |
+
* @return string - the page title
|
550 |
+
*/
|
551 |
+
public function get_page_title(){
|
552 |
+
/*
|
553 |
+
* Filter the page title based on your needs.
|
554 |
+
*/
|
555 |
+
return apply_filters( 'eeb/settings/page_title', $this->page_title );
|
556 |
+
}
|
557 |
+
|
558 |
+
/**
|
559 |
+
* Return the settings_key
|
560 |
+
*
|
561 |
+
* @return string - the settings key
|
562 |
+
*/
|
563 |
+
public function get_settings_key(){
|
564 |
+
return $this->settings_key;
|
565 |
+
}
|
566 |
+
|
567 |
+
/**
|
568 |
+
* Return the version_key
|
569 |
+
*
|
570 |
+
* @return string - the version_key
|
571 |
+
*/
|
572 |
+
public function get_version_key(){
|
573 |
+
return $this->version_key;
|
574 |
+
}
|
575 |
+
|
576 |
+
/**
|
577 |
+
* Return the image_secret_key
|
578 |
+
*
|
579 |
+
* @return string - the image_secret_key
|
580 |
+
*/
|
581 |
+
public function get_image_secret_key(){
|
582 |
+
return $this->image_secret_key;
|
583 |
+
}
|
584 |
+
|
585 |
+
/**
|
586 |
+
* Return the email_image_secret
|
587 |
+
*
|
588 |
+
* @return string - the email_image_secret
|
589 |
+
*/
|
590 |
+
public function get_email_image_secret(){
|
591 |
+
return $this->email_image_secret;
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Return the version
|
596 |
+
*
|
597 |
+
* @return string - the version
|
598 |
+
*/
|
599 |
+
public function get_version(){
|
600 |
+
return apply_filters( 'eeb/settings/get_version', $this->version );
|
601 |
+
}
|
602 |
+
|
603 |
+
/**
|
604 |
+
* Return the default template tags
|
605 |
+
*
|
606 |
+
* @return array - the template tags
|
607 |
+
*/
|
608 |
+
public function get_template_tags(){
|
609 |
+
return apply_filters( 'eeb/settings/get_template_tags', $this->template_tags );
|
610 |
+
}
|
611 |
+
|
612 |
+
/**
|
613 |
+
* Return the widget callback hook name
|
614 |
+
*
|
615 |
+
* @return string - the final widget callback hook name
|
616 |
+
*/
|
617 |
+
public function get_widget_callback_hook(){
|
618 |
+
return apply_filters( 'eeb/settings/widget_callback_hook', $this->widget_callback_hook );
|
619 |
+
}
|
620 |
+
|
621 |
+
/**
|
622 |
+
* Return the final output buffer hook name
|
623 |
+
*
|
624 |
+
* @return string - the final output buffer hook name
|
625 |
+
*/
|
626 |
+
public function get_final_outout_buffer_hook(){
|
627 |
+
return apply_filters( 'eeb/settings/final_outout_buffer_hook', $this->final_outout_buffer_hook );
|
628 |
+
}
|
629 |
+
|
630 |
+
/**
|
631 |
+
* @link http://www.mkyong.com/regular-expressions/how-to-validate-email-address-with-regular-expression/
|
632 |
+
* @param boolean $include
|
633 |
+
* @return string
|
634 |
+
*/
|
635 |
+
public function get_email_regex( $include = false ){
|
636 |
+
|
637 |
+
if ($include === true) {
|
638 |
+
$return = $this->email_regex;
|
639 |
+
} else {
|
640 |
+
$return = '/' . $this->email_regex . '/i';
|
641 |
+
}
|
642 |
+
|
643 |
+
return apply_filters( 'eeb/settings/get_email_regex', $return, $include );
|
644 |
+
}
|
645 |
+
|
646 |
+
/**
|
647 |
+
* Get Woocommerce variation attribute regex
|
648 |
+
*
|
649 |
+
* @param boolean $include
|
650 |
+
* @return string
|
651 |
+
*/
|
652 |
+
public function get_soft_attribute_regex( $single = null ){
|
653 |
+
|
654 |
+
$return = $this->soft_attribute_regex;
|
655 |
+
|
656 |
+
if( $single !== null ){
|
657 |
+
if( isset( $this->soft_attribute_regex[ $single ] ) ){
|
658 |
+
$return = $this->soft_attribute_regex[ $single ];
|
659 |
+
} else {
|
660 |
+
$return = false;
|
661 |
+
}
|
662 |
+
}
|
663 |
+
|
664 |
+
return apply_filters( 'eeb/settings/get_soft_attribute_regex', $return, $single );
|
665 |
+
}
|
666 |
+
|
667 |
+
/**
|
668 |
+
* Get hook priorities
|
669 |
+
*
|
670 |
+
* @param boolean $single - wether you want to return only a single hook priority or not
|
671 |
+
* @return mixed - An array or string of hook priority(-ies)
|
672 |
+
*/
|
673 |
+
public function get_hook_priorities( $single = false ){
|
674 |
+
|
675 |
+
$return = $this->hook_priorities;
|
676 |
+
$default = false;
|
677 |
+
|
678 |
+
if( $single ){
|
679 |
+
if( isset( $this->hook_priorities[ $single ] ) ){
|
680 |
+
$return = $this->hook_priorities[ $single ];
|
681 |
+
} else {
|
682 |
+
$return = 10;
|
683 |
+
$default = true;
|
684 |
+
}
|
685 |
+
}
|
686 |
+
|
687 |
+
return apply_filters( 'eeb/settings/get_hook_priorities', $return, $default, $single );
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* ######################
|
692 |
+
* ###
|
693 |
+
* #### Settings helper
|
694 |
+
* ###
|
695 |
+
* ######################
|
696 |
+
*/
|
697 |
+
|
698 |
+
/**
|
699 |
+
* Get the admin page url
|
700 |
+
*
|
701 |
+
* @return string - The admin page url
|
702 |
+
*/
|
703 |
+
public function get_admin_page_url(){
|
704 |
+
|
705 |
+
$url = admin_url( "options-general.php?page=" . $this->get_page_name() );
|
706 |
+
|
707 |
+
return apply_filters( 'eeb/settings/get_admin_page_url', $url );
|
708 |
+
}
|
709 |
+
|
710 |
+
/**
|
711 |
+
* Helper function to reload the settings
|
712 |
+
*
|
713 |
+
* @return array - An array of all available settings
|
714 |
+
*/
|
715 |
+
public function reload_settings(){
|
716 |
+
|
717 |
+
$this->settings = $this->load_settings();
|
718 |
+
|
719 |
+
return $this->settings;
|
720 |
+
}
|
721 |
+
|
722 |
+
/**
|
723 |
+
* Return the default strings that are available
|
724 |
+
* for this plugin.
|
725 |
+
*
|
726 |
+
* @param $slug - the identifier for your specified setting
|
727 |
+
* @param $single - wether you only want to return the value or the whole settings element
|
728 |
+
* @param $group - in case you call a multi-input that contains multiple values (e.g. checkbox), you can set a sub-slug to grab the sub value
|
729 |
+
* @return string - the default string
|
730 |
+
*/
|
731 |
+
public function get_setting( $slug = '', $single = false, $group = '' ){
|
732 |
+
$return = $this->settings;
|
733 |
+
|
734 |
+
if( empty( $slug ) ){
|
735 |
+
return $return;
|
736 |
+
}
|
737 |
+
|
738 |
+
if( isset( $this->settings[ $slug ] ) || ( ! empty( $group ) && isset( $this->settings[ $group ] ) ) ){
|
739 |
+
if( $single ){
|
740 |
+
$return = false; // Default false
|
741 |
+
|
742 |
+
//Set default to the main valie if available given with radio buttons)
|
743 |
+
if( isset( $this->settings[ $slug ]['value'] ) ){
|
744 |
+
$return = $this->settings[ $slug ]['value'];
|
745 |
+
}
|
746 |
+
|
747 |
+
if(
|
748 |
+
! empty( $group )
|
749 |
+
&& isset( $this->settings[ $group ]['type'] )
|
750 |
+
&& $this->settings[ $group ]['type'] === 'multi-input'
|
751 |
+
)
|
752 |
+
{
|
753 |
+
if( isset( $this->settings[ $group ]['inputs'][ $slug ] ) && isset( $this->settings[ $group ]['inputs'][ $slug ]['value'] ) ){
|
754 |
+
$return = $this->settings[ $group ]['inputs'][ $slug ]['value'];
|
755 |
+
}
|
756 |
+
}
|
757 |
+
|
758 |
+
} else {
|
759 |
+
|
760 |
+
if( ! empty( $group ) && isset( $this->settings[ $group ] ) ){
|
761 |
+
$return = $this->settings[ $group ];
|
762 |
+
} else {
|
763 |
+
$return = $this->settings[ $slug ];
|
764 |
+
}
|
765 |
+
|
766 |
+
}
|
767 |
+
|
768 |
+
}
|
769 |
+
|
770 |
+
return $return;
|
771 |
+
}
|
772 |
+
|
773 |
+
}
|
core/includes/classes/class-email-encoder-bundle-validate.php
ADDED
@@ -0,0 +1,865 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Email_Encoder_Validate
|
5 |
+
*
|
6 |
+
* The main validation functionality for the plugin.
|
7 |
+
* Here is where the logic happens.
|
8 |
+
*
|
9 |
+
* @since 2.0.0
|
10 |
+
* @package EEB
|
11 |
+
* @author Ironikus <info@ironikus.com>
|
12 |
+
*/
|
13 |
+
|
14 |
+
class Email_Encoder_Validate{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The main page name for our admin page
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
* @since 2.0.0
|
21 |
+
*/
|
22 |
+
private $page_name;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The main page title for our admin page
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
* @since 2.0.0
|
29 |
+
*/
|
30 |
+
private $page_title;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Our Email_Encoder_Run constructor.
|
34 |
+
*/
|
35 |
+
function __construct(){
|
36 |
+
$this->page_name = EEB()->settings->get_page_name();
|
37 |
+
$this->page_title = EEB()->settings->get_page_title();
|
38 |
+
$this->final_outout_buffer_hook = EEB()->settings->get_final_outout_buffer_hook();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* ######################
|
43 |
+
* ###
|
44 |
+
* #### FILTERS
|
45 |
+
* ###
|
46 |
+
* ######################
|
47 |
+
*/
|
48 |
+
|
49 |
+
/**
|
50 |
+
* The main page filter function
|
51 |
+
*
|
52 |
+
* @param string $content - the content that needs to be filtered
|
53 |
+
* @param bool $convertPlainEmails - wether plain emails should be preserved or not
|
54 |
+
* @return string - The filtered content
|
55 |
+
*/
|
56 |
+
public function filter_page( $content, $protect_using ){
|
57 |
+
|
58 |
+
$content = $this->filter_soft_dom_attributes( $content, 'char_encode' );
|
59 |
+
|
60 |
+
$htmlSplit = preg_split( '/(<body(([^>]*)>))/is', $content, null, PREG_SPLIT_DELIM_CAPTURE );
|
61 |
+
|
62 |
+
if ( count( $htmlSplit ) < 4 ) {
|
63 |
+
return $content;
|
64 |
+
}
|
65 |
+
|
66 |
+
switch( $protect_using ){
|
67 |
+
case 'with_javascript':
|
68 |
+
case 'without_javascript':
|
69 |
+
case 'char_encode':
|
70 |
+
$head_encoding_method = 'char_encode';
|
71 |
+
break;
|
72 |
+
default:
|
73 |
+
$head_encoding_method = 'default';
|
74 |
+
break;
|
75 |
+
}
|
76 |
+
|
77 |
+
//Filter head area
|
78 |
+
$filtered_head = $this->filter_plain_emails( $htmlSplit[0], null, $head_encoding_method );
|
79 |
+
|
80 |
+
//Filter body
|
81 |
+
//Soft attributes always need to be protected using only the char encode method since otherwise the logic breaks
|
82 |
+
$filtered_body = $this->filter_soft_attributes( $htmlSplit[4], 'char_encode' );
|
83 |
+
$filtered_body = $this->filter_content( $filtered_body, $protect_using );
|
84 |
+
|
85 |
+
$filtered_content = $filtered_head . $htmlSplit[1] . $filtered_body;
|
86 |
+
return $filtered_content;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Filter content
|
91 |
+
*
|
92 |
+
* @param string $content
|
93 |
+
* @param integer $protect_using
|
94 |
+
* @return string
|
95 |
+
*/
|
96 |
+
public function filter_content( $content, $protect_using ){
|
97 |
+
$filtered = $content;
|
98 |
+
$self = $this;
|
99 |
+
$encode_mailtos = (bool) EEB()->settings->get_setting( 'encode_mailtos', true, 'filter_body' );
|
100 |
+
$convert_plain_to_image = (bool) EEB()->settings->get_setting( 'convert_plain_to_image', true, 'filter_body' );
|
101 |
+
|
102 |
+
//Soft attributes always need to be protected using only the char encode method since otherwise the logic breaks
|
103 |
+
$filtered = $this->filter_soft_attributes( $filtered, 'char_encode' );
|
104 |
+
|
105 |
+
switch( $protect_using ){
|
106 |
+
case 'char_encode':
|
107 |
+
$filtered = $this->filter_plain_emails( $filtered, null, 'char_encode' );
|
108 |
+
break;
|
109 |
+
case 'strong_method':
|
110 |
+
$filtered = $this->filter_plain_emails( $filtered );
|
111 |
+
break;
|
112 |
+
case 'without_javascript':
|
113 |
+
$filtered = $this->filter_input_fields( $filtered, $protect_using );
|
114 |
+
$filtered = $this->filter_mailto_links( $filtered, 'without_javascript' );
|
115 |
+
|
116 |
+
if( $convert_plain_to_image ){
|
117 |
+
$replace_by = 'convert_image';
|
118 |
+
} else {
|
119 |
+
$replace_by = 'use_css';
|
120 |
+
}
|
121 |
+
|
122 |
+
if( $encode_mailtos ){
|
123 |
+
if( ! ( function_exists( 'et_fb_enabled' ) && et_fb_enabled() ) ){
|
124 |
+
$filtered = $this->filter_plain_emails( $filtered, function ( $match ) use ( $self ) {
|
125 |
+
return $self->create_protected_mailto( $match[0], array( 'href' => 'mailto:' . $match[0] ), 'without_javascript' );
|
126 |
+
}, $replace_by);
|
127 |
+
} else {
|
128 |
+
$filtered = $this->filter_plain_emails( $filtered, null, $replace_by );
|
129 |
+
}
|
130 |
+
} else {
|
131 |
+
$filtered = $this->filter_plain_emails( $filtered, null, $replace_by );
|
132 |
+
}
|
133 |
+
|
134 |
+
break;
|
135 |
+
case 'with_javascript':
|
136 |
+
$filtered = $this->filter_input_fields( $filtered, $protect_using );
|
137 |
+
$filtered = $this->filter_mailto_links( $filtered );
|
138 |
+
|
139 |
+
if( $convert_plain_to_image ){
|
140 |
+
$replace_by = 'convert_image';
|
141 |
+
} else {
|
142 |
+
$replace_by = 'use_javascript';
|
143 |
+
}
|
144 |
+
|
145 |
+
if( $encode_mailtos ){
|
146 |
+
if( ! ( function_exists( 'et_fb_enabled' ) && et_fb_enabled() ) ){
|
147 |
+
$filtered = $this->filter_plain_emails( $filtered, function ( $match ) use ( $self ) {
|
148 |
+
return $self->create_protected_mailto( $match[0], array( 'href' => 'mailto:' . $match[0] ), 'with_javascript' );
|
149 |
+
}, $replace_by);
|
150 |
+
} else {
|
151 |
+
$filtered = $this->filter_plain_emails( $filtered, null, $replace_by );
|
152 |
+
}
|
153 |
+
} else {
|
154 |
+
$filtered = $this->filter_plain_emails( $filtered, null, $replace_by );
|
155 |
+
}
|
156 |
+
|
157 |
+
break;
|
158 |
+
}
|
159 |
+
|
160 |
+
return $filtered;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Emails will be replaced by '*protected email*'
|
165 |
+
* @param string $content
|
166 |
+
* @param string|callable $replace_by Optional
|
167 |
+
* @param string $protection_method Optional
|
168 |
+
* @param mixed $show_encoded_check Optional
|
169 |
+
* @return string
|
170 |
+
*/
|
171 |
+
public function filter_plain_emails($content, $replace_by = null, $protection_method = 'default', $show_encoded_check = 'default' ){
|
172 |
+
|
173 |
+
if( $show_encoded_check === 'default' ){
|
174 |
+
$show_encoded_check = (bool) EEB()->settings->get_setting( 'show_encoded_check', true );
|
175 |
+
}
|
176 |
+
|
177 |
+
if ( $replace_by === null ) {
|
178 |
+
$replace_by = EEB()->helpers->translate( EEB()->settings->get_setting( 'protection_text', true ), 'email-protection-text' );
|
179 |
+
}
|
180 |
+
|
181 |
+
$self = $this;
|
182 |
+
|
183 |
+
return preg_replace_callback( EEB()->settings->get_email_regex(), function ( $matches ) use ( $replace_by, $protection_method, $show_encoded_check, $self ) {
|
184 |
+
// workaround to skip responsive image names containing @
|
185 |
+
$extention = strtolower( $matches[4] );
|
186 |
+
$excludedList = array('.jpg', '.jpeg', '.png', '.gif');
|
187 |
+
|
188 |
+
if ( in_array( $extention, $excludedList ) ) {
|
189 |
+
return $matches[0];
|
190 |
+
}
|
191 |
+
|
192 |
+
if ( is_callable( $replace_by ) ) {
|
193 |
+
return call_user_func( $replace_by, $matches, $protection_method );
|
194 |
+
}
|
195 |
+
|
196 |
+
if( $protection_method === 'char_encode' ){
|
197 |
+
$protected_return = antispambot( $matches[0] );
|
198 |
+
} elseif( $protection_method === 'convert_image' ){
|
199 |
+
|
200 |
+
$image_link = $self->generate_email_image_url( $matches[0] );
|
201 |
+
if( ! empty( $image_link ) ){
|
202 |
+
$protected_return = '<img src="' . $image_link . '" />';
|
203 |
+
} else {
|
204 |
+
$protected_return = antispambot( $matches[0] );
|
205 |
+
}
|
206 |
+
|
207 |
+
} elseif( $protection_method === 'use_javascript' ){
|
208 |
+
$protection_text = EEB()->helpers->translate( EEB()->settings->get_setting( 'protection_text', true ), 'email-protection-text' );
|
209 |
+
$protected_return = $this->dynamic_js_email_encoding( $matches[0], $protection_text );
|
210 |
+
} elseif( $protection_method === 'use_css' ){
|
211 |
+
$protection_text = EEB()->helpers->translate( EEB()->settings->get_setting( 'protection_text', true ), 'email-protection-text' );
|
212 |
+
$protected_return = $this->encode_email_css( $matches[0], $protection_text );
|
213 |
+
} else {
|
214 |
+
$protected_return = $replace_by;
|
215 |
+
}
|
216 |
+
|
217 |
+
// mark link as successfullly encoded (for admin users)
|
218 |
+
if ( current_user_can( EEB()->settings->get_admin_cap( 'frontend-display-security-check' ) ) && $show_encoded_check ) {
|
219 |
+
$protected_return .= '<i class="eeb-encoded dashicons-before dashicons-lock" title="' . EEB()->helpers->translate( 'Email encoded successfully!', 'frontend-security-check-title' ) . '"></i>';
|
220 |
+
}
|
221 |
+
|
222 |
+
return $protected_return;
|
223 |
+
|
224 |
+
}, $content );
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Filter passed input fields
|
229 |
+
*
|
230 |
+
* @param string $content
|
231 |
+
* @return string
|
232 |
+
*/
|
233 |
+
public function filter_input_fields( $content, $encoding_method = 'default' ){
|
234 |
+
$self = $this;
|
235 |
+
$strong_encoding = (bool) EEB()->settings->get_setting( 'input_strong_protection', true, 'filter_body' );
|
236 |
+
|
237 |
+
$callback_encode_input_fields = function ( $match ) use ( $self, $encoding_method, $strong_encoding ) {
|
238 |
+
$input = $match[0];
|
239 |
+
$email = $match[2];
|
240 |
+
|
241 |
+
//Only allow strong encoding if javascript is supported
|
242 |
+
if( $encoding_method === 'without_javascript' ){
|
243 |
+
$strong_encoding = false;
|
244 |
+
}
|
245 |
+
|
246 |
+
return $self->encode_input_field( $input, $email, $strong_encoding );
|
247 |
+
};
|
248 |
+
|
249 |
+
$regexpInputField = '/<input([^>]*)value=["\'][\s+]*' . EEB()->settings->get_email_regex( true ) . '[\s+]*["\']([^>]*)>/is';
|
250 |
+
|
251 |
+
return preg_replace_callback( $regexpInputField, $callback_encode_input_fields, $content );
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* @param string $content
|
256 |
+
* @return string
|
257 |
+
*/
|
258 |
+
public function filter_mailto_links( $content, $protection_method = null ){
|
259 |
+
$self = $this;
|
260 |
+
|
261 |
+
$callbackEncodeMailtoLinks = function ( $match ) use ( $self, $protection_method ) {
|
262 |
+
$attrs = shortcode_parse_atts( $match[1] );
|
263 |
+
return $self->create_protected_mailto( $match[4], $attrs, $protection_method );
|
264 |
+
};
|
265 |
+
|
266 |
+
$regexpMailtoLink = '/<a[\s+]*(([^>]*)href=["\']mailto\:([^>]*)["\'])>(.*?)<\/a[\s+]*>/is';
|
267 |
+
|
268 |
+
return preg_replace_callback( $regexpMailtoLink, $callbackEncodeMailtoLinks, $content );
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Emails will be replaced by '*protected email*'
|
273 |
+
*
|
274 |
+
* @param string $content
|
275 |
+
* @return string
|
276 |
+
*/
|
277 |
+
public function filter_rss( $content, $protection_type ){
|
278 |
+
|
279 |
+
if( $protection_type === 'strong_method' ) {
|
280 |
+
$filtered = $this->filter_plain_emails( $content );
|
281 |
+
} else {
|
282 |
+
$filtered = $this->filter_plain_emails( $content, null, 'char_encode' );
|
283 |
+
}
|
284 |
+
|
285 |
+
return $filtered;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Filter plain emails using soft attributes
|
290 |
+
*
|
291 |
+
* @param string $content - the content that should be soft filtered
|
292 |
+
* @param string $protection_method - The method (E.g. char_encode)
|
293 |
+
* @return string
|
294 |
+
*/
|
295 |
+
public function filter_soft_attributes( $content, $protection_method ){
|
296 |
+
$soft_attributes = EEB()->settings->get_soft_attribute_regex();
|
297 |
+
|
298 |
+
foreach( $soft_attributes as $ident => $regex ){
|
299 |
+
|
300 |
+
$array = array();
|
301 |
+
preg_match( $regex, $content, $array ) ;
|
302 |
+
|
303 |
+
foreach( $array as $single ){
|
304 |
+
$content = str_replace( $single, $this->filter_plain_emails( $single, null, $protection_method, false ), $content );
|
305 |
+
}
|
306 |
+
|
307 |
+
}
|
308 |
+
|
309 |
+
return $content;
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Filter plain emails using soft dom attributes
|
314 |
+
*
|
315 |
+
* @param string $content - the content that should be soft filtered
|
316 |
+
* @param string $protection_method - The method (E.g. char_encode)
|
317 |
+
* @return string
|
318 |
+
*/
|
319 |
+
public function filter_soft_dom_attributes( $content, $protection_method ){
|
320 |
+
|
321 |
+
if( class_exists( 'DOMDocument' ) ){
|
322 |
+
$dom = new DOMDocument();
|
323 |
+
@$dom->loadHTML($content);
|
324 |
+
|
325 |
+
//Soft-encode scripts
|
326 |
+
$script = $dom->getElementsByTagName('script');
|
327 |
+
foreach($script as $item){
|
328 |
+
$content = str_replace( $item->nodeValue, $this->filter_plain_emails( $item->nodeValue, null, $protection_method, false ), $content );
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
return $content;
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* ######################
|
337 |
+
* ###
|
338 |
+
* #### ENCODINGS
|
339 |
+
* ###
|
340 |
+
* ######################
|
341 |
+
*/
|
342 |
+
|
343 |
+
/**
|
344 |
+
* ASCII method
|
345 |
+
*
|
346 |
+
* @param string $value
|
347 |
+
* @param string $protection_text
|
348 |
+
* @return string
|
349 |
+
*/
|
350 |
+
public function encode_ascii($value, $protection_text) {
|
351 |
+
$mail_link = $value;
|
352 |
+
|
353 |
+
// first encode, so special chars can be supported
|
354 |
+
$mail_link = EEB()->helpers->encode_uri_components( $mail_link );
|
355 |
+
|
356 |
+
$mail_letters = '';
|
357 |
+
|
358 |
+
for ($i = 0; $i < strlen($mail_link); $i ++) {
|
359 |
+
$l = substr($mail_link, $i, 1);
|
360 |
+
|
361 |
+
if (strpos($mail_letters, $l) === false) {
|
362 |
+
$p = rand(0, strlen($mail_letters));
|
363 |
+
$mail_letters = substr($mail_letters, 0, $p) .
|
364 |
+
$l . substr($mail_letters, $p, strlen($mail_letters));
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
$mail_letters_enc = str_replace("\\", "\\\\", $mail_letters);
|
369 |
+
$mail_letters_enc = str_replace("\"", "\\\"", $mail_letters_enc);
|
370 |
+
|
371 |
+
$mail_indices = '';
|
372 |
+
for ($i = 0; $i < strlen($mail_link); $i ++) {
|
373 |
+
$index = strpos($mail_letters, substr($mail_link, $i, 1));
|
374 |
+
$index += 48;
|
375 |
+
$mail_indices .= chr($index);
|
376 |
+
}
|
377 |
+
|
378 |
+
$mail_indices = str_replace("\\", "\\\\", $mail_indices);
|
379 |
+
$mail_indices = str_replace("\"", "\\\"", $mail_indices);
|
380 |
+
|
381 |
+
$element_id = 'eeb-' . mt_rand( 0, 1000000 ) . '-' . mt_rand(0, 1000000);
|
382 |
+
|
383 |
+
return '<span id="'. $element_id . '"></span>'
|
384 |
+
. '<script type="text/javascript">'
|
385 |
+
. '(function(){'
|
386 |
+
. 'var ml="'. $mail_letters_enc .'",mi="'. $mail_indices .'",o="";'
|
387 |
+
. 'for(var j=0,l=mi.length;j<l;j++){'
|
388 |
+
. 'o+=ml.charAt(mi.charCodeAt(j)-48);'
|
389 |
+
. '}document.getElementById("' . $element_id . '").innerHTML = decodeURIComponent(o);' // decode at the end, this way special chars can be supported
|
390 |
+
. '}());'
|
391 |
+
. '</script><noscript>'
|
392 |
+
. $protection_text
|
393 |
+
. '</noscript>';
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Escape encoding method
|
398 |
+
*
|
399 |
+
* @param string $value
|
400 |
+
* @param string $protection_text
|
401 |
+
* @return string
|
402 |
+
*/
|
403 |
+
public function encode_escape( $value, $protection_text ) {
|
404 |
+
$element_id = 'eeb-' . mt_rand( 0, 1000000 ) . '-' . mt_rand( 0, 1000000 );
|
405 |
+
$string = '\'' . $value . '\'';
|
406 |
+
|
407 |
+
// break string into array of characters, we can't use string_split because its php5 only
|
408 |
+
$split = preg_split( '||', $string );
|
409 |
+
$out = '<span id="'. $element_id . '"></span>'
|
410 |
+
. '<script type="text/javascript">' . 'document.getElementById("' . $element_id . '").innerHTML = ev' . 'al(decodeURIComponent("';
|
411 |
+
|
412 |
+
foreach( $split as $c ) {
|
413 |
+
// preg split will return empty first and last characters, check for them and ignore
|
414 |
+
if( ! empty( $c ) ) {
|
415 |
+
$out .= '%' . dechex( ord( $c ) );
|
416 |
+
}
|
417 |
+
}
|
418 |
+
|
419 |
+
$out .= '"))' . '</script><noscript>'
|
420 |
+
. $protection_text
|
421 |
+
. '</noscript>';
|
422 |
+
|
423 |
+
return $out;
|
424 |
+
}
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Encode email in input field
|
428 |
+
* @param string $input
|
429 |
+
* @param string $email
|
430 |
+
* @return string
|
431 |
+
*/
|
432 |
+
public function encode_input_field( $input, $email, $strongEncoding = false ){
|
433 |
+
|
434 |
+
$show_encoded_check = (bool) EEB()->settings->get_setting( 'show_encoded_check', true );
|
435 |
+
|
436 |
+
if ( $strongEncoding === false ) {
|
437 |
+
// encode email with entities (default wp method)
|
438 |
+
$sub_return = str_replace( $email, antispambot( $email ), $input );
|
439 |
+
|
440 |
+
if ( current_user_can( EEB()->settings->get_admin_cap( 'frontend-display-security-check' ) ) && $show_encoded_check ) {
|
441 |
+
$sub_return .= '<i class="eeb-encoded dashicons-before dashicons-lock" title="' . EEB()->helpers->translate( 'Email encoded successfully!', 'frontend-security-check-title' ) . '"></i>';
|
442 |
+
}
|
443 |
+
|
444 |
+
return $sub_return;
|
445 |
+
}
|
446 |
+
|
447 |
+
// add data-enc-email after "<input"
|
448 |
+
$inputWithDataAttr = substr( $input, 0, 6 );
|
449 |
+
$inputWithDataAttr .= ' data-enc-email="' . $this->get_encoded_email( $email ) . '"';
|
450 |
+
$inputWithDataAttr .= substr( $input, 6 );
|
451 |
+
|
452 |
+
// mark link as successfullly encoded (for admin users)
|
453 |
+
if ( current_user_can( EEB()->settings->get_admin_cap( 'frontend-display-security-check' ) ) && $show_encoded_check ) {
|
454 |
+
$inputWithDataAttr .= '<i class="eeb-encoded dashicons-before dashicons-lock" title="' . EEB()->helpers->translate( 'Email encoded successfully!', 'frontend-security-check-title' ) . '"></i>';
|
455 |
+
}
|
456 |
+
|
457 |
+
// remove email from value attribute
|
458 |
+
$encInput = str_replace( $email, '', $inputWithDataAttr );
|
459 |
+
|
460 |
+
return $encInput;
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* Get encoded email, used for data-attribute (translate by javascript)
|
465 |
+
*
|
466 |
+
* @param string $email
|
467 |
+
* @return string
|
468 |
+
*/
|
469 |
+
public function get_encoded_email( $email ){
|
470 |
+
$encEmail = $email;
|
471 |
+
|
472 |
+
// decode entities
|
473 |
+
$encEmail = html_entity_decode( $encEmail );
|
474 |
+
|
475 |
+
// rot13 encoding
|
476 |
+
$encEmail = str_rot13( $encEmail );
|
477 |
+
|
478 |
+
// replace @
|
479 |
+
$encEmail = str_replace( '@', '[at]', $encEmail );
|
480 |
+
|
481 |
+
return $encEmail;
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Create a protected email
|
486 |
+
*
|
487 |
+
* @param string $display
|
488 |
+
* @param array $attrs Optional
|
489 |
+
* @return string
|
490 |
+
*/
|
491 |
+
public function create_protected_mailto( $display, $attrs = array(), $protection_method = null ){
|
492 |
+
$email = '';
|
493 |
+
$class_ori = ( empty( $attrs['class'] ) ) ? '' : $attrs['class'];
|
494 |
+
$custom_class = (string) EEB()->settings->get_setting( 'class_name', true );
|
495 |
+
$activated_protection = ( in_array( (int) EEB()->settings->get_setting( 'protect', true ), array( 1, 2 ) ) ) ? true : false;
|
496 |
+
$show_encoded_check = (string) EEB()->settings->get_setting( 'show_encoded_check', true );
|
497 |
+
|
498 |
+
// set user-defined class
|
499 |
+
if ( $custom_class && strpos( $class_ori, $custom_class ) === FALSE ) {
|
500 |
+
$attrs['class'] = ( empty( $attrs['class'] ) ) ? $custom_class : $attrs['class'] . ' ' . $custom_class;
|
501 |
+
}
|
502 |
+
|
503 |
+
// check title for email address
|
504 |
+
if ( ! empty( $attrs['title'] ) ) {
|
505 |
+
$attrs['title'] = $this->filter_plain_emails( $attrs['title'], '{{email}}' ); // {{email}} will be replaced in javascript
|
506 |
+
}
|
507 |
+
|
508 |
+
// set ignore to data-attribute to prevent being processed by WPEL plugin
|
509 |
+
$attrs['data-wpel-link'] = 'ignore';
|
510 |
+
|
511 |
+
// create element code
|
512 |
+
$link = '<a ';
|
513 |
+
|
514 |
+
foreach ( $attrs AS $key => $value ) {
|
515 |
+
if ( strtolower( $key ) == 'href' && $activated_protection ) {
|
516 |
+
if( $protection_method === 'without_javascript' ){
|
517 |
+
$link .= $key . '="' . antispambot( $value ) . '" ';
|
518 |
+
} else {
|
519 |
+
// get email from href
|
520 |
+
$email = substr($value, 7);
|
521 |
+
|
522 |
+
$encoded_email = $this->get_encoded_email( $email );
|
523 |
+
|
524 |
+
// set attrs
|
525 |
+
$link .= 'href="javascript:;" ';
|
526 |
+
$link .= 'data-enc-email="' . $encoded_email . '" ';
|
527 |
+
}
|
528 |
+
|
529 |
+
} else {
|
530 |
+
$link .= $key . '="' . $value . '" ';
|
531 |
+
}
|
532 |
+
}
|
533 |
+
|
534 |
+
// remove last space
|
535 |
+
$link = substr( $link, 0, -1 );
|
536 |
+
|
537 |
+
$link .= '>';
|
538 |
+
|
539 |
+
$link .= ( $activated_protection && preg_match( EEB()->settings->get_email_regex(), $display) > 0 ) ? $this->get_protected_display( $display, $protection_method ) : $display;
|
540 |
+
|
541 |
+
$link .= '</a>';
|
542 |
+
|
543 |
+
// filter
|
544 |
+
$link = apply_filters( 'eeb_mailto', $link, $display, $email, $attrs );
|
545 |
+
|
546 |
+
// just in case there are still email addresses f.e. within title-tag
|
547 |
+
$link = $this->filter_plain_emails( $link, null, 'char_encode' );
|
548 |
+
|
549 |
+
// mark link as successfullly encoded (for admin users)
|
550 |
+
if ( current_user_can( EEB()->settings->get_admin_cap( 'frontend-display-security-check' ) ) && $show_encoded_check ) {
|
551 |
+
$link .= '<i class="eeb-encoded dashicons-before dashicons-lock" title="' . EEB()->helpers->translate( 'Email encoded successfully!', 'frontend-security-check-title' ) . '"></i>';
|
552 |
+
}
|
553 |
+
|
554 |
+
|
555 |
+
return $link;
|
556 |
+
}
|
557 |
+
|
558 |
+
/**
|
559 |
+
* Create protected display combining these 3 methods:
|
560 |
+
* - reversing string
|
561 |
+
* - adding no-display spans with dummy values
|
562 |
+
* - using the wp antispambot function
|
563 |
+
*
|
564 |
+
* @param string|array $display
|
565 |
+
* @return string Protected display
|
566 |
+
*/
|
567 |
+
public function get_protected_display( $display, $protection_method = null ){
|
568 |
+
|
569 |
+
$convert_plain_to_image = (bool) EEB()->settings->get_setting( 'convert_plain_to_image', true, 'filter_body' );
|
570 |
+
$protection_text = EEB()->helpers->translate( EEB()->settings->get_setting( 'protection_text', true ), 'email-protection-text' );
|
571 |
+
|
572 |
+
// get display out of array (result of preg callback)
|
573 |
+
if ( is_array( $display ) ) {
|
574 |
+
$display = $display[0];
|
575 |
+
}
|
576 |
+
|
577 |
+
if( $convert_plain_to_image ){
|
578 |
+
return '<img src="' . $this->generate_email_image_url( $display ) . '" />';
|
579 |
+
}
|
580 |
+
|
581 |
+
if( $protection_method !== 'without_javascript' ){
|
582 |
+
return $this->dynamic_js_email_encoding( $display, $protection_text );
|
583 |
+
}
|
584 |
+
|
585 |
+
return $this->encode_email_css( $display );
|
586 |
+
|
587 |
+
}
|
588 |
+
|
589 |
+
/**
|
590 |
+
* Dynamic email encoding with certain javascript methods
|
591 |
+
*
|
592 |
+
* @param string $email
|
593 |
+
* @param string $protection_text
|
594 |
+
* @return the encoded email
|
595 |
+
*/
|
596 |
+
public function dynamic_js_email_encoding( $email, $protection_text = null ){
|
597 |
+
$return = $email;
|
598 |
+
$rand = rand(0,2);
|
599 |
+
switch( $rand ){
|
600 |
+
case 2:
|
601 |
+
$return = $this->encode_escape( $return, $protection_text );
|
602 |
+
break;
|
603 |
+
case 1:
|
604 |
+
$return = $this->encode_ascii( $return, $protection_text );
|
605 |
+
break;
|
606 |
+
default:
|
607 |
+
$return = $this->encode_ascii( $return, $protection_text );
|
608 |
+
break;
|
609 |
+
}
|
610 |
+
|
611 |
+
return $return;
|
612 |
+
}
|
613 |
+
|
614 |
+
public function encode_email_css( $display ){
|
615 |
+
$deactivate_rtl = (bool) EEB()->settings->get_setting( 'deactivate_rtl', true, 'filter_body' );
|
616 |
+
|
617 |
+
$stripped_display = strip_tags( $display );
|
618 |
+
$stripped_display = html_entity_decode( $stripped_display );
|
619 |
+
|
620 |
+
$length = strlen( $stripped_display );
|
621 |
+
$interval = ceil( min( 5, $length / 2 ) );
|
622 |
+
$offset = 0;
|
623 |
+
$dummy_data = time();
|
624 |
+
$protected = '';
|
625 |
+
$protection_classes = 'eeb';
|
626 |
+
|
627 |
+
if( $deactivate_rtl ){
|
628 |
+
$rev = $stripped_display;
|
629 |
+
$protection_classes .= ' eeb-nrtl';
|
630 |
+
} else {
|
631 |
+
// reverse string ( will be corrected with CSS )
|
632 |
+
$rev = strrev( $stripped_display );
|
633 |
+
$protection_classes .= ' eeb-rtl';
|
634 |
+
}
|
635 |
+
|
636 |
+
|
637 |
+
while ( $offset < $length ) {
|
638 |
+
$protected .= '<span class="eeb-sd">' . antispambot( substr( $rev, $offset, $interval ) ) . '</span>';
|
639 |
+
|
640 |
+
// setup dummy content
|
641 |
+
$protected .= '<span class="eeb-nodis">' . $dummy_data . '</span>';
|
642 |
+
$offset += $interval;
|
643 |
+
}
|
644 |
+
|
645 |
+
$protected = '<span class="' . $protection_classes . '">' . $protected . '</span>';
|
646 |
+
|
647 |
+
return $protected;
|
648 |
+
}
|
649 |
+
|
650 |
+
public function email_to_image( $email, $image_string_color = 'default', $image_background_color = 'default', $alpha_string = 0, $alpha_fill = 127, $font_size = 4 ){
|
651 |
+
|
652 |
+
$setting_image_string_color = (string) EEB()->settings->get_setting( 'image_color', true, 'image_settings' );
|
653 |
+
$setting_image_background_color = (string) EEB()->settings->get_setting( 'image_background_color', true, 'image_settings' );
|
654 |
+
$image_text_opacity = (int) EEB()->settings->get_setting( 'image_text_opacity', true, 'image_settings' );
|
655 |
+
$image_background_opacity = (int) EEB()->settings->get_setting( 'image_background_opacity', true, 'image_settings' );
|
656 |
+
$image_font_size = (int) EEB()->settings->get_setting( 'image_font_size', true, 'image_settings' );
|
657 |
+
|
658 |
+
if( $image_background_color === 'default' ){
|
659 |
+
$image_background_color = $setting_image_background_color;
|
660 |
+
} else {
|
661 |
+
$image_background_color = '0,0,0';
|
662 |
+
}
|
663 |
+
|
664 |
+
$colors = explode( ',', $image_background_color );
|
665 |
+
$bg_red = $colors[0];
|
666 |
+
$bg_green = $colors[1];
|
667 |
+
$bg_blue = $colors[2];
|
668 |
+
|
669 |
+
if( $image_string_color === 'default' ){
|
670 |
+
$image_string_color = $setting_image_string_color;
|
671 |
+
} else {
|
672 |
+
$image_string_color = '0,0,0';
|
673 |
+
}
|
674 |
+
|
675 |
+
$colors = explode( ',', $image_string_color );
|
676 |
+
$string_red = $colors[0];
|
677 |
+
$string_green = $colors[1];
|
678 |
+
$string_blue = $colors[2];
|
679 |
+
|
680 |
+
if( ! empty( $image_text_opacity ) && $image_text_opacity >= 0 && $image_text_opacity <= 127 ){
|
681 |
+
$alpha_string = intval( $image_text_opacity );
|
682 |
+
}
|
683 |
+
|
684 |
+
if( ! empty( $image_background_opacity ) && $image_background_opacity >= 0 && $image_background_opacity <= 127 ){
|
685 |
+
$alpha_fill = intval( $image_background_opacity );
|
686 |
+
}
|
687 |
+
|
688 |
+
if( ! empty( $image_font_size ) && $image_font_size >= 1 && $image_font_size <= 5 ){
|
689 |
+
$font_size = intval( $image_font_size );
|
690 |
+
}
|
691 |
+
|
692 |
+
$img = imagecreatetruecolor( imagefontwidth( $font_size ) * strlen( $email ), imagefontheight( $font_size ) );
|
693 |
+
imagesavealpha( $img, true );
|
694 |
+
imagefill( $img, 0, 0, imagecolorallocatealpha ($img, $bg_red, $bg_green, $bg_blue, $alpha_fill ) );
|
695 |
+
imagestring( $img, $font_size, 0, 0, $email, imagecolorallocatealpha( $img, $string_red, $string_green, $string_blue, $alpha_string ) );
|
696 |
+
ob_start();
|
697 |
+
imagepng( $img );
|
698 |
+
imagedestroy( $img );
|
699 |
+
|
700 |
+
return ob_get_clean ();
|
701 |
+
}
|
702 |
+
|
703 |
+
public function generate_email_signature( $email, $secret ) {
|
704 |
+
|
705 |
+
if( ! $secret ){
|
706 |
+
return false;
|
707 |
+
}
|
708 |
+
|
709 |
+
$hash_signature = apply_filters( 'eeb/validate/email_signature', 'sha256', $email );
|
710 |
+
|
711 |
+
return base64_encode( hash_hmac( $hash_signature, $email, $secret, true ) );
|
712 |
+
}
|
713 |
+
|
714 |
+
public function generate_email_image_url( $email ) {
|
715 |
+
|
716 |
+
if( empty( $email ) || ! is_email( $email ) ){
|
717 |
+
return false;
|
718 |
+
}
|
719 |
+
|
720 |
+
$secret = EEB()->settings->get_email_image_secret();
|
721 |
+
$signature = $this->generate_email_signature( $email, $secret );
|
722 |
+
$url = home_url() . '?eeb_mail=' . urlencode( base64_encode( $email ) ) . '&eeb_hash=' . urlencode( $signature );
|
723 |
+
|
724 |
+
$url = apply_filters( 'eeb/validate/generate_email_image_url', $url, $email );
|
725 |
+
|
726 |
+
return $url;
|
727 |
+
}
|
728 |
+
|
729 |
+
/**
|
730 |
+
* ######################
|
731 |
+
* ###
|
732 |
+
* #### ENCODER FORM
|
733 |
+
* ###
|
734 |
+
* ######################
|
735 |
+
*/
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Get the encoder form (to use as a demo, like on the options page)
|
739 |
+
* @return string
|
740 |
+
*/
|
741 |
+
public function get_encoder_form() {
|
742 |
+
$powered_by_setting = (bool) EEB()->settings->get_setting( 'powered_by', true, 'encoder_form' );
|
743 |
+
$display_encoder_form = (bool) EEB()->settings->get_setting( 'display_encoder_form', true, 'encoder_form' );
|
744 |
+
|
745 |
+
//shorten circle
|
746 |
+
if( ! $display_encoder_form ){
|
747 |
+
return apply_filters('eeb_form_content_inactive', '' );
|
748 |
+
}
|
749 |
+
|
750 |
+
$powered_by = '';
|
751 |
+
if ($powered_by_setting) {
|
752 |
+
$powered_by .= '<p class="powered-by">' . __('Powered by free', 'email-encoder-bundle') . ' <a rel="external" href="https://wordpress.org/plugins/email-encoder-bundle/">Email Encoder</a></p>';
|
753 |
+
}
|
754 |
+
|
755 |
+
$smethods = array(
|
756 |
+
'rot13' => EEB()->helpers->translate( 'Rot13 (Javascript)', 'eeb-encoder-form-methods' ),
|
757 |
+
'escape' => EEB()->helpers->translate( 'Escape (Javascript)', 'eeb-encoder-form-methods' ),
|
758 |
+
'encode' => EEB()->helpers->translate( 'Encode (HTML)', 'eeb-encoder-form-methods' ),
|
759 |
+
);
|
760 |
+
$method_options = '';
|
761 |
+
$selected = false;
|
762 |
+
foreach( $smethods as $method_name => $name ) {
|
763 |
+
$method_options .= '<option value="' . $method_name . '"' . ( ($selected === false ) ? ' selected="selected"' : '') . '>' . $name . '</option>';
|
764 |
+
$selected = true;
|
765 |
+
}
|
766 |
+
|
767 |
+
$labels = array(
|
768 |
+
'email' => EEB()->helpers->translate( 'Email Address:', 'eeb-encoder-form-labels' ),
|
769 |
+
'display' => EEB()->helpers->translate( 'Display Text:', 'eeb-encoder-form-labels' ),
|
770 |
+
'mailto' => EEB()->helpers->translate( 'Mailto Link:', 'eeb-encoder-form-labels' ),
|
771 |
+
'method' => EEB()->helpers->translate( 'Encoding Method:', 'eeb-encoder-form-labels' ),
|
772 |
+
'create_link' => EEB()->helpers->translate( 'Create Protected Mail Link >>', 'eeb-encoder-form-labels' ),
|
773 |
+
'output' => EEB()->helpers->translate( 'Protected Mail Link (code):', 'eeb-encoder-form-labels' ),
|
774 |
+
'powered_by' => $powered_by,
|
775 |
+
);
|
776 |
+
|
777 |
+
extract($labels);
|
778 |
+
|
779 |
+
$form = <<<FORM
|
780 |
+
<div class="eeb-form">
|
781 |
+
<form>
|
782 |
+
<fieldset>
|
783 |
+
<div class="input">
|
784 |
+
<table>
|
785 |
+
<tbody>
|
786 |
+
<tr>
|
787 |
+
<th><label for="eeb-email">{$email}</label></th>
|
788 |
+
<td><input type="text" class="regular-text" id="eeb-email" name="eeb-email" /></td>
|
789 |
+
</tr>
|
790 |
+
<tr>
|
791 |
+
<th><label for="eeb-display">{$display}</label></th>
|
792 |
+
<td><input type="text" class="regular-text" id="eeb-display" name="eeb-display" /></td>
|
793 |
+
</tr>
|
794 |
+
<tr>
|
795 |
+
<th>{$mailto}</th>
|
796 |
+
<td><span class="eeb-example"></span></td>
|
797 |
+
</tr>
|
798 |
+
<tr>
|
799 |
+
<th><label for="eeb-encode-method">{$method}</label></th>
|
800 |
+
<td><select id="eeb-encode-method" name="eeb-encode-method" class="postform">
|
801 |
+
{$method_options}
|
802 |
+
</select>
|
803 |
+
<input type="button" id="eeb-ajax-encode" name="eeb-ajax-encode" value="{$create_link}" />
|
804 |
+
</td>
|
805 |
+
</tr>
|
806 |
+
</tbody>
|
807 |
+
</table>
|
808 |
+
</div>
|
809 |
+
<div class="eeb-output">
|
810 |
+
<table>
|
811 |
+
<tbody>
|
812 |
+
<tr>
|
813 |
+
<th><label for="eeb-encoded-output">{$output}</label></th>
|
814 |
+
<td><textarea class="large-text node" id="eeb-encoded-output" name="eeb-encoded-output" cols="50" rows="4"></textarea></td>
|
815 |
+
</tr>
|
816 |
+
</tbody>
|
817 |
+
</table>
|
818 |
+
</div>
|
819 |
+
{$powered_by}
|
820 |
+
</fieldset>
|
821 |
+
</form>
|
822 |
+
</div>
|
823 |
+
FORM;
|
824 |
+
|
825 |
+
// apply filters
|
826 |
+
$form = apply_filters('eeb_form_content', $form, $labels, $powered_by_setting );
|
827 |
+
|
828 |
+
return $form;
|
829 |
+
}
|
830 |
+
|
831 |
+
|
832 |
+
public function is_post_excluded( $post_id = null ){
|
833 |
+
|
834 |
+
$skip_posts = (string) EEB()->settings->get_setting( 'skip_posts', true );
|
835 |
+
if( ! empty( $skip_posts ) ){
|
836 |
+
|
837 |
+
if( empty( $post_id ) ){
|
838 |
+
global $post;
|
839 |
+
$post_id = $post->ID;
|
840 |
+
} else {
|
841 |
+
$post_id = intval( $post_id );
|
842 |
+
}
|
843 |
+
|
844 |
+
$exclude_pages = explode( ',', $skip_posts );
|
845 |
+
|
846 |
+
if( is_array( $exclude_pages ) ){
|
847 |
+
$exclude_pages_validated = array();
|
848 |
+
|
849 |
+
foreach( $exclude_pages as $spost_id ){
|
850 |
+
$spost_id = trim($spost_id);
|
851 |
+
if( is_numeric( $spost_id ) ){
|
852 |
+
$exclude_pages_validated[] = intval( $spost_id );
|
853 |
+
}
|
854 |
+
}
|
855 |
+
|
856 |
+
if ( in_array( $post_id, $exclude_pages_validated ) ) {
|
857 |
+
return true;
|
858 |
+
}
|
859 |
+
}
|
860 |
+
|
861 |
+
}
|
862 |
+
|
863 |
+
return false;
|
864 |
+
}
|
865 |
+
}
|
core/includes/classes/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php //Silence is golden
|
core/includes/functions/template-tags.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if( ! function_exists( 'eeb_form' ) ){
|
4 |
+
|
5 |
+
function eeb_form(){
|
6 |
+
return EEB()->validate->get_encoder_form();
|
7 |
+
}
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Template function for encoding email
|
13 |
+
* @global Eeb_Site $Eeb_Site
|
14 |
+
* @param string $email
|
15 |
+
* @param string $display if non given will be same as email
|
16 |
+
* @param string $extra_attrs (Optional)
|
17 |
+
* @param string $method Optional, else the default setted method will; be used
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
//Backwards compatibility
|
21 |
+
if( ! function_exists( 'eeb_email' ) ){
|
22 |
+
function eeb_email( $email, $display = null, $extra_attrs = '', $method = null ){
|
23 |
+
return eeb_mailto( $email, $display, $extra_attrs, $method );
|
24 |
+
}
|
25 |
+
}
|
26 |
+
if (!function_exists('eeb_mailto')):
|
27 |
+
function eeb_mailto( $email, $display = null, $extra_attrs = '', $method = null ) {
|
28 |
+
|
29 |
+
$custom_class = (string) EEB()->settings->get_setting( 'class_name', true );
|
30 |
+
|
31 |
+
if( empty( $display ) ) {
|
32 |
+
$display = $email;
|
33 |
+
} else {
|
34 |
+
$display = html_entity_decode($display);
|
35 |
+
}
|
36 |
+
|
37 |
+
$class_name = ' ' . trim($extra_attrs);
|
38 |
+
$class_name .= ' class="' . esc_attr( $custom_class ) . '"';
|
39 |
+
$mailto = '<a href="mailto:' . $email . '"'. $class_name . '>' . $display . '</a>';
|
40 |
+
|
41 |
+
switch( $method ){
|
42 |
+
case 'enc_ascii':
|
43 |
+
case 'rot13':
|
44 |
+
$mailto = EEB()->validate->encode_ascii( $mailto, $display );
|
45 |
+
break;
|
46 |
+
case 'enc_escape':
|
47 |
+
case 'escape':
|
48 |
+
$mailto = EEB()->validate->encode_escape( $mailto, $display );
|
49 |
+
break;
|
50 |
+
case 'enc_html':
|
51 |
+
case 'encode':
|
52 |
+
default:
|
53 |
+
$mailto = '<a href="mailto:' . antispambot( $email ) . '"'. $class_name . '>' . antispambot( $display ) . '</a>';
|
54 |
+
break;
|
55 |
+
}
|
56 |
+
|
57 |
+
echo apply_filters( 'eeb/frontend/template_func/eeb_mailto', $mailto );
|
58 |
+
|
59 |
+
}
|
60 |
+
endif;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Template function for encoding content
|
64 |
+
* @global Eeb_Site $Eeb_Site
|
65 |
+
* @param string $content
|
66 |
+
* @param string $method Optional, default null
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
//Backwards compatibility
|
70 |
+
if( ! function_exists( 'eeb_content' ) ){
|
71 |
+
function eeb_content( $content, $method = null, $protection_text = null ){
|
72 |
+
return eeb_protect_content( $content, $method, $protection_text );
|
73 |
+
}
|
74 |
+
}
|
75 |
+
if (!function_exists('eeb_protect_content')):
|
76 |
+
function eeb_protect_content( $content, $method = null, $protection_text = null ) {
|
77 |
+
|
78 |
+
if( empty( $protection_text ) ){
|
79 |
+
$protection_text = EEB()->helpers->translate( EEB()->settings->get_setting( 'protection_text', true ), 'email-protection-text-eeb-content-template-func' );
|
80 |
+
} else {
|
81 |
+
$protection_text = wp_kses_post( $protection_text );
|
82 |
+
}
|
83 |
+
|
84 |
+
if( ! empty( $method ) ){
|
85 |
+
$method = sanitize_title( $method );
|
86 |
+
} else {
|
87 |
+
$method = 'rot13';
|
88 |
+
}
|
89 |
+
|
90 |
+
switch( $method ){
|
91 |
+
case 'enc_ascii':
|
92 |
+
case 'rot13':
|
93 |
+
$content = EEB()->validate->encode_ascii( $content, $protection_text );
|
94 |
+
break;
|
95 |
+
case 'enc_escape':
|
96 |
+
case 'escape':
|
97 |
+
$content = EEB()->validate->encode_escape( $content, $protection_text );
|
98 |
+
break;
|
99 |
+
case 'enc_html':
|
100 |
+
case 'encode':
|
101 |
+
default:
|
102 |
+
$content = antispambot( $content );
|
103 |
+
break;
|
104 |
+
}
|
105 |
+
|
106 |
+
return apply_filters( 'eeb/frontend/template_func/eeb_protect_content', $content );
|
107 |
+
}
|
108 |
+
endif;
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Template function for encoding emails in the given content
|
112 |
+
* @global Eeb_Site $Eeb_Site
|
113 |
+
* @param string $content
|
114 |
+
* @param boolean $enc_tags Optional, default true (deprectaed)
|
115 |
+
* @param boolean $enc_mailtos Optional, default true (deprectaed)
|
116 |
+
* @param boolean $enc_plain_emails Optional, default true (deprectaed)
|
117 |
+
* @param boolean $enc_input_fields Optional, default true (deprectaed)
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
//Backwards compatibility
|
121 |
+
if( ! function_exists( 'eeb_email_filter' ) ){
|
122 |
+
function eeb_email_filter( $content, $method = null, $enc_mailtos = true, $enc_plain_emails = true, $enc_input_fields = true ){
|
123 |
+
return eeb_protect_emails( $content, $method, $enc_mailtos, $enc_plain_emails, $enc_input_fields );
|
124 |
+
}
|
125 |
+
}
|
126 |
+
if (!function_exists('eeb_protect_emails')):
|
127 |
+
function eeb_protect_emails( $content, $method = null, $enc_mailtos = true, $enc_plain_emails = true, $enc_input_fields = true ) {
|
128 |
+
|
129 |
+
//backwards compatibility for enc tags
|
130 |
+
if( $method === null || is_bool( $method ) ){
|
131 |
+
$protect_using = (string) EEB()->settings->get_setting( 'protect_using', true );
|
132 |
+
} else {
|
133 |
+
$protect_using = sanitize_title( $method );
|
134 |
+
}
|
135 |
+
|
136 |
+
$content = EEB()->validate->filter_content( $content, $protect_using );
|
137 |
+
return apply_filters( 'eeb/frontend/template_func/eeb_protect_emails', $content, $protect_using );
|
138 |
+
}
|
139 |
+
endif;
|
core/includes/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php //Silence is golden
|
includes/integrations.php → core/includes/integrations/classes/mailoptin.php
RENAMED
@@ -1,10 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
if (!defined('ABSPATH')) {
|
4 |
-
die;
|
5 |
-
}
|
6 |
-
|
7 |
-
if ( ! class_exists( 'MO_Admin_Notice' ) && is_admin() ) {
|
8 |
class MO_Admin_Notice {
|
9 |
public function __construct() {
|
10 |
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
@@ -22,7 +17,7 @@ if ( ! class_exists( 'MO_Admin_Notice' ) && is_admin() ) {
|
|
22 |
}
|
23 |
public function admin_notice() {
|
24 |
global $pagenow;
|
25 |
-
if($pagenow == 'index.php' || (isset($_GET['page']) && strpos($_GET['page'],
|
26 |
if (get_option('mo_dismiss_adnotice', 'false') == 'true') {
|
27 |
return;
|
28 |
}
|
@@ -148,6 +143,5 @@ if ( ! class_exists( 'MO_Admin_Notice' ) && is_admin() ) {
|
|
148 |
return $instance;
|
149 |
}
|
150 |
}
|
151 |
-
|
152 |
MO_Admin_Notice::instance();
|
153 |
}
|
1 |
<?php
|
2 |
+
if ( ! class_exists( 'MO_Admin_Notice' ) ) {
|
|
|
|
|
|
|
|
|
|
|
3 |
class MO_Admin_Notice {
|
4 |
public function __construct() {
|
5 |
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
17 |
}
|
18 |
public function admin_notice() {
|
19 |
global $pagenow;
|
20 |
+
if($pagenow == 'index.php' || (isset($_GET['page']) && strpos($_GET['page'], 'email-encoder-bundle-option-page') !== false)) {
|
21 |
if (get_option('mo_dismiss_adnotice', 'false') == 'true') {
|
22 |
return;
|
23 |
}
|
143 |
return $instance;
|
144 |
}
|
145 |
}
|
|
|
146 |
MO_Admin_Notice::instance();
|
147 |
}
|
core/includes/integrations/loader.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Load our custom marketing integrations
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly.
|
9 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
class EEB_Integrations_Loader{
|
12 |
+
|
13 |
+
function __construct(){
|
14 |
+
$this->load_integrations();
|
15 |
+
}
|
16 |
+
|
17 |
+
public function load_integrations(){
|
18 |
+
|
19 |
+
$plugins = array(
|
20 |
+
'mailoptin' => 'mailoptin.php',
|
21 |
+
);
|
22 |
+
$disable_marketing = (bool) EEB()->settings->get_setting( 'disable_marketing', true );
|
23 |
+
|
24 |
+
$filter_integrations = true;
|
25 |
+
if( $disable_marketing ){
|
26 |
+
$filter_integrations = false;
|
27 |
+
}
|
28 |
+
|
29 |
+
foreach ( $plugins as $plugin_id => $plugin_file ) :
|
30 |
+
|
31 |
+
$plugin_file = 'classes/' . $plugin_file;
|
32 |
+
$full_path = EEB_PLUGIN_DIR . 'core/includes/integrations/' . $plugin_file;
|
33 |
+
|
34 |
+
if ( TRUE === apply_filters( 'eeb/integrations/' . $plugin_id, $filter_integrations ) ){
|
35 |
+
if( file_exists( $full_path ) ){
|
36 |
+
include( $plugin_file );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
endforeach;
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
core/includes/partials/eeb-page-display.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main Template
|
4 |
+
*/
|
5 |
+
|
6 |
+
$currentScreen = get_current_screen();
|
7 |
+
$columnCount = (1 == $currentScreen->get_columns()) ? 1 : 2;
|
8 |
+
$mulsitie_slug = ( is_multisite() ) ? 'network/' : '';
|
9 |
+
|
10 |
+
?>
|
11 |
+
|
12 |
+
<div class="wrap">
|
13 |
+
<h1><?php echo get_admin_page_title() ?></h1>
|
14 |
+
|
15 |
+
<?php if( ! empty( $this->display_notices ) ) : ?>
|
16 |
+
<div class="eeb-admin-notices">
|
17 |
+
<?php foreach( $this->display_notices as $single_notice ) : ?>
|
18 |
+
<?php echo $single_notice; ?>
|
19 |
+
<?php endforeach; ?>
|
20 |
+
</div>
|
21 |
+
<?php endif; ?>
|
22 |
+
|
23 |
+
<form method="post" action="">
|
24 |
+
<?php settings_fields( $this->page_name ); ?>
|
25 |
+
|
26 |
+
<input type="hidden" name="<?php echo $this->page_name; ?>_nonce" value="<?php echo wp_create_nonce( $this->page_name ) ?>">
|
27 |
+
|
28 |
+
<div id="poststuff">
|
29 |
+
<div id="post-body" class="metabox-holder columns-<?php echo $columnCount; ?>">
|
30 |
+
<?php include( 'widgets/main.php' ); ?>
|
31 |
+
|
32 |
+
<div id="postbox-container-1" class="postbox-container">
|
33 |
+
<?php include( 'widgets/sidebar.php' ); ?>
|
34 |
+
</div>
|
35 |
+
|
36 |
+
<div id="postbox-container-2" class="postbox-container">
|
37 |
+
<?php do_meta_boxes('', 'normal', ''); ?>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</form>
|
42 |
+
</div>
|
core/includes/partials/help-tabs/general.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $pluginData = get_plugin_data( EEB_PLUGIN_FILE ); ?>
|
2 |
+
<h3><i class="dashicons-before dashicons-email"></i> <?php echo $pluginData['Name'] ?> - v<?php echo $pluginData['Version']; ?></h3>
|
3 |
+
<p>
|
4 |
+
<?php echo EEB()->helpers->translate( 'The plugin works out-of-the-box to protect your email addresses. All settings are default set to protect your email addresses automatically.', 'help_tab-general' ); ?>
|
5 |
+
</p>
|
6 |
+
<p>
|
7 |
+
<?php echo EEB()->helpers->translate( 'To report problems or bugs or for support, please use <a href="https://wordpress.org/support/plugin/email-encoder-bundle#postform" target="_new">the official forum</a>.', 'help_tab-general' ); ?>
|
8 |
+
</p>
|
9 |
+
<p>
|
10 |
+
<?php echo EEB()->helpers->translate( 'You can now also check your website protection using our email checker tool: <a href="https://ironikus.com/email-checker/" target="_blank">https://ironikus.com/email-checker/</a>.', 'help_tab-general' ); ?>
|
11 |
+
</p>
|
12 |
+
<p>
|
13 |
+
Visit us at <a href="https://ironikus.com" target="_blank" title="Visit us at https://ironikus.com" >https://ironikus.com</a>
|
14 |
+
<i class="dashicons-before dashicons-universal-access"></i>
|
15 |
+
</p>
|
core/includes/partials/help-tabs/shortcodes.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h3><?php echo EEB()->helpers->translate( 'Shortcodes', 'help_tab-shortcodes' ); ?></h3>
|
2 |
+
<p><?php echo EEB()->helpers->translate( 'You can protect those addresses using the following shortcode. Everything you add within these both tags, will be checked for emails automatically.', 'help_tab-shortcodes' ); ?></p>
|
3 |
+
<p><code>[eeb_protect_emails protect_using="with_javascript"]…[/eeb_protect_emails]</code>
|
4 |
+
</p>
|
5 |
+
<p><?php echo EEB()->helpers->translate( 'Create a protected mailto link:', 'help_tab-shortcodes' ); ?></p>
|
6 |
+
<p><code>[eeb_mailto email="info@myemail.com" extra_attrs="target='_blank'" method="rot13" display="Custom Text"]</code>
|
7 |
+
</p>
|
8 |
+
<p><?php echo EEB()->helpers->translate( 'You can also protect phone numbers and any kind of text by using the following shortcode:', 'help_tab-shortcodes' ); ?></p>
|
9 |
+
<h4><code>[eeb_protect_content protection_text="I am a noscript text" method="rot13"]My Email[/eeb_protect_content]</code></h4>
|
10 |
+
<p><?php echo EEB()->helpers->translate( 'Display the encoder form', 'help_tab-shortcodes' ); ?></p>
|
11 |
+
<p><code>[eeb_form]</code>
|
12 |
+
</p>
|
core/includes/partials/help-tabs/template-tags.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h3><?php echo EEB()->helpers->translate( 'Template functions', 'help_tab-template-tags' ); ?></h3>
|
2 |
+
|
3 |
+
<h4><code>eeb_mailto( $email [, $display] [, $attrs] [, $method] )</code></h4>
|
4 |
+
<p><?php echo EEB()->helpers->translate( 'Create a protected mailto link:', 'help_tab-template-tags' ); ?></p>
|
5 |
+
<pre><code><?php
|
6 |
+
if (function_exists('eeb_mailto')) {
|
7 |
+
echo eeb_mailto('info@somedomain.com', 'Mail Me');
|
8 |
+
}
|
9 |
+
?></code></pre>
|
10 |
+
<p><?php echo EEB()->helpers->translate( 'You can pass 3 optional arguments: <code>$display</code>, <code>$attrs</code> and <code>$method</code>', 'help_tab-template-tags' ); ?></p>
|
11 |
+
<br><br>
|
12 |
+
<h4><code>eeb_form()</code></h4>
|
13 |
+
<p><?php echo EEB()->helpers->translate( 'Get Email Encoder Form', 'help_tab-template-tags' ); ?></p>
|
14 |
+
<pre><code><?php
|
15 |
+
if (function_exists('eeb_form')) {
|
16 |
+
echo eeb_form();
|
17 |
+
}
|
18 |
+
?></code></pre>
|
19 |
+
<p><?php echo EEB()->helpers->translate( 'This will output the email encoder form on your website.', 'help_tab-template-tags' ); ?></p>
|
20 |
+
<br><br>
|
21 |
+
<h4><code>eeb_protect_content( $content )</code></h4>
|
22 |
+
<p><?php echo EEB()->helpers->translate( 'Protects the given content against spambots.', 'help_tab-template-tags' ); ?></p>
|
23 |
+
<pre><code><?php
|
24 |
+
if (function_exists('eeb_protect_content')) {
|
25 |
+
echo eeb_protect_content('+12 345 678');
|
26 |
+
}
|
27 |
+
?></code></pre>
|
28 |
+
<br><br>
|
29 |
+
<h4><code>eeb_protect_emails( $content )</code></h4>
|
30 |
+
<p><?php echo EEB()->helpers->translate( 'Protects the given content against spambots.', 'help_tab-template-tags' ); ?></p>
|
31 |
+
<pre><code><?php
|
32 |
+
if (function_exists('eeb_protect_emails')) {
|
33 |
+
echo eeb_protect_emails('You can parse any kind of text or html in here. All emails like test@test.test will be encoded depending on your plugin settings.');
|
34 |
+
}
|
35 |
+
?></code></pre>
|
core/includes/partials/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php //Silence is golden
|
core/includes/partials/widgets/main.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$settings = EEB()->settings->get_setting();
|
4 |
+
$advanced_settings = (bool) EEB()->settings->get_setting( 'advanced_settings', true );
|
5 |
+
|
6 |
+
?>
|
7 |
+
<div id="post-body-content">
|
8 |
+
<div class="postbox">
|
9 |
+
<div class="inside">
|
10 |
+
<fieldset>
|
11 |
+
<table class="form-table">
|
12 |
+
<?php foreach( $settings as $setting_name => $setting ) :
|
13 |
+
$hide_main_layer = '';
|
14 |
+
|
15 |
+
if( ! $advanced_settings && isset( $setting['advanced'] ) && $setting['advanced'] === true ){
|
16 |
+
$hide_main_layer = 'style="display:none !important;"';
|
17 |
+
}
|
18 |
+
|
19 |
+
//Validate settings value
|
20 |
+
$main_settings_value = '';
|
21 |
+
if( isset( $setting['value'] ) ){
|
22 |
+
$main_settings_value = $setting['value'];
|
23 |
+
}
|
24 |
+
|
25 |
+
$is_checked = ( $setting['type'] == 'checkbox' && ( $main_settings_value === 1 || $main_settings_value === '1' ) ) ? 'checked' : '';
|
26 |
+
$value = ( $setting['type'] != 'checkbox' && $setting['type'] != 'multi-input' ) ? $main_settings_value : '1';
|
27 |
+
|
28 |
+
?>
|
29 |
+
<tr valign="top" <?php echo $hide_main_layer; ?>>
|
30 |
+
<th scope="row">
|
31 |
+
<?php echo $setting['title']; ?>
|
32 |
+
</th>
|
33 |
+
<td scope="row" valign="top">
|
34 |
+
<p>
|
35 |
+
<?php if( $setting['type'] === 'multi-input' ) : ?>
|
36 |
+
<?php foreach( $setting['inputs'] as $si_key => $data ) :
|
37 |
+
$hide_sub_layer = '';
|
38 |
+
|
39 |
+
if( ! $advanced_settings && isset( $data['advanced'] ) && $data['advanced'] === true ){
|
40 |
+
$hide_sub_layer = 'style="display:none !important;"';
|
41 |
+
}
|
42 |
+
|
43 |
+
//Always set the radio value of single inputs to their key
|
44 |
+
if( $setting['input-type'] === 'radio' ){
|
45 |
+
$data['value'] = $si_key;
|
46 |
+
}
|
47 |
+
|
48 |
+
$mi_is_checked = ( $setting['input-type'] == 'checkbox' && ( isset( $data['value'] ) && ( $data['value'] === 1 || $data['value'] === '1' ) ) ) ? 'checked' : '';
|
49 |
+
$mi_value = ( $setting['input-type'] != 'checkbox' ) ? $data['value'] : '1';
|
50 |
+
$si_name = $si_key;
|
51 |
+
|
52 |
+
//Re-validate for radio inputs
|
53 |
+
if( $setting['input-type'] == 'radio' ){
|
54 |
+
$si_name = $setting_name;
|
55 |
+
|
56 |
+
//Check radio button
|
57 |
+
if( (string) $main_settings_value === (string) $data['value'] ){
|
58 |
+
$mi_is_checked = 'checked';
|
59 |
+
}
|
60 |
+
}
|
61 |
+
?>
|
62 |
+
<p <?php echo $hide_sub_layer; ?>>
|
63 |
+
<input id="<?php echo $si_name . '_' . $si_key; ?>" name="<?php echo $this->settings_key; ?>[<?php echo $si_name; ?>]" type="<?php echo $setting['input-type']; ?>" class="regular-text" value="<?php echo $mi_value; ?>" <?php echo $mi_is_checked; ?> />
|
64 |
+
<label for="<?php echo $si_name . '_' . $si_key; ?>">
|
65 |
+
<?php echo $data['label']; ?>
|
66 |
+
</label>
|
67 |
+
</p>
|
68 |
+
<?php if( isset( $data['description'] ) ) : ?>
|
69 |
+
<p class="description" <?php echo $hide_sub_layer; ?>>
|
70 |
+
<?php if( in_array( $setting['input-type'], array( 'checkbox', 'radio' ) ) ) : ?>
|
71 |
+
<input name="email-encoder-bundle-hidden-margin" type="radio" class="regular-text" value="" style="visibility:hidden !important;pointer-events:none !important;"/>
|
72 |
+
<?php endif; ?>
|
73 |
+
<?php echo $data['description']; ?>
|
74 |
+
</p>
|
75 |
+
<?php endif; ?>
|
76 |
+
<?php endforeach; ?>
|
77 |
+
<?php else : ?>
|
78 |
+
<input id="<?php echo $setting['id']; ?>" name="<?php echo $this->settings_key; ?>[<?php echo $setting_name; ?>]" type="<?php echo $setting['type']; ?>" class="regular-text" value="<?php echo $value; ?>" <?php echo $is_checked; ?> />
|
79 |
+
<?php if( isset( $setting['label'] ) ) : ?>
|
80 |
+
<label for="<?php echo $setting_name; ?>">
|
81 |
+
<?php echo $setting['label']; ?>
|
82 |
+
</label>
|
83 |
+
<?php endif; ?>
|
84 |
+
<?php endif; ?>
|
85 |
+
</p>
|
86 |
+
<?php if( isset( $setting['description'] ) ) : ?>
|
87 |
+
<p class="description">
|
88 |
+
<?php echo $setting['description']; ?>
|
89 |
+
</p>
|
90 |
+
<?php endif; ?>
|
91 |
+
</td>
|
92 |
+
<td>
|
93 |
+
|
94 |
+
</td>
|
95 |
+
</tr>
|
96 |
+
<?php endforeach; ?>
|
97 |
+
</table>
|
98 |
+
</fieldset>
|
99 |
+
|
100 |
+
<p>
|
101 |
+
<?php submit_button( EEB()->helpers->translate( 'Save all', 'admin-settings' ) ); ?>
|
102 |
+
</p>
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
</div>
|
core/includes/partials/widgets/sidebar.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="support" class="postbox">
|
2 |
+
<div class="inside">
|
3 |
+
<ul>
|
4 |
+
<li>
|
5 |
+
<a href="https://ironikus.com/docs/article-categories/email-encoder-bundle/" target="_blank">
|
6 |
+
<i class="dashicons-before dashicons-media-text"></i>
|
7 |
+
Documentation </a>
|
8 |
+
</li>
|
9 |
+
<li>
|
10 |
+
<a href="http://wordpress.org/support/plugin/email-encoder-bundle#postform" target="_blank">
|
11 |
+
<i class="dashicons-before dashicons-welcome-comments"></i>
|
12 |
+
Report a problem </a>
|
13 |
+
</li>
|
14 |
+
<li>
|
15 |
+
<a href="http://wordpress.org/extend/plugins/email-encoder-bundle/faq/" target="_blank">
|
16 |
+
<i class="dashicons-before dashicons-editor-help"></i>
|
17 |
+
FAQ </a>
|
18 |
+
</li>
|
19 |
+
</ul>
|
20 |
+
|
21 |
+
<hr>
|
22 |
+
<p>
|
23 |
+
<a href="http://wordpress.org/support/view/plugin-reviews/email-encoder-bundle" target="_blank">
|
24 |
+
<i class="dashicons-before dashicons-thumbs-up"></i>
|
25 |
+
<strong>Rate the plugin!</strong>
|
26 |
+
</a>
|
27 |
+
</p>
|
28 |
+
|
29 |
+
<hr>
|
30 |
+
<h4>Other plugins by Ironikus</h4>
|
31 |
+
<ul id="other_plugins">
|
32 |
+
<li>
|
33 |
+
<h4><img src="<?php echo plugins_url('core/includes/assets/img/icon-wp-webhooks.png', EEB_PLUGIN_FILE) ?>"> WP Webhooks</h4>
|
34 |
+
<p>If you love to automate things, this is for you! WP Webhooks allows you to recieve and send data on your WordPress website from any third party service out there.
|
35 |
+
<br /><a href="<?php echo admin_url( $mulsitie_slug . 'plugin-install.php?s=WP+Webhooks&tab=search&type=term'); ?>" target="_blank">Install now for free</a> | <a href="https://wordpress.org/plugins/wp-webhooks/" title="Go to WordPress.org" target="_blank">More info</a>
|
36 |
+
</p>
|
37 |
+
</li>
|
38 |
+
<li>
|
39 |
+
<h4><img src="<?php echo plugins_url('core/includes/assets/img/icon-wp-snow.png', EEB_PLUGIN_FILE) ?>"> WP Snow</h4>
|
40 |
+
<p>Make your website something special with this awesome flakes animation plugin. Make snowflakes, falling snowmans, custom text or any other of the 1300+ icons glide over your website.
|
41 |
+
<br /><a href="<?php echo admin_url( $mulsitie_slug . 'plugin-install.php?s=WP+Snow+–+Best+Snow+Effect+Plugin+&tab=search&type=term'); ?>" target="_blank">Install now for free</a> | <a href="https://wordpress.org/plugins/wp-snow/" title="Go to WordPress.org" target="_blank">More info</a>
|
42 |
+
</p>
|
43 |
+
</li>
|
44 |
+
|
45 |
+
</ul>
|
46 |
+
</div>
|
47 |
+
</div>
|
core/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php //Silence is golden
|
email-encoder-bundle.php
CHANGED
@@ -1,75 +1,60 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
Plugin Name: Email Encoder - Protect Email
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
Author URI: https://ironikus.com/
|
9 |
-
License: Dual licensed under the MIT and GPL licenses
|
10 |
-
Text Domain: email-encoder-bundle
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
//
|
19 |
-
if (!defined('
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
if (version_compare($wp_version, '3.6', '>=') && version_compare(phpversion(), '5.2.4', '>=')) {
|
32 |
-
|
33 |
-
// include classes
|
34 |
-
require_once('includes/class-eeb-admin.php');
|
35 |
-
require_once('includes/class-eeb-site.php');
|
36 |
-
require_once('includes/template-functions.php');
|
37 |
-
require_once('includes/integrations.php');
|
38 |
-
|
39 |
-
// create instance
|
40 |
-
$Eeb_Site = Eeb_Site::getInstance();
|
41 |
-
|
42 |
-
// handle AJAX request
|
43 |
-
// input vars
|
44 |
-
if (!empty($_POST['eebActionEncodeEmail'])) {
|
45 |
-
$eebActionEncodeEmail = sanitize_text_field($_POST['eebActionEncodeEmail']);
|
46 |
-
$method = sanitize_text_field($_POST['eebMethod']);
|
47 |
-
$email = sanitize_email($_POST['eebEmail']);
|
48 |
-
$display = wp_kses_post($_POST['eebDisplay']);
|
49 |
-
|
50 |
-
if (empty($display)) {
|
51 |
-
$display = $email;
|
52 |
-
}
|
53 |
-
|
54 |
-
echo $Eeb_Site->encode_email($email, $display, '', $method, true);
|
55 |
-
exit;
|
56 |
-
}
|
57 |
-
|
58 |
-
} else {
|
59 |
-
|
60 |
-
// set error message
|
61 |
-
if (!function_exists('eeb_error_notice')):
|
62 |
-
function eeb_error_notice() {
|
63 |
-
$plugin_title = get_admin_page_title();
|
64 |
-
|
65 |
-
echo '<div class="error">'
|
66 |
-
. sprintf(__('<p>Warning - The plugin <strong>%s</strong> requires PHP 5.2.4+ and WP 3.6+. Please upgrade your PHP and/or WordPress.'
|
67 |
-
. '<br/>Disable the plugin to remove this message.</p>'
|
68 |
-
, 'email-encoder-bundle'), $plugin_title)
|
69 |
-
. '</div>';
|
70 |
-
}
|
71 |
-
|
72 |
-
add_action('admin_notices', 'eeb_error_notice');
|
73 |
-
endif;
|
74 |
-
|
75 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Email Encoder - Protect Email Addresses
|
4 |
+
* Version: 2.0.0
|
5 |
+
* Plugin URI: https://wordpress.org/plugins/email-encoder-bundle/
|
6 |
+
* Description: Protect email addresses on your site and hide them from spambots. Easy to use & flexible.
|
7 |
+
* Author: Ironikus
|
8 |
+
* Author URI: https://ironikus.com/
|
9 |
+
* License: Dual licensed under the MIT and GPL licenses
|
10 |
+
* Text Domain: email-encoder-bundle
|
11 |
+
*
|
12 |
+
* License: GPL2
|
13 |
+
*
|
14 |
+
* You should have received a copy of the GNU General Public License
|
15 |
+
* along with TMG User Filter. If not, see <http://www.gnu.org/licenses/>.
|
16 |
+
*/
|
17 |
+
|
18 |
+
// Exit if accessed directly.
|
19 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
20 |
+
|
21 |
+
// Plugin name.
|
22 |
+
define( 'EEB_NAME', 'Email Encoder' );
|
23 |
+
|
24 |
+
// Plugin version.
|
25 |
+
define( 'EEB_VERSION', '2.0.0' );
|
26 |
+
|
27 |
+
// Determines if the plugin is loaded
|
28 |
+
define( 'EEB_SETUP', true );
|
29 |
+
|
30 |
+
// Plugin Root File.
|
31 |
+
define( 'EEB_PLUGIN_FILE', __FILE__ );
|
32 |
+
|
33 |
+
// Plugin base.
|
34 |
+
define( 'EEB_PLUGIN_BASE', plugin_basename( EEB_PLUGIN_FILE ) );
|
35 |
+
|
36 |
+
// Plugin Folder Path.
|
37 |
+
define( 'EEB_PLUGIN_DIR', plugin_dir_path( EEB_PLUGIN_FILE ) );
|
38 |
+
|
39 |
+
// Plugin Folder URL.
|
40 |
+
define( 'EEB_PLUGIN_URL', plugin_dir_url( EEB_PLUGIN_FILE ) );
|
41 |
+
|
42 |
+
// Plugin Root File.
|
43 |
+
define( 'EEB_TEXTDOMAIN', 'email-encoder-bundle' );
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Load the main instance for our core functions
|
47 |
+
*/
|
48 |
+
require_once EEB_PLUGIN_DIR . 'core/class-email-encoder-bundle.php';
|
49 |
+
|
50 |
+
/**
|
51 |
+
* The main function to load the only instance
|
52 |
+
* of our master class.
|
53 |
+
*
|
54 |
+
* @return object|Email_Encoder
|
55 |
+
*/
|
56 |
+
function EEB() {
|
57 |
+
return Email_Encoder::instance();
|
58 |
}
|
59 |
|
60 |
+
EEB();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-eeb-admin.php
DELETED
@@ -1,851 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Eeb_Admin
|
4 |
-
*
|
5 |
-
* Contains all code necessary for the Admin part
|
6 |
-
*
|
7 |
-
* @abstract
|
8 |
-
*
|
9 |
-
* @package Email_Encoder_Bundle
|
10 |
-
* @category WordPress Plugins
|
11 |
-
*/
|
12 |
-
|
13 |
-
// this is an include only WP file
|
14 |
-
if (!defined('ABSPATH')) {
|
15 |
-
die;
|
16 |
-
}
|
17 |
-
|
18 |
-
if (!class_exists('Eeb_Admin')):
|
19 |
-
|
20 |
-
abstract class Eeb_Admin {
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var array
|
24 |
-
*/
|
25 |
-
private $default_options = array(
|
26 |
-
'method' => 'enc_ascii',
|
27 |
-
'encode_mailtos' => 1,
|
28 |
-
'encode_emails' => 0,
|
29 |
-
'encode_fields' => 1,
|
30 |
-
'filter_posts' => 1,
|
31 |
-
'filter_widgets' => 1,
|
32 |
-
'filter_comments' => 1,
|
33 |
-
'skip_posts' => '',
|
34 |
-
'protection_text' => '*protected email*',
|
35 |
-
'protection_text_content' => '*protected content*',
|
36 |
-
'class_name' => 'mailto-link',
|
37 |
-
'filter_rss' => 1,
|
38 |
-
'remove_shortcodes_rss' => 1,
|
39 |
-
'protection_text_rss' => '*protected email*',
|
40 |
-
'widget_logic_filter' => 0,
|
41 |
-
'show_encoded_check' => 0,
|
42 |
-
'shortcodes_in_widgets' => 0,
|
43 |
-
'support_deprecated_names' => 0,
|
44 |
-
'own_admin_menu' => 1,
|
45 |
-
'powered_by' => 1,
|
46 |
-
);
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @var array
|
50 |
-
*/
|
51 |
-
protected $options = array();
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @var array
|
55 |
-
*/
|
56 |
-
protected $skip_posts = array();
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @var string
|
60 |
-
*/
|
61 |
-
protected $method = 'enc_ascii';
|
62 |
-
|
63 |
-
/**
|
64 |
-
* @var array
|
65 |
-
*/
|
66 |
-
private $methods = array();
|
67 |
-
|
68 |
-
/**
|
69 |
-
* @var boolean
|
70 |
-
*/
|
71 |
-
private $initial_metabox_settings = false;
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Constructor
|
75 |
-
*/
|
76 |
-
protected function __construct() {
|
77 |
-
// load text domain for translations
|
78 |
-
load_plugin_textdomain('email-encoder-bundle', false, dirname(plugin_basename(EMAIL_ENCODER_BUNDLE_FILE)) . '/languages/');
|
79 |
-
|
80 |
-
// set methods
|
81 |
-
$this->methods = array(
|
82 |
-
'enc_ascii' => array(
|
83 |
-
'name' => __('JS Rot13', 'email-encoder-bundle'),
|
84 |
-
'description' => __('Recommended, the safest method using a rot13 method in JavaScript', 'email-encoder-bundle'),
|
85 |
-
),
|
86 |
-
'enc_escape' => array(
|
87 |
-
'name' => __('JS Escape', 'email-encoder-bundle'),
|
88 |
-
'description' => __('Pretty safe method using JavaScipt\'s escape function', 'email-encoder-bundle'),
|
89 |
-
),
|
90 |
-
'enc_html' => array(
|
91 |
-
'name' => __('Html Encode', 'email-encoder-bundle'),
|
92 |
-
'description' => __('Not recommended, equal to <a href="http://codex.wordpress.org/Function_Reference/antispambot" target="_blank"><code>antispambot()</code></a> function of WordPress', 'email-encoder-bundle'),
|
93 |
-
),
|
94 |
-
);
|
95 |
-
|
96 |
-
// set option values
|
97 |
-
$this->set_options();
|
98 |
-
|
99 |
-
// prepare vars
|
100 |
-
$skip_posts = $this->options['skip_posts'];
|
101 |
-
$skip_posts = str_replace(' ', '', $skip_posts);
|
102 |
-
$skip_posts = explode(',', $skip_posts);
|
103 |
-
$this->skip_posts = $skip_posts;
|
104 |
-
|
105 |
-
// set uninstall hook
|
106 |
-
register_uninstall_hook(EMAIL_ENCODER_BUNDLE_FILE, array('Eeb_Admin', 'uninstall'));
|
107 |
-
|
108 |
-
// add actions
|
109 |
-
add_action('wp', array($this, 'wp'));
|
110 |
-
add_action('admin_init', array($this, 'admin_init'));
|
111 |
-
add_action('admin_menu', array($this, 'admin_menu'));
|
112 |
-
add_action('admin_footer_text', array($this, 'admin_footer_text'));
|
113 |
-
// todo
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Set options from save values or defaults
|
118 |
-
*/
|
119 |
-
private function set_options() {
|
120 |
-
// first set defaults
|
121 |
-
$this->options = $this->default_options;
|
122 |
-
|
123 |
-
// get saved options
|
124 |
-
$saved_options = get_option(EMAIL_ENCODER_BUNDLE_OPTIONS_NAME);
|
125 |
-
|
126 |
-
// backwards compatible (old values)
|
127 |
-
if (empty($saved_options)) {
|
128 |
-
// check old values
|
129 |
-
$saved_options = get_option(EMAIL_ENCODER_BUNDLE_KEY . 'options');
|
130 |
-
|
131 |
-
// cleanup old values
|
132 |
-
delete_option(EMAIL_ENCODER_BUNDLE_KEY . 'options');
|
133 |
-
} else {
|
134 |
-
foreach ($saved_options AS $key => $value) {
|
135 |
-
$this->options[$key] = $value;
|
136 |
-
}
|
137 |
-
}
|
138 |
-
|
139 |
-
// @todo Update current version value
|
140 |
-
// $version = get_option('eeb_version');
|
141 |
-
// if ($version !== EMAIL_ENCODER_BUNDLE_VERSION) {
|
142 |
-
// update_option('eeb_version', $version);
|
143 |
-
// delete_option('eeb_version');
|
144 |
-
//
|
145 |
-
// // on first time loading
|
146 |
-
// $this->initial_metabox_settings = true;
|
147 |
-
// }
|
148 |
-
|
149 |
-
// set encode method
|
150 |
-
$this->method = $this->get_method($this->options['method'], 'enc_ascii');
|
151 |
-
|
152 |
-
// set widget_content filter of Widget Logic plugin
|
153 |
-
$widget_logic_opts = get_option('widget_logic');
|
154 |
-
if (is_array($widget_logic_opts) && key_exists('widget_logic-options-filter', $widget_logic_opts)) {
|
155 |
-
$this->options['widget_logic_filter'] = ($widget_logic_opts['widget_logic-options-filter'] == 'checked') ? 1 : 0;
|
156 |
-
}
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Get method name
|
161 |
-
* @param string $method
|
162 |
-
* @param string $defaultMethod Optional, default 'enc_html'
|
163 |
-
* @return string
|
164 |
-
*/
|
165 |
-
protected function get_method($method, $defaultMethod = 'enc_html') {
|
166 |
-
$method = strtolower($method);
|
167 |
-
|
168 |
-
if (!method_exists($this, $method)) {
|
169 |
-
$method = $defaultMethod; // set default method
|
170 |
-
}
|
171 |
-
|
172 |
-
return $method;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Callback Uninstall
|
177 |
-
*/
|
178 |
-
static public function uninstall() {
|
179 |
-
delete_option(EMAIL_ENCODER_BUNDLE_OPTIONS_NAME);
|
180 |
-
unregister_setting(EMAIL_ENCODER_BUNDLE_KEY, EMAIL_ENCODER_BUNDLE_OPTIONS_NAME);
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* Callbacka admin_init
|
185 |
-
*/
|
186 |
-
public function admin_init() {
|
187 |
-
// register settings
|
188 |
-
register_setting(EMAIL_ENCODER_BUNDLE_KEY, EMAIL_ENCODER_BUNDLE_OPTIONS_NAME);
|
189 |
-
|
190 |
-
// actions and filters
|
191 |
-
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Callback add links on plugin page
|
196 |
-
* @param array $links
|
197 |
-
* @param string $file
|
198 |
-
* @return array
|
199 |
-
*/
|
200 |
-
public function plugin_action_links($links, $file) {
|
201 |
-
if ($file == plugin_basename(EMAIL_ENCODER_BUNDLE_FILE)) {
|
202 |
-
$page = ($this->options['own_admin_menu']) ? 'admin.php' : 'options-general.php';
|
203 |
-
$settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/' . $page . '?page=' . EMAIL_ENCODER_BUNDLE_ADMIN_PAGE . '">' . __('Settings', 'email-encoder-bundle') . '</a>';
|
204 |
-
array_unshift($links, $settings_link);
|
205 |
-
}
|
206 |
-
|
207 |
-
return $links;
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Callback admin_menu
|
212 |
-
*/
|
213 |
-
public function admin_menu() {
|
214 |
-
// add page and menu item
|
215 |
-
if ($this->options['own_admin_menu']) {
|
216 |
-
// create main menu item
|
217 |
-
$page_hook = add_menu_page(__('Email Encoder', 'email-encoder-bundle'), __('Email Encoder', 'email-encoder-bundle'),
|
218 |
-
'manage_options', EMAIL_ENCODER_BUNDLE_ADMIN_PAGE, array($this, 'show_options_page'),
|
219 |
-
plugins_url('images/icon-email-encoder-16.png', EMAIL_ENCODER_BUNDLE_FILE));
|
220 |
-
} else {
|
221 |
-
// create submenu item under "Settings"
|
222 |
-
$page_hook = add_submenu_page('options-general.php', __('Email Encoder', 'email-encoder-bundle'), __('Email Encoder', 'email-encoder-bundle'),
|
223 |
-
'manage_options', EMAIL_ENCODER_BUNDLE_ADMIN_PAGE, array($this, 'show_options_page'));
|
224 |
-
}
|
225 |
-
|
226 |
-
// load plugin page
|
227 |
-
add_action('load-' . $page_hook, array($this, 'load_options_page'));
|
228 |
-
}
|
229 |
-
|
230 |
-
/* -------------------------------------------------------------------------
|
231 |
-
* Admin Options Page
|
232 |
-
* ------------------------------------------------------------------------*/
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Add text to footer
|
236 |
-
*/
|
237 |
-
function admin_footer_text($text_org) {
|
238 |
-
if (@$_GET['page'] != 'email-encoder-bundle-settings') {
|
239 |
-
return $text_org;
|
240 |
-
}
|
241 |
-
|
242 |
-
$text = '<i><a target="_blank" href="https://wordpress.org/plugins/email-encoder-bundle/">Email Encoder</a> v' . EMAIL_ENCODER_BUNDLE_VERSION . ' by <a href="https://ironikus.com/" title="Visit our site to get more great plugins" target="_blank">Ironikus</a>.';
|
243 |
-
$text .= ' Please <a target="_blank" href="https://wordpress.org/support/plugin/email-encoder-bundle/reviews/#new-post" title="Rate the plugin">Rate the plugin ★★★★★</a>.</i> ';
|
244 |
-
|
245 |
-
return $text;
|
246 |
-
} // admin_footer_text
|
247 |
-
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Load admin options page
|
251 |
-
*/
|
252 |
-
public function load_options_page() {
|
253 |
-
// set dashboard postbox
|
254 |
-
wp_enqueue_script('dashboard');
|
255 |
-
|
256 |
-
// add script for ajax encoder
|
257 |
-
wp_enqueue_script('email_encoder', plugins_url('js/email-encoder-bundle.js', EMAIL_ENCODER_BUNDLE_FILE), array('jquery'), EMAIL_ENCODER_BUNDLE_VERSION);
|
258 |
-
wp_enqueue_script('email_encoder_admin', plugins_url('js/email-encoder-bundle-admin.js', EMAIL_ENCODER_BUNDLE_FILE), array('jquery'), EMAIL_ENCODER_BUNDLE_VERSION);
|
259 |
-
|
260 |
-
// add help tabs
|
261 |
-
$this->add_help_tabs();
|
262 |
-
|
263 |
-
// screen settings
|
264 |
-
if (function_exists('add_screen_option')) {
|
265 |
-
add_screen_option('layout_columns', array(
|
266 |
-
'max' => 2,
|
267 |
-
'default' => 2
|
268 |
-
));
|
269 |
-
}
|
270 |
-
|
271 |
-
// add meta boxes
|
272 |
-
add_meta_box('main_settings', __('Main Settings', 'email-encoder-bundle'), array($this, 'show_meta_box_content'), null, 'normal', 'core', array('main_settings'));
|
273 |
-
add_meta_box('additional_settings', __('Additional Settings', 'email-encoder-bundle'), array($this, 'show_meta_box_content'), null, 'normal', 'core', array('additional_settings'));
|
274 |
-
add_meta_box('rss_settings', __('RSS Settings', 'email-encoder-bundle'), array($this, 'show_meta_box_content'), null, 'normal', 'core', array('rss_settings'));
|
275 |
-
add_meta_box('admin_settings', __('Admin Settings', 'email-encoder-bundle'), array($this, 'show_meta_box_content'), null, 'normal', 'core', array('admin_settings'));
|
276 |
-
add_meta_box('encode_form', __('Email Encoder Form', 'email-encoder-bundle'), array($this, 'show_meta_box_content'), null, 'normal', 'core', array('encode_form'));
|
277 |
-
add_meta_box('this_plugin', __('Support', 'email-encoder-bundle'), array($this, 'show_meta_box_content'), null, 'side', 'core', array('this_plugin'));
|
278 |
-
add_meta_box('other_plugins', __('You Might Need These Plugins', 'email-encoder-bundle'), array($this, 'show_meta_box_content'), null, 'side', 'core', array('other_plugins'));
|
279 |
-
}
|
280 |
-
|
281 |
-
/**
|
282 |
-
* Show admin options page
|
283 |
-
*/
|
284 |
-
public function show_options_page() {
|
285 |
-
$this->set_options();
|
286 |
-
?>
|
287 |
-
<style>
|
288 |
-
#other_plugins img {
|
289 |
-
vertical-align: middle;
|
290 |
-
height: 24px;
|
291 |
-
width: auto;
|
292 |
-
padding: 0 5px 0 0;
|
293 |
-
}
|
294 |
-
|
295 |
-
#other_plugins h4 {
|
296 |
-
margin: 0;
|
297 |
-
padding: 0;
|
298 |
-
}
|
299 |
-
|
300 |
-
#other_plugins p {
|
301 |
-
margin: 5px 0 25px 0;
|
302 |
-
padding: 0;
|
303 |
-
}
|
304 |
-
|
305 |
-
</style>
|
306 |
-
<div class="wrap">
|
307 |
-
<h2><?php echo get_admin_page_title() ?> - <em><small><?php _e('Protect Email Addresses From Bots & Scrapers', 'email-encoder-bundle') ?></small></em></h2>
|
308 |
-
|
309 |
-
<?php if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' && $this->options['own_admin_menu']): ?>
|
310 |
-
<div class="updated settings-error" id="setting-error-settings_updated">
|
311 |
-
<p><strong><?php _e('Settings saved.' ) ?></strong></p>
|
312 |
-
</div>
|
313 |
-
<?php endif; ?>
|
314 |
-
|
315 |
-
<?php if ($this->initial_metabox_settings): ?>
|
316 |
-
<script type="text/javascript">jQuery(function($){ $('#additional_settings, #rss_settings, #admin_settings, #encode_form').addClass('closed'); });</script>
|
317 |
-
<?php endif; ?>
|
318 |
-
|
319 |
-
<form method="post" action="options.php">
|
320 |
-
<?php settings_fields(EMAIL_ENCODER_BUNDLE_KEY); ?>
|
321 |
-
|
322 |
-
<input type="hidden" name="<?php echo EMAIL_ENCODER_BUNDLE_KEY ?>_nonce" value="<?php echo wp_create_nonce(EMAIL_ENCODER_BUNDLE_KEY) ?>" />
|
323 |
-
<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
|
324 |
-
<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
|
325 |
-
|
326 |
-
<div id="poststuff">
|
327 |
-
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
328 |
-
<!--<div id="post-body-content"></div>-->
|
329 |
-
|
330 |
-
<div id="postbox-container-1" class="postbox-container">
|
331 |
-
<?php do_meta_boxes('', 'side', ''); ?>
|
332 |
-
</div>
|
333 |
-
|
334 |
-
<div id="postbox-container-2" class="postbox-container">
|
335 |
-
<?php do_meta_boxes('', 'normal', ''); ?>
|
336 |
-
<?php do_meta_boxes('', 'advanced', ''); ?>
|
337 |
-
</div>
|
338 |
-
</div> <!-- #post-body -->
|
339 |
-
</div> <!-- #poststuff -->
|
340 |
-
</form>
|
341 |
-
</div>
|
342 |
-
<?php
|
343 |
-
}
|
344 |
-
|
345 |
-
/**
|
346 |
-
* Show content of metabox (callback)
|
347 |
-
* @param array $post
|
348 |
-
* @param array $meta_box
|
349 |
-
*/
|
350 |
-
public function show_meta_box_content($post, $meta_box) {
|
351 |
-
$key = $meta_box['args'][0];
|
352 |
-
$options = $this->options;
|
353 |
-
|
354 |
-
if ($key === 'main_settings') {
|
355 |
-
?>
|
356 |
-
<?php if (is_plugin_active('wp-mailto-links/wp-mailto-links.php')): ?>
|
357 |
-
<p class="description"><?php _e('Warning: "WP Mailto Links"-plugin is also activated, which could cause conflicts.', 'email-encoder-bundle') ?></p>
|
358 |
-
<?php endif; ?>
|
359 |
-
<fieldset class="options">
|
360 |
-
<table class="form-table">
|
361 |
-
<tr>
|
362 |
-
<th><?php _e('Choose what to protect', 'email-encoder-bundle') ?></th>
|
363 |
-
<td>
|
364 |
-
<label><input type="checkbox" id="encode_mailtos" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[encode_mailtos]" value="1" <?php checked('1', (int) $options['encode_mailtos']); ?> />
|
365 |
-
<span><?php _e('Protect mailto links, like f.e. <code><a href="info@myemail.com">My Email</a></code>', 'email-encoder-bundle') ?></span>
|
366 |
-
<br/><label><input type="checkbox" id="encode_emails" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[encode_emails]" value="1" <?php checked('1', (int) $options['encode_emails']); ?> disabled="disabled" />
|
367 |
-
<span><?php _e('Replace plain email addresses to protected mailto links', 'email-encoder-bundle') ?></span>
|
368 |
-
<!--<span class="description notice-form-field-bug"><br/><?php _e('Notice: be careful with this option when using email addresses on form fields, please <a href="http://wordpress.org/extend/plugins/email-encoder-bundle/faq/" target="_blank">check the FAQ</a> for more info.', 'email-encoder-bundle') ?></span>-->
|
369 |
-
</label>
|
370 |
-
<br/><label><input type="checkbox" id="encode_fields" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[encode_fields]" value="1" <?php checked('1', (int) $options['encode_fields']); ?> />
|
371 |
-
<span><?php _e('Replace pre-filled email addresses in input fields', 'email-encoder-bundle') ?></span>
|
372 |
-
<span class="description"><?php _e(' - recommended!', 'email-encoder-bundle') ?></span>
|
373 |
-
</label>
|
374 |
-
<br/>
|
375 |
-
</td>
|
376 |
-
</tr>
|
377 |
-
<tr>
|
378 |
-
<th><?php _e('Apply on', 'email-encoder-bundle') ?></th>
|
379 |
-
<td>
|
380 |
-
<label><input type="checkbox" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[filter_posts]" value="1" <?php checked('1', (int) $options['filter_posts']); ?> />
|
381 |
-
<span><?php _e('All posts and pages', 'email-encoder-bundle') ?></span>
|
382 |
-
</label>
|
383 |
-
<br/><label><input type="checkbox" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[filter_comments]" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[filter_comments]" value="1" <?php checked('1', (int) $options['filter_comments']); ?> />
|
384 |
-
<span><?php _e('All comments', 'email-encoder-bundle') ?></span></label>
|
385 |
-
<br/><label><input type="checkbox" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[filter_widgets]" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[filter_widgets]" value="1" <?php checked('1', (int) $options['filter_widgets']); ?> />
|
386 |
-
<span><?php if ($this->options['widget_logic_filter']) { _e('All widgets (uses the <code>widget_content</code> filter of the Widget Logic plugin)', 'email-encoder-bundle'); } else { _e('All text widgets', 'email-encoder-bundle'); } ?></span></label>
|
387 |
-
</td>
|
388 |
-
</tr>
|
389 |
-
<tr>
|
390 |
-
<th><?php _e('Add class to protected mailto links', 'email-encoder-bundle') ?></th>
|
391 |
-
<td><label><input type="text" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[class_name]" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[class_name]" value="<?php echo esc_attr($options['class_name']); ?>" />
|
392 |
-
<br/><span class="description"><?php _e('All protected mailto links will get these class(es). Optional, else keep blank.', 'email-encoder-bundle') ?></span></label></td>
|
393 |
-
</tr>
|
394 |
-
</table>
|
395 |
-
</fieldset>
|
396 |
-
|
397 |
-
<p class="submit">
|
398 |
-
<input class="button-primary" type="submit" disabled="disabled" value="<?php _e('Save Changes') ?>" />
|
399 |
-
</p>
|
400 |
-
<br class="clear" />
|
401 |
-
|
402 |
-
<?php
|
403 |
-
} else if ($key === 'rss_settings') {
|
404 |
-
?>
|
405 |
-
<fieldset class="options">
|
406 |
-
<table class="form-table">
|
407 |
-
<tr>
|
408 |
-
<th><?php _e('Protect emails in RSS feeds', 'email-encoder-bundle') ?></th>
|
409 |
-
<td><label><input type="checkbox" id="filter_rss" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[filter_rss]" value="1" <?php checked('1', (int) $options['filter_rss']); ?> />
|
410 |
-
<span><?php _e('Replace emails in RSS feeds', 'email-encoder-bundle') ?></span></label>
|
411 |
-
</td>
|
412 |
-
</tr>
|
413 |
-
<tr>
|
414 |
-
<th><?php _e('Remove shortcodes from RSS feeds', 'email-encoder-bundle') ?></th>
|
415 |
-
<td><label><input type="checkbox" id="remove_shortcodes_rss" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[remove_shortcodes_rss]" value="1" <?php checked('1', (int) $options['remove_shortcodes_rss']); ?> />
|
416 |
-
<span><?php _e('Remove all shortcodes from the RSS feeds', 'email-encoder-bundle') ?></span></label>
|
417 |
-
</td>
|
418 |
-
</tr>
|
419 |
-
<tr>
|
420 |
-
<th><?php _e('Set protection text in RSS feeds', 'email-encoder-bundle') ?></th>
|
421 |
-
<td><label><input type="text" id="protection_text" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text_rss]" value="<?php echo esc_attr($options['protection_text_rss']); ?>" />
|
422 |
-
<br/><span class="description"><?php _e('Used as replacement for email addresses in RSS feeds.', 'email-encoder-bundle') ?></span>
|
423 |
-
</label>
|
424 |
-
</td>
|
425 |
-
</tr>
|
426 |
-
</table>
|
427 |
-
</fieldset>
|
428 |
-
|
429 |
-
<p class="submit">
|
430 |
-
<input class="button-primary" type="submit" disabled="disabled" value="<?php _e('Save Changes') ?>" />
|
431 |
-
</p>
|
432 |
-
<br class="clear" />
|
433 |
-
<?php
|
434 |
-
} else if ($key === 'additional_settings') {
|
435 |
-
?>
|
436 |
-
<fieldset class="options">
|
437 |
-
<table class="form-table">
|
438 |
-
<tr>
|
439 |
-
<th><?php _e('Choose protection method', 'email-encoder-bundle') ?></th>
|
440 |
-
<td>
|
441 |
-
<?php foreach ($this->methods AS $method => $info): ?>
|
442 |
-
<label>
|
443 |
-
<input type="radio" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[method]" class="protection-method" value="<?php echo $method ?>" <?php if ($this->method == $method) echo 'checked="checked"' ?> />
|
444 |
-
<span><?php echo $info['name'] ?></span>
|
445 |
-
- <span class="description"><?php echo $info['description'] ?></span>
|
446 |
-
</label>
|
447 |
-
<br/>
|
448 |
-
<?php endforeach; ?>
|
449 |
-
</td>
|
450 |
-
</tr>
|
451 |
-
<tr>
|
452 |
-
<th><?php _e('Set <code><noscript></code> text', 'email-encoder-bundle') ?></th>
|
453 |
-
<td><label>
|
454 |
-
<span><?php _e('For encoded emails:', 'email-encoder-bundle') ?></span>
|
455 |
-
<br/><input type="text" id="protection_text" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text]" value="<?php echo esc_attr($options['protection_text']); ?>" />
|
456 |
-
</label>
|
457 |
-
<br/>
|
458 |
-
<br/>
|
459 |
-
<label>
|
460 |
-
<span><?php _e('For other encoded content:', 'email-encoder-bundle') ?></span>
|
461 |
-
<br/><input type="text" id="protection_text_content" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text_content]" value="<?php echo esc_attr($options['protection_text_content']); ?>" />
|
462 |
-
</label>
|
463 |
-
<br/>
|
464 |
-
<br/><span class="description"><?php _e('Used as <code><noscript></code> fallback for JavaScrip methods.', 'email-encoder-bundle') ?></span>
|
465 |
-
</td>
|
466 |
-
</tr>
|
467 |
-
<tr>
|
468 |
-
<th><?php _e('Exclude posts', 'email-encoder-bundle') ?></th>
|
469 |
-
<td>
|
470 |
-
<label>
|
471 |
-
<span><?php _e('Do <strong>not</strong> apply protection on posts or pages with the folllowing ID:', 'email-encoder-bundle') ?></span>
|
472 |
-
<br/><input type="text" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[skip_posts]" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[skip_posts]" value="<?php echo esc_attr($options['skip_posts']); ?>" />
|
473 |
-
<br/><span class="description"><?php _e('Seperate Id\'s by comma, f.e.: 2, 7, 13, 32.', 'email-encoder-bundle') ?></span>
|
474 |
-
<br/><span class="description"><?php _e('Notice: shortcodes still work on these posts.', 'email-encoder-bundle') ?></span>
|
475 |
-
</label>
|
476 |
-
</td>
|
477 |
-
</tr>
|
478 |
-
<tr>
|
479 |
-
<th><?php _e('Use shortcodes in widgets', 'email-encoder-bundle') ?></th>
|
480 |
-
<td>
|
481 |
-
<label><input type="checkbox" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[shortcodes_in_widgets]" value="1" <?php checked('1', (int) $options['shortcodes_in_widgets']); ?> />
|
482 |
-
<span><?php _e('Also use shortcodes in widgets', 'email-encoder-bundle') ?></span>
|
483 |
-
<br/><span class="description"><?php if (!$this->options['widget_logic_filter']) { _e('Notice: only works for text widgets!', 'email-encoder-bundle'); } else { _e('All text widgets', 'email-encoder-bundle'); } ?></span></label>
|
484 |
-
</label>
|
485 |
-
</td>
|
486 |
-
</tr>
|
487 |
-
<tr>
|
488 |
-
<th><?php _e('Use deprecated names', 'email-encoder-bundle') ?></th>
|
489 |
-
<td><label><input type="checkbox" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[support_deprecated_names]" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[support_deprecated_names]" value="1" <?php checked('1', (int) $options['support_deprecated_names']); ?> />
|
490 |
-
<span><?php _e('Keep supporting the old names for action, shortcodes and template functions', 'email-encoder-bundle') ?></span>
|
491 |
-
<br /><span class="description">These deprecated will still be available: <code>init_email_encoder_bundle</code>, <code>[encode_email]</code>, <code>[encode_content]</code>, <code>[email_encoder_form]</code>, <code>encode_email()</code>, <code>encode_content()</code>, <code>encode_email_filter()</code></span></label></td>
|
492 |
-
</tr>
|
493 |
-
</table>
|
494 |
-
</fieldset>
|
495 |
-
|
496 |
-
<p class="submit">
|
497 |
-
<input class="button-primary" type="submit" disabled="disabled" value="<?php _e('Save Changes') ?>" />
|
498 |
-
</p>
|
499 |
-
<br class="clear" />
|
500 |
-
<?php
|
501 |
-
} else if ($key === 'admin_settings') {
|
502 |
-
?>
|
503 |
-
<fieldset class="options">
|
504 |
-
<table class="form-table">
|
505 |
-
<tr>
|
506 |
-
<th><?php _e('Check "succesfully encoded"', 'email-encoder-bundle') ?></th>
|
507 |
-
<td><label><input type="checkbox" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[show_encoded_check]" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[show_encoded_check]" value="1" <?php checked('1', (int) $options['show_encoded_check']); ?> />
|
508 |
-
<span><?php _e('Show "successfully encoded" text for all encoded content, only when logged in as admin user', 'email-encoder-bundle') ?></span>
|
509 |
-
<br/><span class="description"><?php _e('This way you can check if emails are really encoded on your site.', 'email-encoder-bundle') ?></span>
|
510 |
-
</label>
|
511 |
-
</td>
|
512 |
-
</tr>
|
513 |
-
<tr>
|
514 |
-
<th><?php _e('Choose admin menu position', 'email-encoder-bundle') ?></th>
|
515 |
-
<td><label><input type="checkbox" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[own_admin_menu]" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[own_admin_menu]" value="1" <?php checked('1', (int) $options['own_admin_menu']); ?> />
|
516 |
-
<span><?php _e('Show as main menu item', 'email-encoder-bundle') ?></span>
|
517 |
-
<br /><span class="description">When disabled this page will be available under "<?php _e('Settings') ?>".</span>
|
518 |
-
</label>
|
519 |
-
</td>
|
520 |
-
</tr>
|
521 |
-
</table>
|
522 |
-
</fieldset>
|
523 |
-
|
524 |
-
<p class="submit">
|
525 |
-
<input class="button-primary" type="submit" disabled="disabled" value="<?php _e('Save Changes') ?>" />
|
526 |
-
</p>
|
527 |
-
|
528 |
-
<br class="clear" />
|
529 |
-
<?php
|
530 |
-
} else if ($key === 'encode_form') {
|
531 |
-
?>
|
532 |
-
<p><?php _e('If you like you can also create you own secure mailto links manually with this form. Just copy/paste the generated code and put it in your post, page or template.', 'email-encoder-bundle') ?></p>
|
533 |
-
|
534 |
-
<hr style="border:1px solid #FFF; border-top:1px solid #EEE;" />
|
535 |
-
|
536 |
-
<?php echo $this->get_encoder_form(); ?>
|
537 |
-
|
538 |
-
<hr style="border:1px solid #FFF; border-top:1px solid #EEE;"/>
|
539 |
-
|
540 |
-
<p class="description"><?php _e('You can also put the encoder form on your site by using the shortcode <code>[eeb_form]</code> or the template function <code>eeb_form()</code>.', 'email-encoder-bundle') ?></p>
|
541 |
-
|
542 |
-
<fieldset class="options">
|
543 |
-
<table class="form-table">
|
544 |
-
<tr>
|
545 |
-
<th><?php _e('Show "powered by"', 'email-encoder-bundle') ?></th>
|
546 |
-
<td><label><input type="checkbox" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[powered_by]" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[powered_by]" value="1" <?php checked('1', (int) $options['powered_by']); ?> />
|
547 |
-
<span><?php _e('Show a "powered by" link on bottom of the encoder form', 'email-encoder-bundle') ?></span>
|
548 |
-
</label>
|
549 |
-
</td>
|
550 |
-
</tr>
|
551 |
-
</table>
|
552 |
-
</fieldset>
|
553 |
-
|
554 |
-
<p class="submit">
|
555 |
-
<input class="button-primary" type="submit" disabled="disabled" value="<?php _e('Save Changes') ?>" />
|
556 |
-
</p>
|
557 |
-
<br class="clear" />
|
558 |
-
|
559 |
-
<?php
|
560 |
-
} else if ($key === 'this_plugin') {
|
561 |
-
?>
|
562 |
-
<ul>
|
563 |
-
<li><a href="#" class="eeb-help-link"><?php _e('Documentation', 'email-encoder-bundle') ?></a></li>
|
564 |
-
<li><a href="http://wordpress.org/support/plugin/email-encoder-bundle#postform" target="_blank"><?php _e('Report a problem', 'email-encoder-bundle') ?></a></li>
|
565 |
-
<li><a href="http://wordpress.org/support/plugin/email-encoder-bundle#postform" target="_blank"><?php _e('Get support', 'email-encoder-bundle') ?></a></li>
|
566 |
-
<li><strong><a href="http://wordpress.org/support/view/plugin-reviews/email-encoder-bundle" target="_blank"><?php _e('Rate the plugin ★★★★★', 'email-encoder-bundle') ?></a></strong></li>
|
567 |
-
</ul>
|
568 |
-
|
569 |
-
<?php
|
570 |
-
} else if ($key === 'other_plugins') {
|
571 |
-
|
572 |
-
$mulsitie_slug = ( is_multisite() ) ? 'network/' : '';
|
573 |
-
?>
|
574 |
-
<h4><img src="<?php echo plugins_url('images/icon-wp-webhooks.png', EMAIL_ENCODER_BUNDLE_FILE) ?>"> WP Webhooks</h4>
|
575 |
-
<p>If you love to automate things, this is for you! WP Webhooks allows you to recieve and send data on your WordPress website from any third party service out there.
|
576 |
-
<br /><a href="<?php echo admin_url( $mulsitie_slug . 'plugin-install.php?s=WP+Webhooks&tab=search&type=term'); ?>" target="_blank">Install now for free</a> | <a href="https://wordpress.org/plugins/wp-webhooks/" title="Go to WordPress.org" target="_blank">More info</a>
|
577 |
-
</p>
|
578 |
-
|
579 |
-
<h4><img src="<?php echo plugins_url('images/icon-wp-snow.png', EMAIL_ENCODER_BUNDLE_FILE) ?>"> WP Snow</h4>
|
580 |
-
<p>Make your website something special with this awesome flakes animation plugin. Make snowflakes, falling snowmans, custom text or any other of the 1300+ icons glide over your website.
|
581 |
-
<br /><a href="<?php echo admin_url( $mulsitie_slug . 'plugin-install.php?s=WP+Snow+–+Best+Snow+Effect+Plugin+&tab=search&type=term'); ?>" target="_blank">Install now for free</a> | <a href="https://wordpress.org/plugins/wp-snow/" title="Go to WordPress.org" target="_blank">More info</a>
|
582 |
-
</p>
|
583 |
-
<?php
|
584 |
-
}
|
585 |
-
}
|
586 |
-
|
587 |
-
/* -------------------------------------------------------------------------
|
588 |
-
* Help Tabs
|
589 |
-
* ------------------------------------------------------------------------*/
|
590 |
-
|
591 |
-
/**
|
592 |
-
* Add help tabs
|
593 |
-
*/
|
594 |
-
public function add_help_tabs() {
|
595 |
-
if (!function_exists('get_current_screen')) {
|
596 |
-
return;
|
597 |
-
}
|
598 |
-
|
599 |
-
$screen = get_current_screen();
|
600 |
-
|
601 |
-
$screen->set_help_sidebar($this->get_help_text('sidebar'));
|
602 |
-
|
603 |
-
$screen->add_help_tab(array(
|
604 |
-
'id' => 'quickstart',
|
605 |
-
'title' => __('Quick Start', 'email-encoder-bundle'),
|
606 |
-
'content' => $this->get_help_text('quickstart'),
|
607 |
-
));
|
608 |
-
$screen->add_help_tab(array(
|
609 |
-
'id' => 'shortcodes',
|
610 |
-
'title' => __('Shortcodes', 'email-encoder-bundle'),
|
611 |
-
'content' => $this->get_help_text('shortcodes'),
|
612 |
-
));
|
613 |
-
$screen->add_help_tab(array(
|
614 |
-
'id' => 'templatefunctions',
|
615 |
-
'title' => __('Template Functions', 'email-encoder-bundle'),
|
616 |
-
'content' => $this->get_help_text('templatefunctions'),
|
617 |
-
));
|
618 |
-
$screen->add_help_tab(array(
|
619 |
-
'id' => 'actions',
|
620 |
-
'title' => __('Action Hook', 'email-encoder-bundle'),
|
621 |
-
'content' => $this->get_help_text('actions'),
|
622 |
-
));
|
623 |
-
$screen->add_help_tab(array(
|
624 |
-
'id' => 'filters',
|
625 |
-
'title' => __('Filter Hooks', 'email-encoder-bundle'),
|
626 |
-
'content' => $this->get_help_text('filters'),
|
627 |
-
));
|
628 |
-
$screen->add_help_tab(array(
|
629 |
-
'id' => 'faq',
|
630 |
-
'title' => __('FAQ', 'email-encoder-bundle'),
|
631 |
-
'content' => $this->get_help_text('faq'),
|
632 |
-
));
|
633 |
-
}
|
634 |
-
|
635 |
-
/**
|
636 |
-
* Get text for given help tab
|
637 |
-
* @param string $key
|
638 |
-
* @return string
|
639 |
-
*/
|
640 |
-
private function get_help_text($key) {
|
641 |
-
if ($key === 'quickstart') {
|
642 |
-
$plugin_title = get_admin_page_title();
|
643 |
-
$icon_url = plugins_url('images/icon-email-encoder.png', EMAIL_ENCODER_BUNDLE_FILE);
|
644 |
-
$quick_start_url = plugins_url('images/quick-start.png', EMAIL_ENCODER_BUNDLE_FILE);
|
645 |
-
$version = EMAIL_ENCODER_BUNDLE_VERSION;
|
646 |
-
|
647 |
-
$content = sprintf(__('<h3><img src="%s" width="16" height="16" /> %s - version %s</h3>'
|
648 |
-
. '<p>By default, out-of-the-box all mailto links in your posts, pages, comments and (text) widgets will be encoded and protected. <br/>If you also want to encode plain email address, you have to enable that option.</p>'
|
649 |
-
. '<img src="%s" width="600" height="273" />'
|
650 |
-
, 'email-encoder-bundle'), $icon_url, $plugin_title, $version, $quick_start_url);
|
651 |
-
} else if ($key === 'shortcodes') {
|
652 |
-
$content = __('<h3>Shortcodes</h3>'
|
653 |
-
. '<p>You can use these shortcodes within your posts or pages.</p>'
|
654 |
-
. '<h4>eeb_email</h4>'
|
655 |
-
. '<p>Create an encoded mailto link:</p>'
|
656 |
-
. '<p><code>[eeb_email email="..." display="..."]</code></p>'
|
657 |
-
. '<ul>'
|
658 |
-
. '<li>"display" is optional or the email wil be shown as display (also protected)</li>'
|
659 |
-
. '<li>"extra_attrs" is optional, example: <code>extra_attrs="target=\'_blank\'"</code></li>'
|
660 |
-
. '<li>"method" is optional, else the method option will be used.</li>'
|
661 |
-
. '</ul>'
|
662 |
-
. '<h4>eeb_content</h4>'
|
663 |
-
. '<p>Encode some text:</p>'
|
664 |
-
. '<p><code>[eeb_content method="..."]...[/eeb_content]</code></p>'
|
665 |
-
. '<ul>'
|
666 |
-
. '<li>"method" is optional, else the method option will be used.</li>'
|
667 |
-
. '</ul>'
|
668 |
-
. '<h4>eeb_form</h4>'
|
669 |
-
. '<p>Create an encoder form:</p>'
|
670 |
-
. '<p><code>[eeb_form]</code></p>'
|
671 |
-
, 'email-encoder-bundle');
|
672 |
-
} else if ($key === 'templatefunctions') {
|
673 |
-
$content = __('<h3>Template Functions</h3>'
|
674 |
-
. '<h4>eeb_email()</h4>'
|
675 |
-
. '<p>Create an encoded mailto link:</p>'
|
676 |
-
. '<pre><code><?php' . "\n"
|
677 |
-
. 'if (function_exists(\'eeb_email\')) {' . "\n"
|
678 |
-
. ' echo eeb_email(\'info@somedomain.com\');' . "\n"
|
679 |
-
. '}' . "\n"
|
680 |
-
. '?></code></pre>'
|
681 |
-
. '<p>You can pass a few extra optional params (in this order): <code>display</code>, <code>extra_attrs</code>, <code>method</code></p>'
|
682 |
-
. '<h4>eeb_content()</h4>'
|
683 |
-
. '<p>Encode some text:</p>'
|
684 |
-
. '<pre><code><?php' . "\n"
|
685 |
-
. 'if (function_exists(\'eeb_content\')) {' . "\n"
|
686 |
-
. ' echo eeb_content(\'Encode this text\');' . "\n"
|
687 |
-
. '}' . "\n"
|
688 |
-
. '?></code></pre>'
|
689 |
-
. '<p>You can pas an extra optional param: <code>method</code></p>'
|
690 |
-
. '<h4>eeb_email_filter()</h4>'
|
691 |
-
. '<p>Filter given content and encode all email addresses or mailto links:</p>'
|
692 |
-
. '<pre><code><?php' . "\n"
|
693 |
-
. 'if (function_exists(\'eeb_email_filter\')) {' . "\n"
|
694 |
-
. ' echo eeb_email_filter(\'Some content with email like info@somedomein.com or a mailto link\');' . "\n"
|
695 |
-
. '}' . "\n"
|
696 |
-
. '?></code></pre>'
|
697 |
-
. '<p>You can pass a few extra optional params (in this order): <code>enc_tags</code>, <code>enc_mailtos</code>, <code>enc_plain_emails</code>, <code>enc_input_fields</code></p>'
|
698 |
-
. '<h4>eeb_form()</h4>'
|
699 |
-
. '<p>Create an encoder form:</p>'
|
700 |
-
. '<pre><code><?php' . "\n"
|
701 |
-
. 'if (function_exists(\'eeb_form\')) {' . "\n"
|
702 |
-
. ' echo eeb_form();' . "\n"
|
703 |
-
. '}' . "\n"
|
704 |
-
. '?></code></pre>'
|
705 |
-
, 'email-encoder-bundle');
|
706 |
-
} else if ($key === 'actions') {
|
707 |
-
$content = __('<h3>Action Hooks</h3>'
|
708 |
-
. '<h4>eeb_ready</h4>'
|
709 |
-
. '<p>Add extra code on initializing this plugin, like extra filters for encoding.</p>'
|
710 |
-
. '<pre><code><?php' . "\n"
|
711 |
-
. 'add_action(\'eeb_ready\', \'extra_encode_filters\');' . "\n\n"
|
712 |
-
. 'function extra_encode_filters($eeb_object) {' . "\n"
|
713 |
-
. ' add_filter(\'some_filter\', array($eeb_object, \'callback_filter\'));' . "\n"
|
714 |
-
. '}' . "\n"
|
715 |
-
. '?></code></pre>'
|
716 |
-
, 'email-encoder-bundle');
|
717 |
-
} else if ($key === 'filters') {
|
718 |
-
$content = __('<h3>Filter Hooks</h3>'
|
719 |
-
. '<h4>eeb_mailto_regexp</h4>'
|
720 |
-
. '<p>You can change the regular expression used to search for mailto links.</p>'
|
721 |
-
. '<pre><code><?php' . "\n"
|
722 |
-
. 'add_filter(\'eeb_mailto_regexp\', \'change_mailto_regexp\');' . "\n\n"
|
723 |
-
. 'function change_mailto_regexp($regexp) {' . "\n"
|
724 |
-
. ' return \'-your regular expression-\';' . "\n"
|
725 |
-
. '}' . "\n"
|
726 |
-
. '?></code></pre>'
|
727 |
-
. '<h4>eeb_email_regexp</h4>'
|
728 |
-
. '<p>You can change the regular expression used to search for mailto links.</p>'
|
729 |
-
. '<pre><code><?php' . "\n"
|
730 |
-
. 'add_filter(\'eeb_email_regexp\', \'change_email_regexp\');' . "\n\n"
|
731 |
-
. 'function change_email_regexp($regexp) {' . "\n"
|
732 |
-
. ' return \'-your regular expression-\';' . "\n"
|
733 |
-
. '}' . "\n"
|
734 |
-
. '?></code></pre>'
|
735 |
-
. '<h4>eeb_form_content</h4>'
|
736 |
-
. '<p>Filter for changing the form layout.</p>'
|
737 |
-
. '<pre><code><?php' . "\n"
|
738 |
-
. 'add_filter(\'eeb_form_content\', \'eeb_form_content\', 10, 4);' . "\n\n"
|
739 |
-
. 'function eeb_form_content($content, $labels, $show_powered_by, $methods) {' . "\n"
|
740 |
-
. ' // add a <div>-wrapper' . "\n"
|
741 |
-
. ' return \'<div class="form-wrapper">\' . $content . \'</div>\';' . "\n"
|
742 |
-
. '}' . "\n"
|
743 |
-
. '?></code></pre>'
|
744 |
-
, 'email-encoder-bundle');
|
745 |
-
} else if ($key === 'faq') {
|
746 |
-
$content = __('<h3>FAQ</h3>'
|
747 |
-
. '<p>Please see the <a href="http://wordpress.org/extend/plugins/email-encoder-bundle/faq/" target="_blank">official FAQ</a>.'
|
748 |
-
, 'email-encoder-bundle');
|
749 |
-
} else if ($key === 'sidebar') {
|
750 |
-
$content = __('<h4>More Info</h4>'
|
751 |
-
. '<ul>'
|
752 |
-
. '<li><a href="https://profiles.wordpress.org/ironikus/#content-plugins" target="_blank">Quality free plugins</a></li>'
|
753 |
-
. '<li><a href="http://wordpress.org/support/plugin/email-encoder-bundle#postform" target="_blank">Get Support</a></li>'
|
754 |
-
. '<li><a href="https://ironikus.com/" target="_blank">Visit Ironikus</a></li>'
|
755 |
-
. '</ul>'
|
756 |
-
, 'email-encoder-bundle');
|
757 |
-
} else {
|
758 |
-
$content = '';
|
759 |
-
}
|
760 |
-
|
761 |
-
return $content;
|
762 |
-
}
|
763 |
-
|
764 |
-
/* -------------------------------------------------------------------------
|
765 |
-
* Encoder Form
|
766 |
-
* -------------------------------------------------------------------------/
|
767 |
-
|
768 |
-
/**
|
769 |
-
* Get the encoder form (to use as a demo, like on the options page)
|
770 |
-
* @return string
|
771 |
-
*/
|
772 |
-
public function get_encoder_form() {
|
773 |
-
$method_options = '';
|
774 |
-
foreach ($this->methods as $method_name => $info) {
|
775 |
-
$method_options .= '<option value="' . $method_name . '"' . (($this->method == $method_name) ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
|
776 |
-
}
|
777 |
-
|
778 |
-
$show_powered_by = (bool) $this->options['powered_by'];
|
779 |
-
$powered_by = '';
|
780 |
-
if ($show_powered_by) {
|
781 |
-
$powered_by .= '<p class="powered-by">' . __('Powered by free', 'email-encoder-bundle') . ' <a rel="external" href="https://wordpress.org/plugins/email-encoder-bundle/">Email Encoder</a></p>';
|
782 |
-
}
|
783 |
-
|
784 |
-
$labels = array(
|
785 |
-
'email' => __('Email Address:', 'email-encoder-bundle'),
|
786 |
-
'display' => __('Display Text:', 'email-encoder-bundle'),
|
787 |
-
'mailto' => __('Mailto Link:', 'email-encoder-bundle'),
|
788 |
-
'method' => __('Encoding Method:', 'email-encoder-bundle'),
|
789 |
-
'create_link' => __('Create Protected Mail Link >>', 'email-encoder-bundle'),
|
790 |
-
'output' => __('Protected Mail Link (code):', 'email-encoder-bundle'),
|
791 |
-
'method_options' => $method_options,
|
792 |
-
'powered_by' => $powered_by,
|
793 |
-
);
|
794 |
-
|
795 |
-
extract($labels);
|
796 |
-
|
797 |
-
$form = <<<FORM
|
798 |
-
<div class="eeb-form">
|
799 |
-
<form>
|
800 |
-
<fieldset>
|
801 |
-
<div class="input">
|
802 |
-
<table>
|
803 |
-
<tbody>
|
804 |
-
<tr>
|
805 |
-
<th><label for="eeb-email">{$email}</label></th>
|
806 |
-
<td><input type="text" class="regular-text" id="eeb-email" name="eeb-email" /></td>
|
807 |
-
</tr>
|
808 |
-
<tr>
|
809 |
-
<th><label for="eeb-display">{$display}</label></th>
|
810 |
-
<td><input type="text" class="regular-text" id="eeb-display" name="eeb-display" /></td>
|
811 |
-
</tr>
|
812 |
-
<tr>
|
813 |
-
<th>{$mailto}</th>
|
814 |
-
<td><span class="eeb-example"></span></td>
|
815 |
-
</tr>
|
816 |
-
<tr>
|
817 |
-
<th><label for="eeb-encode-method">{$method}</label></th>
|
818 |
-
<td><select id="eeb-encode-method" name="eeb-encode-method" class="postform">
|
819 |
-
{$method_options}
|
820 |
-
</select>
|
821 |
-
<input type="button" id="eeb-ajax-encode" name="eeb-ajax-encode" value="{$create_link}" />
|
822 |
-
</td>
|
823 |
-
</tr>
|
824 |
-
</tbody>
|
825 |
-
</table>
|
826 |
-
</div>
|
827 |
-
<div class="eeb-output">
|
828 |
-
<table>
|
829 |
-
<tbody>
|
830 |
-
<tr>
|
831 |
-
<th><label for="eeb-encoded-output">{$output}</label></th>
|
832 |
-
<td><textarea class="large-text node" id="eeb-encoded-output" name="eeb-encoded-output" cols="50" rows="4"></textarea></td>
|
833 |
-
</tr>
|
834 |
-
</tbody>
|
835 |
-
</table>
|
836 |
-
</div>
|
837 |
-
{$powered_by}
|
838 |
-
</fieldset>
|
839 |
-
</form>
|
840 |
-
</div>
|
841 |
-
FORM;
|
842 |
-
|
843 |
-
// apply filters
|
844 |
-
$form = apply_filters('eeb_form_content', $form, $labels, $show_powered_by, $this->methods);
|
845 |
-
|
846 |
-
return $form;
|
847 |
-
}
|
848 |
-
|
849 |
-
} // end class Eeb_Admin
|
850 |
-
|
851 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-eeb-site.php
DELETED
@@ -1,586 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Eeb_Site (singleton)
|
4 |
-
*
|
5 |
-
* Contains all necessary code for the site part
|
6 |
-
*
|
7 |
-
* @extends Eeb_Admin
|
8 |
-
* @final
|
9 |
-
*
|
10 |
-
* @package Email_Encoder_Bundle
|
11 |
-
* @category WordPress Plugins
|
12 |
-
*/
|
13 |
-
|
14 |
-
// this is an include only WP file
|
15 |
-
if (!defined('ABSPATH')) {
|
16 |
-
die;
|
17 |
-
}
|
18 |
-
|
19 |
-
if (!class_exists('Eeb_Site') && class_exists('Eeb_Admin')):
|
20 |
-
|
21 |
-
final class Eeb_Site extends Eeb_Admin {
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @var Eeb_Site Singleton instance
|
25 |
-
*/
|
26 |
-
static private $instance = null;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var boolean
|
30 |
-
*/
|
31 |
-
private $is_admin_user = false;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @var array Regular expresssions
|
35 |
-
*/
|
36 |
-
private $regexp_patterns = array(
|
37 |
-
'mailto' => '/<a([^<>]*?)href=["\']mailto:([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9](\.[A-Z.]{2,6})(.*?))["\'](.*?)>(.*?)<\/a[\s+]*>/is',
|
38 |
-
'email' => '/[A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9](\.[A-Z.]{2,6})/is',
|
39 |
-
'input' => '/<input([^>]*)value=["\'][\s+]*([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6})[\s+]*["\']([^>]*)>/is',
|
40 |
-
'class' => '/class=["\'](.*?)["\']/i',
|
41 |
-
);
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Constructor
|
45 |
-
*/
|
46 |
-
protected function __construct() {
|
47 |
-
parent::__construct();
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Make private to prevent multiple objects
|
52 |
-
*/
|
53 |
-
private function __clone() {}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Get singleton instance
|
57 |
-
*/
|
58 |
-
static public function getInstance() {
|
59 |
-
if (self::$instance === null) {
|
60 |
-
self::$instance = new Eeb_Site();
|
61 |
-
}
|
62 |
-
|
63 |
-
return self::$instance;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* wp action
|
68 |
-
*/
|
69 |
-
public function wp() {
|
70 |
-
$this->is_admin_user = current_user_can('manage_options');
|
71 |
-
|
72 |
-
if (is_admin()) {
|
73 |
-
return;
|
74 |
-
}
|
75 |
-
|
76 |
-
// apply filters
|
77 |
-
$this->regexp_patterns['mailto'] = apply_filters('eeb_mailto_regexp', $this->regexp_patterns['mailto']);
|
78 |
-
$this->regexp_patterns['email'] = apply_filters('eeb_email_regexp', $this->regexp_patterns['email']);
|
79 |
-
|
80 |
-
if (is_feed()) {
|
81 |
-
// rss feed
|
82 |
-
$rss_filters = array('the_title', 'the_content', 'the_excerpt', 'the_title_rss', 'the_content_rss', 'the_excerpt_rss',
|
83 |
-
'comment_text_rss', 'comment_author_rss', 'the_category_rss', 'the_content_feed', 'author_feed_link', 'feed_link');
|
84 |
-
|
85 |
-
foreach($rss_filters as $filter) {
|
86 |
-
if ($this->options['remove_shortcodes_rss']) {
|
87 |
-
add_filter($filter, array($this, 'callback_rss_remove_shortcodes'), 9);
|
88 |
-
}
|
89 |
-
|
90 |
-
if ($this->options['filter_rss']) {
|
91 |
-
add_filter($filter, array($this, 'callback_filter_rss'), 100);
|
92 |
-
}
|
93 |
-
}
|
94 |
-
} else {
|
95 |
-
// site
|
96 |
-
$filters = array();
|
97 |
-
|
98 |
-
// post content
|
99 |
-
if ($this->options['filter_posts']) {
|
100 |
-
array_push($filters, 'the_title', 'the_content', 'the_excerpt', 'get_the_excerpt');
|
101 |
-
}
|
102 |
-
|
103 |
-
// comments
|
104 |
-
if ($this->options['filter_comments']) {
|
105 |
-
array_push($filters, 'comment_text', 'comment_excerpt', 'comment_url', 'get_comment_author_url', 'get_comment_author_link', 'get_comment_author_url_link');
|
106 |
-
}
|
107 |
-
|
108 |
-
// widgets
|
109 |
-
if ($this->options['filter_widgets']) {
|
110 |
-
array_push($filters, 'widget_title', 'widget_text', 'widget_content');
|
111 |
-
|
112 |
-
// also replace shortcodes
|
113 |
-
if ($this->options['shortcodes_in_widgets']) {
|
114 |
-
add_filter('widget_text', 'do_shortcode', 100);
|
115 |
-
add_filter('widget_content', 'do_shortcode', 100); // widget_content id filter of Widget Logic plugin
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
foreach($filters as $filter) {
|
120 |
-
add_filter($filter, array($this, 'callback_filter'), 100);
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
// actions
|
125 |
-
add_action('wp_head', array($this, 'wp_head'));
|
126 |
-
|
127 |
-
// shortcodes
|
128 |
-
add_shortcode('eeb_form', array($this, 'shortcode_email_encoder_form'));
|
129 |
-
add_shortcode('eeb_email', array($this, 'shortcode_encode_email'));
|
130 |
-
add_shortcode('eeb_content', array($this, 'shortcode_encode_content'));
|
131 |
-
|
132 |
-
// hook
|
133 |
-
do_action('eeb_ready', array($this, 'callback_filter'), $this);
|
134 |
-
|
135 |
-
// support for deprecated action and shortcodes
|
136 |
-
if ($this->options['support_deprecated_names'] == 1) {
|
137 |
-
// deprecated template functions
|
138 |
-
require_once('deprecated.php');
|
139 |
-
|
140 |
-
// deprecated shortcodes
|
141 |
-
add_shortcode('email_encoder_form', array($this, 'shortcode_email_encoder_form'));
|
142 |
-
add_shortcode('encode_email', array($this, 'shortcode_encode_email'));
|
143 |
-
add_shortcode('encode_content', array($this, 'shortcode_encode_content'));
|
144 |
-
|
145 |
-
// deprecated hooks
|
146 |
-
do_action('init_email_encoder_bundle', array($this, 'callback_filter'), $this);
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* WP head
|
152 |
-
*/
|
153 |
-
public function wp_head() {
|
154 |
-
$css = '';
|
155 |
-
$css .= '<style type="text/css" media="screen">';
|
156 |
-
|
157 |
-
// add styling for encoding check message + icon
|
158 |
-
if ($this->is_admin_user && $this->options['show_encoded_check']) {
|
159 |
-
$css .= 'a.encoded-check { position:absolute; text-decoration:none !important; margin:0; padding:0; box-shadow: none; background: none; }';
|
160 |
-
$css .= 'a.encoded-check:hover { margin:0; padding:0; box-shadow: none; cursor:help; text-decoration: none!important; }';
|
161 |
-
$css .= 'a.encoded-check:hover img { opacity: 1; cursor:help; text-decoration: none!important; margin:0; padding:0; box-shadow: none; }';
|
162 |
-
$css .= 'a.encoded-check img { opacity: 0.5; width:auto; height:16px; margin:0; padding:0; box-shadow: none; }';
|
163 |
-
}
|
164 |
-
|
165 |
-
// $css .= 'a[href^="mailto:"] .fa { margin-right:0.4em; }';
|
166 |
-
$css .= '</style>';
|
167 |
-
|
168 |
-
echo $css;
|
169 |
-
}
|
170 |
-
|
171 |
-
/* -------------------------------------------------------------------------
|
172 |
-
* Filter Callbacks
|
173 |
-
* ------------------------------------------------------------------------*/
|
174 |
-
|
175 |
-
/**
|
176 |
-
* WP filter callback
|
177 |
-
* @param string $content
|
178 |
-
* @return string
|
179 |
-
*/
|
180 |
-
public function callback_filter($content) {
|
181 |
-
global $post;
|
182 |
-
|
183 |
-
if (isset($post) && is_a($post, 'WP_Post') && in_array($post->ID, $this->skip_posts)) {
|
184 |
-
return $content;
|
185 |
-
}
|
186 |
-
|
187 |
-
return $this->encode_email_filter($content, true, $this->options['encode_mailtos'], $this->options['encode_emails'], $this->options['encode_fields']);
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* RSS Filter callback
|
192 |
-
* @param string $content
|
193 |
-
* @return string
|
194 |
-
*/
|
195 |
-
public function callback_filter_rss($content) {
|
196 |
-
$content = preg_replace($this->regexp_patterns, esc_attr($this->options['protection_text_rss']), $content);
|
197 |
-
|
198 |
-
return $content;
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
-
* RSS Callback Remove shortcodes
|
203 |
-
* @param string $content
|
204 |
-
* @return string
|
205 |
-
*/
|
206 |
-
public function callback_rss_remove_shortcodes($content) {
|
207 |
-
// strip shortcodes like [eeb_content], [eeb_form]
|
208 |
-
$content = strip_shortcodes($content);
|
209 |
-
|
210 |
-
return $content;
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Filter content for encoding
|
215 |
-
* @param string $content
|
216 |
-
* @param boolean $enc_tags Optional, default true
|
217 |
-
* @param boolean $enc_mailtos Optional, default true
|
218 |
-
* @param boolean $enc_plain_emails Optional, default true
|
219 |
-
* @param boolean $enc_input_fields Optional, default true
|
220 |
-
* @return string
|
221 |
-
*/
|
222 |
-
public function encode_email_filter($content, $enc_tags = true, $enc_mailtos = true, $enc_plain_emails = true, $enc_input_fields = true) {
|
223 |
-
// encode input fields with prefilled email address
|
224 |
-
if ($enc_input_fields) {
|
225 |
-
$content = preg_replace_callback($this->regexp_patterns['input'], array($this, 'callback_encode_input_field'), $content);
|
226 |
-
}
|
227 |
-
|
228 |
-
// encode mailto links
|
229 |
-
if ($enc_mailtos) {
|
230 |
-
$content = preg_replace_callback($this->regexp_patterns['mailto'], array($this, 'callback_encode_email'), $content);
|
231 |
-
}
|
232 |
-
|
233 |
-
// replace plain emails
|
234 |
-
if ($enc_plain_emails) {
|
235 |
-
$content = preg_replace_callback($this->regexp_patterns['email'], array($this, 'callback_encode_email'), $content);
|
236 |
-
}
|
237 |
-
|
238 |
-
// workaround for double encoding bug when auto-protect mailto is enabled and method is enc_html
|
239 |
-
$content = str_replace('[a-replacement]', '<a', $content);
|
240 |
-
|
241 |
-
return $content;
|
242 |
-
}
|
243 |
-
|
244 |
-
/**
|
245 |
-
* Callback for encoding email
|
246 |
-
* @param array $match
|
247 |
-
* @return string
|
248 |
-
*/
|
249 |
-
public function callback_encode_email($match) {
|
250 |
-
if (count($match) < 4) {
|
251 |
-
$email = $match[0];
|
252 |
-
$extention = strtolower($match[1]);
|
253 |
-
} else {
|
254 |
-
$email = $match[2];
|
255 |
-
$extention = strtolower($match[3]);
|
256 |
-
}
|
257 |
-
|
258 |
-
// workaround to skip responsive image names containing @
|
259 |
-
$excludedList = array('.jpg', '.jpeg', '.png', '.gif');
|
260 |
-
if (in_array($extention, $excludedList)) {
|
261 |
-
return $match[0];
|
262 |
-
}
|
263 |
-
|
264 |
-
if (count($match) < 4) {
|
265 |
-
$encoded = $this->encode_email($email);
|
266 |
-
} else {
|
267 |
-
$encoded = $this->encode_email($email, $match[6], $match[1] . ' ' . $match[5]);
|
268 |
-
}
|
269 |
-
|
270 |
-
// workaround for double encoding bug when auto-protect mailto is enabled and method is enc_html
|
271 |
-
$encoded = str_replace('<a', '[a-replacement]', $encoded);
|
272 |
-
|
273 |
-
return $encoded;
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Callback for encoding input field with email address
|
278 |
-
* @param array $match
|
279 |
-
* @return string
|
280 |
-
*/
|
281 |
-
public function callback_encode_input_field($match) {
|
282 |
-
if ($this->method === 'enc_html') {
|
283 |
-
// enc_html method
|
284 |
-
$email = $match[2];
|
285 |
-
$encoded_email = $this->enc_html($email);
|
286 |
-
|
287 |
-
$encoded = str_replace($email , $encoded_email, $match[0]);
|
288 |
-
$encoded = $this->get_success_check($encoded);
|
289 |
-
} else {
|
290 |
-
$encoded = $this->encode_content($match[0]);
|
291 |
-
}
|
292 |
-
|
293 |
-
return $encoded;
|
294 |
-
}
|
295 |
-
|
296 |
-
/* -------------------------------------------------------------------------
|
297 |
-
* Shortcode Functions
|
298 |
-
* ------------------------------------------------------------------------*/
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Shortcode showing encoder form
|
302 |
-
* @return string
|
303 |
-
*/
|
304 |
-
public function shortcode_email_encoder_form() {
|
305 |
-
// add style and script for ajax encoder
|
306 |
-
wp_enqueue_script('email_encoder', plugins_url('js/email-encoder-bundle.js', EMAIL_ENCODER_BUNDLE_FILE), array('jquery'), EMAIL_ENCODER_BUNDLE_VERSION);
|
307 |
-
|
308 |
-
return $this->get_encoder_form();
|
309 |
-
}
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Shortcode encoding email
|
313 |
-
* @param array $attrs
|
314 |
-
* @return string
|
315 |
-
*/
|
316 |
-
public function shortcode_encode_email($attrs) {
|
317 |
-
if (!is_array($attrs) || !key_exists('email', $attrs)) {
|
318 |
-
return '';
|
319 |
-
}
|
320 |
-
|
321 |
-
$email = $attrs['email'];
|
322 |
-
$display = (key_exists('display', $attrs)) ? $attrs['display'] : $attrs['email'];
|
323 |
-
$method = (key_exists('method', $attrs)) ? $attrs['method'] : null;
|
324 |
-
$extra_attrs = (key_exists('extra_attrs', $attrs)) ? $attrs['extra_attrs'] : null;
|
325 |
-
|
326 |
-
$encoded = $this->encode_email($email, $display, $extra_attrs, $method);
|
327 |
-
|
328 |
-
// workaround for double encoding bug when auto-protect mailto is enabled and method is enc_html
|
329 |
-
$encoded = str_replace('<a', '[a-replacement]', $encoded);
|
330 |
-
|
331 |
-
return $encoded;
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Shortcode encoding content
|
336 |
-
* @param array $attrs
|
337 |
-
* @param string $content Optional
|
338 |
-
* @return string
|
339 |
-
*/
|
340 |
-
public function shortcode_encode_content($attrs, $content = '') {
|
341 |
-
$method = (is_array($attrs) && key_exists('method', $attrs)) ? $attrs['method'] : null;
|
342 |
-
|
343 |
-
return $this->encode_content($content, $method);
|
344 |
-
}
|
345 |
-
|
346 |
-
/* -------------------------------------------------------------------------
|
347 |
-
* Encode Functions
|
348 |
-
* -------------------------------------------------------------------------/
|
349 |
-
|
350 |
-
/**
|
351 |
-
* Encode the given email into an encoded HTML link
|
352 |
-
* @param string $content
|
353 |
-
* @param string $method Optional, else the default setted method will; be used
|
354 |
-
* @param boolean $no_html_checked Optional
|
355 |
-
* @param string $protection_text Optional
|
356 |
-
* @return string
|
357 |
-
*/
|
358 |
-
public function encode_content($content, $method = null, $no_html_checked = false, $protection_text = null) {
|
359 |
-
if ($protection_text === null) {
|
360 |
-
$protection_text = esc_attr($this->options['protection_text_content']);
|
361 |
-
}
|
362 |
-
|
363 |
-
// get encode method
|
364 |
-
$method = $this->get_method($method, $this->method);
|
365 |
-
|
366 |
-
// get encoded email code
|
367 |
-
$content = $this->{$method}($content, $protection_text);
|
368 |
-
|
369 |
-
// add visual check
|
370 |
-
if ($no_html_checked !== true) {
|
371 |
-
$content = $this->get_success_check($content);
|
372 |
-
}
|
373 |
-
|
374 |
-
return $content;
|
375 |
-
}
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Encode the given email into an encoded HTML link
|
379 |
-
* @param string $email
|
380 |
-
* @param string $display Optional, if not set display will be the email
|
381 |
-
* @param string $extra_attrs Optional
|
382 |
-
* @param string $method Optional, else the default setted method will; be used
|
383 |
-
* @param boolean $no_html_checked
|
384 |
-
* @return string
|
385 |
-
*/
|
386 |
-
public function encode_email($email, $display = null, $extra_attrs = '', $method = null, $no_html_checked = false) {
|
387 |
-
// get encode method
|
388 |
-
$method = $this->get_method($method, $this->method);
|
389 |
-
|
390 |
-
// decode entities
|
391 |
-
$email = html_entity_decode($email);
|
392 |
-
|
393 |
-
// set email as display
|
394 |
-
if ($display === null) {
|
395 |
-
$display = $email;
|
396 |
-
|
397 |
-
if ($method === 'enc_html') {
|
398 |
-
$display = $this->enc_html($display);
|
399 |
-
}
|
400 |
-
} else {
|
401 |
-
$display = html_entity_decode($display);
|
402 |
-
}
|
403 |
-
|
404 |
-
if ($method === 'enc_html') {
|
405 |
-
$email = $this->enc_html($email);
|
406 |
-
}
|
407 |
-
|
408 |
-
$extra_attrs = ' ' . trim($extra_attrs);
|
409 |
-
|
410 |
-
// add class
|
411 |
-
if (preg_match($this->regexp_patterns['class'], $extra_attrs, $matches)) {
|
412 |
-
// class attribute set
|
413 |
-
$extra_attrs = str_replace($matches[0], sprintf('class="%s"', $matches[1] . ' ' . esc_attr($this->options['class_name'])), $extra_attrs);
|
414 |
-
} else {
|
415 |
-
// class attribute not set
|
416 |
-
$extra_attrs .= ' class="' . esc_attr($this->options['class_name']) . '"';
|
417 |
-
}
|
418 |
-
|
419 |
-
$mailto = '<a href="mailto:' . $email . '"'. $extra_attrs . '>' . $display . '</a>';
|
420 |
-
|
421 |
-
if ($method === 'enc_html') {
|
422 |
-
// add visual check
|
423 |
-
if ($no_html_checked !== true) {
|
424 |
-
$mailto = $this->get_success_check($mailto);
|
425 |
-
}
|
426 |
-
} else {
|
427 |
-
$mailto = $this->encode_content($mailto, $method, $no_html_checked, esc_attr($this->options['protection_text']));
|
428 |
-
}
|
429 |
-
|
430 |
-
// get encoded email code
|
431 |
-
return $mailto;
|
432 |
-
}
|
433 |
-
|
434 |
-
/**
|
435 |
-
* Add html to encoded content to show check icon and text
|
436 |
-
* @param string $content
|
437 |
-
* @return string
|
438 |
-
*/
|
439 |
-
private function get_success_check($content) {
|
440 |
-
if (!$this->is_admin_user || !$this->options['show_encoded_check']) {
|
441 |
-
return $content;
|
442 |
-
}
|
443 |
-
|
444 |
-
$text = htmlspecialchars( __( 'Successfully Encoded! This is a check and it\\\'s only visible when logged in as admin.', 'email-encoder-bundle') );
|
445 |
-
|
446 |
-
return $content
|
447 |
-
. '<a href="javascript:;" onclick="alert(\'' . $text . '\');" class="encoded-check"'
|
448 |
-
. ' title="' . $text . '">'
|
449 |
-
. '<img class="encoded-check-icon" src="' . plugins_url('images/icon-email-encoder.png', EMAIL_ENCODER_BUNDLE_FILE)
|
450 |
-
. '" alt="' . __('Encoded', 'email-encoder-bundle') . '" />' . '</a>';
|
451 |
-
}
|
452 |
-
|
453 |
-
/* -------------------------------------------------------------------------
|
454 |
-
* Different Encoding Methods
|
455 |
-
* ------------------------------------------------------------------------*/
|
456 |
-
|
457 |
-
/**
|
458 |
-
* ASCII method
|
459 |
-
* Based on function from Tyler Akins (http://rumkin.com/tools/mailto_encoder/)
|
460 |
-
*
|
461 |
-
* @param string $value
|
462 |
-
* @param string $protection_text
|
463 |
-
* @return string
|
464 |
-
*/
|
465 |
-
private function enc_ascii($value, $protection_text) {
|
466 |
-
$mail_link = $value;
|
467 |
-
|
468 |
-
// first encode, so special chars can be supported
|
469 |
-
$mail_link = $this->encodeURIComponent($mail_link);
|
470 |
-
|
471 |
-
$mail_letters = '';
|
472 |
-
|
473 |
-
for ($i = 0; $i < strlen($mail_link); $i ++) {
|
474 |
-
$l = substr($mail_link, $i, 1);
|
475 |
-
|
476 |
-
if (strpos($mail_letters, $l) === false) {
|
477 |
-
$p = rand(0, strlen($mail_letters));
|
478 |
-
$mail_letters = substr($mail_letters, 0, $p) .
|
479 |
-
$l . substr($mail_letters, $p, strlen($mail_letters));
|
480 |
-
}
|
481 |
-
}
|
482 |
-
|
483 |
-
$mail_letters_enc = str_replace("\\", "\\\\", $mail_letters);
|
484 |
-
$mail_letters_enc = str_replace("\"", "\\\"", $mail_letters_enc);
|
485 |
-
|
486 |
-
$mail_indices = '';
|
487 |
-
for ($i = 0; $i < strlen($mail_link); $i ++) {
|
488 |
-
$index = strpos($mail_letters, substr($mail_link, $i, 1));
|
489 |
-
$index += 48;
|
490 |
-
$mail_indices .= chr($index);
|
491 |
-
}
|
492 |
-
|
493 |
-
$mail_indices = str_replace("\\", "\\\\", $mail_indices);
|
494 |
-
$mail_indices = str_replace("\"", "\\\"", $mail_indices);
|
495 |
-
|
496 |
-
$element_id = 'eeb-' . mt_rand(0, 1000000);
|
497 |
-
|
498 |
-
return '<span id="'. $element_id . '"></span>'
|
499 |
-
. '<script type="text/javascript">'
|
500 |
-
. '(function(){'
|
501 |
-
. 'var ml="'. $mail_letters_enc .'",mi="'. $mail_indices .'",o="";'
|
502 |
-
. 'for(var j=0,l=mi.length;j<l;j++){'
|
503 |
-
. 'o+=ml.charAt(mi.charCodeAt(j)-48);'
|
504 |
-
. '}document.getElementById("' . $element_id . '").innerHTML = decodeURIComponent(o);' // decode at the end, this way special chars can be supported
|
505 |
-
. '}());'
|
506 |
-
. '</script><noscript>'
|
507 |
-
. $protection_text
|
508 |
-
. '</noscript>';
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* This is the opponent of JavaScripts decodeURIComponent()
|
513 |
-
* @link http://stackoverflow.com/questions/1734250/what-is-the-equivalent-of-javascripts-encodeuricomponent-in-php
|
514 |
-
* @param string $str
|
515 |
-
* @return string
|
516 |
-
*/
|
517 |
-
private function encodeURIComponent($str) {
|
518 |
-
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')');
|
519 |
-
return strtr(rawurlencode($str), $revert);
|
520 |
-
}
|
521 |
-
|
522 |
-
/**
|
523 |
-
* Escape method
|
524 |
-
* Taken from the plugin "Email Spam Protection" by Adam Hunter (http://blueberryware.net/2008/09/14/email-spam-protection/)
|
525 |
-
*
|
526 |
-
* @param string $value
|
527 |
-
* @param string $protection_text
|
528 |
-
* @return string
|
529 |
-
*/
|
530 |
-
private function enc_escape($value, $protection_text) {
|
531 |
-
$element_id = 'eeb-' . mt_rand(0, 1000000);
|
532 |
-
$string = '\'' . $value . '\'';
|
533 |
-
|
534 |
-
// break string into array of characters, we can't use string_split because its php5 only
|
535 |
-
$split = preg_split('||', $string);
|
536 |
-
$out = '<span id="'. $element_id . '"></span>'
|
537 |
-
. '<script type="text/javascript">' . 'document.getElementById("' . $element_id . '").innerHTML = ev' . 'al(decodeURIComponent("';
|
538 |
-
|
539 |
-
foreach ($split as $c) {
|
540 |
-
// preg split will return empty first and last characters, check for them and ignore
|
541 |
-
if (!empty($c)) {
|
542 |
-
$out .= '%' . dechex(ord($c));
|
543 |
-
}
|
544 |
-
}
|
545 |
-
|
546 |
-
$out .= '"))' . '</script><noscript>'
|
547 |
-
. $protection_text
|
548 |
-
. '</noscript>';
|
549 |
-
|
550 |
-
return $out;
|
551 |
-
}
|
552 |
-
|
553 |
-
/**
|
554 |
-
* Convert randomly chars to htmlentities
|
555 |
-
* This method is partly taken from WordPress
|
556 |
-
* @link http://codex.wordpress.org/Function_Reference/antispambot
|
557 |
-
*
|
558 |
-
* @param string $value
|
559 |
-
* @return string
|
560 |
-
*/
|
561 |
-
private function enc_html( $value ) {
|
562 |
-
// check for built-in WP function
|
563 |
-
if ( ! function_exists('antispambot' ) ) {
|
564 |
-
$emailNOSPAMaddy = antispambot( $value );
|
565 |
-
} else {
|
566 |
-
$emailNOSPAMaddy = '';
|
567 |
-
for ( $i = 0, $len = strlen( $value ); $i < $len; $i++ ) {
|
568 |
-
$j = rand( 0, 1 + 0 );
|
569 |
-
if ( $j == 0 ) {
|
570 |
-
$emailNOSPAMaddy .= '&#' . ord( $value[ $i ] ) . ';';
|
571 |
-
} elseif ( $j == 1 ) {
|
572 |
-
$emailNOSPAMaddy .= $value[ $i ];
|
573 |
-
} elseif ( $j == 2 ) {
|
574 |
-
$emailNOSPAMaddy .= '%' . zeroise( dechex( ord( $value[ $i ] ) ), 2 );
|
575 |
-
}
|
576 |
-
}
|
577 |
-
}
|
578 |
-
|
579 |
-
$emailNOSPAMaddy = str_replace( '@', '@', $emailNOSPAMaddy );
|
580 |
-
|
581 |
-
return $emailNOSPAMaddy;
|
582 |
-
}
|
583 |
-
|
584 |
-
} // end class Eeb_Site
|
585 |
-
|
586 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/deprecated.php
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Deprecated template Functions
|
4 |
-
*
|
5 |
-
* @package Email_Encoder_Bundle
|
6 |
-
* @category WordPress Plugins
|
7 |
-
*/
|
8 |
-
|
9 |
-
// this is an include only WP file
|
10 |
-
if (!defined('ABSPATH')) {
|
11 |
-
die;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Template function for encoding email
|
16 |
-
*
|
17 |
-
* @deprecated
|
18 |
-
*
|
19 |
-
* @global Eeb_Site $Eeb_Site
|
20 |
-
* @param string $email
|
21 |
-
* @param string $display if non given will be same as email
|
22 |
-
* @param string $method Optional, else the default setted method will; be used
|
23 |
-
* @param string $extra_attrs Optional
|
24 |
-
* @return string
|
25 |
-
*/
|
26 |
-
if (!function_exists('encode_email')):
|
27 |
-
function encode_email($email, $display = null, $method = null, $extra_attrs = '') {
|
28 |
-
return eeb_email($email, $display, $extra_attrs, $method);
|
29 |
-
}
|
30 |
-
endif;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Template function for encoding content
|
34 |
-
*
|
35 |
-
* @deprecated
|
36 |
-
*
|
37 |
-
* @global Eeb_Site $Eeb_Site
|
38 |
-
* @param string $content
|
39 |
-
* @param string $method Optional, default null
|
40 |
-
* @return string
|
41 |
-
*/
|
42 |
-
if (!function_exists('encode_content')):
|
43 |
-
function encode_content($content, $method = null) {
|
44 |
-
return eeb_content($content, $method);
|
45 |
-
}
|
46 |
-
endif;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Template function for encoding emails in the given content
|
50 |
-
*
|
51 |
-
* @deprecated
|
52 |
-
*
|
53 |
-
* @global Eeb_Site $Eeb_Site
|
54 |
-
* @param string $content
|
55 |
-
* @param boolean $enc_tags Optional, default true
|
56 |
-
* @param boolean $enc_mailtos Optional, default true
|
57 |
-
* @param boolean $enc_plain_emails Optional, default true
|
58 |
-
* @return string
|
59 |
-
*/
|
60 |
-
if (!function_exists('encode_email_filter')):
|
61 |
-
function encode_email_filter($content, $enc_tags = true, $enc_mailtos = true, $enc_plain_emails = true) {
|
62 |
-
return eeb_email_filter($content, $enc_tags, $enc_mailtos, $enc_plain_emails);
|
63 |
-
}
|
64 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/template-functions.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Template Functions
|
4 |
-
*
|
5 |
-
* @package Email_Encoder_Bundle
|
6 |
-
* @category WordPress Plugins
|
7 |
-
*/
|
8 |
-
|
9 |
-
// this is an include only WP file
|
10 |
-
if (!defined('ABSPATH')) {
|
11 |
-
die;
|
12 |
-
}
|
13 |
-
|
14 |
-
if (!is_admin()):
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Template function for encoding email
|
18 |
-
* @global Eeb_Site $Eeb_Site
|
19 |
-
* @param string $email
|
20 |
-
* @param string $display if non given will be same as email
|
21 |
-
* @param string $extra_attrs Optional
|
22 |
-
* @param string $method Optional, else the default setted method will; be used
|
23 |
-
* @return string
|
24 |
-
*/
|
25 |
-
if (!function_exists('eeb_email')):
|
26 |
-
function eeb_email($email, $display = null, $extra_attrs = '', $method = null) {
|
27 |
-
global $Eeb_Site;
|
28 |
-
return $Eeb_Site->encode_email($email, $display, $extra_attrs, $method);
|
29 |
-
}
|
30 |
-
endif;
|
31 |
-
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Template function for encoding content
|
35 |
-
* @global Eeb_Site $Eeb_Site
|
36 |
-
* @param string $content
|
37 |
-
* @param string $method Optional, default null
|
38 |
-
* @return string
|
39 |
-
*/
|
40 |
-
if (!function_exists('eeb_content')):
|
41 |
-
function eeb_content($content, $method = null) {
|
42 |
-
global $Eeb_Site;
|
43 |
-
return $Eeb_Site->encode_content($content, $method);
|
44 |
-
}
|
45 |
-
endif;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Template function for encoding emails in the given content
|
49 |
-
* @global Eeb_Site $Eeb_Site
|
50 |
-
* @param string $content
|
51 |
-
* @param boolean $enc_tags Optional, default true
|
52 |
-
* @param boolean $enc_mailtos Optional, default true
|
53 |
-
* @param boolean $enc_plain_emails Optional, default true
|
54 |
-
* @param boolean $enc_input_fields Optional, default true
|
55 |
-
* @return string
|
56 |
-
*/
|
57 |
-
if (!function_exists('eeb_email_filter')):
|
58 |
-
function eeb_email_filter($content, $enc_tags = true, $enc_mailtos = true, $enc_plain_emails = true, $enc_input_fields = true) {
|
59 |
-
global $Eeb_Site;
|
60 |
-
return $Eeb_Site->encode_email_filter($content, $enc_tags, $enc_mailtos, $enc_plain_emails, $enc_input_fields);
|
61 |
-
}
|
62 |
-
endif;
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Template function for getting HTML of the encoder form (to put it on the site)
|
66 |
-
* @global Eeb_Site $Eeb_Site
|
67 |
-
* @return string
|
68 |
-
*/
|
69 |
-
if (!function_exists('eeb_form')):
|
70 |
-
function eeb_form() {
|
71 |
-
global $Eeb_Site;
|
72 |
-
return $Eeb_Site->get_encoder_form();
|
73 |
-
}
|
74 |
-
endif;
|
75 |
-
|
76 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php //Silence is golden
|
js/email-encoder-bundle-admin.js
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
/* Email Encoder Bundle - Admin */
|
2 |
-
/*global jQuery*/
|
3 |
-
jQuery(function ($) {
|
4 |
-
'use strict';
|
5 |
-
|
6 |
-
var $encodeEmails = $('#encode_emails');
|
7 |
-
|
8 |
-
$('#setting-error-settings_updated').click(function () {
|
9 |
-
$(this).hide();
|
10 |
-
});
|
11 |
-
|
12 |
-
// enable/disable plain emails
|
13 |
-
$('#encode_mailtos')
|
14 |
-
.change(function () {
|
15 |
-
var checked = $(this).prop('checked');
|
16 |
-
|
17 |
-
$encodeEmails.attr('disabled', !checked);
|
18 |
-
|
19 |
-
if (!checked) {
|
20 |
-
$encodeEmails.attr('checked', false);
|
21 |
-
}
|
22 |
-
|
23 |
-
// force change trigger
|
24 |
-
$encodeEmails.change();
|
25 |
-
})
|
26 |
-
.change();
|
27 |
-
|
28 |
-
// show/hide notice
|
29 |
-
$encodeEmails.change(function () {
|
30 |
-
$('.notice-form-field-bug')[$encodeEmails.prop('checked') ? 'fadeIn' : 'fadeOut']();
|
31 |
-
});
|
32 |
-
|
33 |
-
// add form-table class to Encoder Form tables
|
34 |
-
$('.eeb-form table').addClass('form-table');
|
35 |
-
|
36 |
-
//
|
37 |
-
$('.eeb-help-link').click(function (e) {
|
38 |
-
$('#contextual-help-link').click();
|
39 |
-
e.preventDefault();
|
40 |
-
});
|
41 |
-
|
42 |
-
// Workaround for saving disabled checkboxes in options db
|
43 |
-
// prepare checkboxes before submit
|
44 |
-
$('.wrap form').submit(function () {
|
45 |
-
// force value 0 being saved in options
|
46 |
-
$('*[type="checkbox"]:not(:checked)')
|
47 |
-
.css({ 'visibility': 'hidden' })
|
48 |
-
.attr({
|
49 |
-
'value': '0',
|
50 |
-
'checked': 'checked'
|
51 |
-
});
|
52 |
-
});
|
53 |
-
|
54 |
-
// enable submit buttons
|
55 |
-
$('*[type="submit"]')
|
56 |
-
.attr('disabled', false)
|
57 |
-
.removeClass('submit'); // remove class to fix button background
|
58 |
-
|
59 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php //Silence is golden
|
languages/wp-mailto-links.mo
ADDED
Binary file
|
languages/wp-mailto-links.po
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Email Encoder\n"
|
4 |
+
"POT-Creation-Date: 2015-06-22 22:50+0100\n"
|
5 |
+
"PO-Revision-Date: 2015-06-22 22:51+0100\n"
|
6 |
+
"Last-Translator: Victor <info@freelancephp.net>\n"
|
7 |
+
"Language-Team: Victor <info@freelancephp.net>\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.6.3\n"
|
12 |
+
"X-Poedit-Basepath: .\n"
|
13 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
14 |
+
"Language: en\n"
|
license.txt
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<http://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
readme.txt
CHANGED
@@ -1,319 +1,326 @@
|
|
1 |
-
=== Email Encoder - Protect Email
|
2 |
-
Contributors: ironikus
|
3 |
-
Tags: email address, protect, antispam, mailto, spambot, secure, e-mail, email, mail, obfuscate, encode, encoder, encrypt, hide, bot, crawl, spider, robots, spam, protection, harvest, harvesting, security
|
4 |
-
Requires at least: 4.0
|
5 |
-
Requires PHP: 5.1
|
6 |
-
Tested up to: 5.2.3
|
7 |
-
Stable tag:
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
*
|
31 |
-
*
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
The
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
`
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
In
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
=
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
*
|
133 |
-
*
|
134 |
-
*
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
*
|
140 |
-
*
|
141 |
-
*
|
142 |
-
*
|
143 |
-
*
|
144 |
-
|
145 |
-
|
146 |
-
*
|
147 |
-
*
|
148 |
-
*
|
149 |
-
* -
|
150 |
-
* -
|
151 |
-
* -
|
152 |
-
* -
|
153 |
-
* -
|
154 |
-
* -
|
155 |
-
*
|
156 |
-
*
|
157 |
-
*
|
158 |
-
|
159 |
-
|
160 |
-
*
|
161 |
-
*
|
162 |
-
*
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
*
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
*
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
*
|
190 |
-
|
191 |
-
= 1.
|
192 |
-
*
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
*
|
197 |
-
|
198 |
-
= 1.
|
199 |
-
*
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
* Fixed bug
|
204 |
-
|
205 |
-
= 1.0
|
206 |
-
*
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
* Fixed
|
211 |
-
|
212 |
-
= 1.0.
|
213 |
-
*
|
214 |
-
* Fixed bug
|
215 |
-
|
216 |
-
|
217 |
-
*
|
218 |
-
|
219 |
-
|
220 |
-
*
|
221 |
-
*
|
222 |
-
*
|
223 |
-
|
224 |
-
|
225 |
-
* Added
|
226 |
-
*
|
227 |
-
*
|
228 |
-
*
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
*
|
233 |
-
*
|
234 |
-
* Fixed bug
|
235 |
-
*
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
*
|
240 |
-
*
|
241 |
-
*
|
242 |
-
*
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
*
|
247 |
-
*
|
248 |
-
*
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
* Added
|
253 |
-
* Added
|
254 |
-
*
|
255 |
-
*
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
*
|
260 |
-
|
261 |
-
|
262 |
-
*
|
263 |
-
*
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
*
|
270 |
-
*
|
271 |
-
*
|
272 |
-
*
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
*
|
277 |
-
*
|
278 |
-
*
|
279 |
-
*
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
*
|
286 |
-
*
|
287 |
-
|
288 |
-
|
289 |
-
*
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
*
|
294 |
-
*
|
295 |
-
|
296 |
-
|
297 |
-
*
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
*
|
302 |
-
|
303 |
-
|
304 |
-
*
|
305 |
-
*
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
*
|
311 |
-
|
312 |
-
|
313 |
-
*
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
*
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Email Encoder - Protect Email Addresses ===
|
2 |
+
Contributors: ironikus
|
3 |
+
Tags: email address, protect, antispam, mailto, spambot, secure, e-mail, email, mail, obfuscate, encode, encoder, encrypt, hide, bot, crawl, spider, robots, spam, protection, harvest, harvesting, security
|
4 |
+
Requires at least: 4.0
|
5 |
+
Requires PHP: 5.1
|
6 |
+
Tested up to: 5.2.3
|
7 |
+
Stable tag: 2.0.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Protect email addresses on your site and hide them from spambots. Easy to use & flexible.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
Full site protection for your email addresses from spam-bots, email harvesters and other robots. No configuration needed.
|
16 |
+
Also protext phone numbers or any other text using our integrated `[eeb_protect_content]` shortcode.
|
17 |
+
|
18 |
+
= Features =
|
19 |
+
* Full page protection for all of your emails
|
20 |
+
* Instant results (No confiruation needed)
|
21 |
+
* Protects mailto links, plain emails, email input fields, RSS feeds and much more
|
22 |
+
* Autmoatic protection technique detection (Our plugin chooses automatically the best protection technique for each email)
|
23 |
+
* Exclude posts and pages from protection
|
24 |
+
* Automatically convert plain emails to mailto-links
|
25 |
+
* Automatically convert plain emails to png images
|
26 |
+
* Supports rot13 encoing, escape encoding, CSS directions, entity encoding and much more
|
27 |
+
* Deactivate CSS directions manually for browser backwards compatibility
|
28 |
+
* Shortcode support: `[eeb_protect_emails]`, `[eeb_protect_content]`, `[eeb_mailto]`, `[eeb_form]`
|
29 |
+
* Template tag support: `eeb_protect_emails()`, `eeb_protect_content()`, `eeb_mailto()`, `eeb_form()`
|
30 |
+
* Protect phone numbers (or any text or html)
|
31 |
+
* Also supports special chars, like é, â, ö, Chinese characters etcetera
|
32 |
+
* Use the Encoder Form to manually create encoded scripts
|
33 |
+
|
34 |
+
= Free Website Check =
|
35 |
+
We offer you a free tool to test if your website contains unprotected emails. You can use our website checker by [clicking here](https://ironikus.com/email-checker/)
|
36 |
+
|
37 |
+
= Easy to use =
|
38 |
+
After activating the plugin all email addresses on your website will be protected out-of-the-box.
|
39 |
+
We also offer custom shortcodes and template functions to protect phone numbers or other text.
|
40 |
+
|
41 |
+
= Support =
|
42 |
+
* Documentation - After plugin activation, check the help tab on the plugin options page
|
43 |
+
* [Documentation on ironikus.com](https://ironikus.com/docs/article-categories/email-encoder/)
|
44 |
+
* [FAQ](http://wordpress.org/extend/plugins/email-encoder-bundle/faq/)
|
45 |
+
|
46 |
+
= Like this plugin? =
|
47 |
+
[Please Review it](http://wordpress.org/support/view/plugin-reviews/email-encoder-bundle)
|
48 |
+
|
49 |
+
== Installation ==
|
50 |
+
|
51 |
+
1. Go to `Plugins` in the Admin menu
|
52 |
+
2. Click on the button `Add new`
|
53 |
+
3. Search for `Email Encoder` and click 'Install Now' or click on the `upload` link to upload `email-encode-bundle.zip`
|
54 |
+
4. Click on `Activate plugin`
|
55 |
+
5. You will find the settings page unter "Settings -> Email Encoder" within your admin dashboard
|
56 |
+
|
57 |
+
== Frequently Asked Questions ==
|
58 |
+
|
59 |
+
= How can I test if an email address (or other content) is encoded? =
|
60 |
+
|
61 |
+
You can test this in three different ways.
|
62 |
+
|
63 |
+
The easiest (and most efficient) way is to use our website checker, which looks over your website and detects unprotected emails. It is completely free and you can [find it here](https://ironikus.com/email-checker/) on our website.
|
64 |
+
|
65 |
+
The second possibility is to enable the plugin option (in the admin panel) called *"Security Check"*.
|
66 |
+
When you are logged in and look on the page there will be a icon on the right side of each email address confirming it was successfully encoded. (This counts only for emails that are displayed within the body tag as HTML. Emails within data attributes or the header won't show this icon since otherwise the site breaks.)
|
67 |
+
|
68 |
+
The third possibility is to check the source code yourself by right-clicking on the page and select *View Source Code* (the exact text depends on the browser).
|
69 |
+
Now your (real) source code will be shown. Your email address should not be shown in a readable way in the source.
|
70 |
+
|
71 |
+
**Important:** in the element inspector of the browser the email address is *nearly always* shown, so don't worry about that. That is because the inspector shows a real time representation of the page. This means an encoded email address is already decoded and made usable for the visitor of the page.
|
72 |
+
|
73 |
+
= How do I encode my email address(es)? =
|
74 |
+
|
75 |
+
All email addresses are protected automatically by default, so it is not necessary to configure anything else.
|
76 |
+
|
77 |
+
In case you wish to customize it, we also offer some neatsettings, shortcodes and template functions. Please check the settings page within your WordPress website or [our documentation](https://ironikus.com/docs/article-categories/email-encoder/)
|
78 |
+
|
79 |
+
The visitors will see everything as normal, but the source behind it will now be encoded (for spambots), and looks, for example, like the code down below (Depending on your settings):
|
80 |
+
`<script type="text/javascript">/*<![CDATA[*/ML="mo@k<insc:r.y=-Ehe a\">f/lMt";MI="4CB8HC77=D0C5HJ1>H563DB@:AF=D0C5HJ190<6C0A2JA7J;6HDBBJ5JHA=DI<B?0C5HDEI<B?0C5H4GCE";OT="";for(j=0;j<MI.length;j++){OT+=ML.charAt(MI.charCodeAt(j)-48);}document.write(OT);/*]]>*/</script><noscript>*protected email*</noscript>`
|
81 |
+
|
82 |
+
For more information, please check out the [following page](https://ironikus.com/docs/knowledge-base/what-will-be-protected-2/)
|
83 |
+
|
84 |
+
= How do I encode phone numbers or other text? =
|
85 |
+
|
86 |
+
Just use the following shortcode within your posts:
|
87 |
+
`[eeb_protect_content]35-01235-468113[/eeb_protect_content]`
|
88 |
+
|
89 |
+
For other parts of your site you can use the template function `eeb_protect_content()`.
|
90 |
+
|
91 |
+
= My website looks broken after activating the plugin. What to do? =
|
92 |
+
|
93 |
+
First: Don't panic!
|
94 |
+
Simply create a support request within the [support forum](http://wordpress.org/support/plugin/email-encoder-bundle#postform) and we will come back to you as soon as possible with help.
|
95 |
+
|
96 |
+
= How can I encode content of BBPress, WP e-commerce or other plugins? =
|
97 |
+
|
98 |
+
Every content will be automatically protected. In case you find something, that doesn't work from your end, we are very happy to help!
|
99 |
+
|
100 |
+
= Can I use special characters (like Chinese)? =
|
101 |
+
|
102 |
+
Yes, since version 1.3.0 also special characters are supported.
|
103 |
+
|
104 |
+
== Screenshots ==
|
105 |
+
|
106 |
+
1. Admin Options Page
|
107 |
+
1. Check encoded email/content when logged in as admin
|
108 |
+
1. Email Encoder Form on the Site
|
109 |
+
|
110 |
+
== Other Notes
|
111 |
+
= Credits =
|
112 |
+
* [Adam Hunter](http://blueberryware.net) for the encode method 'JavaScript Escape' which is taken from his plugin [Email Spam Protection](http://blueberryware.net/2008/09/14/email-spam-protection/)
|
113 |
+
* [Tyler Akins](http://rumkin.com) for the encode method 'JavaScript ASCII Mixer'
|
114 |
+
* Title icon on Admin Options Page was made by [Jack Cai](http://www.doublejdesign.co.uk/)
|
115 |
+
|
116 |
+
== Changelog ==
|
117 |
+
|
118 |
+
= 2.0.0 =
|
119 |
+
* PLEASE READ BEFORE UPDATING
|
120 |
+
* THIS IS A COMPLETELY REFACTORED VERSION OF THE PLUGIN. EVEN WITH INVESTING TONS OF TIME INTO MAKING THIS PLUGIN AS MUCH BACKWARDS COMPATIBLE AS POSSIBLE, WE WOULD STILL APPRECIATE IF YOU TEST THIS VERSION BEFORE YPU UPDATE.
|
121 |
+
* THE PLUGIN GOT A COMPLETE OVERHAUL AND OFFERS NOW MORE OPTIMIZED FEATURES AND A SUPER SIMPLE USER INTERFACE. PLEASE FIND ALL CHANGES DOWN BELOW.
|
122 |
+
* Feature: Completely rewritten version of your beloved plugin
|
123 |
+
* Feature: Introduce FULL SITE PROTECTION (Automatically protect ALL emails within your page)
|
124 |
+
* Feature: Simplified settings (We cleaned the settings a lot, but you can still get some your old settings page back by activating the advanced checkbox :) )
|
125 |
+
* Feature: Feature to automatically detect the best protection method
|
126 |
+
* Feature: Choose from four new settings the strength of your protections
|
127 |
+
* Feature: Added admin security check icon to encoded input fields and encoded plain emails/texts, as well as to all shortcodes
|
128 |
+
* Feature: Also protect every single shortcode content
|
129 |
+
* Feature: Create images out of email addresses
|
130 |
+
* Feature: Protect header section automatically
|
131 |
+
* Feature: Added and refactored shortcodes. For a full list of shortcodes, please check this article: https://ironikus.com/docs/knowledge-base/available-shortcodes/
|
132 |
+
* Feature: Setting to deactivate the Encoder Form completely
|
133 |
+
* Feature: Choose converting plain emails to mailto links as an additional feature
|
134 |
+
* Feature: Change filter apply from "wp" to "init" (This allows you to also grab some ajax values to parse them directy encoded)
|
135 |
+
* Feature: Website checker to search your site for unprotected emails. Follow this URL for more information: https://ironikus.com/email-checker/
|
136 |
+
* Tweak: Backward compatibility to the new plugin settings
|
137 |
+
* Tweak: Completely performance optimized (We removed everything that is not necessary, included a better object caching and much more)
|
138 |
+
* Tweak: Optimized filter combinations
|
139 |
+
* Fix: The old logic broke some email encodings, especially with custom tags. We fixed all of them
|
140 |
+
* Fix: We fixed tons of bugs from the previous version
|
141 |
+
* Dev: Code rewritten on the newest WordPress standards
|
142 |
+
* Dev: Tons of new WordPress filters and actions. For a full list, please check https://ironikus.com/docs/article-categories/email-encoder/
|
143 |
+
* Deprecated: We removed the deprecated functions. Please make sure to update your custom logic to the newest standards.
|
144 |
+
|
145 |
+
= 1.53 =
|
146 |
+
* PLEASE READ BEFORE UPDATE
|
147 |
+
* THIS PLUGIN WILL BE REFACTORED WITH THE NEXT UPDATE
|
148 |
+
* TO PREPARE YOURSELF, YOU WILL FIND A LIST DOWN BELOW WITH THE CHANGES THAT AWAIT YOU
|
149 |
+
* - The plugin will be simplified using automatically the best protection for your site
|
150 |
+
* - The plugin will protect yout site out-of-the-box
|
151 |
+
* - We introduce a site-wide protection, not only based on WordPress shortcodes (This includes protection for your FULL site)
|
152 |
+
* - You will be able to choose the protection type. Available will be: Automatically (using Javascript), Automatically (Without Javascript), Protection Text, Entity encode
|
153 |
+
* - The plugin structure will be optimized using the current WordPress standards
|
154 |
+
* - Switch between full site protection and only WordPress filters
|
155 |
+
* - (Optional) Protect emails by converting them to PNG images (where applicable)
|
156 |
+
* - Round-robin method for javascript based protection (Choose the best method automatically from similar protection methods)
|
157 |
+
* - Tons of bugfixes
|
158 |
+
* - All settings will be fully compatible in any combination
|
159 |
+
* - The encoding form will continue to exists
|
160 |
+
* - All settings that have been available in the old version and will be available in the new version are backwards compatible
|
161 |
+
* - Display admin notice to all encoded emails (where applicable)
|
162 |
+
* ###################
|
163 |
+
* THE UPDATE WILL BE LAUNCHED WITHIN OCTOBER
|
164 |
+
* Tweak: Introduce our new partner MailOptin
|
165 |
+
|
166 |
+
= 1.5.2 =
|
167 |
+
* Tweak: Add popup window for admin success message of hidden email
|
168 |
+
* Fix: Fix bug for non-available antispambot() function
|
169 |
+
* Ironikus takes over development (https://ironikus.com)
|
170 |
+
|
171 |
+
= 1.51 =
|
172 |
+
* 2019-03-25
|
173 |
+
* minor bug fixes
|
174 |
+
* 161,000 downloads; 30,000 installs
|
175 |
+
|
176 |
+
= 1.4.6 =
|
177 |
+
* Fixed bug retina png and gif images
|
178 |
+
|
179 |
+
= 1.4.5 =
|
180 |
+
* Fixed ? params bug
|
181 |
+
|
182 |
+
= 1.4.4 =
|
183 |
+
* Fixed skip responsive images containing @
|
184 |
+
|
185 |
+
= 1.4.3 =
|
186 |
+
* Changed content
|
187 |
+
|
188 |
+
= 1.4.2 =
|
189 |
+
* Fixed potential xss vulnerability
|
190 |
+
|
191 |
+
= 1.4.1 =
|
192 |
+
* Fixed [preserving classes on mailto links](https://wordpress.org/support/topic/preserve-link-classes)
|
193 |
+
|
194 |
+
= 1.4.0 =
|
195 |
+
* Fixed bug prefilled email address in input fields
|
196 |
+
* Added option protection text for encoded content (other than email addresses)
|
197 |
+
|
198 |
+
= 1.3.0 =
|
199 |
+
* Also support special chars for the javascript methods, like é, â, ö, Chinese chars etcetera
|
200 |
+
* Fixed bug unchecking options "use shortcode" and "use deprecated"
|
201 |
+
|
202 |
+
= 1.2.1 =
|
203 |
+
* Fixed bug index php error
|
204 |
+
|
205 |
+
= 1.2.0 =
|
206 |
+
* Added filter for Encoder Form content (eeb_form_content)
|
207 |
+
|
208 |
+
= 1.1.0 =
|
209 |
+
* Added filters for changing regular expression for mailto links and email addresses
|
210 |
+
* Fixed bug don't encode when loading admin panel
|
211 |
+
|
212 |
+
= 1.0.2 =
|
213 |
+
* Fixed bug wrong "settings" link
|
214 |
+
* Fixed bug removing shortcodes RSS feed
|
215 |
+
|
216 |
+
= 1.0.1 =
|
217 |
+
* Fixed PHP support (same as WordPress)
|
218 |
+
|
219 |
+
= 1.0.0 =
|
220 |
+
* NOW ONLY SUPPORT FOR WP 3.4.0+
|
221 |
+
* Fixed bug deleting setting values when unregister (will now be deleted on uninstall)
|
222 |
+
* Fixed bug also possible to set protection text when RSS disabled
|
223 |
+
* Fixed bug saving metaboxes settings
|
224 |
+
* Added option support shortcodes in widgets
|
225 |
+
* Added option removing shortcodes for RSS feed
|
226 |
+
* Removed "random" method option
|
227 |
+
* Changed names for action and shortcode (prefixed with eeb_), optional the old names will still be supported
|
228 |
+
* Added template function for creating the encoder form
|
229 |
+
* Changed class en id names of the Encoder Form
|
230 |
+
|
231 |
+
= 0.80 =
|
232 |
+
* Added screen settings
|
233 |
+
* Registered metaboxes
|
234 |
+
* Fixed bug random method
|
235 |
+
* Workaround for display with special characters (like Chinese), works only with enc_html
|
236 |
+
|
237 |
+
= 0.71 =
|
238 |
+
* Option to make own menu item (in admin panel) for this plugin
|
239 |
+
* Option for showing "successfully encoded" check
|
240 |
+
* Fixed bug showing errors for calling wrong translate function
|
241 |
+
* Fixed bug always showing encoded check on site (for html encode method)
|
242 |
+
* Added workaround for saving disabled checkboxes in options table
|
243 |
+
* Fixed bug where encoded check was also applied on output of encoding form
|
244 |
+
|
245 |
+
= 0.70 =
|
246 |
+
* Fixed bug with extra params
|
247 |
+
* Changed texts and added help tabs on admin options page
|
248 |
+
* Changed visual check for encoded mails/content by showing icon and success message
|
249 |
+
* Solved that all attributes of mailto links remain when encoding
|
250 |
+
|
251 |
+
= 0.60 =
|
252 |
+
* Added hook "init_email_encoder_form" to add custom filters (of other plugins)
|
253 |
+
* Added JavaScript code encapsulation for ASCII method
|
254 |
+
* Solved reinstalling bug for setting right encoding method
|
255 |
+
* Fixed bug shortcodes encoded with HTML method
|
256 |
+
|
257 |
+
= 0.50 =
|
258 |
+
* Added encode method for all kind of contents (template function and shortcode "encode_content")
|
259 |
+
* Added extra param for additional html attributes (f.e. target="_blank")
|
260 |
+
* Added option to skip certain posts from being automatically encoded
|
261 |
+
* Added option custom protection text
|
262 |
+
* Removed "method" folder. Not possible to add own methods anymore.
|
263 |
+
* Other small changes and some refactoring
|
264 |
+
|
265 |
+
= 0.42 =
|
266 |
+
* Widget Logic options bug
|
267 |
+
|
268 |
+
= 0.41 =
|
269 |
+
* Fixed bug by improving regular expression for mailto links
|
270 |
+
* Changed script attribute `language` to `type`
|
271 |
+
* Script only loaded on options page (hopefully this solves the dashboard toggle problem some people are experiencing)
|
272 |
+
* Added support for widget_content filter of the Logic Widget plugin
|
273 |
+
|
274 |
+
= 0.40 =
|
275 |
+
* Added option for setting CSS classes
|
276 |
+
* Improved RSS protection
|
277 |
+
* Removed Lim_Email_Encoder class (now all handled by the main class)
|
278 |
+
* Enabled setting checkbox for filtering posts
|
279 |
+
* Fixed PHP / WP notices
|
280 |
+
* Added param for encode methods: $obj
|
281 |
+
|
282 |
+
= 0.32 =
|
283 |
+
* Fix IE bug
|
284 |
+
* Bug plain emails
|
285 |
+
* Optional "method" param for tag and template function, f.e. [encode_email email="test@domain.com" method="ascii"]
|
286 |
+
* Small adjustments
|
287 |
+
|
288 |
+
= 0.31 =
|
289 |
+
* Fixed tiny bug (incorrect var-name $priority on line 100 of email-encoder-bundle.php)
|
290 |
+
|
291 |
+
= 0.30 =
|
292 |
+
* Added protection for emails in RSS feeds
|
293 |
+
* Improved filtering tags [encode_email ... ]
|
294 |
+
* Improved ASCII and Escape method and added noscript message
|
295 |
+
* Solved an option bug (encode mailto links VS encode plain emails)
|
296 |
+
* Made some cosmetical adjustments on the options page
|
297 |
+
* Code refactoring
|
298 |
+
|
299 |
+
= 0.22 =
|
300 |
+
* First decodes entities before encoding email
|
301 |
+
* Added more wp filters for encoding
|
302 |
+
|
303 |
+
= 0.21 =
|
304 |
+
* Changed Encoder Form: HTML markup and JavaScript
|
305 |
+
* Made some minor adjustments and fixed little bugs
|
306 |
+
|
307 |
+
= 0.20 =
|
308 |
+
* Implemented internalization (including translation for nl_NL)
|
309 |
+
* Improved user-interface of the Admin Settings Page and the Encoder Form
|
310 |
+
* Added template function: encode_email_filter()
|
311 |
+
* Kept and added only high-quality encoding methods
|
312 |
+
* Refactored the code and changed method- and var-names within the classes
|
313 |
+
* Removed 3rd param $encode_display out of the encoding methods, display should always be encoded
|
314 |
+
* Added prefix 'lim_email_' to the encoding methods
|
315 |
+
|
316 |
+
= 0.12 =
|
317 |
+
* Nothing changed, but 0.11 had some errors because /methods directory was missing in the repository.
|
318 |
+
|
319 |
+
= 0.11 =
|
320 |
+
* also possible to use encode tag in widgets by activating the "filter widget" option
|
321 |
+
|
322 |
+
= 0.10 =
|
323 |
+
* Works with PHP4 and PHP5
|
324 |
+
* Methods: default_encode, wp_antispambot, anti_email_spam, email_escape, hide_email
|
325 |
+
* Use the tags: `[email_encode email=".." display=".."]`, `[email_encoder_form]`
|
326 |
+
* Template function: `email_encode()`
|