Email Encoder Bundle – Protect Email Address - Version 0.30

Version Description

  • Added protection for emails in RSS feeds
  • Improved filtering tags [encode_email ... ]
  • Improved ASCII and Escape method and added noscript message
  • Solved an option bug (encode mailto links VS encode plain emails)
  • Made some cosmetical adjustments on the options page
  • Code refactoring
Download this release

Release Info

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

Code changes from version 0.22 to 0.30

GPL-license.txt DELETED
@@ -1,45 +0,0 @@
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
5
-
6
- Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7
- Preamble
8
-
9
- The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software — to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation’s software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
10
-
11
- When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
12
-
13
- To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
14
-
15
- For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
16
-
17
- We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
18
-
19
- Also, for each author’s protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
20
-
21
- Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone’s free use or not licensed at all.
22
-
23
- The precise terms and conditions for copying, distribution and modification follow.
24
- GNU General Public License Terms and Conditions for Copying, Distribution, and Modification
25
-
26
- 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
27
- 1. You may copy and distribute verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
28
- 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
29
- 1. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
30
- 2. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
31
- 3. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
32
- These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
33
- 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
34
- 1. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
35
- 2. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
36
- 3. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
37
- 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
38
- 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
39
- 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
40
- 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
41
- 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
42
- 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
43
- 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
44
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
45
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Lim_Email_Encoder.php CHANGED
@@ -69,8 +69,7 @@ class Lim_Email_Encoder {
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 )
@@ -80,38 +79,6 @@ class Lim_Email_Encoder {
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
@@ -122,19 +89,20 @@ class Lim_Email_Encoder {
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
 
@@ -143,18 +111,6 @@ class Lim_Email_Encoder {
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
69
  */
70
  function encode( $email, $display = NULL ) {
71
  // decode entities
72
+ $email = html_entity_decode( $email );
 
73
 
74
  // set email as display
75
  if ( $display === NULL )
79
  return call_user_func( $this->method, $email, $display );
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  /**
83
  * Convert randomly chars to htmlentities
84
  * This method is partly taken from WordPress
89
  */
90
  function get_htmlent( $value ) {
91
  // check if antispambot WordPress function exists
92
+ if ( function_exists( 'antispambot' ) ) {
93
+ $enc_value = antispambot( $value );
94
+ } else {
95
+ $enc_value = '';
96
+ srand( (float) microtime() * 1000000 );
97
 
98
+ for ( $i = 0; $i < strlen( $value ); $i = $i + 1 ) {
99
+ $j = floor( rand( 0, 1 ) );
100
 
101
+ if ( $j == 0 ) {
102
+ $enc_value .= '&#' . ord( substr( $value, $i, 1 ) ).';';
103
+ } elseif ( $j == 1 ) {
104
+ $enc_value .= substr( $value, $i, 1 );
105
+ }
106
  }
107
  }
108
 
111
  return $enc_value;
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  /**
115
  * Load available methods
116
  * @return void
MIT-license.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2010 Victor Villaverde Laan, http://www.freelancephp.net/
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
email-encoder-bundle.php CHANGED
@@ -2,9 +2,9 @@
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
  */
@@ -12,35 +12,57 @@ License: Dual licensed under the MIT and GPL licenses
12
  require_once dirname( __FILE__ ) . '/Lim_Email_Encoder.php';
13
 
14
  /**
15
- * Class WP_Email_Encoder, child of Lim_Email_Encoder
16
  * @package Lim_Email_Encoder
17
  * @category WordPress Plugins
18
  */
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
  /**
41
  * PHP4 constructor
42
  */
43
- function WP_Email_Encoder() {
44
  $this->__construct();
45
  }
46
 
@@ -56,43 +78,71 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
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' ) )
95
- register_deactivation_hook( __FILE__, array( &$this, 'deactivation' ));
96
  }
97
 
98
  /**
@@ -100,13 +150,13 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
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;
@@ -124,9 +174,6 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
124
  // add options page
125
  $page = add_options_page( 'Email Encoder Bundle', 'Email Encoder Bundle',
126
  'manage_options', __FILE__, array( &$this, 'options_page' ) );
127
-
128
- // add scripts
129
- add_action( 'admin_print_scripts-' . $page, array( &$this, 'admin_print_scripts' ) );
130
  }
131
  }
132
 
@@ -135,15 +182,14 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
135
  */
136
  function admin_init() {
137
  // register settings
138
- register_setting( $this->domain, $this->domain . 'options' );
139
- }
140
 
141
- /**
142
- * Callback admin_print_scripts
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
  /**
@@ -151,8 +197,34 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
151
  */
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">
@@ -165,42 +237,57 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
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>
@@ -210,27 +297,34 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
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>
@@ -240,47 +334,45 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
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>
@@ -349,12 +441,36 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
349
  return $form;
350
  }
351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  /**
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,43 +478,76 @@ class WP_Email_Encoder extends Lim_Email_Encoder {
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
 
398
  /**
399
  * Create instance
400
  */
401
- $WP_Email_Encoder = new WP_Email_Encoder;
402
 
403
 
404
  /**
@@ -410,40 +559,40 @@ if ( ! empty( $_GET['ajax'] ) ):
410
  $email = $_GET['email'];
411
  $display = ( empty( $_GET['display'] ) ) ? $email : $_GET['display'];
412
 
413
- $WP_Email_Encoder->set_method( $method );
414
 
415
- echo $WP_Email_Encoder->encode( $email, $display );
416
  exit;
417
  endif;
418
 
419
 
420
  /**
421
  * Template function for encoding email
422
- * @global WP_Email_Encoder $WP_Email_Encoder
423
  * @param string $email
424
  * @param string $display if non given will be same as email
425
  * @return string
426
  */
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
 
2
  /*
3
  Plugin Name: Email Encoder Bundle
4
  Plugin URI: http://www.freelancephp.net/email-encoder-php-class-wp-plugin/
5
+ Description: Protect email addresses on your site from spambots and being used for spamming by using one of the encoding methods.
6
  Author: Victor Villaverde Laan
7
+ Version: 0.30
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
12
  require_once dirname( __FILE__ ) . '/Lim_Email_Encoder.php';
13
 
14
  /**
15
+ * Class WP_Email_Encoder_Bundle, child of Lim_Email_Encoder
16
  * @package Lim_Email_Encoder
17
  * @category WordPress Plugins
18
  */
19
+ class WP_Email_Encoder_Bundle extends Lim_Email_Encoder {
20
+
21
+ /**
22
+ * Current version
23
+ * @var string
24
+ */
25
+ var $version = '0.30';
26
 
27
  /**
28
  * Used as prefix for options entry and could be used as text domain (for translations)
29
  * @var string
30
  */
31
+ var $domain = 'WP_Email_Encoder_Bundle';
32
+
33
+ /**
34
+ * Name of the options
35
+ * @var string
36
+ */
37
+ var $options_name = 'WP_Email_Encoder_Bundle_options';
38
 
39
  /**
40
  * @var array
41
  */
42
  var $options = array(
43
+ 'method' => NULL,
44
+ 'encode_mailtos' => 1,
45
+ 'encode_emails' => 1,
46
+ 'filter_widgets' => 1,
47
+ 'filter_comments' => 1,
48
+ 'filter_rss' => 1,
49
+ 'powered_by' => 1,
50
  );
51
 
52
+ /**
53
+ * Regexp
54
+ * @var array
55
+ */
56
+ var $regexp_patterns = array(
57
+ 'mailto' => '/<a.*?href=["\']mailto:(.*?)["\'].*?>(.*?)<\/a[\s+]*>/i',
58
+ 'tag' => '/\[encode_email\s+(.*?)\]/i',
59
+ 'email' => '/([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6})/i',
60
+ );
61
+
62
  /**
63
  * PHP4 constructor
64
  */
65
+ function WP_Email_Encoder_Bundle() {
66
  $this->__construct();
67
  }
68
 
78
  // load text domain for translations
79
  load_plugin_textdomain( $this->domain, dirname( __FILE__ ) . '/lang/', basename( dirname(__FILE__) ) . '/lang/' );
80
 
81
+ // add actions
82
+ add_action( 'init', array( $this, 'init' ) );
83
+ add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
84
+ add_action( 'admin_init', array( &$this, 'admin_init' ) );
85
+ add_action( 'the_posts', array( &$this, 'the_posts' ) );
86
+ }
87
 
88
+ /**
89
+ * Callback init
90
+ */
91
+ function init() {
92
+ if ( is_admin() ) {
93
+ // set uninstall hook
94
+ if ( function_exists( 'register_deactivation_hook' ) )
95
+ register_deactivation_hook( __FILE__, array( &$this, 'deactivation' ));
96
+ } else {
97
+ $priority = 100;
98
+
99
+ // set content filters
100
+ add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), $priotity );
101
+
102
+ // comments
103
+ if ( $this->options[ 'filter_comments' ] ) {
104
+ add_filter( 'comment_text', array( $this, '_filter_callback' ), $priority );
105
+ add_filter( 'comment_excerpt', array( $this, '_filter_callback' ), $priority );
106
+ add_filter( 'get_comment_author_url', array( $this, '_filter_callback' ), $priority );
107
+ add_filter( 'get_comment_author_link', array( $this, '_filter_callback' ), $priority );
108
+ add_filter( 'get_comment_author_url_link', array( $this, '_filter_callback' ), $priority );
109
+ }
110
 
111
+ // widgets ( only text widgets )
112
+ if ( $this->options[ 'filter_widgets' ] ) {
113
+ add_filter( 'widget_title', array( $this, '_filter_callback' ), $priority );
114
+ add_filter( 'widget_text', array( $this, '_filter_callback' ), $priority );
115
 
116
+ // Only if Widget Logic plugin is installed
117
+ add_filter( 'widget_content', array( $this, '_filter_callback' ), $priority );
118
+ }
119
  }
120
+ }
121
 
122
+ /**
123
+ * pre_get_posts filter
124
+ * @param object $query
125
+ */
126
+ function pre_get_posts( $query ) {
127
+ $priority = 100;
128
 
129
+ if ( $query->is_feed ) {
130
+ // rss feed
131
+ if ( $this->options[ 'filter_rss' ] ) {
132
+ add_filter( 'the_content_rss', array( $this, '_filter_rss_callback' ), $priority );
133
+ add_filter( 'the_content_feed', array( $this, '_filter_rss_callback' ), $priority );
134
+ add_filter( 'the_excerpt_rss', array( $this, '_filter_rss_callback' ), $priority );
135
+ add_filter( 'comment_text_rss', array( $this, '_filter_rss_callback' ), $priority );
136
+ }
137
+ } else {
138
+ // post content
139
+ add_filter( 'the_title', array( $this, '_filter_callback' ), $priority );
140
+ add_filter( 'the_content', array( $this, '_filter_callback' ), $priority );
141
+ add_filter( 'the_excerpt', array( $this, '_filter_callback' ), $priority );
142
+ add_filter( 'get_the_excerpt', array( $this, '_filter_callback' ), $priority );
143
+ }
144
 
145
+ return $query;
 
 
146
  }
147
 
148
  /**
150
  * @param array $posts
151
  */
152
  function the_posts( $posts ) {
153
+ if ( empty( $posts ) )
154
  return $posts;
155
 
156
  foreach ( $posts as $key => $post ) {
157
  if ( stripos( $post->post_content, '[email_encoder_form]' ) > -1 ) {
158
  // add style and script for ajax encoder
159
+ wp_enqueue_script( 'email_encoder', plugins_url( 'js/email-encoder-bundle.js', __FILE__ ), array( 'jquery' ), $this->version );
160
  // replace tag by form
161
  $posts[$key]->post_content = str_replace( '[email_encoder_form]', $this->get_encoder_form(), $post->post_content );
162
  break;
174
  // add options page
175
  $page = add_options_page( 'Email Encoder Bundle', 'Email Encoder Bundle',
176
  'manage_options', __FILE__, array( &$this, 'options_page' ) );
 
 
 
177
  }
178
  }
179
 
182
  */
183
  function admin_init() {
184
  // register settings
185
+ register_setting( $this->domain, $this->options_name );
 
186
 
187
+ // set dashboard postbox
188
+ wp_admin_css( 'dashboard' );
189
+ wp_enqueue_script( 'dashboard' );
190
+
191
+ // add style and script for ajax encoder
192
+ wp_enqueue_script( 'email_encoder', plugins_url( 'js/email-encoder-bundle.js', __FILE__ ), array( 'jquery' ), $this->version );
193
  }
194
 
195
  /**
197
  */
198
  function options_page() {
199
  ?>
200
+ <script language="javascript">
201
+ jQuery(function( $ ){
202
+ // remove message
203
+ $( '.settings-error' )
204
+ .hide()
205
+ .slideDown( 600 )
206
+ .delay( 3000 )
207
+ .slideUp( 600 );
208
+
209
+ // set info text for selected encoding method
210
+ $( '.method-info-select' ).bind( 'change blur keyup', function(){
211
+ var method = $( this ).val(),
212
+ $desc = $( this ).parent().find( 'span.description' );
213
+
214
+ if ( methodInfo && methodInfo[ method ] ) {
215
+ $desc.html( methodInfo[ method ][ 'description' ] || '' );
216
+ } else {
217
+ $desc.html( '' );
218
+ }
219
+ })
220
+ .blur();
221
+
222
+ // add form-table class to Encoder Form tables
223
+ $( '.email-encoder-form table' ).addClass( 'form-table' );
224
+ });
225
+ </script>
226
  <div class="wrap">
227
+ <div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/icon-email-encoder-bundle.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
228
  <h2>Email Encoder Bundle</h2>
229
 
230
  <form method="post" action="options.php">
237
  $options = $this->options;
238
  ?>
239
  <div class="postbox-container metabox-holder meta-box-sortables" style="width: 69%">
240
+ <div style="margin:0 5px;">
241
  <div class="postbox">
242
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
243
+ <h3 class="hndle"><?php _e( 'General Settings' ) ?></h3>
244
  <div class="inside">
245
  <fieldset class="options">
246
  <table class="form-table">
247
  <tr>
248
+ <th><?php _e( 'Choose encoding method', $this->domain ) ?></th>
249
+ <td><label><select id="<?php echo $this->options_name ?>[method]" name="<?php echo $this->options_name ?>[method]" class="method-info-select postform">
250
  <?php foreach ( $this->methods AS $method => $info ): ?>
251
  <option value="<?php echo $method ?>" <?php if ( $this->method == $method ) echo 'selected="selected"' ?>><?php echo $info[ 'name' ] ?></option>
252
  <?php endforeach; ?>
253
  <option value="random" <?php if ( $this->method == 'random' ) echo 'selected="selected"' ?>><?php echo __( 'Random', $this->domain ) ?></option>
254
  </select>
255
+ <br /><span class="description"></span></label>
256
  </td>
257
  </tr>
258
  <tr>
259
+ <th><?php _e( 'Encode emails', $this->domain ) ?></th>
260
+ <td>
261
+ <label><input type="checkbox" name="<?php echo $this->options_name ?>[encode_tags]" value="1" checked="checked" disabled="disabled" />
262
+ <span><?php _e( 'Encode <code>[encode_email]</code> tags', $this->domain ) ?></span>
263
+ </label>
264
+ <br/><label><input type="checkbox" id="<?php echo $this->options_name ?>[encode_mailtos]" name="<?php echo $this->options_name ?>[encode_mailtos]" value="1" <?php checked('1', (int) $options['encode_mailtos']); ?> />
265
+ <span><?php _e( 'Encode mailto-links', $this->domain ) ?></span>
266
+ </label>
267
+ <br/><label><input type="checkbox" id="<?php echo $this->options_name ?>[encode_emails]" name="<?php echo $this->options_name ?>[encode_emails]" value="1" <?php checked('1', (int) $options['encode_emails']); ?> />
268
+ <span><?php _e( 'Replace plain emailaddresses to encoded mailto-links', $this->domain ) ?></span>
269
+ </label>
270
+ <?php if ( $enc_conflict ): ?>
271
+ <br/><span class="description"><?php _e( 'Warning: "WP Mailto Links Plugin" is activated, turn off this option when a conflict occures.', $this->domain ) ?></span>
272
+ <?php endif; ?>
273
+ </td>
274
  </tr>
275
  <tr>
276
+ <th><?php _e( 'Options has effect on', $this->domain ) ?></th>
277
+ <td><label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_posts]" value="1" checked="checked" disabled="disabled" />
278
+ <span><?php _e( 'Posts', $this->domain ) ?></span>
279
+ </label>
280
+ <br/><label><input type="checkbox" id="<?php echo $this->options_name ?>[filter_comments]" name="<?php echo $this->options_name ?>[filter_comments]" value="1" <?php checked('1', (int) $options['filter_comments']); ?> />
281
+ <span><?php _e( 'Comments', $this->domain ) ?></span></label>
282
+ <br/><label><input type="checkbox" id="<?php echo $this->options_name ?>[filter_widgets]" name="<?php echo $this->options_name ?>[filter_widgets]" value="1" <?php checked('1', (int) $options['filter_widgets']); ?> />
283
+ <span><?php _e( 'Text widgets', $this->domain ) ?></span></label>
284
+ </td>
285
  </tr>
286
  <tr>
287
+ <th><?php _e( 'Protect RSS feed', $this->domain ) ?></th>
288
+ <td><label><input type="checkbox" id="<?php echo $this->options_name ?>[filter_rss]" name="<?php echo $this->options_name ?>[filter_rss]" value="1" <?php checked('1', (int) $options['filter_rss']); ?> />
289
+ <span><?php _e( 'Replace emails in RSS feed by <code>*protected email*</code>', $this->domain ) ?></span></label>
290
+ </td>
291
  </tr>
292
  </table>
293
  </fieldset>
297
  </div>
298
  </div>
299
 
300
+ <div class="postbox closed">
301
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
302
+ <h3 class="hndle"><?php _e( 'How to use', $this->domain ) ?></h3>
303
  <div class="inside">
304
+ <h4><?php _e( 'Tags', $this->domain ) ?></h4>
305
+ <ul>
306
+ <li><code>[encode_email email="..." display="..."]</code> <span class="description"><?php _e( 'Encode the given email, "display" is optional otherwise the email wil be used as display', $this->domain ) ?></span></li>
307
+ <li><code>[email_encoder_form]</code> <span class="description"><?php _e( 'Puts an email encoder form in your post', $this->domain ) ?></span></li>
308
+ </ul>
309
+ <h4><?php _e( 'Template functions' ) ?></h4>
310
+ <ul>
311
+ <li><code>&lt;?php echo encode_email( 'info@myemail.com', 'My Email' ); ?&gt;</code> <span class="description"><?php _e( 'Encode the given email, the second param is display and optional', $this->domain ) ?></span></li>
312
+ <li><code>&lt;?php echo encode_email_filter( $content ); ?&gt;</code> <span class="description"><?php _e( 'Filter the given content for emails to encode', $this->domain ) ?></span></li>
313
+ </ul>
314
  </div>
315
  </div>
316
 
317
  <div class="postbox">
318
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
319
+ <h3 class="hndle"><?php _e( 'Email Encoder Form', $this->domain ) ?></h3>
320
  <div class="inside">
321
+ <?php echo $this->get_encoder_form(); ?>
322
+
323
  <fieldset class="options">
324
  <table class="form-table">
325
  <tr>
326
+ <th><?php _e( 'Show "powered by"-link', $this->domain ) ?></th>
327
+ <td><label><input type="checkbox" id="<?php echo $this->options_name ?>[powered_by]" name="<?php echo $this->options_name ?>[powered_by]" value="1" <?php checked('1', (int) $options['powered_by']); ?> /> <span><?php _e( 'Show the "powered by"-link on bottom of the encode form', $this->domain ) ?></span></label></td>
 
 
 
 
328
  </tr>
329
  </table>
330
  </fieldset>
334
  </div>
335
  </div>
336
  </div>
337
+ </div>
338
 
339
+ <div class="postbox-container side metabox-holder meta-box-sortables" style="width:29%;">
340
+ <div style="margin:0 5px;">
341
  <div class="postbox">
342
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
343
+ <h3 class="hndle"><?php _e( 'About' ) ?>...</h3>
344
  <div class="inside">
345
+ <h4><img src="<?php echo plugins_url( 'images/icon-email-encoder-bundle.png', __FILE__ ) ?>" width="16" height="16" /> Email Encoder Bundle (v<?php echo $this->version ?>)</h4>
346
+ <p><?php _e( 'Protect email addresses on your site from spambots and being used for spamming by using one of the encoding methods.', $this->domain ) ?></p>
 
 
 
 
347
  <ul>
348
+ <li><a href="http://www.freelancephp.net/contact/" target="_blank"><?php _e( 'Questions or suggestions?', $this->domain ) ?></a></li>
349
+ <li><?php _e( 'If you like this plugin please send your rating at WordPress.org.' ) ?></li>
350
+ <li><a href="http://wordpress.org/extend/plugins/email-encoder-bundle/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/email-encoder-php-class-wp-plugin/" target="_blank">FreelancePHP.net</a></li>
351
  </ul>
352
  </div>
353
  </div>
354
 
355
  <div class="postbox">
356
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
357
+ <h3 class="hndle"><?php _e( 'Other Plugins', $this->domain ) ?></h3>
358
  <div class="inside">
359
+ <h4><img src="<?php echo plugins_url( 'images/icon-wp-external-links.png', __FILE__ ) ?>" width="16" height="16" /> WP External Links</h4>
360
+ <p><?php _e( 'Manage external links on your site: open in new window/tab, set icon, add "external", add "nofollow" and more.', $this->domain ) ?></p>
361
  <ul>
362
+ <li><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugin-install.php?tab=search&type=term&s=WP+External+Links+freelancephp&plugin-search-input=Search+Plugins" target="_blank"><?php _e( 'Get this plugin now' ) ?></a></li>
363
+ <li><a href="http://wordpress.org/extend/plugins/wp-external-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-external-links-plugin/" target="_blank">FreelancePHP.net</a></li>
364
  </ul>
365
 
366
+ <h4><img src="<?php echo plugins_url( 'images/icon-wp-mailto-links.png', __FILE__ ) ?>" width="16" height="16" /> WP Mailto Links</h4>
367
+ <p><?php _e( 'Manage mailto links on your site and protect emails from spambots, set mail icon and more.', $this->domain ) ?></p>
368
  <ul>
369
+ <li><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugin-install.php?tab=search&type=term&s=WP+Mailto+Links+freelancephp&plugin-search-input=Search+Plugins" target="_blank"><?php _e( 'Get this plugin now' ) ?></a></li>
370
+ <li><a href="http://wordpress.org/extend/plugins/wp-mailto-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-mailto-links-plugin/" target="_blank">FreelancePHP.net</a></li>
 
 
 
 
 
371
  </ul>
372
  </div>
373
  </div>
374
  </div>
375
+ </div>
376
  </form>
377
  <div class="clear"></div>
378
  </div>
441
  return $form;
442
  }
443
 
444
+ /**
445
+ * Encode all emails of the given content
446
+ * @param string $content
447
+ * @param boolean $enc_tags Optional, default TRUE
448
+ * @param boolean $enc_mailtos Optional, default TRUE
449
+ * @param boolean $enc_plain_emails Optional, default TRUE
450
+ * @return string
451
+ */
452
+ function filter( $content, $enc_tags = TRUE, $enc_mailtos = TRUE, $enc_plain_emails = TRUE ) {
453
+ // encode mailto links
454
+ if ( $enc_mailtos )
455
+ $content = preg_replace_callback( $this->regexp_patterns[ 'mailto' ], array( $this, '_callback' ), $content );
456
+
457
+ // replace content tags [encode_email] to mailto links
458
+ if ( $enc_tags )
459
+ $content = preg_replace_callback( $this->regexp_patterns[ 'tag' ], array( $this, '_callback_shortcode' ), $content );
460
+
461
+ // replace plain emails
462
+ if ( $enc_plain_emails )
463
+ $content = preg_replace_callback( $this->regexp_patterns[ 'email' ], array( $this, '_callback' ), $content );
464
+
465
+ return $content;
466
+ }
467
+
468
  /**
469
  * Deactivation plugin method
470
  */
471
  function deactivation() {
472
+ delete_option( $this->options_name );
473
+ unregister_setting( $this->domain, $this->options_name );
474
  }
475
 
476
  /**
478
  */
479
  function _set_options() {
480
  // set options
481
+ $saved_options = get_option( $this->options_name );
482
+
483
+ // backwards compatible (old values)
484
  if ( empty( $saved_options ) ) {
485
+ $saved_options = get_option( $this->domain . 'options' );
486
+ }
487
+
488
+ // set all options
489
+ if ( ! empty( $saved_options ) ) {
490
+ foreach ( $this->options AS $key => $option ) {
491
+ $this->options[ $key ] = $saved_options[ $key ];
492
+ }
493
+ }
494
+
495
+ $this->set_method( $this->options['method'] );
496
+ }
497
+
498
+ /**
499
+ * Callback for encoding email
500
+ * @param array $match
501
+ * @return string
502
+ */
503
+ function _callback( $match ) {
504
+ if ( count( $match ) == 2 )
505
+ return $this->encode( $match[1] );
506
+
507
+ return $this->encode( $match[1], $match[2] );
508
+ }
509
+
510
+ /**
511
+ * Callback shortcode [encode_email ... ] for encoding email
512
+ * @param array $match
513
+ * @return string
514
+ */
515
+ function _callback_shortcode( $match ) {
516
+ $attrs = shortcode_parse_atts( $match[1] );
517
+
518
+ if ( key_exists( 'email', $attrs ) )
519
+ $email = $attrs[ 'email' ];
520
+
521
+ if ( key_exists( 'display', $attrs ) ) {
522
+ $display = $attrs[ 'display' ];
523
  } else {
524
+ $display = $attrs[ 'email' ];
 
 
 
 
 
 
 
 
525
  }
526
+
527
+ return $this->encode( $email, $display );
528
  }
529
 
530
  /**
531
  * Callback used for wp filters
532
  */
533
  function _filter_callback( $content ) {
534
+ return $this->filter( $content, TRUE, $this->options[ 'encode_mailtos' ], $this->options[ 'encode_emails' ] );
535
  }
536
 
537
+ /**
538
+ * Callback RSS
539
+ */
540
+ function _filter_rss_callback( $content ) {
541
+ return preg_replace( $this->regexp_patterns, '*protected email*', $content );
542
+ }
543
+
544
+ } // end class WP_Email_Encoder_Bundle
545
 
