Email Encoder Bundle – Protect Email Address - Version 0.21

Version Description

  • Changed Encoder Form: HTML markup and JavaScript
  • Made some minor adjustments and fixed little bugs
Download this release

Release Info

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

Code changes from version 0.12 to 0.21

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 ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.21
10
+ * @link http://www.freelancephp.net/email-encoder-php-class/
11
+ * @license MIT license
12
+ */
13
+ class Lim_Email_Encoder {
14
+
15
+ /**
16
+ * @var array
17
+ */
18
+ var $methods = array();
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ var $method = NULL;
24
+
25
+
26
+ /**
27
+ * PHP4 constructor
28
+ */
29
+ function Lim_Email_Encoder() {
30
+ $this->__construct();
31
+ }
32
+
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
+ } 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
+ }
63
+
64
+ /**
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
+ if ( $display === NULL )
72
+ $display = $email;
73
+
74
+ // get encoded email code
75
+ return call_user_func( $this->method, $email, $display );
76
+ }
77
+
78
+ /**
79
+ * Encode all emails of the given content
80
+ * @param string $content
81
+ * @param boolean $enc_tags Optional, default TRUE
82
+ * @param boolean $enc_plain_emails Optional, default TRUE
83
+ * @param boolean $enc_mailtos Optional, default TRUE
84
+ * @return string
85
+ */
86
+ function filter( $content, $enc_tags = TRUE, $enc_plain_emails = TRUE, $enc_mailtos = TRUE ) {
87
+ // encode mailto links
88
+ if ( $enc_mailtos ) {
89
+ $mailto_pattern = '/<a.*?href=["\']mailto:(.*?)["\'].*?>(.*?)<\/a>/i';
90
+ $content = preg_replace_callback( $mailto_pattern, array( $this, '_callback' ), $content );
91
+ }
92
+
93
+ // replace content tags [encode_email email="?" display="?"] to mailto links
94
+ // this code is partly taken from the plugin "Fay Emails Encoder"
95
+ // Credits goes to Faycal Tirich (http://faycaltirich.blogspot.com)
96
+ if ( $enc_tags ) {
97
+ $tag_pattern = '/\[encode_email\s+email=["\'](.*?)["\']\s+display=["\'](.*?)["\']]/i';
98
+ $content = preg_replace_callback( $tag_pattern, array( $this, '_callback' ), $content );
99
+ }
100
+
101
+ // replace plain emails
102
+ if ( $enc_plain_emails ) {
103
+ $email_pattern = '/([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6})/i';
104
+ $content = preg_replace_callback( $email_pattern, array( $this, '_callback' ), $content );
105
+ }
106
+
107
+ return $content;
108
+ }
109
+
110
+ /**
111
+ * Convert randomly chars to htmlentities
112
+ * This method is partly taken from WordPress
113
+ * @link http://codex.wordpress.org/Function_Reference/antispambot
114
+ * @static
115
+ * @param string $value
116
+ * @return string
117
+ */
118
+ function get_htmlent( $value ) {
119
+ // check if antispambot WordPress function exists
120
+ if ( ! function_exists( 'antispambot' ) )
121
+ return antispambot( $value );
122
+
123
+ $enc_value = '';
124
+ srand( (float) microtime() * 1000000 );
125
+
126
+ for ( $i = 0; $i < strlen( $value ); $i = $i + 1 ) {
127
+ $j = floor( rand( 0, 1 ) );
128
+
129
+ if ( $j == 0 ) {
130
+ $enc_value .= '&#' . ord( substr( $value, $i, 1 ) ).';';
131
+ } elseif ( $j == 1 ) {
132
+ $enc_value .= substr( $value, $i, 1 );
133
+ }
134
+ }
135
+
136
+ $enc_value = str_replace( '@', '&#64;', $enc_value );
137
+
138
+ return $enc_value;
139
+ }
140
+
141
+ /**
142
+ * Callback for encoding email
143
+ * @param array $match
144
+ * @return string
145
+ */
146
+ function _callback( $match ) {
147
+ if ( count( $match ) == 2 )
148
+ return $this->encode( $match[1] );
149
+
150
+ return $this->encode( $match[1], $match[2] );
151
+ }
152
+
153
+ /**
154
+ * Load available methods
155
+ * @return void
156
+ */
157
+ function _load_methods() {
158
+ $method_dir = dirname(__FILE__) . '/methods';
159
+ $handle = opendir( $method_dir );
160
+
161
+ // dir not found
162
+ if ( ! $handle )
163
+ return;
164
+
165
+ // include all methods inside the method folder
166
+ while ( false !== ($file = readdir($handle)) ) {
167
+ if ( '.php' == substr( $file, -4 ) ) {
168
+ require_once $method_dir . '/' . $file;
169
+
170
+ $name = substr( $file, 0, -4 );
171
+ $fn = 'lim_email_' . $name;
172
+
173
+ if ( function_exists( $fn ) ) {
174
+ // set method with info
175
+ $this->methods[$fn] = ( isset( ${ $fn } ) )
176
+ ? ${ $fn }
177
+ : array( 'name' => $name, 'description' => $name );
178
+ }
179
+ }
180
+ }
181
+
182
+ closedir( $handle );
183
+ }
184
+
185
+ } // end class Lim_Email_Encoder
186
+
187
+ /*?> // 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
  }
@@ -211,45 +276,54 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
211
  function get_encoder_form() {
212
  ob_start();
213
  ?>
214
- <form class="email-encoder-form">
 
215
  <fieldset>
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>
 
253
  <?php
254
  $form = ob_get_contents();
255
  ob_clean();
@@ -261,8 +335,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 +344,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 +357,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 +367,13 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
293
  }
294
  }
295
 
 
 
 
 
 
 
 
296
  } // end class WP_Email_Encoder
297
 
298
 
@@ -303,7 +384,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 +394,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 +409,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.21
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 <code>[encode_email]</code> tags', $this->domain ) ?></span></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( 'Automatically encode all 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( 'Replace plain emailaddresses to encoded mailto-links', $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( 'Email 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 Email 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( 'Put 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 the Email 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 email 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
  }
276
  function get_encoder_form() {
277
  ob_start();
278
  ?>
279
+ <div class="email-encoder-form">
280
+ <form>
281
  <fieldset>
282
+ <div class="input">
283
+ <table>
284
  <tr>
285
+ <tr>
286
+ <th><label for="email"><?php _e( 'Email address', $this->domain ) ?></label></th>
287
+ <td><input type="text" class="regular-text" id="email" name="email" /></td>
288
+ </tr>
289
+ <tr>
290
+ <th><label for="display"><?php _e( 'Display', $this->domain ) ?></label></th>
291
+ <td><input type="text" class="regular-text" id="display" name="display" /></td>
292
+ </tr>
293
+ <tr>
294
+ <th><?php _e( 'Example', $this->domain ) ?></th>
295
+ <td><span id="example"></span></td>
296
+ </tr>
297
+ <tr>
298
+ <th><label for="encode_method"><?php _e( 'Encode method', $this->domain ) ?></label></th>
299
+ <td><select id="encode_method" name="encode_method" class="postform">
300
+ <?php foreach ( $this->methods AS $method => $info ): ?>
301
+ <option value="<?php echo $method ?>" <?php if ( $this->method == $method ) echo 'selected="selected"' ?>><?php echo $info[ 'name' ] ?></option>
302
+ <?php endforeach; ?>
303
+ <option value="random" <?php if ( $this->method == 'random' ) echo 'selected="selected"' ?>><?php _e( 'Random', $this->domain ) ?></option>
304
+ </select>
305
+ <input type="button" id="ajax_encode" value="<?php _e( 'Encode', $this->domain ) ?> &gt;&gt;" />
306
+ </td>
307
+ </tr>
308
  </tr>
309
+ </table>
310
+ </div>
311
+ <div class="output nodis">
312
+ <table>
313
  <tr>
314
+ <tr>
315
+ <th><label for="encoded_output"><?php _e( 'Code', $this->domain ) ?></label></th>
316
+ <td><textarea class="large-text node" id="encoded_output" name="encoded_output"></textarea></td>
317
+ </tr>
318
  </tr>
319
+ </table>
320
+ </div>
321
  <?php if ( $this->options['powered_by'] ): ?>
322
+ <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>
323
  <?php endif; ?>
324
  </fieldset>
325
+ </form>
326
+ </div>
327
  <?php
328
  $form = ob_get_contents();
329
  ob_clean();
335
  * Deactivation plugin method
336
  */
