Email Encoder Bundle – Protect Email Address - Version 0.22

Version Description

  • First decodes entities before encoding email
  • Added more wp filters for encoding
Download this release

Release Info

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

Code changes from version 0.10 to 0.22

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,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.22
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
+ // decode entities
72
+ if ( function_exists( 'wp_kses_decode_entities' ) )
73
+ $email = wp_kses_decode_entities( $email );
74
+
75
+ // set email as display
76
+ if ( $display === NULL )
77
+ $display = $email;
78
+
79
+ // get encoded email code
80
+ return call_user_func( $this->method, $email, $display );
81
+ }
82
+
83
+ /**
84
+ * Encode all emails of the given content
85
+ * @param string $content
86
+ * @param boolean $enc_tags Optional, default TRUE
87
+ * @param boolean $enc_plain_emails Optional, default TRUE
88
+ * @param boolean $enc_mailtos Optional, default TRUE
89
+ * @return string
90
+ */
91
+ function filter( $content, $enc_tags = TRUE, $enc_plain_emails = TRUE, $enc_mailtos = TRUE ) {
92
+ // encode mailto links
93
+ if ( $enc_mailtos ) {
94
+ $mailto_pattern = '/<a.*?href=["\']mailto:(.*?)["\'].*?>(.*?)<\/a>/i';
95
+ $content = preg_replace_callback( $mailto_pattern, array( $this, '_callback' ), $content );
96
+ }
97
+
98
+ // replace content tags [encode_email email="?" display="?"] to mailto links
99
+ // this code is partly taken from the plugin "Fay Emails Encoder"
100
+ // Credits goes to Faycal Tirich (http://faycaltirich.blogspot.com)
101
+ if ( $enc_tags ) {
102
+ $tag_pattern = '/\[encode_email\s+email=["\'](.*?)["\']\s+display=["\'](.*?)["\']]/i';
103
+ $content = preg_replace_callback( $tag_pattern, array( $this, '_callback' ), $content );
104
+ }
105
+
106
+ // replace plain emails
107
+ if ( $enc_plain_emails ) {
108
+ $email_pattern = '/([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6})/i';
109
+ $content = preg_replace_callback( $email_pattern, array( $this, '_callback' ), $content );
110
+ }
111
+
112
+ return $content;
113
+ }
114
+
115
+ /**
116
+ * Convert randomly chars to htmlentities
117
+ * This method is partly taken from WordPress
118
+ * @link http://codex.wordpress.org/Function_Reference/antispambot
119
+ * @static
120
+ * @param string $value
121
+ * @return string
122
+ */
123
+ function get_htmlent( $value ) {
124
+ // check if antispambot WordPress function exists
125
+ if ( ! function_exists( 'antispambot' ) )
126
+ return antispambot( $value );
127
+
128
+ $enc_value = '';
129
+ srand( (float) microtime() * 1000000 );
130
+
131
+ for ( $i = 0; $i < strlen( $value ); $i = $i + 1 ) {
132
+ $j = floor( rand( 0, 1 ) );
133
+
134
+ if ( $j == 0 ) {
135
+ $enc_value .= '&#' . ord( substr( $value, $i, 1 ) ).';';
136
+ } elseif ( $j == 1 ) {
137
+ $enc_value .= substr( $value, $i, 1 );
138
+ }
139
+ }
140
+
141
+ $enc_value = str_replace( '@', '&#64;', $enc_value );
142
+
143
+ return $enc_value;
144
+ }
145
+
146
+ /**
147
+ * Callback for encoding email
148
+ * @param array $match
149
+ * @return string
150
+ */
151
+ function _callback( $match ) {
152
+ if ( count( $match ) == 2 )
153
+ return $this->encode( $match[1] );
154
+
155
+ return $this->encode( $match[1], $match[2] );
156
+ }
157
+
158
+ /**
159
+ * Load available methods
160
+ * @return void
161
+ */
162
+ function _load_methods() {
163
+ $method_dir = dirname(__FILE__) . '/methods';
164
+ $handle = opendir( $method_dir );
165
+
166
+ // dir not found
167
+ if ( ! $handle )
168
+ return;
169
+
170
+ // include all methods inside the method folder
171
+ while ( false !== ($file = readdir($handle)) ) {
172
+ if ( '.php' == substr( $file, -4 ) ) {
173
+ require_once $method_dir . '/' . $file;
174
+
175
+ $name = substr( $file, 0, -4 );
176
+ $fn = 'lim_email_' . $name;
177
+
178
+ if ( function_exists( $fn ) ) {
179
+ // set method with info
180
+ $this->methods[$fn] = ( isset( ${ $fn } ) )
181
+ ? ${ $fn }
182
+ : array( 'name' => $name, 'description' => $name );
183
+ }
184
+ }
185
+ }
186
+
187
+ closedir( $handle );
188
+ }
189
+
190
+ } // end class Lim_Email_Encoder
191
+
192
+ /*?> // 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.1
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,18 +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_comments' => TRUE,
32
  'form_on_site' => FALSE, // set encoder form on the website
33
  'powered_by' => TRUE,
 
 
 
34
  );
35
 
36
  /**
@@ -46,24 +50,45 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
46
  function __construct() {
47
  parent::__construct();
48
 
49
- // add all $wp_options to $options
50
- $this->options = array_merge( $this->options, $this->wp_options );
51
  // set option values
52
  $this->_set_options();
 
 
 
53
 
54
  // add filters
55
- add_filter( 'the_content', array( &$this, 'encode_filter' ), 100 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
- // also filter comments
58
- if ( $this->options['filter_comments'] )
59
- add_filter( 'comment_text', array( &$this, 'encode_filter' ), 100 );
60
 
61
  // add actions
62
  add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
63
  add_action( 'admin_init', array( &$this, 'admin_init' ) );
64
-
65
- if ( $this->options['form_on_site'] )
66
- add_action( 'the_posts', array( &$this, 'the_posts' ) );
67
 
68
  // set uninstall hook
69
  if ( function_exists( 'register_deactivation_hook' ) )
@@ -75,13 +100,13 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
75
  * @param array $posts
76
  */