546
 
547
  /**
548
  * Create instance
549
  */
550
+ $WP_Email_Encoder_Bundle = new WP_Email_Encoder_Bundle;
551
 
552
 
553
  /**
559
  $email = $_GET['email'];
560
  $display = ( empty( $_GET['display'] ) ) ? $email : $_GET['display'];
561
 
562
+ $WP_Email_Encoder_Bundle->set_method( $method );
563
 
564
+ echo $WP_Email_Encoder_Bundle->encode( $email, $display );
565
  exit;
566
  endif;
567
 
568
 
569
  /**
570
  * Template function for encoding email
571
+ * @global WP_Email_Encoder $WP_Email_Encoder_Bundle
572
  * @param string $email
573
  * @param string $display if non given will be same as email
574
  * @return string
575
  */
576
  if ( ! function_exists( 'encode_email' ) ):
577
  function encode_email( $email, $display = NULL ) {
578
+ global $WP_Email_Encoder_Bundle;
579
+ return $WP_Email_Encoder_Bundle->encode( $email, $display );
580
  }
581
  endif;
582
 
583
  /**
584
  * Template function for encoding emails in the given content
585
+ * @global WP_Email_Encoder $WP_Email_Encoder_Bundle
586
  * @param string $content
587
  * @param boolean $enc_tags Optional, default TRUE
 
588
  * @param boolean $enc_mailtos Optional, default TRUE
589
+ * @param boolean $enc_plain_emails Optional, default TRUE
590
  * @return string
591
  */