337
  function deactivation() {
338
+ delete_option( $this->domain . 'options' );
339
+ unregister_setting( $this->domain, $this->domain . 'options' );
340
  }
341
 
342
  /**
344
  */
345
  function _set_options() {
346
  // set options
347
+ $saved_options = get_option( $this->domain . 'options' );
348
  if ( empty( $saved_options ) ) {
349
  // set defaults
350
+ $this->options['encode_tags'] = (int) $this->options['encode_tags'];
351
+ $this->options['encode_mailtos'] = (int) $this->options['encode_mailtos'];
352
+ $this->options['encode_emails'] = (int) $this->options['encode_emails'];
353
  $this->options['filter_comments'] = (int) $this->options['filter_comments'];
354
  $this->options['filter_widgets'] = (int) $this->options['filter_widgets'];
355
  $this->options['form_on_site'] = (int) $this->options['form_on_site'];
357
  } else {
358
  // set saved option values
359
  $this->set_method( $saved_options['method'] );
360
+ $this->options['encode_tags'] = ! empty( $saved_options['encode_tags'] );
361
+ $this->options['encode_mailtos'] = ! empty( $saved_options['encode_mailtos'] );
362
+ $this->options['encode_emails'] = ! empty( $saved_options['encode_emails'] );
363
  $this->options['filter_comments'] = ! empty( $saved_options['filter_comments'] );
364
  $this->options['filter_widgets'] = ! empty( $saved_options['filter_widgets'] );
365
  $this->options['form_on_site'] = ! empty( $saved_options['form_on_site'] );
367
  }
368
  }
