Email Encoder Bundle – Protect Email Address - Version 0.20

Version Description

  • Implemented internalization (including translation for nl_NL)
  • Improved user-interface of the Admin Settings Page and the Encoder Form
  • Added template function: encode_email_filter()
  • Kept and added only high-quality encoding methods
  • Refactored the code and changed method and var names within the classes
  • Fixed bugs occured using anti_email_spam() and hide_email() method
Download this release

Release Info

Developer freelancephp
Plugin Icon 128x128 Email Encoder Bundle – Protect Email Address
Version 0.20
Comparing to
See all releases

Code changes from version 0.12 to 0.20

GPL-license.txt CHANGED
@@ -1,4 +1,4 @@
1
- Version 2, June 1991
2
 
3
  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
4
  51 Franklin St, Fifth Floor, Boston, MA 02110, USA
1
+ Version 2, June 1991
2
 
3
  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
4
  51 Franklin St, Fifth Floor, Boston, MA 02110, USA
lim-email-encoder.php → Lim_Email_Encoder.php RENAMED
@@ -1,12 +1,14 @@
1
  <?php
2
  /**
3
- * Class Lim_Email_Encoder
 
4
  * Protecting email-spamming by replacing them with one of the registered encoding- or javascript-methods
5
- * @author Victor Villaverde Laan
6
  * @package Lim_Email_Encoder
7
- * @version 0.1
8
- * @link http://www.freelancephp.net/email-encoder
9
- * @license Dual licensed under the MIT and GPL licenses
 
10
  */