592
  if ( ! function_exists( 'encode_email_filter' ) ):
593
+ function encode_email_filter( $content, $enc_tags = TRUE, $enc_mailtos = TRUE, $enc_plain_emails = TRUE ) {
594
+ global $WP_Email_Encoder_Bundle;
595
+ return $WP_Email_Encoder_Bundle->filter( $content, $enc_tags, $enc_mailtos, $enc_plain_emails );
596
  }
597
  endif;
598
 
images/icon-email-encoder-bundle.png ADDED
Binary file
images/icon-wp-external-links.png ADDED
Binary file
images/icon-wp-mailto-links.png ADDED
Binary file
js/email-encoder-bundle.js CHANGED
@@ -1,123 +1,64 @@
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 );
1
+ // Email Encoder Bundle Plugin
2
+ jQuery(function( $ ){
3
 
4
+ var prevEmail, getEncoded,
5
+ $wrap = $( 'div.email-encoder-form' ),
6
+ $email = $wrap.find( '#email' ),
7
+ $display = $wrap.find( '#display' );
8
 
9
+ // hide output
10
+ $wrap.find( '.nodis' ).hide();
 
 
 
 
 
 
11
 
12
+ // auto-set display field
13
+ $email.keyup(function(){
14
+ var email = $email.val(),
15
+ display = $display.val();
16
 
17
+ if ( ! display || display == prevEmail )
18
+ $display.val( email );
 
 
19
 
20
+ prevEmail = email;
21
+ });
22
 
23
+ // get encoded email ( ajax call )
24
+ getEncoded = function () {
25
+ // stop when email field is empty
26
+ if ( ! $email.val() )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  return;
28
 
29
+ // empty output
30
+ $wrap.find( '#encoded_output' ).val( '' );
31
+
32
+ // get the encoded email link
33
+ $.get( '', {
34
+ ajax: true,
35
+ email: $email.val(),
36
+ display: $display.val() || $email.val(),
37
+ method: $wrap.find( '#encode_method' ).val()
38
+ },
39
+ function(data){
40
+ $wrap.find( '#encoded_output' ).val( data );
41
+ $wrap.find( '.output' ).slideDown();
 
 
 
 
 
 
 
 
 
 
 
 
42
  });
43
+ };
44
 
45
+ // get encoded link on these events
46
+ $wrap.find( '#email, #display' ).keyup(function(){
47
+ // show example how it will appear on the page
48
+ $wrap.find( '#example' ).html( '<a href="mailto:'+ $email.val() +'">'+ $display.val() +'</a>' );
49
 
50
+ // clear code field
51
+ $wrap.find( '.output' ).slideUp();
52
+ $wrap.find( '#encoded_output' ).val( '' );
53
+ })
54
+ .keyup();
55
 
56
+ $wrap.find( '#encode_method' ).bind( 'change keyup', function(){
57
+ getEncoded();
58
+ });
59
 
60
+ $wrap.find( '#ajax_encode' ).click(function(){
61
+ getEncoded();
62
+ });
63
 
64
  });
 
 