369
 
370
+ /**
371
+ * Callback used for wp filters
372
+ */
373
+ function _filter_callback( $content ) {
374
+ return $this->filter( $content, $this->options[ 'encode_tags' ], $this->options[ 'encode_mailtos' ], $this->options[ 'encode_emails' ] );
375
+ }
376
+
377
  } // end class WP_Email_Encoder
378
 
379
 
384
 
385
 
386
  /**
387
+ * Ajax Encoding request
388
  */
389
  if ( ! empty( $_GET['ajax'] ) ):
390
  // input vars
394
 
395
  $WP_Email_Encoder->set_method( $method );
396
 
397
+ echo $WP_Email_Encoder->encode( $email, $display );
398
  exit;
399
  endif;
400
 
409
  if ( ! function_exists( 'encode_email' ) ):
410
  function encode_email( $email, $display = NULL ) {
411
  global $WP_Email_Encoder;
412
+ return $WP_Email_Encoder->encode( $email, $display );
413
+ }
414
+ endif;
415
+
416
+ /**
417
+ * Template function for encoding emails in the given content
418
+ * @global WP_Email_Encoder $WP_Email_Encoder
419
+ * @param string $content
420
+ * @param boolean $enc_tags Optional, default TRUE
421
+ * @param boolean $enc_plain_emails Optional, default TRUE
422
+ * @param boolean $enc_mailtos Optional, default TRUE
423
+ * @return string
424
+ */
425
+ if ( ! function_exists( 'encode_email_filter' ) ):
426
+ function encode_email_filter( $content, $enc_tags = TRUE, $enc_plain_emails = TRUE, $enc_mailtos = TRUE ) {
427
+ global $WP_Email_Encoder;
428
+ return $WP_Email_Encoder->filter( $content, $enc_tags, $enc_plain_emails, $enc_mailtos );
429
  }
430
  endif;
431
 