77
  function the_posts( $posts ) {
78
- if ( empty( $posts ) )
79
  return $posts;
80
 
81
  foreach ( $posts as $key => $post ) {
82
  if ( stripos( $post->post_content, '[email_encoder_form]' ) > -1 ) {
83
  // add style and script for ajax encoder
84
- wp_enqueue_script( 'email_encoder', plugins_url( 'js/wp_esp.js', __FILE__ ), array( 'jquery' ) );
85
  // replace tag by form
86
  $posts[$key]->post_content = str_replace( '[email_encoder_form]', $this->get_encoder_form(), $post->post_content );
87
  break;
@@ -110,7 +135,7 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
110
  */
111
  function admin_init() {
112
  // register settings
113
- register_setting( $this->prefix, $this->prefix . 'options' );
114
  }
115
 
116
  /**
@@ -118,7 +143,7 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
118
  */
119
  function admin_print_scripts() {
120
  // add script for ajax encoder
121
- wp_enqueue_script( 'email_encoder', plugins_url( 'js/wp_esp.js', __FILE__ ), array( 'jquery' ) );
122
  }
123
 
124
  /**
@@ -127,70 +152,137 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
127
  function options_page() {
128
  ?>
129
  <div class="wrap">
 
130
  <h2>Email Encoder Bundle</h2>
131
 
132
- <div>
133
- <h3>Settings</h3>
134
- <form method="post" action="options.php">
135
- <?php
136
- settings_fields( $this->prefix );
 
137
  $this->_set_options();
138
  $options = $this->options;
139
  ?>
140
- <fieldset class="options">
141
- <table class="form-table">
142
- <tr>
143
- <th><label for="<?php echo $this->prefix ?>options[method]"><?php _e( 'Encoding method', $this->prefix ) ?></label></th>
144
- <td><select id="<?php echo $this->prefix ?>options[method]" name="<?php echo $this->prefix ?>options[method]" class="postform">
145
- <?php foreach ( $this->methods AS $key => $method ): ?>
146
- <option value="<?php echo $key ?>" <?php if ( $options['method'] == $key ) echo 'selected="selected"' ?>><?php _e( $key, $this->prefix ) ?></option>
147
- <?php endforeach; ?>
148
- <option value="random" <?php if ( $options['method'] == 'random' ) echo 'selected="selected"' ?>><?php _e( 'random', $this->prefix ) ?></option>
149
- </select></td>
150
- </tr>
151
- <tr>
152
- <th><label for="<?php echo $this->prefix ?>options[encode_display]"><?php _e( 'Encode email titles (display)', $this->prefix ) ?></label></th>
153
- <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>
154
- </tr>
155
- <tr>
156
- <th><label for="<?php echo $this->prefix ?>options[encode_mailto]"><?php _e( 'Encode mailto links', $this->prefix ) ?></label></th>
157
- <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>
158
- </tr>
159
- <tr>
160
- <th><label for="<?php echo $this->prefix ?>options[replace_emails]"><?php _e( 'Replace plain text emails', $this->prefix ) ?></label></th>
161
- <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 in the content to an encoded mailto link', $this->prefix ) ?></span></td>
162
- </tr>
163
- <tr>
164
- <th><label for="<?php echo $this->prefix ?>options[filter_comments]"><?php _e( 'Also filter comments', $this->prefix ) ?></label></th>
165
- <td><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>
166
- </tr>
167
- <tr>
168
- <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>
169
- <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>
170
- </tr>
171
- <tr>
172
- <th><label for="<?php echo $this->prefix ?>options[powered_by]"><?php _e( 'Show powered by link', $this->prefix ) ?></label></th>
173
- <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>
174
- </tr>
175
- </table>
176
- </fieldset>
177
- <p class="submit">
178
- <input class="button-primary" type="submit" value="<?php _e( 'Save Changes', $this->prefix ) ?>" />
179
- </p>
180
- </form>
181
- </div>
182
-
183
- <div>
184
- <h3>How To Use?</h3>
185
- <p>Inside a post or page use this code: <code>[encode_email email="info@myemail.com" display="My Email"]</code></p>
186
- <p>And for templates use: <code>&lt;?php echo encode_email( 'info@myemail.com', 'My Email' ); ?&gt;</code></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  </div>
188
 
189
- <div>
190
- <h3>Encoder Form</h3>
191
- <?php echo $this->get_encoder_form(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  </div>
193
-
 
194
  </div>
195
  <?php
196
  }
@@ -202,45 +294,54 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
202
  function get_encoder_form() {
203
  ob_start();
204
  ?>
205
- <form class="email-encoder-form">
 
206
  <fieldset>
207
- <table class="form-table">
208
- <tr>
209
- <tr>
210
- <th><label for="email"><?php _e( 'Email', $this->prefix ) ?></label></th>
211
- <td><input type="text" class="regular-text" id="email" name="email" /></td>
212
- </tr>
213
  <tr>
214
- <th><label for="display"><?php _e( 'Display (optional)', $this->prefix ) ?></label></th>
215
- <td><input type="text" class="regular-text" id="display" name="display" /></td>
216
- </tr>
217
- <tr>
218
- <th><label for="encode_method"><?php _e( 'Encode method', $this->prefix ) ?></label></th>
219
- <td><select id="encode_method" name="encode_method" class="postform">
220
- <?php foreach ( $this->methods AS $key => $method ): ?>
221
- <option value="<?php echo $key ?>" <?php if ( $this->options['method'] == $key ) echo 'selected="selected"' ?>><?php _e( $key, $this->prefix ) ?></option>
222
- <?php endforeach; ?>
223
- <option value="random" <?php if ( $this->options['method'] == 'random' ) echo 'selected="selected"' ?>><?php _e( 'random', $this->prefix ) ?></option>
224
- </select>
225
- <input type="button" id="ajax_encode" value="Encode &gt;" /></td>
226
- </tr>
227
- </tr>
228
- <tr>
229
- <tr>
230
- <th><?php _e( 'Example', $this->prefix ) ?></th>
231
- <td><span id="example"></span></td>
 
 
 
 
 
232
  </tr>
 
 
 
 
233
  <tr>
234
- <th><label for="encoded_output"><?php _e( 'Code', $this->prefix ) ?></label></th>
235
- <td><textarea class="large-text node" id="encoded_output" name="encoded_output"></textarea></td>
 
 
236
  </tr>
237
- </tr>
238
- </table>
239
  <?php if ( $this->options['powered_by'] ): ?>
240
- <p class="powered-by">Powered by <a rel="external" href="http://www.freelancephp.net/email-encoder/">Email Encoder Bundle</a></p>
241
  <?php endif; ?>
242
  </fieldset>
243
- </form>
 
244
  <?php
245
  $form = ob_get_contents();
246
  ob_clean();
@@ -252,8 +353,8 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
252
  * Deactivation plugin method
253
  */
254
  function deactivation() {
255
- delete_option( $this->prefix . 'options' );
256
- unregister_setting( $this->prefix, $this->prefix . 'options' );
257
  }
258
 
259
  /**
@@ -261,27 +362,36 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
261
  */
262
  function _set_options() {
263
  // set options
264
- $saved_options = get_option( $this->prefix . 'options' );
265
  if ( empty( $saved_options ) ) {
266
  // set defaults
267
- $this->options['encode_display'] = (int) $this->options['encode_display'];
268
- $this->options['encode_mailto'] = (int) $this->options['encode_mailto'];
269
- $this->options['replace_emails'] = (int) $this->options['replace_emails'];
270
  $this->options['filter_comments'] = (int) $this->options['filter_comments'];
 
271
  $this->options['form_on_site'] = (int) $this->options['form_on_site'];
272
  $this->options['powered_by'] = (int) $this->options['powered_by'];
273
  } else {
274
  // set saved option values
275
  $this->set_method( $saved_options['method'] );
276
- $this->options['encode_display'] = ! empty( $saved_options['encode_display'] );
277
- $this->options['encode_mailto'] = ! empty( $saved_options['encode_mailto'] );
278
- $this->options['replace_emails'] = ! empty( $saved_options['replace_emails'] );
279
  $this->options['filter_comments'] = ! empty( $saved_options['filter_comments'] );
 
280
  $this->options['form_on_site'] = ! empty( $saved_options['form_on_site'] );
281
  $this->options['powered_by'] = ! empty( $saved_options['powered_by'] );
282
  }
283
  }
284
 
 
 
 
 
 
 
 
285
  } // end class WP_Email_Encoder
286
 
287
 
@@ -292,7 +402,7 @@ $WP_Email_Encoder = new WP_Email_Encoder;
292
 
293
 
294
  /**
295
- * Ajax request
296
  */
297
  if ( ! empty( $_GET['ajax'] ) ):
298
  // input vars
@@ -302,7 +412,7 @@ if ( ! empty( $_GET['ajax'] ) ):
302
 
303
  $WP_Email_Encoder->set_method( $method );
304
 
305
- echo $WP_Email_Encoder->encode_email( $email, $display );
306
  exit;
307
  endif;
308
 
@@ -317,7 +427,23 @@ endif;
317
  if ( ! function_exists( 'encode_email' ) ):
318
  function encode_email( $email, $display = NULL ) {
319
  global $WP_Email_Encoder;
320
- return $WP_Email_Encoder->encode_email( $email, $display );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  }
322
  endif;
323
 
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.22
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
+ // set filter priority
61
+ $priority = 100;
62
+
63
+ // content
64
+ add_filter( 'the_title', array( $this, '_filter_callback' ), $priority );
65
+ add_filter( 'the_content', array( $this, '_filter_callback' ), $priority );
66
+ add_filter( 'the_excerpt', array( $this, '_filter_callback' ), $priority );
67
+ add_filter( 'get_the_excerpt', array( $this, '_filter_callback' ), $priority );
68
+
69
+ // comments
70
+ if ( $this->options[ 'filter_comments' ] ) {
71
+ add_filter( 'comment_text', array( $this, '_filter_callback' ), $priority );
72
+ add_filter( 'comment_excerpt', array( $this, '_filter_callback' ), $priority );
73
+ add_filter( 'get_comment_author_url', array( $this, '_filter_callback' ), $priority );
74
+ add_filter( 'get_comment_author_link', array( $this, '_filter_callback' ), $priority );
75
+ add_filter( 'get_comment_author_url_link', array( $this, '_filter_callback' ), $priority );
76
+ }
77
+
78
+ // widgets ( only text widgets )
79
+ if ( $this->options[ 'filter_widgets' ] ) {
80
+ add_filter( 'widget_title', array( $this, '_filter_callback' ), $priority );
81
+ add_filter( 'widget_text', array( $this, '_filter_callback' ), $priority );
82
+
83
+ // Only if Widget Logic plugin is installed
84
+ add_filter( 'widget_content', array( $this, '_filter_callback' ), $priority );
85
+ }
86
 
 
 
 
87
 
88
  // add actions
89
  add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
90
  add_action( 'admin_init', array( &$this, 'admin_init' ) );
91
+ add_action( 'the_posts', array( &$this, 'the_posts' ) );
 
 
92
 
93
  // set uninstall hook
94
  if ( function_exists( 'register_deactivation_hook' ) )
100
  * @param array $posts
101
  */
102
  function the_posts( $posts ) {
103
+ if ( empty( $posts ) OR ! $this->options['form_on_site'] )
104
  return $posts;
105
 
106
  foreach ( $posts as $key => $post ) {
107
  if ( stripos( $post->post_content, '[email_encoder_form]' ) > -1 ) {
108
  // add style and script for ajax encoder
109
+ wp_enqueue_script( 'email_encoder', plugins_url( 'js/email-encoder-bundle.js', __FILE__ ), array( 'jquery' ) );
110
  // replace tag by form
111
  $posts[$key]->post_content = str_replace( '[email_encoder_form]', $this->get_encoder_form(), $post->post_content );
112
  break;
135
  */
136
  function admin_init() {
137
  // register settings
138
+ register_setting( $this->domain, $this->domain . 'options' );
139
  }
140
 
141
  /**
143
  */
144
  function admin_print_scripts() {
145
  // add script for ajax encoder
146
+ wp_enqueue_script( 'email_encoder', plugins_url( 'js/email-encoder-bundle.js', __FILE__ ), array( 'jquery-ui-sortable' ) );
147
  }
148
 
149
  /**
152
  function options_page() {
153
  ?>
154
  <div class="wrap">
155
+ <div class="icon32" id="icon-options-general"><br></div>
156
  <h2>Email Encoder Bundle</h2>
157
 
158
+ <form method="post" action="options.php">
159
+ <script language="javascript">
160
+ var methodInfo = <?php echo json_encode( $this->methods ) ?>;
161
+ </script>
162
+ <?php
163
+ settings_fields( $this->domain );
164
  $this->_set_options();
165
  $options = $this->options;
166
  ?>
167
+ <div class="postbox-container metabox-holder meta-box-sortables" style="width: 69%">
168
+ <div class="postbox">
169
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
170
+ <h3 class="hndle"><?php _e( 'Settings' ) ?></h3>
171
+ <div class="inside">
172
+ <fieldset class="options">
173
+ <table class="form-table">
174
+ <tr>
175
+ <th><label for="<?php echo $this->domain ?>options[method]"><?php _e( 'Choose encoding method', $this->domain ) ?></label></th>
176
+ <td><select id="<?php echo $this->domain ?>options[method]" name="<?php echo $this->domain ?>options[method]" class="method-info-select postform">
177
+ <?php foreach ( $this->methods AS $method => $info ): ?>
178
+ <option value="<?php echo $method ?>" <?php if ( $this->method == $method ) echo 'selected="selected"' ?>><?php echo $info[ 'name' ] ?></option>
179
+ <?php endforeach; ?>
180
+ <option value="random" <?php if ( $this->method == 'random' ) echo 'selected="selected"' ?>><?php echo __( 'Random', $this->domain ) ?></option>
181
+ </select>
182
+ <br /><span class="description"></span>
183
+ </td>
184
+ </tr>
185
+ <tr>
186
+ <th><label for="<?php echo $this->domain ?>options[encode_tags]"><?php _e( 'Encode tags', $this->domain ) ?></label></th>
187
+ <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>
188
+ </tr>
189
+ <tr>
190
+ <th><label for="<?php echo $this->domain ?>options[encode_mailtos]"><?php _e( 'Encode mailto-links', $this->domain ) ?></label></th>
191
+ <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>
192
+ </tr>
193
+ <tr>
194
+ <th><label for="<?php echo $this->domain ?>options[encode_emails]"><?php _e( 'Encode plain emails', $this->domain ) ?></label></th>
195
+ <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>
196
+ </tr>
197
+ <tr>
198
+ <th style="padding-top:25px"><label for="<?php echo $this->domain ?>options[filter_comments]"><?php _e( 'Include comments', $this->domain ) ?></label></th>
199
+ <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>
200
+ </tr>
201
+ <tr>
202
+ <th><label for="<?php echo $this->domain ?>options[filter_widgets]"><?php _e( 'Include widgets', $this->domain ) ?></label></th>
203
+ <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>
204
+ </tr>
205
+ </table>
206
+ </fieldset>
207
+ <p class="submit">
208
+ <input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
209
+ </p>
210
+ </div>
211
+ </div>
212
+
213
+ <div class="postbox">
214
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
215
+ <h3 class="hndle"><?php _e( 'Email Encoder Form', $this->domain ) ?></h3>
216
+ <div class="inside">
217
+ <?php echo $this->get_encoder_form(); ?>
218
+ </div>
219
+ </div>
220
+
221
+ <div class="postbox">
222
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
223
+ <h3 class="hndle"><?php _e( 'Settings Email Encoder Form', $this->domain ) ?></h3>
224
+ <div class="inside">
225
+ <fieldset class="options">
226
+ <table class="form-table">
227
+ <tr>
228
+ <th><label for="<?php echo $this->domain ?>options[form_on_site]"><?php _e( 'Put form on your site', $this->domain ) ?></label></th>
229
+ <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>
230
+ </tr>
231
+ <tr>
232
+ <th><label for="<?php echo $this->domain ?>options[powered_by]"><?php _e( 'Show "powered by"-link', $this->domain ) ?></label></th>
233
+ <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>
234
+ </tr>
235
+ </table>
236
+ </fieldset>
237
+ <p class="submit">
238
+ <input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
239
+ </p>
240
+ </div>
241
+ </div>
242
  </div>
243
 
244
+ <div class="postbox-container side metabox-holder meta-box-sortables" style="width: 29%">
245
+ <div class="postbox">
246
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
247
+ <h3 class="hndle"><?php _e( 'How to use', $this->domain ) ?></h3>
248
+ <div class="inside">
249
+ <h4><?php _e( 'Tags', $this->domain ) ?></h4>
250
+ <ul>
251
+ <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>
252
+ <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>
253
+ </ul>
254
+ <h4><?php _e( 'Template functions' ) ?></h4>
255
+ <ul>
256
+ <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>
257
+ <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>
258
+ </ul>
259
+ </div>
260
+ </div>
261
+
262
+ <div class="postbox">
263
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
264
+ <h3 class="hndle"><?php _e( 'About this plugin', $this->domain ) ?></h3>
265
+ <div class="inside">
266
+ <h4>FreelancePHP.net</h4>
267
+ <ul>
268
+ <li><a href="http://www.freelancephp.net/email-encoder-php-class-wp-plugin/" target="_blank">WP Email Encoder Bundle</a></li>
269
+ </ul>
270
+
271
+ <h4>WordPress Plugin Directory</h4>
272
+ <ul>
273
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/" target="_blank"><?php _e( 'Description', $this->domain ) ?></a></li>
274
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/installation/" target="_blank"><?php _e( 'Installation', $this->domain ) ?></a></li>
275
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/faq/" target="_blank"><?php _e( 'FAQ', $this->domain ) ?></a></li>
276
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/screenshots/" target="_blank"><?php _e( 'Screenshot', $this->domain ) ?></a></li>
277
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/other_notes/" target="_blank"><?php _e( 'Other Notes', $this->domain ) ?></a></li>
278
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/changelog/" target="_blank"><?php _e( 'Changelog', $this->domain ) ?></a></li>
279
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/stats/" target="_blank"><?php _e( 'Stats', $this->domain ) ?></a></li>
280
+ </ul>
281
+ </div>
282
+ </div>
283
  </div>
284
+ </form>
285
+ <div class="clear"></div>
286
  </div>
287
  <?php
288
  }
294
  function get_encoder_form() {
295
  ob_start();
296
  ?>
297
+ <div class="email-encoder-form">
298
+ <form>
299
  <fieldset>
300
+ <div class="input">
301
+ <table>
 
 
 
 
302
  <tr>
303
+ <tr>
304
+ <th><label for="email"><?php _e( 'Email address', $this->domain ) ?></label></th>
305
+ <td><input type="text" class="regular-text" id="email" name="email" /></td>
306
+ </tr>
307
+ <tr>
308
+ <th><label for="display"><?php _e( 'Display', $this->domain ) ?></label></th>
309
+ <td><input type="text" class="regular-text" id="display" name="display" /></td>
310
+ </tr>
311
+ <tr>
312
+ <th><?php _e( 'Example', $this->domain ) ?></th>
313
+ <td><span id="example"></span></td>
314
+ </tr>
315
+ <tr>
316
+ <th><label for="encode_method"><?php _e( 'Encode method', $this->domain ) ?></label></th>
317
+ <td><select id="encode_method" name="encode_method" class="postform">
318
+ <?php foreach ( $this->methods AS $method => $info ): ?>
319
+ <option value="<?php echo $method ?>" <?php if ( $this->method == $method ) echo 'selected="selected"' ?>><?php echo $info[ 'name' ] ?></option>
320
+ <?php endforeach; ?>
321
+ <option value="random" <?php if ( $this->method == 'random' ) echo 'selected="selected"' ?>><?php _e( 'Random', $this->domain ) ?></option>
322
+ </select>
323
+ <input type="button" id="ajax_encode" value="<?php _e( 'Encode', $this->domain ) ?> &gt;&gt;" />
324
+ </td>
325
+ </tr>
326
  </tr>
327
+ </table>
328
+ </div>
329
+ <div class="output nodis">
330
+ <table>
331
  <tr>
332
+ <tr>
333
+ <th><label for="encoded_output"><?php _e( 'Code', $this->domain ) ?></label></th>
334
+ <td><textarea class="large-text node" id="encoded_output" name="encoded_output"></textarea></td>
335
+ </tr>
336
  </tr>
337
+ </table>
338
+ </div>
339
  <?php if ( $this->options['powered_by'] ): ?>
340
+ <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>
341
  <?php endif; ?>
342
  </fieldset>
343
+ </form>
344
+ </div>
345
  <?php
346
  $form = ob_get_contents();
347
  ob_clean();
353
  * Deactivation plugin method
354
  */
355
  function deactivation() {
356
+ delete_option( $this->domain . 'options' );
357
+ unregister_setting( $this->domain, $this->domain . 'options' );
358
  }
359
 
360
  /**
362
  */
363
  function _set_options() {
364
  // set options
365
+ $saved_options = get_option( $this->domain . 'options' );
366
  if ( empty( $saved_options ) ) {
367
  // set defaults
368
+ $this->options['encode_tags'] = (int) $this->options['encode_tags'];
369
+ $this->options['encode_mailtos'] = (int) $this->options['encode_mailtos'];
370
+ $this->options['encode_emails'] = (int) $this->options['encode_emails'];
371
  $this->options['filter_comments'] = (int) $this->options['filter_comments'];
372
+ $this->options['filter_widgets'] = (int) $this->options['filter_widgets'];
373
  $this->options['form_on_site'] = (int) $this->options['form_on_site'];
374
  $this->options['powered_by'] = (int) $this->options['powered_by'];
375
  } else {
376
  // set saved option values
377
  $this->set_method( $saved_options['method'] );
378
+ $this->options['encode_tags'] = ! empty( $saved_options['encode_tags'] );
379
+ $this->options['encode_mailtos'] = ! empty( $saved_options['encode_mailtos'] );
380
+ $this->options['encode_emails'] = ! empty( $saved_options['encode_emails'] );
381
  $this->options['filter_comments'] = ! empty( $saved_options['filter_comments'] );
382
+ $this->options['filter_widgets'] = ! empty( $saved_options['filter_widgets'] );
383
  $this->options['form_on_site'] = ! empty( $saved_options['form_on_site'] );
384
  $this->options['powered_by'] = ! empty( $saved_options['powered_by'] );
385
  }
386
  }
387
 
388
+ /**
389
+ * Callback used for wp filters
390
+ */
391
+ function _filter_callback( $content ) {
392
+ return $this->filter( $content, $this->options[ 'encode_tags' ], $this->options[ 'encode_mailtos' ], $this->options[ 'encode_emails' ] );
393
+ }
394
+
395
  } // end class WP_Email_Encoder
396
 
397
 
402
 
403
 
404
  /**
405
+ * Ajax Encoding request
406
  */
407
  if ( ! empty( $_GET['ajax'] ) ):
408
  // input vars
412
 
413
  $WP_Email_Encoder->set_method( $method );
414
 
415
+ echo $WP_Email_Encoder->encode( $email, $display );
416
  exit;
417
  endif;
418
 
427
  if ( ! function_exists( 'encode_email' ) ):
428
  function encode_email( $email, $display = NULL ) {
429
  global $WP_Email_Encoder;
430
+ return $WP_Email_Encoder->encode( $email, $display );
431
+ }
432
+ endif;
433
+
434
+ /**
435
+ * Template function for encoding emails in the given content
436
+ * @global WP_Email_Encoder $WP_Email_Encoder
437
+ * @param string $content
438
+ * @param boolean $enc_tags Optional, default TRUE
439
+ * @param boolean $enc_plain_emails Optional, default TRUE
440
+ * @param boolean $enc_mailtos Optional, default TRUE
441
+ * @return string
442
+ */
443
+ if ( ! function_exists( 'encode_email_filter' ) ):
444
+ function encode_email_filter( $content, $enc_tags = TRUE, $enc_plain_emails = TRUE, $enc_mailtos = TRUE ) {
445
+ global $WP_Email_Encoder;
446
+ return $WP_Email_Encoder->filter( $content, $enc_tags, $enc_plain_emails, $enc_mailtos );
447
  }
448
  endif;
449
 
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,75 +1,114 @@
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.7.0
6
- Tested up to: 2.9.1
7
- Stable tag: 0.10
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
- * Automatically encodes all email adresses (plain text and mailto links)
16
- * Put an email encoder form on your own site.
17
- * Choose the prefered method (or on every request randomly pick one of the methods)
18
- * Add your own methods.
19
- * Easy to use.
 
 
 
 
 
 
 
 
 
 
20
 
21
  == Installation ==
22
 
23
- 1. Upload `wp-email-encoder-bundle.zip` to the `/wp-content/plugins/` directory
24
- 1. Activate the plugin through the 'Plugins' menu in WordPress
25
- 1. Place `[encode_email email="youremail@domain.com" display="Mail me"]` in a post
26
- 1. OR place `<?php encode_emal( 'youremail@domain.com', 'Mail me' ); ?>` in your templates
 
 
27
 
28
- 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]`
 
 
29
 
30
  == Frequently Asked Questions ==
31
 
32
- = Which method should I use? =
33
 
34
- The `wp_antispambot` method uses the built-in function of WordPress and does not use any javascript.
35
- Although JavaScript methods (like email_escape) are probably better protection agains spambots.
36
- You could also use the `random` function to randomly pick a method on every page request.
37
 
38
- = How can I add my own method? =
39
 
40
- 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.
41
- 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:
42
- `if ( $encode_display ) {`
43
- ` $display = Lim_Email_Encoder::get_htmlent( $display );`
44
- `}`
45
 
46
- 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`.
47
- Now your function will be loaded automatically.
48
 
49
- [Do you have another question? Please ask me](http://www.freelancephp.net/email-encoder/)
 
 
 
 
 
 
 
50
 
51
  == Screenshots ==
52
 
53
- 1. Admin option page
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  = 0.10 =
58
  * Works with PHP4 and PHP5
59
  * Methods: default_encode, wp_antispambot, anti_email_spam, email_escape, hide_email
60
  * Use the tags: `[email_encode email=".." display=".."]`, `[email_encoder_form]`
61
  * Template function: `email_encode()`
62
 
63
- == Credits ==
64
 
65
- Credit goes to:
 
 
66
 
67
- * [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/)
68
- * [Maurits van der Schee](http://www.maurits.vdschee.nl) for the encode method hide_email()
69
- * [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/)
70
  * [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)
 
71
 
72
  == Upgrade Notice ==
73
 
74
- = 0.10 =
75
- The first release.
1
  === Email Encoder Bundle ===
2
  Contributors: freelancephp
3
+ Tags: email, hide, mailto, spam, protection, spambots, encoder, encrypt, encode, obfuscate, antispam, spamming
 
4
  Requires at least: 2.7.0
5
+ Tested up to: 3.1
6
+ Stable tag: 0.22
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.22 =
73
+ * First decodes entities before encoding email
74
+ * Added more wp filters for encoding
75
+
76
+ = 0.21 =
77
+ * Changed Encoder Form: HTML markup and JavaScript
78
+ * Made some minor adjustments and fixed little bugs
79
+
80
+ = 0.20 =
81
+ * Implemented internalization (including translation for nl_NL)
82
+ * Improved user-interface of the Admin Settings Page and the Encoder Form
83
+ * Added template function: encode_email_filter()
84
+ * Kept and added only high-quality encoding methods
85
+ * Refactored the code and changed method- and var-names within the classes
86
+ * Removed 3rd param $encode_display out of the encoding methods, display should always be encoded
87
+ * Added prefix 'lim_email_' to the encoding methods
88
+
89
+ = 0.12 =
90
+ * Nothing changed, but 0.11 had some errors because /methods directory was missing in the repository.
91
+
92
+ = 0.11 =
93
+ * also possible to use encode tag in widgets by activating the "filter widget" option
94
+
95
  = 0.10 =
96
  * Works with PHP4 and PHP5
97
  * Methods: default_encode, wp_antispambot, anti_email_spam, email_escape, hide_email
98
  * Use the tags: `[email_encode email=".." display=".."]`, `[email_encoder_form]`
99
  * Template function: `email_encode()`
100
 
101
+ == Other Notes ==
102
 
103
+ = TODO =
104
+ I've got some nice ideas for the next version(s).
105
+ If you have a suggestion please [contact me](http://www.freelancephp.net/contact/)
106
 
107
+ = Credits =
108
+ * [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/)
 
109
  * [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)
110
+ * [Tyler Akins](http://rumkin.com) for the encode method 'JavaScript ASCII Mixer'
111
 
112
  == Upgrade Notice ==
113
 
114
+ 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