lang/wp_email_enc-nl_NL.mo DELETED
Binary file
lang/wp_email_enc-nl_NL.po DELETED
@@ -1,152 +0,0 @@
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
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
methods/ascii.php CHANGED
@@ -45,14 +45,13 @@ function lim_email_ascii( $email, $display ) {
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;
45
  $MailIndexes = str_replace("\\", "\\\\", $MailIndexes);
46
  $MailIndexes = str_replace("\"", "\\\"", $MailIndexes);
47
 
48
+ return '<script language="javascript">/*<![CDATA[*/'
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);/*]]>*/</script><noscript>*protected email*</noscript>';
 
55
  }
56
 
57
  endif;
methods/escape.php CHANGED
@@ -27,7 +27,7 @@ function lim_email_escape( $email, $display ) {
27
  $out .= '%' . dechex(ord($c));
28
  }
29
  }
30
- $out .= "'))" . '/*]]>*/</script>';
31
  return $out;
32
  }
33
 
27
  $out .= '%' . dechex(ord($c));
28
  }
29
  }
30
+ $out .= "'))" . '/*]]>*/</script><noscript>*protected email*</noscript>';
31
  return $out;
32
  }
33
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: freelancephp
3
  Tags: email, hide, mailto, spam, protection, spambots, encoder, encrypt, encode, obfuscate, antispam, spamming