11
  class Lim_Email_Encoder {
12
 
@@ -16,14 +18,10 @@ class Lim_Email_Encoder {
16
  var $methods = array();
17
 
18
  /**
19
- * @var array
20
  */
21
- var $options = array(
22
- 'method' => 'default_encode',
23
- 'encode_display' => TRUE, // encode display with the default encoder
24
- 'encode_mailto' => TRUE,
25
- 'replace_emails' => TRUE,
26
- );
27
 
28
  /**
29
  * PHP4 constructor
@@ -35,59 +33,58 @@ class Lim_Email_Encoder {
35
  /**
36
  * PHP5 constructor
37
  */
38
- function __construct() {
39
  // include all available method files
40
- $this->_include_method_files();
 
 
 
41
  }
42
 
43
  /**
44
  * Set the encode method to use
45
- * @param string $key can be a method key or 'random'
 
46
  */
47
- function set_method( $key ) {
48
- if ( 'random' == $key ) {
49
  // set a random method
50
- $this->options['method'] = array_rand( $this->methods );
51
- } else if ( ! key_exists( $key, $this->methods ) ) {
52
  // set default method
53
- $this->options['method'] = 'default_encode';
54
  } else {
55
- $this->options['method'] = $key;
56
  }
 
 
57
  }
58
 
59
  /**
60
- * Encode the given email into an encoded link
61
  * @param string $email
62
- * @param string $display
63
  * @return string
64
  */
65
- function encode_email( $email, $display = NULL ) {
66
  if ( $display === NULL )
67
  $display = $email;
68
 
69
- // get the encode method to use
70
- $encode_method = $this->methods[ $this->options['method'] ];
71
-
72
  // get encoded email code
73
- return call_user_func( $encode_method, $email, $display, $this->options['encode_display'] );
74
  }
75
 
76
  /**
77
- * Filter for encoding emails in the given content
78
  * @param string $content
 
 
 
79
  * @return string
80
  */
81
- function encode_filter( $content ) {
82
- // replace plain emails to a content tag
83
- if ( $this->options['replace_emails'] ) {
84
- $email_pattern = '/([ ])([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6})/i';
85
- $replacement = '${1}[encode_email email="${2}" display="${2}"]';
86
- $content = preg_replace( $email_pattern, $replacement, $content );
87
- }
88
-
89
  // encode mailto links
90
- if ( $this->options['encode_mailto'] ) {
91
  $mailto_pattern = '/<a.*?href=["\']mailto:(.*?)["\'].*?>(.*?)<\/a>/i';
92
  $content = preg_replace_callback( $mailto_pattern, array( $this, '_callback' ), $content );
93
  }
@@ -95,8 +92,16 @@ class Lim_Email_Encoder {
95
  // replace content tags [encode_email email="?" display="?"] to mailto links
96
  // this code is partly taken from the plugin "Fay Emails Encoder"
97
  // Credits goes to Faycal Tirich (http://faycaltirich.blogspot.com)
98
- $tag_pattern = '/\[encode_email\s+email=["\'](.*?)["\']\s+display=["\'](.*?)["\']]/i';
99
- $content = preg_replace_callback( $tag_pattern, array( $this, '_callback' ), $content );
 
 
 
 
 
 
 
 
100
 
101
  return $content;
102
  }
@@ -110,6 +115,10 @@ class Lim_Email_Encoder {
110
  * @return string
111
  */
112
  function get_htmlent( $value ) {
 
 
 
 
113
  $enc_value = '';
114
  srand( (float) microtime() * 1000000 );
115
 
@@ -134,14 +143,17 @@ class Lim_Email_Encoder {
134
  * @return string
135
  */
136
  function _callback( $match ) {
137
- return $this->encode_email( $match[1], $match[2] );
 
 
 
138
  }
139
 
140
  /**
141
- * Including all method files
142
  * @return void
143
  */
144
- function _include_method_files() {
145
  $method_dir = dirname(__FILE__) . '/methods';
146
  $handle = opendir( $method_dir );
147
 
@@ -154,10 +166,14 @@ class Lim_Email_Encoder {
154
  if ( '.php' == substr( $file, -4 ) ) {
155
  require_once $method_dir . '/' . $file;
156
 
157
- $fn = substr( $file, 0, -4 );
158
 
159
- if ( function_exists( $fn ) )
160
- $this->methods[$fn] = $fn;
 
 
 
 
161
  }
162
  }
163
 
@@ -166,4 +182,4 @@ class Lim_Email_Encoder {
166
 
167
  } // end class Lim_Email_Encoder
168
 
169
- ?>
1
  <?php
2
  /**
3
+ * Lim_Email_Encoder Class
4
+ *
5
  * Protecting email-spamming by replacing them with one of the registered encoding- or javascript-methods
6
+ *
7
  * @package Lim_Email_Encoder
8
+ * @author Victor Villaverde Laan
9
+ * @version 0.2
10
+ * @link http://www.freelancephp.net/email-encoder-php-class/
11
+ * @license MIT license
12
  */
13
  class Lim_Email_Encoder {
14
 
18
  var $methods = array();
19
 
20
  /**
21
+ * @var string
22
  */
23
+ var $method = NULL;
24
+
 
 
 
 
25
 
26
  /**
27
  * PHP4 constructor
33
  /**
34
  * PHP5 constructor
35
  */
36
+ function __construct( $method = NULL ) {
37
  // include all available method files
38
+ $this->_load_methods();
39
+
40
+ // set method
41
+ $this->set_method( $method );
42
  }
43
 
44
  /**
45
  * Set the encode method to use
46
+ * @param string $method can be the name of the method or 'random'
47
+ * @return $this
48
  */
49
+ function set_method( $method ) {
50
+ if ( 'random' == $method ) {
51
  // set a random method
52
+ $this->method = array_rand( $this->methods );
53
+ } else if ( ! key_exists( $method, $this->methods ) ) {
54
  // set default method
55
+ $this->method = 'lim_email_html_encode';
56
  } else {
57
+ $this->method = $method;
58
  }
59
+
60
+ return $this;
61
  }
62
 
63
  /**
64
+ * Encode the given email into an encoded HTML link
65
  * @param string $email
66
+ * @param string $display Optional, if not set display will be the email
67
  * @return string
68
  */
69
+ function encode( $email, $display = NULL ) {
70
  if ( $display === NULL )
71
  $display = $email;
72
 
 
 
 
73
  // get encoded email code
74
+ return call_user_func( $this->method, $email, $display );
75
  }
76
 
77
  /**
78
+ * Encode all emails of the given content
79
  * @param string $content
80
+ * @param boolean $enc_tags Optional, default TRUE
81
+ * @param boolean $enc_plain_emails Optional, default TRUE
82
+ * @param boolean $enc_mailtos Optional, default TRUE
83
  * @return string
84
  */
85
+ function filter( $content, $enc_tags = TRUE, $enc_plain_emails = TRUE, $enc_mailtos = TRUE ) {
 
 
 
 
 
 
 
86
  // encode mailto links
87
+ if ( $enc_mailtos ) {
88
  $mailto_pattern = '/<a.*?href=["\']mailto:(.*?)["\'].*?>(.*?)<\/a>/i';
89
  $content = preg_replace_callback( $mailto_pattern, array( $this, '_callback' ), $content );
90
  }
92
  // replace content tags [encode_email email="?" display="?"] to mailto links
93
  // this code is partly taken from the plugin "Fay Emails Encoder"
94
  // Credits goes to Faycal Tirich (http://faycaltirich.blogspot.com)
95
+ if ( $enc_tags ) {
96
+ $tag_pattern = '/\[encode_email\s+email=["\'](.*?)["\']\s+display=["\'](.*?)["\']]/i';
97
+ $content = preg_replace_callback( $tag_pattern, array( $this, '_callback' ), $content );
98
+ }
99
+
100
+ // replace plain emails
101
+ if ( $enc_plain_emails ) {
102
+ $email_pattern = '/([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6})/i';
103
+ $content = preg_replace_callback( $email_pattern, array( $this, '_callback' ), $content );
104
+ }
105
 
106
  return $content;
107
  }
115
  * @return string
116
  */
117
  function get_htmlent( $value ) {
118
+ // check if antispambot WordPress function exists
119
+ if ( ! function_exists( 'antispambot' ) )
120
+ return antispambot( $value );
121
+
122
  $enc_value = '';
123
  srand( (float) microtime() * 1000000 );
124
 
143
  * @return string
144
  */
145
  function _callback( $match ) {
146
+ if ( count( $match ) == 2 )
147
+ return $this->encode( $match[1] );
148
+
149
+ return $this->encode( $match[1], $match[2] );
150
  }
151
 
152
  /**
153
+ * Load available methods
154
  * @return void
155
  */
156
+ function _load_methods() {
157
  $method_dir = dirname(__FILE__) . '/methods';
158
  $handle = opendir( $method_dir );
159
 
166
  if ( '.php' == substr( $file, -4 ) ) {
167
  require_once $method_dir . '/' . $file;
168
 
169
+ $fn = 'lim_email_' . substr( $file, 0, -4 );
170
 
171
+ if ( function_exists( $fn ) ) {
172
+ // set method with info
173
+ $this->methods[$fn] = ( isset( ${ $fn } ) )
174
+ ? ${ $fn }
175
+ : array( 'name' => NULL, 'description' => NULL );
176
+ }
177
  }
178
  }
179
 
182
 
183
  } // end class Lim_Email_Encoder
184
 
185
+ /*?> // ommit closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */
email-encoder-bundle.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  /*
3
  Plugin Name: Email Encoder Bundle
4
- Plugin URI: http://www.freelancephp.net/email-encoder
5
  Description: Protecting email-spamming by replacing them with one of the registered encoding-methods
6
  Author: Victor Villaverde Laan
7
- Version: 0.12
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
11
  // include parent class
12
- require_once dirname(__FILE__) . '/lim-email-encoder.php';
13
 
14
  /**
15
  * Class WP_Email_Encoder, child of Lim_Email_Encoder
@@ -19,19 +19,22 @@ require_once dirname(__FILE__) . '/lim-email-encoder.php';
19
  class WP_Email_Encoder extends Lim_Email_Encoder {
20
 
21
  /**
22
- * Prefix for options entry and being used as text domain (for translations)
23
  * @var string
24
  */
25
- var $prefix = 'wp_esp';
26
 
27
  /**
28
  * @var array
29
  */
30
- var $wp_options = array(
31
  'filter_widgets' => TRUE,
32
  'filter_comments' => TRUE,
33
  'form_on_site' => FALSE, // set encoder form on the website
34
  'powered_by' => TRUE,
 
 
 
35
  );
36
 
37
  /**
@@ -47,28 +50,27 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
47
  function __construct() {
48
  parent::__construct();
49
 
50
- // add all $wp_options to $options
51
- $this->options = array_merge( $this->options, $this->wp_options );
52
  // set option values
53
  $this->_set_options();
 
 
 
54
 
55
  // add filters
56
- add_filter( 'the_content', array( &$this, 'encode_filter' ), 100 );
57
 
58
  // also filter comments
59
  if ( $this->options['filter_comments'] )
60
- add_filter( 'comment_text', array( &$this, 'encode_filter' ), 100 );
61
 
62
  // also filter widgets
63
  if ( $this->options['filter_widgets'] )
64
- add_filter( 'widget_text', array( &$this, 'encode_filter' ), 100 );
65
 
66
  // add actions
67
  add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
68
  add_action( 'admin_init', array( &$this, 'admin_init' ) );
69
-
70
- if ( $this->options['form_on_site'] )
71
- add_action( 'the_posts', array( &$this, 'the_posts' ) );
72
 
73
  // set uninstall hook
74
  if ( function_exists( 'register_deactivation_hook' ) )
@@ -80,13 +82,13 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
80
  * @param array $posts
81
  */
82
  function the_posts( $posts ) {
83
- if ( empty( $posts ) )
84
  return $posts;
85
 
86
  foreach ( $posts as $key => $post ) {
87
  if ( stripos( $post->post_content, '[email_encoder_form]' ) > -1 ) {
88
  // add style and script for ajax encoder
89
- wp_enqueue_script( 'email_encoder', plugins_url( 'js/wp_esp.js', __FILE__ ), array( 'jquery' ) );
90
  // replace tag by form
91
  $posts[$key]->post_content = str_replace( '[email_encoder_form]', $this->get_encoder_form(), $post->post_content );
92
  break;
@@ -115,7 +117,7 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
115
  */
116
  function admin_init() {
117
  // register settings
118
- register_setting( $this->prefix, $this->prefix . 'options' );
119
  }
120
 
121
  /**
@@ -123,7 +125,7 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
123
  */
124
  function admin_print_scripts() {
125
  // add script for ajax encoder
126
- wp_enqueue_script( 'email_encoder', plugins_url( 'js/wp_esp.js', __FILE__ ), array( 'jquery' ) );
127
  }
128
 
129
  /**
@@ -132,74 +134,137 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
132
  function options_page() {
133
  ?>
134
  <div class="wrap">
 
135
  <h2>Email Encoder Bundle</h2>
136
 
137
- <div>
138
- <h3>Settings</h3>
139
- <form method="post" action="options.php">
140
- <?php
141
- settings_fields( $this->prefix );
 
142
  $this->_set_options();
143
  $options = $this->options;
144
  ?>
145
- <fieldset class="options">
146
- <table class="form-table">
147
- <tr>
148
- <th><label for="<?php echo $this->prefix ?>options[method]"><?php _e( 'Encoding method', $this->prefix ) ?></label></th>
149
- <td><select id="<?php echo $this->prefix ?>options[method]" name="<?php echo $this->prefix ?>options[method]" class="postform">
150
- <?php foreach ( $this->methods AS $key => $method ): ?>
151
- <option value="<?php echo $key ?>" <?php if ( $options['method'] == $key ) echo 'selected="selected"' ?>><?php _e( $key, $this->prefix ) ?></option>
152
- <?php endforeach; ?>
153
- <option value="random" <?php if ( $options['method'] == 'random' ) echo 'selected="selected"' ?>><?php _e( 'random', $this->prefix ) ?></option>
154
- </select></td>
155
- </tr>
156
- <tr>
157
- <th><label for="<?php echo $this->prefix ?>options[encode_display]"><?php _e( 'Encode email titles (display)', $this->prefix ) ?></label></th>
158
- <td><input type="checkbox" id="<?php echo $this->prefix ?>options[encode_display]" name="<?php echo $this->prefix ?>options[encode_display]" value="1" <?php checked('1', (int) $options['encode_display']); ?> /> <span class="description"><?php _e( '(recommended)', $this->prefix ) ?></span></td>
159
- </tr>
160
- <tr>
161
- <th><label for="<?php echo $this->prefix ?>options[encode_mailto]"><?php _e( 'Encode mailto links', $this->prefix ) ?></label></th>
162
- <td><input type="checkbox" id="<?php echo $this->prefix ?>options[encode_mailto]" name="<?php echo $this->prefix ?>options[encode_mailto]" value="1" <?php checked('1', (int) $options['encode_mailto']); ?> /> <span class="description"><?php _e( 'encode all mailto links in the content', $this->prefix ) ?></span></td>
163
- </tr>
164
- <tr>
165
- <th><label for="<?php echo $this->prefix ?>options[replace_emails]"><?php _e( 'Replace plain text emails', $this->prefix ) ?></label></th>
166
- <td><input type="checkbox" id="<?php echo $this->prefix ?>options[replace_emails]" name="<?php echo $this->prefix ?>options[replace_emails]" value="1" <?php checked('1', (int) $options['replace_emails']); ?> /> <span class="description"><?php _e( 'replacing plain text emails to an encoded mailto link', $this->prefix ) ?></span></td>
167
- </tr>
168
- <tr>
169
- <th style="padding-top:25px"><label for="<?php echo $this->prefix ?>options[filter_comments]"><?php _e( 'Also filter comments', $this->prefix ) ?></label></th>
170
- <td style="padding-top:25px"><input type="checkbox" id="<?php echo $this->prefix ?>options[filter_comments]" name="<?php echo $this->prefix ?>options[filter_comments]" value="1" <?php checked('1', (int) $options['filter_comments']); ?> /> <span class="description"><?php _e( 'also filter all comments for encoding', $this->prefix ) ?></span></td>
171
- </tr>
172
- <tr>
173
- <th><label for="<?php echo $this->prefix ?>options[filter_widgets]"><?php _e( 'Also filter widgets', $this->prefix ) ?></label></th>
174
- <td><input type="checkbox" id="<?php echo $this->prefix ?>options[filter_widgets]" name="<?php echo $this->prefix ?>options[filter_widgets]" value="1" <?php checked('1', (int) $options['filter_widgets']); ?> /> <span class="description"><?php _e( 'also filter widgets for encoding', $this->prefix ) ?></span></td>
175
- </tr>
176
- <tr>
177
- <th style="padding-top:25px"><label for="<?php echo $this->prefix ?>options[form_on_site]"><?php _e( 'Encode form on your site', $this->prefix ) ?></label></th>
178
- <td style="padding-top:25px"><input type="checkbox" id="<?php echo $this->prefix ?>options[form_on_site]" name="<?php echo $this->prefix ?>options[form_on_site]" value="1" <?php checked('1', (int) $options['form_on_site']); ?> /> <span class="description"><?php _e( 'put an encode form on your site, use this tag in a post or page:', $this->prefix ) ?></span> <code>[email_encoder_form]</code></td>
179
- </tr>
180
- <tr>
181
- <th><label for="<?php echo $this->prefix ?>options[powered_by]"><?php _e( 'Show powered by link', $this->prefix ) ?></label></th>
182
- <td><input type="checkbox" id="<?php echo $this->prefix ?>options[powered_by]" name="<?php echo $this->prefix ?>options[powered_by]" value="1" <?php checked('1', (int) $options['powered_by']); ?> /> <span class="description"><?php _e( 'show the powered by link on bottom of the encode form', $this->prefix ) ?></span></td>
183
- </tr>
184
- </table>
185
- </fieldset>
186
- <p class="submit">
187
- <input class="button-primary" type="submit" value="<?php _e( 'Save Changes', $this->prefix ) ?>" />
188
- </p>
189
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  </div>
191
 
192
- <div>
193
- <h3>How To Use?</h3>
194
- <p>Inside a post or page use this code: <code>[encode_email email="info@myemail.com" display="My Email"]</code></p>
195
- <p>And for templates use: <code>&lt;?php echo encode_email( 'info@myemail.com', 'My Email' ); ?&gt;</code></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  </div>
197
-
198
- <div>
199
- <h3>Encoder Form</h3>
200
- <?php echo $this->get_encoder_form(); ?>
201
- </div>
202
-
203
  </div>
204
  <?php
205
  }
@@ -216,37 +281,41 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
216
  <table class="form-table">
217
  <tr>
218
  <tr>
219
- <th><label for="email"><?php _e( 'Email', $this->prefix ) ?></label></th>
220
  <td><input type="text" class="regular-text" id="email" name="email" /></td>
221
  </tr>
222
  <tr>
223
- <th><label for="display"><?php _e( 'Display (optional)', $this->prefix ) ?></label></th>
224
  <td><input type="text" class="regular-text" id="display" name="display" /></td>
225
  </tr>
226
  <tr>
227
- <th><label for="encode_method"><?php _e( 'Encode method', $this->prefix ) ?></label></th>
228
  <td><select id="encode_method" name="encode_method" class="postform">
229
- <?php foreach ( $this->methods AS $key => $method ): ?>
230
- <option value="<?php echo $key ?>" <?php if ( $this->options['method'] == $key ) echo 'selected="selected"' ?>><?php _e( $key, $this->prefix ) ?></option>
231
- <?php endforeach; ?>
232
- <option value="random" <?php if ( $this->options['method'] == 'random' ) echo 'selected="selected"' ?>><?php _e( 'random', $this->prefix ) ?></option>
233
- </select>
234
- <input type="button" id="ajax_encode" value="Encode &gt;" /></td>
 
235
  </tr>
236
  </tr>
 
 
 
237
  <tr>
238
  <tr>
239
- <th><?php _e( 'Example', $this->prefix ) ?></th>
240
  <td><span id="example"></span></td>
241
  </tr>
242
  <tr>
243
- <th><label for="encoded_output"><?php _e( 'Code', $this->prefix ) ?></label></th>
244
  <td><textarea class="large-text node" id="encoded_output" name="encoded_output"></textarea></td>
245
  </tr>
246
  </tr>
247
  </table>
248
  <?php if ( $this->options['powered_by'] ): ?>
249
- <p class="powered-by">Powered by <a rel="external" href="http://www.freelancephp.net/email-encoder/">Email Encoder Bundle</a></p>
250
  <?php endif; ?>
251
  </fieldset>
252
  </form>
@@ -261,8 +330,8 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
261
  * Deactivation plugin method
262
  */
263
  function deactivation() {
264
- delete_option( $this->prefix . 'options' );
265
- unregister_setting( $this->prefix, $this->prefix . 'options' );
266
  }
267
 
268
  /**
@@ -270,12 +339,12 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
270
  */
271
  function _set_options() {
272
  // set options
273
- $saved_options = get_option( $this->prefix . 'options' );
274
  if ( empty( $saved_options ) ) {
275
  // set defaults
276
- $this->options['encode_display'] = (int) $this->options['encode_display'];
277
- $this->options['encode_mailto'] = (int) $this->options['encode_mailto'];
278
- $this->options['replace_emails'] = (int) $this->options['replace_emails'];
279
  $this->options['filter_comments'] = (int) $this->options['filter_comments'];
280
  $this->options['filter_widgets'] = (int) $this->options['filter_widgets'];
281
  $this->options['form_on_site'] = (int) $this->options['form_on_site'];
@@ -283,9 +352,9 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
283
  } else {
284
  // set saved option values
285
  $this->set_method( $saved_options['method'] );
286
- $this->options['encode_display'] = ! empty( $saved_options['encode_display'] );
287
- $this->options['encode_mailto'] = ! empty( $saved_options['encode_mailto'] );
288
- $this->options['replace_emails'] = ! empty( $saved_options['replace_emails'] );
289
  $this->options['filter_comments'] = ! empty( $saved_options['filter_comments'] );
290
  $this->options['filter_widgets'] = ! empty( $saved_options['filter_widgets'] );
291
  $this->options['form_on_site'] = ! empty( $saved_options['form_on_site'] );
@@ -293,6 +362,13 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
293
  }
294
  }
295
 
 
 
 
 
 
 
 
296
  } // end class WP_Email_Encoder
297
 
298
 
@@ -303,7 +379,7 @@ $WP_Email_Encoder = new WP_Email_Encoder;
303
 
304
 
305
  /**
306
- * Ajax request
307
  */
308
  if ( ! empty( $_GET['ajax'] ) ):
309
  // input vars
@@ -313,7 +389,7 @@ if ( ! empty( $_GET['ajax'] ) ):
313
 
314
  $WP_Email_Encoder->set_method( $method );
315
 
316
- echo $WP_Email_Encoder->encode_email( $email, $display );
317
  exit;
318
  endif;
319
 
@@ -328,7 +404,23 @@ endif;
328
  if ( ! function_exists( 'encode_email' ) ):
329
  function encode_email( $email, $display = NULL ) {
330
  global $WP_Email_Encoder;
331
- return $WP_Email_Encoder->encode_email( $email, $display );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  }
333
  endif;
334
 
1
  <?php
2
  /*
3
  Plugin Name: Email Encoder Bundle
4
+ Plugin URI: http://www.freelancephp.net/email-encoder-php-class-wp-plugin/
5
  Description: Protecting email-spamming by replacing them with one of the registered encoding-methods
6
  Author: Victor Villaverde Laan
7
+ Version: 0.2
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
11
  // include parent class
12
+ require_once dirname( __FILE__ ) . '/Lim_Email_Encoder.php';
13
 
14
  /**
15
  * Class WP_Email_Encoder, child of Lim_Email_Encoder
19
  class WP_Email_Encoder extends Lim_Email_Encoder {
20
 
21
  /**
22
+ * Used as prefix for options entry and could be used as text domain (for translations)
23
  * @var string
24
  */
25
+ var $domain = 'wp_email_enc';
26
 
27
  /**
28
  * @var array
29
  */
30
+ var $options = array(
31
  'filter_widgets' => TRUE,
32
  'filter_comments' => TRUE,
33
  'form_on_site' => FALSE, // set encoder form on the website
34
  'powered_by' => TRUE,
35
+ 'encode_tags' => TRUE,
36
+ 'encode_mailtos' => TRUE,
37
+ 'encode_emails' => TRUE,
38
  );
39
 
40
  /**
50
  function __construct() {
51
  parent::__construct();
52
 
 
 
53
  // set option values
54
  $this->_set_options();
55
+
56
+ // load text domain for translations
57
+ load_plugin_textdomain( $this->domain, dirname( __FILE__ ) . '/lang/', basename( dirname(__FILE__) ) . '/lang/' );
58
 
59
  // add filters
60
+ add_filter( 'the_content', array( &$this, '_filter_callback' ), 100 );
61
 
62
  // also filter comments
63
  if ( $this->options['filter_comments'] )
64
+ add_filter( 'comment_text', array( &$this, '_filter_callback' ), 100 );
65
 
66
  // also filter widgets
67
  if ( $this->options['filter_widgets'] )
68
+ add_filter( 'widget_text', array( &$this, '_filter_callback' ), 100 );
69
 
70
  // add actions
71
  add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
72
  add_action( 'admin_init', array( &$this, 'admin_init' ) );
73
+ add_action( 'the_posts', array( &$this, 'the_posts' ) );
 
 
74
 
75
  // set uninstall hook
76
  if ( function_exists( 'register_deactivation_hook' ) )
82
  * @param array $posts
83
  */
84
  function the_posts( $posts ) {
85
+ if ( empty( $posts ) OR ! $this->options['form_on_site'] )
86
  return $posts;
87
 
88
  foreach ( $posts as $key => $post ) {
89
  if ( stripos( $post->post_content, '[email_encoder_form]' ) > -1 ) {
90
  // add style and script for ajax encoder
91
+ wp_enqueue_script( 'email_encoder', plugins_url( 'js/email-encoder-bundle.js', __FILE__ ), array( 'jquery' ) );
92
  // replace tag by form
93
  $posts[$key]->post_content = str_replace( '[email_encoder_form]', $this->get_encoder_form(), $post->post_content );
94
  break;
117
  */
118
  function admin_init() {
119
  // register settings
120
+ register_setting( $this->domain, $this->domain . 'options' );
121
  }
122
 
123
  /**
125
  */
126
  function admin_print_scripts() {
127
  // add script for ajax encoder
128
+ wp_enqueue_script( 'email_encoder', plugins_url( 'js/email-encoder-bundle.js', __FILE__ ), array( 'jquery-ui-sortable' ) );
129
  }
130
 
131
  /**
134
  function options_page() {
135
  ?>
136
  <div class="wrap">
137
+ <div class="icon32" id="icon-options-general"><br></div>
138
  <h2>Email Encoder Bundle</h2>
139
 
140
+ <form method="post" action="options.php">
141
+ <script language="javascript">
142
+ var methodInfo = <?php echo json_encode( $this->methods ) ?>;
143
+ </script>
144
+ <?php
145
+ settings_fields( $this->domain );
146
  $this->_set_options();
147
  $options = $this->options;
148
  ?>
149
+ <div class="postbox-container metabox-holder meta-box-sortables" style="width: 69%">
150
+ <div class="postbox">
151
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
152
+ <h3 class="hndle"><?php _e( 'Settings' ) ?></h3>
153
+ <div class="inside">
154
+ <fieldset class="options">
155
+ <table class="form-table">
156
+ <tr>
157
+ <th><label for="<?php echo $this->domain ?>options[method]"><?php _e( 'Choose encoding method', $this->domain ) ?></label></th>
158
+ <td><select id="<?php echo $this->domain ?>options[method]" name="<?php echo $this->domain ?>options[method]" class="method-info-select postform">
159
+ <?php foreach ( $this->methods AS $method => $info ): ?>
160
+ <option value="<?php echo $method ?>" <?php if ( $this->method == $method ) echo 'selected="selected"' ?>><?php echo $info[ 'name' ] ?></option>
161
+ <?php endforeach; ?>
162
+ <option value="random" <?php if ( $this->method == 'random' ) echo 'selected="selected"' ?>><?php echo __( 'Random', $this->domain ) ?></option>
163
+ </select>
164
+ <br /><span class="description"></span>
165
+ </td>
166
+ </tr>
167
+ <tr>
168
+ <th><label for="<?php echo $this->domain ?>options[encode_tags]"><?php _e( 'Encode tags', $this->domain ) ?></label></th>
169
+ <td><input type="checkbox" id="<?php echo $this->domain ?>options[encode_tags]" name="<?php echo $this->domain ?>options[encode_tags]" value="1" <?php checked('1', (int) $options['encode_tags']); ?> /> <span class="description"><?php _e( 'Encode all tags like', $this->domain ) ?></span> <code>[encode_email email="info@myemail.com" display="My Email"]</code></td>
170
+ </tr>
171
+ <tr>
172
+ <th><label for="<?php echo $this->domain ?>options[encode_mailtos]"><?php _e( 'Encode mailto links', $this->domain ) ?></label></th>
173
+ <td><input type="checkbox" id="<?php echo $this->domain ?>options[encode_mailtos]" name="<?php echo $this->domain ?>options[encode_mailtos]" value="1" <?php checked('1', (int) $options['encode_mailtos']); ?> /> <span class="description"><?php _e( 'Also encode mailto links', $this->domain ) ?></span></td>
174
+ </tr>
175
+ <tr>
176
+ <th><label for="<?php echo $this->domain ?>options[encode_emails]"><?php _e( 'Encode plain emails', $this->domain ) ?></label></th>
177
+ <td><input type="checkbox" id="<?php echo $this->domain ?>options[encode_emails]" name="<?php echo $this->domain ?>options[encode_emails]" value="1" <?php checked('1', (int) $options['encode_emails']); ?> /> <span class="description"><?php _e( 'Replacing plain text emails to an encoded mailto link', $this->domain ) ?></span></td>
178
+ </tr>
179
+ <tr>
180
+ <th style="padding-top:25px"><label for="<?php echo $this->domain ?>options[filter_comments]"><?php _e( 'Include comments', $this->domain ) ?></label></th>
181
+ <td style="padding-top:25px"><input type="checkbox" id="<?php echo $this->domain ?>options[filter_comments]" name="<?php echo $this->domain ?>options[filter_comments]" value="1" <?php checked('1', (int) $options['filter_comments']); ?> /> <span class="description"><?php _e( 'Also filter all comments for encoding', $this->domain ) ?></span></td>
182
+ </tr>
183
+ <tr>
184
+ <th><label for="<?php echo $this->domain ?>options[filter_widgets]"><?php _e( 'Include widgets', $this->domain ) ?></label></th>
185
+ <td><input type="checkbox" id="<?php echo $this->domain ?>options[filter_widgets]" name="<?php echo $this->domain ?>options[filter_widgets]" value="1" <?php checked('1', (int) $options['filter_widgets']); ?> /> <span class="description"><?php _e( 'Also filter widgets for encoding', $this->domain ) ?></span></td>
186
+ </tr>
187
+ </table>
188
+ </fieldset>
189
+ <p class="submit">
190
+ <input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
191
+ </p>
192
+ </div>
193
+ </div>
194
+
195
+ <div class="postbox">
196
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
197
+ <h3 class="hndle"><?php _e( 'Encoder Form', $this->domain ) ?></h3>
198
+ <div class="inside">
199
+ <?php echo $this->get_encoder_form(); ?>
200
+ </div>
201
+ </div>
202
+
203
+ <div class="postbox">
204
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
205
+ <h3 class="hndle"><?php _e( 'Settings Encoder Form', $this->domain ) ?></h3>
206
+ <div class="inside">
207
+ <fieldset class="options">
208
+ <table class="form-table">
209
+ <tr>
210
+ <th><label for="<?php echo $this->domain ?>options[form_on_site]"><?php _e( 'Encode form on your site', $this->domain ) ?></label></th>
211
+ <td><input type="checkbox" id="<?php echo $this->domain ?>options[form_on_site]" name="<?php echo $this->domain ?>options[form_on_site]" value="1" <?php checked('1', (int) $options['form_on_site']); ?> /> <span class="description"><?php _e( 'Put an encode form (like above) on your site by using this tag in a post or page', $this->domain ) ?></span> <code>[email_encoder_form]</code><span class="description"> (<?php _e( 'turn off for when not used', $this->domain ) ?>)</span></td>
212
+ </tr>
213
+ <tr>
214
+ <th><label for="<?php echo $this->domain ?>options[powered_by]"><?php _e( 'Show "powered by"-link', $this->domain ) ?></label></th>
215
+ <td><input type="checkbox" id="<?php echo $this->domain ?>options[powered_by]" name="<?php echo $this->domain ?>options[powered_by]" value="1" <?php checked('1', (int) $options['powered_by']); ?> /> <span class="description"><?php _e( 'Show the "powered by"-link on bottom of the encode form', $this->domain ) ?></span></td>
216
+ </tr>
217
+ </table>
218
+ </fieldset>
219
+ <p class="submit">
220
+ <input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
221
+ </p>
222
+ </div>
223
+ </div>
224
  </div>
225
 
226
+ <div class="postbox-container side metabox-holder meta-box-sortables" style="width: 29%">
227
+ <div class="postbox">
228
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
229
+ <h3 class="hndle"><?php _e( 'How to use', $this->domain ) ?></h3>
230
+ <div class="inside">
231
+ <h4><?php _e( 'Tags', $this->domain ) ?></h4>
232
+ <ul>
233
+ <li><code>[encode_email email="..." display="..."]</code><br/><span class="description"><?php _e( 'Encode the given email, "display" is optional otherwise the email wil be used as display', $this->domain ) ?></span></li>
234
+ <li><code>[email_encoder_form]</code><br/><span class="description"><?php _e( 'Puts an encoder form in your post (check if the option is activated on this page)', $this->domain ) ?></span></li>
235
+ </ul>
236
+ <h4><?php _e( 'Template functions' ) ?></h4>
237
+ <ul>
238
+ <li><code>&lt;?php echo encode_email( 'info@myemail.com', 'My Email' ); ?&gt;</code><br/><span class="description"><?php _e( 'Encode the given email, the second param is display and optional', $this->domain ) ?></span></li>
239
+ <li><code>&lt;?php echo encode_email_filter( $content ); ?&gt;</code><br/><span class="description"><?php _e( 'Filter the given content for emails to encode', $this->domain ) ?></span></li>
240
+ </ul>
241
+ </div>
242
+ </div>
243
+
244
+ <div class="postbox">
245
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
246
+ <h3 class="hndle"><?php _e( 'About this plugin', $this->domain ) ?></h3>
247
+ <div class="inside">
248
+ <h4>FreelancePHP.net</h4>
249
+ <ul>
250
+ <li><a href="http://www.freelancephp.net/email-encoder-php-class-wp-plugin/" target="_blank">WP Email Encoder Bundle</a></li>
251
+ </ul>
252
+
253
+ <h4>WordPress Plugin Directory</h4>
254
+ <ul>
255
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/" target="_blank"><?php _e( 'Description', $this->domain ) ?></a></li>
256
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/installation/" target="_blank"><?php _e( 'Installation', $this->domain ) ?></a></li>
257
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/faq/" target="_blank"><?php _e( 'FAQ', $this->domain ) ?></a></li>
258
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/screenshots/" target="_blank"><?php _e( 'Screenshot', $this->domain ) ?></a></li>
259
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/other_notes/" target="_blank"><?php _e( 'Other Notes', $this->domain ) ?></a></li>
260
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/changelog/" target="_blank"><?php _e( 'Changelog', $this->domain ) ?></a></li>
261
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/stats/" target="_blank"><?php _e( 'Stats', $this->domain ) ?></a></li>
262
+ </ul>
263
+ </div>
264
+ </div>
265
  </div>
266
+ </form>
267
+ <div class="clear"></div>
 
 
 
 
268
  </div>
269
  <?php
270
  }
281
  <table class="form-table">
282
  <tr>
283
  <tr>
284
+ <th><label for="email"><?php _e( 'Email', $this->domain ) ?></label></th>
285
  <td><input type="text" class="regular-text" id="email" name="email" /></td>
286
  </tr>
287
  <tr>
288
+ <th><label for="display"><?php _e( 'Display (optional)', $this->domain ) ?></label></th>
289
  <td><input type="text" class="regular-text" id="display" name="display" /></td>
290
  </tr>
291
  <tr>
292
+ <th><label for="encode_method"><?php _e( 'Encode method', $this->domain ) ?></label></th>
293
  <td><select id="encode_method" name="encode_method" class="postform">
294
+ <?php foreach ( $this->methods AS $method => $info ): ?>
295
+ <option value="<?php echo $method ?>" <?php if ( $this->method == $method ) echo 'selected="selected"' ?>><?php echo $info[ 'name' ] ?></option>
296
+ <?php endforeach; ?>
297
+ <option value="random" <?php if ( $this->method == 'random' ) echo 'selected="selected"' ?>><?php _e( 'Random', $this->domain ) ?></option>
298
+ </select>
299
+ <input type="button" id="ajax_encode" value="<?php _e( 'Encode', $this->domain ) ?> &gt;&gt;" />
300
+ </td>
301
  </tr>
302
  </tr>
303
+ </table>
304
+ <hr />
305
+ <table class="form-table">
306
  <tr>
307
  <tr>
308
+ <th><?php _e( 'Link', $this->domain ) ?></th>
309
  <td><span id="example"></span></td>
310
  </tr>
311
  <tr>
312
+ <th><label for="encoded_output"><?php _e( 'Code', $this->domain ) ?></label></th>
313
  <td><textarea class="large-text node" id="encoded_output" name="encoded_output"></textarea></td>
314
  </tr>
315
  </tr>
316
  </table>
317
  <?php if ( $this->options['powered_by'] ): ?>
318
+ <p class="powered-by"><?php _e( 'Powered by', $this->domain ) ?> <a rel="external" href="http://www.freelancephp.net/email-encoder-php-class-wp-plugin/">Email Encoder Bundle</a></p>
319
  <?php endif; ?>
320
  </fieldset>
321
  </form>
330
  * Deactivation plugin method
331
  */
332
  function deactivation() {
333
+ delete_option( $this->domain . 'options' );
334
+ unregister_setting( $this->domain, $this->domain . 'options' );
335
  }
336
 
337
  /**
339
  */
340
  function _set_options() {
341
  // set options
342
+ $saved_options = get_option( $this->domain . 'options' );
343
  if ( empty( $saved_options ) ) {
344
  // set defaults
345
+ $this->options['encode_tags'] = (int) $this->options['encode_tags'];
346
+ $this->options['encode_mailtos'] = (int) $this->options['encode_mailtos'];
347
+ $this->options['encode_emails'] = (int) $this->options['encode_emails'];
348
  $this->options['filter_comments'] = (int) $this->options['filter_comments'];
349
  $this->options['filter_widgets'] = (int) $this->options['filter_widgets'];
350
  $this->options['form_on_site'] = (int) $this->options['form_on_site'];
352
  } else {
353
  // set saved option values
354
  $this->set_method( $saved_options['method'] );
355
+ $this->options['encode_tags'] = ! empty( $saved_options['encode_tags'] );
356
+ $this->options['encode_mailtos'] = ! empty( $saved_options['encode_mailtos'] );
357
+ $this->options['encode_emails'] = ! empty( $saved_options['encode_emails'] );
358
  $this->options['filter_comments'] = ! empty( $saved_options['filter_comments'] );
359
  $this->options['filter_widgets'] = ! empty( $saved_options['filter_widgets'] );
360
  $this->options['form_on_site'] = ! empty( $saved_options['form_on_site'] );
362
  }
363
  }
364
 
365
+ /**
366
+ * Callback used for wp filters
367
+ */
368
+ function _filter_callback( $content ) {
369
+ return $this->filter( $content, $this->options[ 'encode_tags' ], $this->options[ 'encode_mailtos' ], $this->options[ 'encode_emails' ] );
370
+ }
371
+
372
  } // end class WP_Email_Encoder
373
 
374
 
379
 
380
 
381
  /**
382
+ * Ajax Encoding request
383
  */
384
  if ( ! empty( $_GET['ajax'] ) ):
385
  // input vars
389
 
390
  $WP_Email_Encoder->set_method( $method );
391
 
392
+ echo $WP_Email_Encoder->encode( $email, $display );
393
  exit;
394
  endif;
395
 
404
  if ( ! function_exists( 'encode_email' ) ):
405
  function encode_email( $email, $display = NULL ) {
406
  global $WP_Email_Encoder;
407
+ return $WP_Email_Encoder->encode( $email, $display );
408
+ }
409
+ endif;
410
+
411
+ /**
412
+ * Template function for encoding emails in the given content
413
+ * @global WP_Email_Encoder $WP_Email_Encoder
414
+ * @param string $content
415
+ * @param boolean $enc_tags Optional, default TRUE
416
+ * @param boolean $enc_plain_emails Optional, default TRUE
417
+ * @param boolean $enc_mailtos Optional, default TRUE
418
+ * @return string
419
+ */
420
+ if ( ! function_exists( 'encode_email_filter' ) ):
421
+ function encode_email_filter( $content, $enc_tags = TRUE, $enc_plain_emails = TRUE, $enc_mailtos = TRUE ) {
422
+ global $WP_Email_Encoder;
423
+ return $WP_Email_Encoder->filter( $content, $enc_tags, $enc_plain_emails, $enc_mailtos );
424
  }
425
  endif;
426
 
js/email-encoder-bundle.js ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ){
2
+
3
+ $(function(){
4
+
5
+ /**
6
+ * Encoded Form
7
+ */
8
+ var prevEmail = $( '#email' ).val(),
9
+ prevDisplay = $( '#display' ).val(),
10
+ prevMethod = $( '#encode_method' ).val(),
11
+ getEncoded = function ( forceCall ) {
12
+ var email = $( '#email' ).val(),
13
+ display = $( '#display' ).val(),
14
+ method = $( '#encode_method' ).val();
15
+
16
+ // stop when email field is empty
17
+ if ( email == prevEmail && display == prevDisplay && ( ! email || method == prevMethod ) && ! forceCall )
18
+ return;
19
+
20
+ // empty output
21
+ $( '#example' ).empty();
22
+ $( '#encoded_output' ).val( '' );
23
+
24
+ // get the encoded email link
25
+ $.get( '', {
26
+ ajax: true,
27
+ email: email,
28
+ display: display || email,
29
+ method: method
30
+ },
31
+ function(data){
32
+ $( '#encoded_output' ).val( data );
33
+
34
+ // show example how it will appear on the page
35
+ $( '#example' ).html( '<a href="mailto:'+ email +'">'+ display +'</a>' );
36
+
37
+ // set prev values
38
+ prevEmail = email;
39
+ prevDisplay = display;
40
+ prevMethod = method;
41
+ });
42
+ };
43
+
44
+ // get encoded link on these events
45
+ $( '#email, #display' ).blur(function(){
46
+ getEncoded();
47
+ });
48
+ $( '#encode_method' ).bind( 'change blur keyup', function(){
49
+ getEncoded();
50
+ })
51
+ .blur();
52
+ $( '#ajax_encode' ).click(function(){
53
+ getEncoded( true );
54
+ });
55
+
56
+ // set info text for selected encoding method
57
+ $( '.method-info-select' ).bind( 'change blur keyup', function(){
58
+ var method = $( this ).val(),
59
+ $desc = $( this ).parent().find( 'span.description' );
60
+
61
+ if ( methodInfo && methodInfo[ method ] ) {
62
+ $desc.html( methodInfo[ method ][ 'description' ] || '' );
63
+ } else {
64
+ $desc.html( '' );
65
+ }
66
+ })
67
+ .blur();
68
+
69
+ /**
70
+ * Admin Panel
71
+ */
72
+ // skip rest when not admin
73
+ if ( $( '#adminmenu' ).size() == 0 )
74
+ return;
75
+
76
+ // prevent toggle when dragging
77
+ var toggle = true;
78
+
79
+ // set sortable boxes
80
+ $( '.meta-box-sortables' ).sortable({
81
+ items: '.postbox',
82
+ handle: 'h3',
83
+ placeholder: 'sortable-placeholder',
84
+ forcePlaceholderSize: true,
85
+ stop: function () {
86
+ toggle = false;
87
+ }
88
+ });
89
+
90
+ // set box content toggle
91
+ $( 'h3.hndle, div.handlediv' ).click(function(){
92
+ if( toggle )
93
+ $( this ).parent().find( '.inside' ).toggle();
94
+
95
+ toggle = true;
96
+ });
97
+
98
+ // set margins
99
+ $( 'div.postbox div.inside' )
100
+ .css({ 'margin-left': '10px', 'margin-right': '10px' });
101
+
102
+ });
103
+
104
+ })( jQuery );
js/wp_esp.js DELETED
@@ -1,24 +0,0 @@
1
- (function( $ ){
2
-
3
- $( document ).ready(function(){
4
-
5
- $( '#ajax_encode' ).click(function(){
6
- var gets = {
7
- ajax: true,
8
- email: $( '#email' ).val(),
9
- display: $( '#display' ).val() || $( '#email' ).val(),
10
- method: $( '#encode_method' ).val()
11
- };
12
-
13
- // get the encoded email link
14
- $.get( '', gets, function(data){
15
- $( '#encoded_output' ).val( data );
16
- });
17
-
18
- // show example how it will appear on the page
19
- $( '#example' ).html( '<a href="mailto:'+ gets.email +'">'+ gets.display +'</a>' );
20
- });
21
-
22
- });
23
-
24
- })( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/wp_email_enc-nl_NL.mo ADDED
Binary file
lang/wp_email_enc-nl_NL.po ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "POT-Creation-Date: \n"
5
+ "PO-Revision-Date: \n"
6
+ "Last-Translator: Victor Villaverde Laan <info@freelancephp.net>\n"
7
+ "Language-Team: <info@freelancephp.net>\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=iso-8859-1\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+
12
+ # ------------------
13
+ # -- Settings --
14
+ # ------------------
15
+ msgid "Choose encoding method"
16
+ msgstr "Kies encodeer methode"
17
+
18
+ msgid "Encode tags"
19
+ msgstr "Encodeer tags"
20
+
21
+ msgid "Encode all tags like"
22
+ msgstr "Encodeer alle tags, zoals"
23
+
24
+ msgid "Encode mailto links"
25
+ msgstr "Encodeer mailto links"
26
+
27
+ msgid "Also encode mailto links"
28
+ msgstr "Ook de mailto links encoderen"
29
+
30
+ msgid "Encode plain emails"
31
+ msgstr "Encodeer gewone emails"
32
+
33
+ msgid "Replacing plain text emails to an encoded mailto link"
34
+ msgstr "Emails vervangen door ge-encodeerde mailto links"
35
+
36
+ msgid "Include comments"
37
+ msgstr "Inclusief reacties"
38
+
39
+ msgid "Also filter all comments for encoding"
40
+ msgstr "Ook de reacties doorlopen"
41
+
42
+ msgid "Include widgets"
43
+ msgstr "Inclusief widgets"
44
+
45
+ msgid "Also filter widgets for encoding"
46
+ msgstr "Ook de widgets doorlopen"
47
+
48
+ # ---------------------------
49
+ # -- Settings Encoder Form --
50
+ # ---------------------------
51
+ msgid "Encoder Form"
52
+ msgstr "Encodeer Formulier"
53
+
54
+ msgid "Settings Encoder Form"
55
+ msgstr "Instellingen Encodeer Formulier"
56
+
57
+ msgid "Encode form on your site"
58
+ msgstr "Encodeer Formulier op je site"
59
+
60
+ msgid "Put an encode form (like above) on your site by using this tag in a post or page"
61
+ msgstr "Plaats een Encodeer Formulier (zoals hierboven) op je site m.b.v de volgende tag"
62
+
63
+ msgid "turn off for when not used"
64
+ msgstr "uitzettten als deze functie niet wordt gebruikt"
65
+
66
+ msgid "Show \"powered by\"-link"
67
+ msgstr "Toon \"powered by\"-link"
68
+
69
+ msgid "Show the \"powered by\"-link on bottom of the encode form"
70
+ msgstr "Toon de \"powered by\"-link onderaan de Encodeer Formulier"
71
+
72
+ # ----------------
73
+ # -- How to use --
74
+ # ----------------
75
+ msgid "How to use"
76
+ msgstr "Hoe te gebruiken"
77
+
78
+ msgid "Tags"
79
+ msgstr ""
80
+
81
+ msgid "Encode the given email, \"display\" is optional otherwise the email wil be used as display"
82
+ msgstr "Encodeer de opgegeven email, \"display\" is optioneel (anders wordt de email getoond)"
83
+
84
+ msgid "Puts an encoder form in your post (check if the option is activated on this page)"
85
+ msgstr "Zet een encoder formulier in je berichten (zorg ervoor dat de optie aan staat op deze pagina)"
86
+
87
+ msgid "Template functions"
88
+ msgstr "Template functies"
89
+
90
+ msgid "Encode the given email, the second param is display and optional"
91
+ msgstr "Encodeer de opgegeven email, de tweede parameter is de tekst die wordt getoond en is optioneel"
92
+
93
+ msgid "Filter the given content for emails to encode"
94
+ msgstr "Filter de content op emails om te encoderen"
95
+
96
+ # -----------------------
97
+ # -- About this plugin --
98
+ # -----------------------
99
+ msgid "About this plugin"
100
+ msgstr "Over deze plugin"
101
+
102
+ msgid "Description"
103
+ msgstr "Beschrijving"
104
+
105
+ msgid "Installation"
106
+ msgstr "Installatie"
107
+
108
+ msgid "FAQ"
109
+ msgstr ""
110
+
111
+ msgid "Screenshot"
112
+ msgstr ""
113
+
114
+ msgid "Other Notes"
115
+ msgstr "Andere notities"
116
+
117
+ msgid "Changelog"
118
+ msgstr ""
119
+
120
+ msgid "Stats"
121
+ msgstr "Statistieken"
122
+
123
+ # ------------------
124
+ # -- Encoder Form --
125
+ # ------------------
126
+ msgid "Email"
127
+ msgstr ""
128
+
129
+ msgid "Display (optional)"
130
+ msgstr "Tonen"
131
+
132
+ msgid "Encode method"
133
+ msgstr "Encodeer methode"
134
+
135
+ msgid "Encode"
136
+ msgstr "Encodeer"
137
+
138
+ msgid "Link"
139
+ msgstr ""
140
+
141
+ msgid "Code"
142
+ msgstr ""
143
+
144
+ msgid "Powered by"
145
+ msgstr ""
146
+
147
+ # --------------------
148
+ # -- Encode Methods --
149
+ # --------------------
150
+ msgid "Random"
151
+ msgstr "Willekeurig"
152
+
methods/anti_email_spam.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- if ( ! function_exists( 'anti_email_spam' ) ):
3
-
4
- /**
5
- * Email encode method uses javascript to split the email in 2 parts and set into seperate vars
6
- * Taken from the plugin "Anti-email Spam"
7
- * Credits goes to John Godley
8
- * @link http://urbangiraffe.com/plugins/anti-email-spam/
9
- * @package Lim_Email_Spam_Protect
10
- * @param string $email the email to encode
11
- * @param string $display the display showing on the page
12
- * @param string $encode_display also encode the display
13
- * @return string
14
- */
15
- function anti_email_spam( $email, $display, $encode_display ) {
16
- if ( $encode_display )
17
- $display = Lim_Email_Encoder::get_htmlent( $display );
18
-
19
- $parts = explode ('@', substr ($email, 1));
20
- $str = $matches[1].'<script type="text/javascript">/*<![CDATA[*/';
21
- $str .= 'var username = "'.$parts[0].'"; var hostname = "'.$parts[1].'";';
22
- $str .= 'document.write("<a href=" + "mail" + "to:" + username + ';
23
- $str .= '"@" + hostname + ">'.$display.'<\/a>")';
24
- $str .= '/*]]>*/</script>';
25
- return $str;
26
- }
27
-
28
- endif;
29
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
methods/ascii.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! function_exists( 'lim_email_ascii' ) ):
3
+
4
+ // Info (optional)
5
+ $lim_email_ascii = array(
6
+ 'name' => 'JavaScript ASCII',
7
+ 'description' => 'Uses javascript (<a href="http://rumkin.com/tools/mailto_encoder/" target="_blank">original source</a>).',
8
+ );
9
+
10
+ /**
11
+ * lim_email_ascii()
12
+ * Based on function from Tyler Akins (http://rumkin.com/tools/mailto_encoder/)
13
+ *
14
+ * @package Lim_Email_Encoder
15
+ * @param string $email the email to encode
16
+ * @param string $display the display showing on the page
17
+ * @return string
18
+ */
19
+ function lim_email_ascii( $email, $display ) {
20
+ $MailLink = '<a href="mailto:' . $email . '">' . $display . '</a>';
21
+
22
+ $MailLetters = '';
23
+
24
+ for ($i = 0; $i < strlen($MailLink); $i ++)
25
+ {
26
+ $l = substr($MailLink, $i, 1);
27
+ if (strpos($MailLetters, $l) === false)
28
+ {
29
+ $p = rand(0, strlen($MailLetters));
30
+ $MailLetters = substr($MailLetters, 0, $p) .
31
+ $l . substr($MailLetters, $p, strlen($MailLetters));
32
+ }
33
+ }
34
+
35
+ $MailLettersEnc = str_replace("\\", "\\\\", $MailLetters);
36
+ $MailLettersEnc = str_replace("\"", "\\\"", $MailLettersEnc);
37
+
38
+ $MailIndexes = '';
39
+ for ($i = 0; $i < strlen($MailLink); $i ++)
40
+ {
41
+ $index = strpos($MailLetters, substr($MailLink, $i, 1));
42
+ $index += 48;
43
+ $MailIndexes .= chr($index);
44
+ }
45
+ $MailIndexes = str_replace("\\", "\\\\", $MailIndexes);
46
+ $MailIndexes = str_replace("\"", "\\\"", $MailIndexes);
47
+
48
+ return '<script language="javascript"><!--
49
+ ML="'. $MailLettersEnc .'";
50
+ MI="'. $MailIndexes .'";
51
+ OT="";
52
+ for(j=0;j<MI.length;j++){
53
+ OT+=ML.charAt(MI.charCodeAt(j)-48);
54
+ }document.write(OT);
55
+ // --></script>';
56
+ }
57
+
58
+ endif;
59
+ ?>
methods/default_encode.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- if ( ! function_exists( 'default_encode' ) ):
3
-
4
- /**
5
- * Default email encode method converting email to html entities
6
- * @package Lim_Email_Encoder
7
- * @param string $email the email to encode
8
- * @param string $display the display showing on the page
9
- * @param string $encode_display also encode the display
10
- * @return string
11
- */
12
- function default_encode( $email, $display, $encode_display ) {
13
- $email = Lim_Email_Encoder::get_htmlent( $email );
14
-
15
- if ( $encode_display )
16
- $display = Lim_Email_Encoder::get_htmlent( $display );
17
-
18
- // return encode mailto link
19
- return '<a href="mailto:' . $email . '">' . $display . '</a>';
20
- }
21
-
22
- endif;
23
-
24
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
methods/{email_escape.php → escape.php} RENAMED
@@ -1,18 +1,22 @@
1
  <?php
2
- if ( ! function_exists( 'email_escape' ) ):
 
 
 
 
 
 
3
 
4
  /**
5
- * Email encode method uses javascript eval() and unescape()
6
- * Taken from the plugin "Email Spam Protection" (v1.2)
7
- * Credits goes to Adam Hunter
8
- * @link http://blueberryware.net/2008/09/14/email-spam-protection/
9
  * @package Lim_Email_Encoder
10
  * @param string $email the email to encode
11
  * @param string $display the display showing on the page
12
- * @param string $encode_display also encode the display
13
  * @return string
14
  */
15
- function email_escape( $email, $display, $encode_display ) {
16
  $string = 'document.write(\'<a href="mailto:' . $email . '">' . $display . '</a>\')';
17
  /* break string into array of characters, we can't use string_split because its php5 only :( */
18
  $split = preg_split('||', $string);
1
  <?php
2
+ if ( ! function_exists( 'lim_email_escape' ) ):
3
+
4
+ // Info (optional)
5
+ $lim_email_escape = array(
6
+ 'name' => 'JavaScript Escape',
7
+ 'description' => 'Uses javascript eval() function (<a href="http://blueberryware.net/2008/09/14/email-spam-protection/" target="_blank">original source</a>).',
8
+ );
9
 
10
  /**
11
+ * lim_email_escape()
12
+ * Taken from the plugin "Email Spam Protection" by Adam Hunter (http://blueberryware.net/2008/09/14/email-spam-protection/)
13
+ *
 
14
  * @package Lim_Email_Encoder
15
  * @param string $email the email to encode
16
  * @param string $display the display showing on the page
 
17
  * @return string
18
  */
19
+ function lim_email_escape( $email, $display ) {
20
  $string = 'document.write(\'<a href="mailto:' . $email . '">' . $display . '</a>\')';
21
  /* break string into array of characters, we can't use string_split because its php5 only :( */
22
  $split = preg_split('||', $string);
methods/hide_email.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- if ( ! function_exists( 'hide_email' ) ):
3
-
4
- /**
5
- * hide_email is an email encode method
6
- * Credits goes to Maurits van der Schee
7
- * @link http://www.maurits.vdschee.nl/php_hide_email/
8
- * @package Lim_Email_Encoder
9
- * @param string $email the email to encode
10
- * @param string $display the display showing on the page
11
- * @param string $encode_display also encode the display
12
- * @return string
13
- */
14
- function hide_email( $email, $display, $encode_display ) {
15
- if ( $encode_display )
16
- $display = Lim_Email_Encoder::get_htmlent( $display );
17
-
18
- $character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
19
- $key = str_shuffle($character_set);
20
- $cipher_text = '';
21
- $id = 'e'.rand(1,999999999);
22
- for ($i=0;$i<strlen($email);$i+=1)
23
- $cipher_text.= $key[strpos($character_set,$email[$i])];
24
- $script = 'var a="'.$key.'";var b=a.split("").sort().join("");var c="'.$cipher_text.'";var d="";';
25
- $script.= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));';
26
- $script.= 'document.getElementById("'.$id.'").innerHTML="<a href=\\"mailto:"+d+"\\">'.$display.'</a>"';
27
- $script = "eval(\"".str_replace(array("\\",'"'),array("\\\\",'\"'), $script)."\")";
28
- $script = '<script type="text/javascript">/*<![CDATA[*/'.$script.'/*]]>*/</script>';
29
- return '<span id="'.$id.'">'.$display.'</span>'.$script;
30
- }
31
-
32
- endif;
33
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
methods/html_encode.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! function_exists( 'lim_email_html_encode' ) ):
3
+
4
+ // Info (optional)
5
+ $lim_email_html_encode = array(
6
+ 'name' => 'Html Encode',
7
+ 'description' => 'Email encode method using antispambot() built-in WordPress (<a href="http://codex.wordpress.org/Function_Reference/antispambot" target="_blank">more info</a>).',
8
+ );
9
+
10
+ /**
11
+ * lim_email_html_encode()
12
+ * Default email encode method converting email to html entities
13
+ *
14
+ * @package Lim_Email_Encoder
15
+ * @param string $email the email to encode
16
+ * @param string $display the display showing on the page
17
+ * @return string
18
+ */
19
+ function lim_email_html_encode( $email, $display ) {
20
+ $email = Lim_Email_Encoder::get_htmlent( $email );
21
+ $display = Lim_Email_Encoder::get_htmlent( $display );
22
+
23
+ // return encode mailto link
24
+ return '<a href="mailto:' . $email . '">' . $display . '</a>';
25
+ }
26
+
27
+ endif;
28
+
29
+ ?>
methods/wp_antispambot.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- // WordPress only !!!
3
- if ( ! function_exists( 'wp_antispambot' ) AND function_exists( 'antispambot' ) ):
4
-
5
- /**
6
- * Email encode method using antispambot() built-in WordPress
7
- * @link http://codex.wordpress.org/Function_Reference/antispambot
8
- * @package Lim_Email_Encoder
9
- * @param string $email the email to encode
10
- * @param string $display the display showing on the page
11
- * @param string $encode_display also encode the display
12
- * @return string
13
- */
14
- function wp_antispambot( $email, $display, $encode_display ) {
15
- if ( $encode_display )
16
- $display = antispambot( $display );
17
-
18
- // return encode mailto link
19
- return '<a href="mailto:' . antispambot( $email ) . '">' . $display . '</a>';
20
- }
21
-
22
- endif;
23
-
24
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,80 +1,91 @@
1
  === Email Encoder Bundle ===
2
  Contributors: freelancephp
3
- Donate link: http://www.freelancephp.net/email-encoder/
4
- Tags: email, email address, mailto, encoder, encode, spam, protection, antispam, spambots, spamming
5
  Requires at least: 2.8.0
6
- Tested up to: 2.9.2
7
- Stable tag: 0.12
8
 
9
- Encoding email adresses to protect them from spambots and being used for spamming.
10
 
11
  == Description ==
12
 
13
- Encoding email adresses to protect them from spambots and being used for spamming.
14
 
15
- * Encodes email adresses (plain text and mailto links)
16
- * Choose the preferred method (or on every request randomly pick one of the methods)
17
- * Easy to use.
 
 
 
 
 
 
18
 
19
- Extra:
20
- * Put an email encoder form on your own site.
21
- * Add your own methods.
22
 
23
- == Installation ==
24
-
25
- 1. Upload `wp-email-encoder-bundle.zip` to the `/wp-content/plugins/` directory
26
- 1. Activate the plugin through the 'Plugins' menu in WordPress
27
- 1. Place `[encode_email email="youremail@domain.com" display="Mail me"]` in a post
28
- 1. OR place `<?php encode_emal( 'youremail@domain.com', 'Mail me' ); ?>` in your templates
29
 
30
- If you want to put an email encoder form on your site. Activate this on the admin option page and put this code in your post: `[email_encoder_form]`
31
 
32
- == Frequently Asked Questions ==
 
33
 
34
- = Which method should I use? =
 
 
35
 
36
- The `wp_antispambot` method uses the built-in function of WordPress and does not use any javascript.
37
- Although JavaScript methods (like email_escape) are probably better protection agains spambots.
38
- You could also use the `random` function to randomly pick a method on every page request.
39
 
40
- = How can I add my own method? =
41
 
42
- You can choose your own name for the new encode function, f.e. func_name(). The function should have 3 arguments: $email, $display and $encode_display.
43
- The 3th argument $encode_display (boolean) tells you if the function also needs to encode $display. In most cases you can just use this code for encoding the display:
44
- `if ( $encode_display ) {`
45
- ` $display = Lim_Email_Encoder::get_htmlent( $display );`
46
- `}`
47
 
48
- Create a PHP file in the directory /methods, which contains the encode function. Give the file the same name as the function, e.g. `func_name.php`.
49
- Now your function will be loaded automatically.
50
 
51
- [Do you have another question? Please ask me](http://www.freelancephp.net/email-encoder/)
52
 
53
  == Screenshots ==
54
 
55
- 1. Admin option page
56
 
57
  == Changelog ==
58
 
 
 
 
 
 
 
 
 
59
  = 0.12 =
60
  * Nothing changed, but 0.11 had some errors because /methods directory was missing in the repository.
61
 
62
  = 0.11 =
63
- * also possible to use encode tag in widgets (activate "filter widget" option)
64
 
65
- = 0.1 =
66
  * Works with PHP4 and PHP5
67
  * Methods: default_encode, wp_antispambot, anti_email_spam, email_escape, hide_email
68
  * Use the tags: `[email_encode email=".." display=".."]`, `[email_encoder_form]`
69
  * Template function: `email_encode()`
70
 
71
- == Credits ==
72
 
73
- Credit goes to:
 
 
74
 
75
- * [John Godley](http://urbangiraffe.com) for the encode method anti_email_spam() which is taken from his plugin [Anti-email Spam](http://urbangiraffe.com/plugins/anti-email-spam/)
76
- * [Maurits van der Schee](http://www.maurits.vdschee.nl) for the encode method hide_email()
77
- * [Adam Hunter](http://blueberryware.net) for the encode method email_escape() which is taken from his plugin [Email Spam Protection](http://blueberryware.net/2008/09/14/email-spam-protection/)
78
  * [Faycal Tirich](http://faycaltirich.blogspot.com) for using the regular expression from his plugin [WP Emails Encoder](http://faycaltirich.blogspot.com/1979/01/fay-emails-encoder-plugin.html)
 
79
 
80
  == Upgrade Notice ==
 
 
1
  === Email Encoder Bundle ===
2
  Contributors: freelancephp
3
+ Tags: email, hide email, mailto, spam, protection, spambots, encoder, encrypt, encode, obfuscate, antispam, spamming
 
4
  Requires at least: 2.8.0
5
+ Tested up to: 3.0.5
6
+ Stable tag: 0.20
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
 
10
  == Description ==
11
 
12
+ Protect email addresses on your site from spambots and being used for spamming. This plugin encodes all email adresses so spambots cannot read them.
13
 
14
+ = Features =
15
+ * Encoding all emails: plain text, mailto links and the tags like `[encode_email email="..." display="..."]`
16
+ * Scanning posts, widgets and comments
17
+ * Immediatly ready after install
18
+ * Choose one of the high-quality encoding methods
19
+ * Supports querystrings like 'info@myemail.com?subject=Plugin'
20
+ * Tag available `[encode_email email="info@myemail.com" display="My Email"]`
21
+ * Template functions available `<?php echo encode_email( 'info@myemail.com', 'My Email' ); ?>`
22
+ * Supports PHP4.3+ and up to latest WP version
23
 
24
+ = Extra =
25
+ * Put a Email Encoder Form on your site
26
+ * Developers can add their own methods
27
 
28
+ [Authors plugin page](http://www.freelancephp.net/email-encoder-php-class-wp-plugin/)
 
 
 
 
 
29
 
30
+ == Installation ==
31
 
32
+ 1. Upload `wp-email-encoder-bundle.zip` to the `/wp-content/plugins/` directory or add the plugin with 'Add Plugins' in the admin menu
33
+ 1. Be sure the plugin is activated in the Plugins-list
34
 
35
+ = Tags =
36
+ * `[encode_email email="..." display="..."]` Encode the given email, "display" is optional otherwise the email wil be used as display
37
+ * `[email_encoder_form]` Puts an encoder form in your post (check if the option is activated on this page)
38
 
39
+ = Template functions =
40
+ * `<?php echo encode_email( 'info@myemail.com', 'My Email' ); ?>` Encode the given email, the second param is display and optional
41
+ * `<?php echo encode_email_filter( $content ); ?>` Filter the given content for emails to encode
42
 
43
+ == Frequently Asked Questions ==
44
 
45
+ = Which encoding method should I use? =
 
 
 
 
46
 
47
+ The `Html Encode` method uses the built-in function of WordPress and does not use any javascript.
48
+ Although JavaScript methods (like `JavaScript ASCII`) are probably better protection against spambots.
49
 
50
+ [Do you have another question? Please ask me](http://www.freelancephp.net/contact/)
51
 
52
  == Screenshots ==
53
 
54
+ 1. Admin Settings Page
55
 
56
  == Changelog ==
57
 
58
+ = 0.20 =
59
+ * Implemented internalization (including translation for nl_NL)
60
+ * Improved user-interface of the Admin Settings Page and the Encoder Form
61
+ * Added template function: encode_email_filter()
62
+ * Kept and added only high-quality encoding methods
63
+ * Refactored the code and changed method and var names within the classes
64
+ * Fixed bugs occured using anti_email_spam() and hide_email() method
65
+
66
  = 0.12 =
67
  * Nothing changed, but 0.11 had some errors because /methods directory was missing in the repository.
68
 
69
  = 0.11 =
70
+ * also possible to use encode tag in widgets by activating the "filter widget" option
71
 
72
+ = 0.10 =
73
  * Works with PHP4 and PHP5
74
  * Methods: default_encode, wp_antispambot, anti_email_spam, email_escape, hide_email
75
  * Use the tags: `[email_encode email=".." display=".."]`, `[email_encoder_form]`
76
  * Template function: `email_encode()`
77
 
78
+ == Other Notes ==
79
 
80
+ = TODO =
81
+ I've got some nice ideas for the next version(s).
82
+ If you have a suggestion please [contact me](http://www.freelancephp.net/contact/)
83
 
84
+ = Credits =
85
+ * [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/)
 
86
  * [Faycal Tirich](http://faycaltirich.blogspot.com) for using the regular expression from his plugin [WP Emails Encoder](http://faycaltirich.blogspot.com/1979/01/fay-emails-encoder-plugin.html)
87
+ * [Tyler Akins](http://rumkin.com) for the encode method 'JavaScript ASCII Mixer'
88
 
89
  == Upgrade Notice ==
90
+
91
+ Be carefull when upgrading from version 0.12 or less. The structure of the code has been changed. If you have written your own encoding method you should make some minor adjustments (see FAQ).
screenshot-1.jpg CHANGED
Binary file