js/email-encoder-bundle.js ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ){
2
+
3
+ $(function(){
4
+
5
+ /**
6
+ * Encoded Form
7
+ */
8
+ (function(){
9
+ var prevEmail, getEncoded,
10
+ $wrap = $( 'div.email-encoder-form' ),
11
+ $email = $wrap.find( '#email' ),
12
+ $display = $wrap.find( '#display' );
13
+
14
+ // hide output
15
+ $wrap.find( '.nodis' ).hide();
16
+
17
+ // auto-set display field
18
+ $email.keyup(function(){
19
+ var email = $email.val(),
20
+ display = $display.val();
21
+
22
+ if ( ! display || display == prevEmail )
23
+ $display.val( email );
24
+
25
+ prevEmail = email;
26
+ });
27
+
28
+ // get encoded email ( ajax call )
29
+ getEncoded = function () {
30
+ // stop when email field is empty
31
+ if ( ! $email.val() )
32
+ return;
33
+
34
+ // empty output
35
+ $wrap.find( '#encoded_output' ).val( '' );
36
+
37
+ // get the encoded email link
38
+ $.get( '', {
39
+ ajax: true,
40
+ email: $email.val(),
41
+ display: $display.val() || $email.val(),
42
+ method: $wrap.find( '#encode_method' ).val()
43
+ },
44
+ function(data){
45
+ $wrap.find( '#encoded_output' ).val( data );
46
+ $wrap.find( '.output' ).slideDown();
47
+ });
48
+ };
49
+
50
+ // get encoded link on these events
51
+ $wrap.find( '#email, #display' ).keyup(function(){
52
+ // show example how it will appear on the page
53
+ $wrap.find( '#example' ).html( '<a href="mailto:'+ $email.val() +'">'+ $display.val() +'</a>' );
54
+
55
+ // clear code field
56
+ $wrap.find( '.output' ).slideUp();
57
+ $wrap.find( '#encoded_output' ).val( '' );
58
+ })
59
+ .keyup();
60
+
61
+ $wrap.find( '#encode_method' ).bind( 'change keyup', function(){
62
+ getEncoded();
63
+ });
64
+
65
+ $wrap.find( '#ajax_encode' ).click(function(){
66
+ getEncoded();
67
+ });
68
+ }());
69
+
70
+ /**
71
+ * Admin Panel
72
+ */
73
+ (function(){
74
+ // skip rest when not admin
75
+ if ( $( '#adminmenu' ).size() == 0 )
76
+ return;
77
+
78
+ // prevent toggle when dragging
79
+ var toggle = true;
80
+
81
+ // set info text for selected encoding method
82
+ $( '.method-info-select' ).bind( 'change blur keyup', function(){
83
+ var method = $( this ).val(),
84
+ $desc = $( this ).parent().find( 'span.description' );
85
+
86
+ if ( methodInfo && methodInfo[ method ] ) {
87
+ $desc.html( methodInfo[ method ][ 'description' ] || '' );
88
+ } else {
89
+ $desc.html( '' );
90
+ }
91
+ })
92
+ .blur();
93
+
94
+ // set sortable boxes
95
+ $( '.meta-box-sortables' ).sortable({
96
+ items: '.postbox',
97
+ handle: 'h3',
98
+ placeholder: 'sortable-placeholder',
99
+ forcePlaceholderSize: true,
100
+ stop: function () {
101
+ toggle = false;
102
+ }
103
+ });
104
+
105
+ // set box content toggle
106
+ $( 'h3.hndle, div.handlediv' ).click(function(){
107
+ if( toggle )
108
+ $( this ).parent().find( '.inside' ).toggle();
109
+
110
+ toggle = true;
111
+ });
112
+
113
+ // set margins
114
+ $( 'div.postbox div.inside' )
115
+ .css({ 'margin-left': '10px', 'margin-right': '10px' });
116
+
117
+ // add form-table class to Encoder Form tables
118
+ $( '.email-encoder-form table' ).addClass( 'form-table' );
119
+ }());
120
+
121
+ });
122
+
123
+ })( 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 <code>[encode_email]</code> tags"
22
+ msgstr "Encodeer <code>[encode_email]</code> tags"
23
+
24
+ msgid "Encode mailto-links"
25
+ msgstr "Encodeer mailto-links"
26
+
27
+ msgid "Automatically encode all mailto-links"
28
+ msgstr "Mailto links automatisch encoderen"
29
+
30
+ msgid "Encode plain emails"
31
+ msgstr "Encodeer gewone emails"
32
+
33
+ msgid "Replace plain emailaddresses to encoded mailto-links"
34
+ msgstr "Emailadressen automatisch 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 reacties filteren om te encoderen"
41
+
42
+ msgid "Include widgets"
43
+ msgstr "Inclusief widgets"
44
+
45
+ msgid "Also filter widgets for encoding"
46
+ msgstr "Ook de widgets filteren om te encoderen"
47
+
48
+ # ---------------------------
49
+ # -- Settings Encoder Form --
50
+ # ---------------------------
51
+ msgid "Email Encoder Form"
52
+ msgstr "Email Encodeer Formulier"
53
+
54
+ msgid "Settings Email Encoder Form"
55
+ msgstr "Instellingen Email Encodeer Formulier"
56
+
57
+ msgid "Put form on your site"
58
+ msgstr "Plaats formulier op je site"
59
+
60
+ msgid "Put the Email Encode Form (like above) on your site by using this tag in a post or page"
61
+ msgstr "Plaats de Email 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 address"
127
+ msgstr "Emailadres"
128
+
129
+ msgid "Display"
130
+ msgstr "Toon op het scherm"
131
+
132
+ msgid "Encode method"
133
+ msgstr "Encodeer methode"
134
+
135
+ msgid "Encode"
136
+ msgstr "Encodeer"
137
+
138
+ msgid "Example"
139
+ msgstr "Voorbeeld"
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
+
lim-email-encoder.php DELETED
@@ -1,169 +0,0 @@
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
-
13
- /**
14
- * @var array
15
- */
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
30
- */
31
- function Lim_Email_Encoder() {
32
- $this->__construct();
33
- }
34
-
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
- }
94
-
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
- }
103
-
104
- /**
105
- * Convert randomly chars to htmlentities
106
- * This method is partly taken from WordPress
107
- * @link http://codex.wordpress.org/Function_Reference/antispambot
108
- * @static
109
- * @param string $value
110
- * @return string
111
- */
112
- function get_htmlent( $value ) {
113
- $enc_value = '';
114
- srand( (float) microtime() * 1000000 );
115
-
116
- for ( $i = 0; $i < strlen( $value ); $i = $i + 1 ) {
117
- $j = floor( rand( 0, 1 ) );
118
-
119
- if ( $j == 0 ) {
120
- $enc_value .= '&#' . ord( substr( $value, $i, 1 ) ).';';
121
- } elseif ( $j == 1 ) {
122
- $enc_value .= substr( $value, $i, 1 );
123
- }
124
- }
125
-
126
- $enc_value = str_replace( '@', '&#64;', $enc_value );
127
-
128
- return $enc_value;
129
- }
130
-
131
- /**
132
- * Callback for encoding email
133
- * @param array $match
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
-
148
- // dir not found
149
- if ( ! $handle )
150
- return;
151
-
152
- // include all methods inside the method folder
153
- while ( false !== ($file = readdir($handle)) ) {
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
-
164
- closedir( $handle );
165
- }
166
-
167
- } // end class Lim_Email_Encoder
168
-
169
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,110 @@
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.21
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 and activation
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 function 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 an 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
+ = I want to make some adjustment in one of the encoding methods. What is the best way? =
51
 
52
+ The best way is to make a copy of that method and make your adjustments in the copy. Give the new method a unique name.
53
+ Now you can keep updating this plugin and keep remaining the changes you have made.
 
54
 
55
+ = My self-written method doesn't work after upgrading to v0.2. How to fix this? =
56
 
57
+ The has been some changes to the structure of the encoding methods.
58
+ The first is the 3rd param `$encode_display` has been removed, because the display should always be encoded.
59
+ Second, the methodnames should contain the prefix `lim_email_`.
60
+ Optionally you can add a name and description to be showed in the admin panel, like:
61
+ `$lim_email_yourmethodname = array( 'name' => 'YourMethodName', 'description' => '....' );`
62
 
 
 
63
 
64
+ [Do you have another question? Please ask me](http://www.freelancephp.net/contact/)
65
 
66
  == Screenshots ==
67
 
68
+ 1. Admin Settings Page
69
 
70
  == Changelog ==
71
 
72
+ = 0.21 =
73
+ * Changed Encoder Form: HTML markup and JavaScript
74
+ * Made some minor adjustments and fixed little bugs
75
+
76
+ = 0.20 =
77
+ * Implemented internalization (including translation for nl_NL)
78
+ * Improved user-interface of the Admin Settings Page and the Encoder Form
79
+ * Added template function: encode_email_filter()
80
+ * Kept and added only high-quality encoding methods
81
+ * Refactored the code and changed method- and var-names within the classes
82
+ * Removed 3rd param $encode_display out of the encoding methods, display should always be encoded
83
+ * Added prefix 'lim_email_' to the encoding methods
84
+
85
  = 0.12 =
86
  * Nothing changed, but 0.11 had some errors because /methods directory was missing in the repository.
87
 
88
  = 0.11 =
89
+ * also possible to use encode tag in widgets by activating the "filter widget" option
90
 
91
+ = 0.10 =
92
  * Works with PHP4 and PHP5
93
  * Methods: default_encode, wp_antispambot, anti_email_spam, email_escape, hide_email
94
  * Use the tags: `[email_encode email=".." display=".."]`, `[email_encoder_form]`
95
  * Template function: `email_encode()`
96
 
97
+ == Other Notes ==
98
 
99
+ = TODO =
100
+ I've got some nice ideas for the next version(s).
101
+ If you have a suggestion please [contact me](http://www.freelancephp.net/contact/)
102
 
103
+ = Credits =
104
+ * [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/)
 
105
  * [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)
106
+ * [Tyler Akins](http://rumkin.com) for the encode method 'JavaScript ASCII Mixer'
107
 
108
  == Upgrade Notice ==
109
+
110
+ 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