4
  Requires at least: 2.7.0
5
  Tested up to: 3.1
6
- Stable tag: 0.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
 
@@ -12,25 +12,26 @@ Protect email addresses on your site from spambots and being used for spamming.
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
@@ -60,15 +61,23 @@ 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
@@ -100,15 +109,13 @@ Optionally you can add a name and description to be showed in the admin panel, l
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).
 
 
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.30
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
 
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
+ * Protect plain emails and mailto links
16
+ * Scanning posts, widgets, comments and RSS feeds
 
17
  * Choose one of the high-quality encoding methods
18
  * Supports querystrings like 'info@myemail.com?subject=Plugin'
19
+
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
 
23
  = Extra =
24
  * Put an Email Encoder Form on your site
25
  * Developers can add their own methods
26
 
27
+ Supports PHP4.3+ and up to latest WP version.
28
 
29
  == Installation ==
30
 
31
+ 1. Go to `Plugins` in the Admin menu
32
+ 1. Click on the button `Add new`
33
+ 1. Search for `Email Encode Bundle` and click 'Install Now' or click on the `upload` link to upload `email-encode-bundle.zip`
34
+ 1. Click on `Activate plugin`
35
 
36
  = Tags =
37
  * `[encode_email email="..." display="..."]` Encode the given email, "display" is optional otherwise the email wil be used as display
