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