email-encoder-bundle
Last commit date
images
7 years ago
includes
7 years ago
js
10 years ago
email-encoder-bundle.php
7 years ago
readme.txt
7 years ago
email-encoder-bundle.php
75 lines
| 1 | <?php |
| 2 | /* |
| 3 | Plugin Name: Email Encoder - Protect Email Address |
| 4 | Plugin URI: https://wordpress.org/plugins/email-encoder-bundle/ |
| 5 | Description: Protect email addresses on your site and hide them from spambots by encoding them. Easy to use & flexible. |
| 6 | Author: WebFactory Ltd |
| 7 | Version: 1.51 |
| 8 | Author URI: https://www.webfactoryltd.com/ |
| 9 | License: Dual licensed under the MIT and GPL licenses |
| 10 | Text Domain: email-encoder-bundle |
| 11 | */ |
| 12 | |
| 13 | // this is an include only WP file |
| 14 | if (!defined('ABSPATH')) { |
| 15 | die; |
| 16 | } |
| 17 | |
| 18 | // constants |
| 19 | if (!defined('EMAIL_ENCODER_BUNDLE_VERSION')) { define('EMAIL_ENCODER_BUNDLE_VERSION', '1.5'); } |
| 20 | if (!defined('EMAIL_ENCODER_BUNDLE_FILE')) { define('EMAIL_ENCODER_BUNDLE_FILE', defined('TEST_EEB_PLUGIN_FILE') ? TEST_EEB_PLUGIN_FILE : __FILE__); } |
| 21 | if (!defined('EMAIL_ENCODER_BUNDLE_KEY')) { define('EMAIL_ENCODER_BUNDLE_KEY', 'WP_Email_Encoder_Bundle'); } |
| 22 | if (!defined('EMAIL_ENCODER_BUNDLE_OPTIONS_NAME')) { define('EMAIL_ENCODER_BUNDLE_OPTIONS_NAME', 'WP_Email_Encoder_Bundle_options'); } |
| 23 | if (!defined('EMAIL_ENCODER_BUNDLE_ADMIN_PAGE')) { define('EMAIL_ENCODER_BUNDLE_ADMIN_PAGE', 'email-encoder-bundle-settings'); } |
| 24 | |
| 25 | // wp_version var was used by older WP versions |
| 26 | if (!isset($wp_version)) { |
| 27 | $wp_version = get_bloginfo('version'); |
| 28 | } |
| 29 | |
| 30 | // check plugin compatibility |
| 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 | |
| 38 | // create instance |
| 39 | $Eeb_Site = Eeb_Site::getInstance(); |
| 40 | |
| 41 | // handle AJAX request |
| 42 | // input vars |
| 43 | if (!empty($_POST['eebActionEncodeEmail'])) { |
| 44 | $eebActionEncodeEmail = sanitize_text_field($_POST['eebActionEncodeEmail']); |
| 45 | $method = sanitize_text_field($_POST['eebMethod']); |
| 46 | $email = sanitize_email($_POST['eebEmail']); |
| 47 | $display = wp_kses_post($_POST['eebDisplay']); |
| 48 | |
| 49 | if (empty($display)) { |
| 50 | $display = $email; |
| 51 | } |
| 52 | |
| 53 | echo $Eeb_Site->encode_email($email, $display, '', $method, true); |
| 54 | exit; |
| 55 | } |
| 56 | |
| 57 | } else { |
| 58 | |
| 59 | // set error message |
| 60 | if (!function_exists('eeb_error_notice')): |
| 61 | function eeb_error_notice() { |
| 62 | $plugin_title = get_admin_page_title(); |
| 63 | |
| 64 | echo '<div class="error">' |
| 65 | . sprintf(__('<p>Warning - The plugin <strong>%s</strong> requires PHP 5.2.4+ and WP 3.6+. Please upgrade your PHP and/or WordPress.' |
| 66 | . '<br/>Disable the plugin to remove this message.</p>' |
| 67 | , 'email-encoder-bundle'), $plugin_title) |
| 68 | . '</div>'; |
| 69 | } |
| 70 | |
| 71 | add_action('admin_notices', 'eeb_error_notice'); |
| 72 | endif; |
| 73 | |
| 74 | } |
| 75 |