61
  Optionally you can add a name and description to be showed in the admin panel, like:
62
  `$lim_email_yourmethodname = array( 'name' => 'YourMethodName', 'description' => '....' );`
63
 
 
64
  [Do you have another question? Please ask me](http://www.freelancephp.net/contact/)
65
 
66
  == Screenshots ==
67
 
68
+ 1. Admin Options Page
69
+ 1. Email Encoder Form on the Site
70
 
71
  == Changelog ==
72
 
73
+ = 0.30 =
74
+ * Added protection for emails in RSS feeds
75
+ * Improved filtering tags [encode_email ... ]
76
+ * Improved ASCII and Escape method and added noscript message
77
+ * Solved an option bug (encode mailto links VS encode plain emails)
78
+ * Made some cosmetical adjustments on the options page
79
+ * Code refactoring
80
+
81
  = 0.22 =
82
  * First decodes entities before encoding email
83
  * Added more wp filters for encoding
109
 
110
  == Other Notes ==
111
 
 
 
 
 
112
  = Credits =
113
  * [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/)
 
114
  * [Tyler Akins](http://rumkin.com) for the encode method 'JavaScript ASCII Mixer'
115
+ * Title icon on Admin Options Page was made by [Jack Cai](http://www.doublejdesign.co.uk/)
116
 
117
  == Upgrade Notice ==
118
 
119
+ = 0.30 =
120
+ * Some bug fixes
121
+ * New: email protection for RSS feeds
screenshot-1.jpg DELETED
Binary file
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file