Version Description
- Fix IE bug
- Bug plain emails
- Optional "method" param for tag and template function, f.e. [encode_email email="test@domain.com" method="ascii"]
- Small adjustments
Download this release
Release Info
| Developer | freelancephp |
| Plugin | |
| Version | 0.32 |
| Comparing to | |
| See all releases | |
Code changes from version 0.31 to 0.32
- Lim_Email_Encoder.php +30 -14
- email-encoder-bundle.php +77 -45
- readme.txt +13 -1
Lim_Email_Encoder.php
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
/**
|
| 3 |
* Lim_Email_Encoder Class
|
| 4 |
*
|
| 5 |
-
* Protecting email-spamming by replacing them with one of the registered encoding-
|
| 6 |
*
|
| 7 |
* @package Lim_Email_Encoder
|
| 8 |
* @author Victor Villaverde Laan
|
| 9 |
-
* @version 0.
|
| 10 |
* @link http://www.freelancephp.net/email-encoder-php-class/
|
| 11 |
* @license MIT license
|
| 12 |
*/
|
|
@@ -47,16 +47,7 @@ class Lim_Email_Encoder {
|
|
| 47 |
* @return $this
|
| 48 |
*/
|
| 49 |
function set_method( $method ) {
|
| 50 |
-
|
| 51 |
-
// set a random method
|
| 52 |
-
$this->method = array_rand( $this->methods );
|
| 53 |
-
} elseif ( ! key_exists( $method, $this->methods ) ) {
|
| 54 |
-
// set default method
|
| 55 |
-
$this->method = 'lim_email_html_encode';
|
| 56 |
-
} else {
|
| 57 |
-
// add 'lim_email_' prefix if not already set
|
| 58 |
-
$this->method = ( strpos( $method, 'lim_email_' ) !== FALSE ) ? $method : 'lim_email_' . $method;
|
| 59 |
-
}
|
| 60 |
|
| 61 |
return $this;
|
| 62 |
}
|
|
@@ -65,9 +56,10 @@ class Lim_Email_Encoder {
|
|
| 65 |
* Encode the given email into an encoded HTML link
|
| 66 |
* @param string $email
|
| 67 |
* @param string $display Optional, if not set display will be the email
|
|
|
|
| 68 |
* @return string
|
| 69 |
*/
|
| 70 |
-
function encode( $email, $display = NULL ) {
|
| 71 |
// decode entities
|
| 72 |
$email = html_entity_decode( $email );
|
| 73 |
|
|
@@ -75,8 +67,15 @@ class Lim_Email_Encoder {
|
|
| 75 |
if ( $display === NULL )
|
| 76 |
$display = $email;
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
// get encoded email code
|
| 79 |
-
return call_user_func( $
|
| 80 |
}
|
| 81 |
|
| 82 |
/**
|
|
@@ -143,6 +142,23 @@ class Lim_Email_Encoder {
|
|
| 143 |
closedir( $handle );
|
| 144 |
}
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
} // end class Lim_Email_Encoder
|
| 147 |
|
| 148 |
/*?> // ommit closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */
|
| 2 |
/**
|
| 3 |
* Lim_Email_Encoder Class
|
| 4 |
*
|
| 5 |
+
* Protecting email-spamming by replacing them with one of the registered encoding-methods
|
| 6 |
*
|
| 7 |
* @package Lim_Email_Encoder
|
| 8 |
* @author Victor Villaverde Laan
|
| 9 |
+
* @version 0.32
|
| 10 |
* @link http://www.freelancephp.net/email-encoder-php-class/
|
| 11 |
* @license MIT license
|
| 12 |
*/
|
| 47 |
* @return $this
|
| 48 |
*/
|
| 49 |
function set_method( $method ) {
|
| 50 |
+
$this->method = $this->_get_method( $method );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
return $this;
|
| 53 |
}
|
| 56 |
* Encode the given email into an encoded HTML link
|
| 57 |
* @param string $email
|
| 58 |
* @param string $display Optional, if not set display will be the email
|
| 59 |
+
* @param string $method Optional, else the default setted method will; be used
|
| 60 |
* @return string
|
| 61 |
*/
|
| 62 |
+
function encode( $email, $display = NULL, $method = NULL ) {
|
| 63 |
// decode entities
|
| 64 |
$email = html_entity_decode( $email );
|
| 65 |
|
| 67 |
if ( $display === NULL )
|
| 68 |
$display = $email;
|
| 69 |
|
| 70 |
+
// set encode method
|
| 71 |
+
if ( $method === NULL ) {
|
| 72 |
+
$method = $this->method;
|
| 73 |
+
} else {
|
| 74 |
+
$method = $this->_get_method( $method );
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
// get encoded email code
|
| 78 |
+
return call_user_func( $method, $email, $display );
|
| 79 |
}
|
| 80 |
|
| 81 |
/**
|
| 142 |
closedir( $handle );
|
| 143 |
}
|
| 144 |
|
| 145 |
+
function _get_method( $method ) {
|
| 146 |
+
$method = strtolower( $method );
|
| 147 |
+
|
| 148 |
+
if ( 'random' == $method ) {
|
| 149 |
+
// set a random method
|
| 150 |
+
$method = array_rand( $this->methods );
|
| 151 |
+
} else {
|
| 152 |
+
// add 'lim_email_' prefix if not already set
|
| 153 |
+
$method = ( strpos( $method, 'lim_email_' ) !== FALSE ) ? $method : 'lim_email_' . $method;
|
| 154 |
+
|
| 155 |
+
if ( ! key_exists( $method, $this->methods ) )
|
| 156 |
+
$method = 'lim_email_html_encode'; // set default method
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
return $method;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
} // end class Lim_Email_Encoder
|
| 163 |
|
| 164 |
/*?> // ommit closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */
|
email-encoder-bundle.php
CHANGED
|
@@ -4,7 +4,7 @@ Plugin Name: Email Encoder Bundle
|
|
| 4 |
Plugin URI: http://www.freelancephp.net/email-encoder-php-class-wp-plugin/
|
| 5 |
Description: Protect email addresses on your site from spambots and being used for spamming by using one of the encoding methods.
|
| 6 |
Author: Victor Villaverde Laan
|
| 7 |
-
Version: 0.
|
| 8 |
Author URI: http://www.freelancephp.net
|
| 9 |
License: Dual licensed under the MIT and GPL licenses
|
| 10 |
*/
|
|
@@ -22,7 +22,7 @@ class WP_Email_Encoder_Bundle extends Lim_Email_Encoder {
|
|
| 22 |
* Current version
|
| 23 |
* @var string
|
| 24 |
*/
|
| 25 |
-
var $version = '0.
|
| 26 |
|
| 27 |
/**
|
| 28 |
* Used as prefix for options entry and could be used as text domain (for translations)
|
|
@@ -114,7 +114,8 @@ class WP_Email_Encoder_Bundle extends Lim_Email_Encoder {
|
|
| 114 |
add_filter( 'widget_text', array( $this, '_filter_callback' ), $priority );
|
| 115 |
|
| 116 |
// Only if Widget Logic plugin is installed
|
| 117 |
-
|
|
|
|
| 118 |
}
|
| 119 |
}
|
| 120 |
}
|
|
@@ -219,36 +220,64 @@ jQuery(function( $ ){
|
|
| 219 |
})
|
| 220 |
.blur();
|
| 221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
// add form-table class to Encoder Form tables
|
| 223 |
$( '.email-encoder-form table' ).addClass( 'form-table' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
});
|
| 225 |
</script>
|
| 226 |
<div class="wrap">
|
| 227 |
<div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/icon-email-encoder-bundle.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
|
| 228 |
<h2>Email Encoder Bundle</h2>
|
| 229 |
|
| 230 |
-
<form method="post" action="options.php">
|
| 231 |
<script language="javascript">
|
| 232 |
var methodInfo = <?php echo json_encode( $this->methods ) ?>;
|
| 233 |
</script>
|
| 234 |
-
<?php
|
| 235 |
-
settings_fields( $this->domain );
|
| 236 |
-
$this->_set_options();
|
| 237 |
-
$options = $this->options;
|
| 238 |
-
?>
|
| 239 |
<div class="postbox-container metabox-holder meta-box-sortables" style="width: 69%">
|
| 240 |
<div style="margin:0 5px;">
|
| 241 |
<div class="postbox">
|
| 242 |
<div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
|
| 243 |
<h3 class="hndle"><?php _e( 'General Settings' ) ?></h3>
|
| 244 |
<div class="inside">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
<fieldset class="options">
|
| 246 |
<table class="form-table">
|
| 247 |
<tr>
|
| 248 |
<th><?php _e( 'Choose encoding method', $this->domain ) ?></th>
|
| 249 |
<td><label><select id="<?php echo $this->options_name ?>[method]" name="<?php echo $this->options_name ?>[method]" class="method-info-select postform">
|
| 250 |
<?php foreach ( $this->methods AS $method => $info ): ?>
|
| 251 |
-
<option value="<?php echo $method ?>" <?php if ( $this->method == $method ) echo 'selected="selected"' ?>><?php echo $info[ 'name' ] ?></option>
|
| 252 |
<?php endforeach; ?>
|
| 253 |
<option value="random" <?php if ( $this->method == 'random' ) echo 'selected="selected"' ?>><?php echo __( 'Random', $this->domain ) ?></option>
|
| 254 |
</select>
|
|
@@ -261,15 +290,12 @@ jQuery(function( $ ){
|
|
| 261 |
<label><input type="checkbox" name="<?php echo $this->options_name ?>[encode_tags]" value="1" checked="checked" disabled="disabled" />
|
| 262 |
<span><?php _e( 'Encode <code>[encode_email]</code> tags', $this->domain ) ?></span>
|
| 263 |
</label>
|
| 264 |
-
<br/><label><input type="checkbox" id="
|
| 265 |
<span><?php _e( 'Encode mailto-links', $this->domain ) ?></span>
|
| 266 |
</label>
|
| 267 |
-
<br/><label><input type="checkbox" id="
|
| 268 |
<span><?php _e( 'Replace plain emailaddresses to encoded mailto-links', $this->domain ) ?></span>
|
| 269 |
</label>
|
| 270 |
-
<?php if ( $enc_conflict ): ?>
|
| 271 |
-
<br/><span class="description"><?php _e( 'Warning: "WP Mailto Links Plugin" is activated, turn off this option when a conflict occures.', $this->domain ) ?></span>
|
| 272 |
-
<?php endif; ?>
|
| 273 |
</td>
|
| 274 |
</tr>
|
| 275 |
<tr>
|
|
@@ -291,9 +317,19 @@ jQuery(function( $ ){
|
|
| 291 |
</tr>
|
| 292 |
</table>
|
| 293 |
</fieldset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
<p class="submit">
|
| 295 |
<input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
|
| 296 |
</p>
|
|
|
|
| 297 |
</div>
|
| 298 |
</div>
|
| 299 |
|
|
@@ -303,12 +339,12 @@ jQuery(function( $ ){
|
|
| 303 |
<div class="inside">
|
| 304 |
<h4><?php _e( 'Tags', $this->domain ) ?></h4>
|
| 305 |
<ul>
|
| 306 |
-
<li><code>[encode_email email="..." display="..."]</code> <span class="description"><?php _e( 'Encode the given email
|
| 307 |
<li><code>[email_encoder_form]</code> <span class="description"><?php _e( 'Puts an email encoder form in your post', $this->domain ) ?></span></li>
|
| 308 |
</ul>
|
| 309 |
<h4><?php _e( 'Template functions' ) ?></h4>
|
| 310 |
<ul>
|
| 311 |
-
<li><code><?php echo encode_email( 'info@myemail.com', 'My Email' ); ?></code> <span class="description"><?php _e( 'Encode the given email
|
| 312 |
<li><code><?php echo encode_email_filter( $content ); ?></code> <span class="description"><?php _e( 'Filter the given content for emails to encode', $this->domain ) ?></span></li>
|
| 313 |
</ul>
|
| 314 |
</div>
|
|
@@ -319,18 +355,6 @@ jQuery(function( $ ){
|
|
| 319 |
<h3 class="hndle"><?php _e( 'Email Encoder Form', $this->domain ) ?></h3>
|
| 320 |
<div class="inside">
|
| 321 |
<?php echo $this->get_encoder_form(); ?>
|
| 322 |
-
|
| 323 |
-
<fieldset class="options">
|
| 324 |
-
<table class="form-table">
|
| 325 |
-
<tr>
|
| 326 |
-
<th><?php _e( 'Show "powered by"-link', $this->domain ) ?></th>
|
| 327 |
-
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[powered_by]" name="<?php echo $this->options_name ?>[powered_by]" value="1" <?php checked('1', (int) $options['powered_by']); ?> /> <span><?php _e( 'Show the "powered by"-link on bottom of the encode form', $this->domain ) ?></span></label></td>
|
| 328 |
-
</tr>
|
| 329 |
-
</table>
|
| 330 |
-
</fieldset>
|
| 331 |
-
<p class="submit">
|
| 332 |
-
<input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
|
| 333 |
-
</p>
|
| 334 |
</div>
|
| 335 |
</div>
|
| 336 |
</div>
|
|
@@ -359,21 +383,32 @@ jQuery(function( $ ){
|
|
| 359 |
<h4><img src="<?php echo plugins_url( 'images/icon-wp-external-links.png', __FILE__ ) ?>" width="16" height="16" /> WP External Links</h4>
|
| 360 |
<p><?php _e( 'Manage external links on your site: open in new window/tab, set icon, add "external", add "nofollow" and more.', $this->domain ) ?></p>
|
| 361 |
<ul>
|
| 362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
<li><a href="http://wordpress.org/extend/plugins/wp-external-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-external-links-plugin/" target="_blank">FreelancePHP.net</a></li>
|
| 364 |
</ul>
|
| 365 |
|
| 366 |
<h4><img src="<?php echo plugins_url( 'images/icon-wp-mailto-links.png', __FILE__ ) ?>" width="16" height="16" /> WP Mailto Links</h4>
|
| 367 |
<p><?php _e( 'Manage mailto links on your site and protect emails from spambots, set mail icon and more.', $this->domain ) ?></p>
|
| 368 |
<ul>
|
| 369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
<li><a href="http://wordpress.org/extend/plugins/wp-mailto-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-mailto-links-plugin/" target="_blank">FreelancePHP.net</a></li>
|
| 371 |
</ul>
|
| 372 |
</div>
|
| 373 |
</div>
|
| 374 |
</div>
|
| 375 |
</div>
|
| 376 |
-
</form>
|
| 377 |
<div class="clear"></div>
|
| 378 |
</div>
|
| 379 |
<?php
|
|
@@ -515,16 +550,14 @@ jQuery(function( $ ){
|
|
| 515 |
function _callback_shortcode( $match ) {
|
| 516 |
$attrs = shortcode_parse_atts( $match[1] );
|
| 517 |
|
| 518 |
-
if ( key_exists( 'email', $attrs ) )
|
| 519 |
-
|
| 520 |
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
$display = $attrs[ 'email' ];
|
| 525 |
-
}
|
| 526 |
|
| 527 |
-
return $this->encode( $email, $display );
|
| 528 |
}
|
| 529 |
|
| 530 |
/**
|
|
@@ -559,9 +592,7 @@ if ( ! empty( $_GET['ajax'] ) ):
|
|
| 559 |
$email = $_GET['email'];
|
| 560 |
$display = ( empty( $_GET['display'] ) ) ? $email : $_GET['display'];
|
| 561 |
|
| 562 |
-
$WP_Email_Encoder_Bundle->
|
| 563 |
-
|
| 564 |
-
echo $WP_Email_Encoder_Bundle->encode( $email, $display );
|
| 565 |
exit;
|
| 566 |
endif;
|
| 567 |
|
|
@@ -571,12 +602,13 @@ endif;
|
|
| 571 |
* @global WP_Email_Encoder $WP_Email_Encoder_Bundle
|
| 572 |
* @param string $email
|
| 573 |
* @param string $display if non given will be same as email
|
|
|
|
| 574 |
* @return string
|
| 575 |
*/
|
| 576 |
if ( ! function_exists( 'encode_email' ) ):
|
| 577 |
-
function encode_email( $email, $display = NULL ) {
|
| 578 |
global $WP_Email_Encoder_Bundle;
|
| 579 |
-
return $WP_Email_Encoder_Bundle->encode( $email, $display );
|
| 580 |
}
|
| 581 |
endif;
|
| 582 |
|
| 4 |
Plugin URI: http://www.freelancephp.net/email-encoder-php-class-wp-plugin/
|
| 5 |
Description: Protect email addresses on your site from spambots and being used for spamming by using one of the encoding methods.
|
| 6 |
Author: Victor Villaverde Laan
|
| 7 |
+
Version: 0.32
|
| 8 |
Author URI: http://www.freelancephp.net
|
| 9 |
License: Dual licensed under the MIT and GPL licenses
|
| 10 |
*/
|
| 22 |
* Current version
|
| 23 |
* @var string
|
| 24 |
*/
|
| 25 |
+
var $version = '0.32';
|
| 26 |
|
| 27 |
/**
|
| 28 |
* Used as prefix for options entry and could be used as text domain (for translations)
|
| 114 |
add_filter( 'widget_text', array( $this, '_filter_callback' ), $priority );
|
| 115 |
|
| 116 |
// Only if Widget Logic plugin is installed
|
| 117 |
+
// @todo Doesn't work and cannot find another way to filter all widget contents
|
| 118 |
+
//add_filter( 'widget_content', array( $this, 'filter_content' ), $priority );
|
| 119 |
}
|
| 120 |
}
|
| 121 |
}
|
| 220 |
})
|
| 221 |
.blur();
|
| 222 |
|
| 223 |
+
// "has effect on"
|
| 224 |
+
$( 'input#encode_emails' )
|
| 225 |
+
.change(function(){
|
| 226 |
+
if ( $( this ).attr( 'checked' ) )
|
| 227 |
+
$( 'input#encode_mailtos' ).attr( 'checked', true );
|
| 228 |
+
})
|
| 229 |
+
.change();
|
| 230 |
+
|
| 231 |
+
$( 'input#encode_mailtos' )
|
| 232 |
+
.change(function(){
|
| 233 |
+
if ( ! $( this ).attr( 'checked' ) )
|
| 234 |
+
$( 'input#encode_emails' ).attr( 'checked', false );
|
| 235 |
+
});
|
| 236 |
+
|
| 237 |
// add form-table class to Encoder Form tables
|
| 238 |
$( '.email-encoder-form table' ).addClass( 'form-table' );
|
| 239 |
+
|
| 240 |
+
// slide postbox
|
| 241 |
+
$( '.postbox' ).find( '.handlediv, .hndle' ).click(function(){
|
| 242 |
+
var $inside = $( this ).parent().find( '.inside' );
|
| 243 |
+
|
| 244 |
+
if ( $inside.css( 'display' ) == 'block' ) {
|
| 245 |
+
$inside.css({ display:'block' }).slideUp();
|
| 246 |
+
} else {
|
| 247 |
+
$inside.css({ display:'none' }).slideDown();
|
| 248 |
+
}
|
| 249 |
+
});
|
| 250 |
});
|
| 251 |
</script>
|
| 252 |
<div class="wrap">
|
| 253 |
<div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/icon-email-encoder-bundle.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
|
| 254 |
<h2>Email Encoder Bundle</h2>
|
| 255 |
|
|
|
|
| 256 |
<script language="javascript">
|
| 257 |
var methodInfo = <?php echo json_encode( $this->methods ) ?>;
|
| 258 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
<div class="postbox-container metabox-holder meta-box-sortables" style="width: 69%">
|
| 260 |
<div style="margin:0 5px;">
|
| 261 |
<div class="postbox">
|
| 262 |
<div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
|
| 263 |
<h3 class="hndle"><?php _e( 'General Settings' ) ?></h3>
|
| 264 |
<div class="inside">
|
| 265 |
+
<form method="post" action="options.php">
|
| 266 |
+
<?php
|
| 267 |
+
settings_fields( $this->domain );
|
| 268 |
+
$this->_set_options();
|
| 269 |
+
$options = $this->options;
|
| 270 |
+
?>
|
| 271 |
+
<?php if ( is_plugin_active( 'wp-mailto-links/wp-mailto-links.php' ) ): ?>
|
| 272 |
+
<p class="description"><?php _e( 'Warning: "WP Mailto Links"-plugin is also activated, which could cause conflicts.', $this->domain ) ?></p>
|
| 273 |
+
<?php endif; ?>
|
| 274 |
<fieldset class="options">
|
| 275 |
<table class="form-table">
|
| 276 |
<tr>
|
| 277 |
<th><?php _e( 'Choose encoding method', $this->domain ) ?></th>
|
| 278 |
<td><label><select id="<?php echo $this->options_name ?>[method]" name="<?php echo $this->options_name ?>[method]" class="method-info-select postform">
|
| 279 |
<?php foreach ( $this->methods AS $method => $info ): ?>
|
| 280 |
+
<option value="<?php echo $method ?>" <?php if ( $this->method == $method ) echo 'selected="selected"' ?>><?php echo $info[ 'name' ]; if ( $method == 'lim_email_ascii' ){ echo ' (recommended)'; } ?></option>
|
| 281 |
<?php endforeach; ?>
|
| 282 |
<option value="random" <?php if ( $this->method == 'random' ) echo 'selected="selected"' ?>><?php echo __( 'Random', $this->domain ) ?></option>
|
| 283 |
</select>
|
| 290 |
<label><input type="checkbox" name="<?php echo $this->options_name ?>[encode_tags]" value="1" checked="checked" disabled="disabled" />
|
| 291 |
<span><?php _e( 'Encode <code>[encode_email]</code> tags', $this->domain ) ?></span>
|
| 292 |
</label>
|
| 293 |
+
<br/><label><input type="checkbox" id="encode_mailtos" name="<?php echo $this->options_name ?>[encode_mailtos]" value="1" <?php checked('1', (int) $options['encode_mailtos']); ?> />
|
| 294 |
<span><?php _e( 'Encode mailto-links', $this->domain ) ?></span>
|
| 295 |
</label>
|
| 296 |
+
<br/><label><input type="checkbox" id="encode_emails" name="<?php echo $this->options_name ?>[encode_emails]" value="1" <?php checked('1', (int) $options['encode_emails']); ?> />
|
| 297 |
<span><?php _e( 'Replace plain emailaddresses to encoded mailto-links', $this->domain ) ?></span>
|
| 298 |
</label>
|
|
|
|
|
|
|
|
|
|
| 299 |
</td>
|
| 300 |
</tr>
|
| 301 |
<tr>
|
| 317 |
</tr>
|
| 318 |
</table>
|
| 319 |
</fieldset>
|
| 320 |
+
|
| 321 |
+
<fieldset class="options">
|
| 322 |
+
<table class="form-table">
|
| 323 |
+
<tr>
|
| 324 |
+
<th><?php _e( '"Email Encoder Form" settings', $this->domain ) ?></th>
|
| 325 |
+
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[powered_by]" name="<?php echo $this->options_name ?>[powered_by]" value="1" <?php checked('1', (int) $options['powered_by']); ?> /> <span><?php _e( 'Show the "powered by"-link on bottom of the encode form', $this->domain ) ?></span></label></td>
|
| 326 |
+
</tr>
|
| 327 |
+
</table>
|
| 328 |
+
</fieldset>
|
| 329 |
<p class="submit">
|
| 330 |
<input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
|
| 331 |
</p>
|
| 332 |
+
</form>
|
| 333 |
</div>
|
| 334 |
</div>
|
| 335 |
|
| 339 |
<div class="inside">
|
| 340 |
<h4><?php _e( 'Tags', $this->domain ) ?></h4>
|
| 341 |
<ul>
|
| 342 |
+
<li><code>[encode_email email="..." display="..." method="..."]</code> <span class="description"><?php _e( 'Encode the given email<br/>"display" is optional otherwise the email wil be used as display<br/>"method" is optional and can be set to use a different method then the options value', $this->domain ) ?></span></li>
|
| 343 |
<li><code>[email_encoder_form]</code> <span class="description"><?php _e( 'Puts an email encoder form in your post', $this->domain ) ?></span></li>
|
| 344 |
</ul>
|
| 345 |
<h4><?php _e( 'Template functions' ) ?></h4>
|
| 346 |
<ul>
|
| 347 |
+
<li><code><?php echo encode_email( 'info@myemail.com', 'My Email' ); ?></code> <span class="description"><?php _e( 'Encode the given email<br/>the second param is $display and optional<br/>the thrid param is $method and optional', $this->domain ) ?></span></li>
|
| 348 |
<li><code><?php echo encode_email_filter( $content ); ?></code> <span class="description"><?php _e( 'Filter the given content for emails to encode', $this->domain ) ?></span></li>
|
| 349 |
</ul>
|
| 350 |
</div>
|
| 355 |
<h3 class="hndle"><?php _e( 'Email Encoder Form', $this->domain ) ?></h3>
|
| 356 |
<div class="inside">
|
| 357 |
<?php echo $this->get_encoder_form(); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
</div>
|
| 359 |
</div>
|
| 360 |
</div>
|
| 383 |
<h4><img src="<?php echo plugins_url( 'images/icon-wp-external-links.png', __FILE__ ) ?>" width="16" height="16" /> WP External Links</h4>
|
| 384 |
<p><?php _e( 'Manage external links on your site: open in new window/tab, set icon, add "external", add "nofollow" and more.', $this->domain ) ?></p>
|
| 385 |
<ul>
|
| 386 |
+
<?php if ( is_plugin_active( 'wp-external-links/wp-external-links.php' ) ): ?>
|
| 387 |
+
<li><?php _e( 'This plugin is already activated.', $this->domain ) ?> <a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/options-general.php?page=wp-external-links/wp-external-links.php"><?php _e( 'Settings' ) ?></a></li>
|
| 388 |
+
<?php elseif( file_exists( WP_PLUGIN_DIR . '/wp-external-links/wp-external-links.php' ) ): ?>
|
| 389 |
+
<li><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugins.php?plugin_status=inactive"><?php _e( 'Activate this plugin.', $this->domain ) ?></a></li>
|
| 390 |
+
<?php else: ?>
|
| 391 |
+
<li><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugin-install.php?tab=search&type=term&s=WP+External+Links+freelancephp&plugin-search-input=Search+Plugins"><?php _e( 'Get this plugin now', $this->domain ) ?></a></li>
|
| 392 |
+
<?php endif; ?>
|
| 393 |
<li><a href="http://wordpress.org/extend/plugins/wp-external-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-external-links-plugin/" target="_blank">FreelancePHP.net</a></li>
|
| 394 |
</ul>
|
| 395 |
|
| 396 |
<h4><img src="<?php echo plugins_url( 'images/icon-wp-mailto-links.png', __FILE__ ) ?>" width="16" height="16" /> WP Mailto Links</h4>
|
| 397 |
<p><?php _e( 'Manage mailto links on your site and protect emails from spambots, set mail icon and more.', $this->domain ) ?></p>
|
| 398 |
<ul>
|
| 399 |
+
<?php if ( is_plugin_active( 'wp-mailto-links/wp-mailto-links.php' ) ): ?>
|
| 400 |
+
<li><?php _e( 'This plugin is already activated.', $this->domain ) ?> <a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/options-general.php?page=wp-mailto-links/wp-mailto-links.php"><?php _e( 'Settings' ) ?></a></li>
|
| 401 |
+
<?php elseif( file_exists( WP_PLUGIN_DIR . '/wp-mailto-links/wp-mailto-links.php' ) ): ?>
|
| 402 |
+
<li><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugins.php?plugin_status=inactive"><?php _e( 'Activate this plugin.', $this->domain ) ?></a></li>
|
| 403 |
+
<?php else: ?>
|
| 404 |
+
<li><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugin-install.php?tab=search&type=term&s=WP+Mailto+Links+freelancephp&plugin-search-input=Search+Plugins"><?php _e( 'Get this plugin now', $this->domain ) ?></a></li>
|
| 405 |
+
<?php endif; ?>
|
| 406 |
<li><a href="http://wordpress.org/extend/plugins/wp-mailto-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-mailto-links-plugin/" target="_blank">FreelancePHP.net</a></li>
|
| 407 |
</ul>
|
| 408 |
</div>
|
| 409 |
</div>
|
| 410 |
</div>
|
| 411 |
</div>
|
|
|
|
| 412 |
<div class="clear"></div>
|
| 413 |
</div>
|
| 414 |
<?php
|
| 550 |
function _callback_shortcode( $match ) {
|
| 551 |
$attrs = shortcode_parse_atts( $match[1] );
|
| 552 |
|
| 553 |
+
if ( ! key_exists( 'email', $attrs ) )
|
| 554 |
+
return '';
|
| 555 |
|
| 556 |
+
$email = $attrs[ 'email' ];
|
| 557 |
+
$display = ( key_exists( 'display', $attrs ) ) ? $attrs[ 'display' ] : $attrs[ 'email' ];
|
| 558 |
+
$method = ( key_exists( 'method', $attrs ) ) ? $attrs[ 'method' ] : NULL;
|
|
|
|
|
|
|
| 559 |
|
| 560 |
+
return $this->encode( $email, $display, $method );
|
| 561 |
}
|
| 562 |
|
| 563 |
/**
|
| 592 |
$email = $_GET['email'];
|
| 593 |
$display = ( empty( $_GET['display'] ) ) ? $email : $_GET['display'];
|
| 594 |
|
| 595 |
+
echo $WP_Email_Encoder_Bundle->encode( $email, $display, $method );
|
|
|
|
|
|
|
| 596 |
exit;
|
| 597 |
endif;
|
| 598 |
|
| 602 |
* @global WP_Email_Encoder $WP_Email_Encoder_Bundle
|
| 603 |
* @param string $email
|
| 604 |
* @param string $display if non given will be same as email
|
| 605 |
+
* @param string $method Optional, else the default setted method will; be used
|
| 606 |
* @return string
|
| 607 |
*/
|
| 608 |
if ( ! function_exists( 'encode_email' ) ):
|
| 609 |
+
function encode_email( $email, $display = NULL, $method = NULL ) {
|
| 610 |
global $WP_Email_Encoder_Bundle;
|
| 611 |
+
return $WP_Email_Encoder_Bundle->encode( $email, $display, $method );
|
| 612 |
}
|
| 613 |
endif;
|
| 614 |
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: freelancephp
|
|
| 3 |
Tags: email, hide, mailto, spam, protection, spambots, encoder, encrypt, encode, obfuscate, antispam, spamming
|
| 4 |
Requires at least: 2.7.0
|
| 5 |
Tested up to: 3.1
|
| 6 |
-
Stable tag: 0.
|
| 7 |
|
| 8 |
Protect email addresses on your site from spambots and being used for spamming. This plugin encodes all email adresses so spambots cannot read them.
|
| 9 |
|
|
@@ -70,6 +70,12 @@ Optionally you can add a name and description to be showed in the admin panel, l
|
|
| 70 |
|
| 71 |
== Changelog ==
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
= 0.31 =
|
| 74 |
* Fixed tiny bug (incorrect var-name $priority on line 100 of email-encoder-bundle.php)
|
| 75 |
|
|
@@ -119,6 +125,12 @@ Optionally you can add a name and description to be showed in the admin panel, l
|
|
| 119 |
|
| 120 |
== Upgrade Notice ==
|
| 121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
= 0.30 =
|
| 123 |
* Some bug fixes
|
| 124 |
* New: email protection for RSS feeds
|
| 3 |
Tags: email, hide, mailto, spam, protection, spambots, encoder, encrypt, encode, obfuscate, antispam, spamming
|
| 4 |
Requires at least: 2.7.0
|
| 5 |
Tested up to: 3.1
|
| 6 |
+
Stable tag: 0.32
|
| 7 |
|
| 8 |
Protect email addresses on your site from spambots and being used for spamming. This plugin encodes all email adresses so spambots cannot read them.
|
| 9 |
|
| 70 |
|
| 71 |
== Changelog ==
|
| 72 |
|
| 73 |
+
= 0.32 =
|
| 74 |
+
* Fix IE bug
|
| 75 |
+
* Bug plain emails
|
| 76 |
+
* Optional "method" param for tag and template function, f.e. [encode_email email="test@domain.com" method="ascii"]
|
| 77 |
+
* Small adjustments
|
| 78 |
+
|
| 79 |
= 0.31 =
|
| 80 |
* Fixed tiny bug (incorrect var-name $priority on line 100 of email-encoder-bundle.php)
|
| 81 |
|
| 125 |
|
| 126 |
== Upgrade Notice ==
|
| 127 |
|
| 128 |
+
= 0.32 =
|
| 129 |
+
* Fix IE bug
|
| 130 |
+
* Bug plain emails
|
| 131 |
+
* Optional "method" param for tag and template function
|
| 132 |
+
* Small adjustments
|
| 133 |
+
|
| 134 |
= 0.30 =
|
| 135 |
* Some bug fixes
|
| 136 |
* New: email protection for RSS feeds
|
