PluginProbe
CryptX / 2.6.6
CryptX v2.6.6
4.2.1 4.2.0 4.1.1 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9 2.0 2.1 2.2 2.3 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 All 93 releases
← All changes | cryptx.php +279 -80 2.4.42.6.6 View file →
@@ -2,11 +2,12 @@
2 2 /*
3 3 Plugin Name: CryptX
4 4 Plugin URI: http://weber-nrw.de/wordpress/cryptx/
5 5 Description: No more SPAM by spiders scanning you site for email adresses. With CryptX you can hide all your email adresses, with and without a mailto-link, by converting them using javascript or UNICODE. Although you can choose to add a mailto-link to all unlinked email adresses with only one klick at the settings. That's great, isn't it?
6 -Version: 2.4.4
6 +Version: 2.6.6
7 7 Author: Ralf Weber
8 8 Author URI: http://weber-nrw.de/
9 +Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4026696
9 10 */
10 11
11 12 /////////////////////////////////////////////////////////////////////////////
12 13
@@ -22,10 +23,14 @@
22 23 */
23 24 if (!class_exists('cryptX')) {
24 25
25 26 /////////////////////////////////////////////////////////////////////////////
27 +// plugin definitions
28 +define( 'CRYPTX_BASENAME', plugin_basename( __FILE__ ) );
29 +define( 'CRYPTX_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
30 +define( 'CRYPTX_FILENAME', str_replace( CRYPTX_BASEFOLDER.'/', '', plugin_basename(__FILE__) ) );
26 31
27 -load_plugin_textdomain('cryptx', PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/languages');
32 +load_plugin_textdomain('cryptx', sprintf('%s/cryptx/languages', PLUGINDIR ));
28 33
29 34 $cryptX_var = (array) get_option('cryptX');
30 35
31 36 /**
@@ -44,9 +49,9 @@
44 49 * This constructor attaches the needer plugin hook callbacks
45 50 */
46 51 function cryptX() {
47 52
48 - global $cryptX_var;
53 + global $cryptX_var, $wp_version;
49 54
50 55 // attach the converstion handlers
51 56 //
52 57 if (@$cryptX_var[theContent]) {
@@ -85,41 +90,143 @@
85 90
86 91 // attach javascript to Header
87 92 //
88 93 if (@$cryptX_var[java]) {
89 - add_action(
90 - 'wp_head',
91 - array(&$this, 'header')
92 - );
94 + if (@$cryptX_var[load_java]) {
95 + add_action(
96 + 'wp_footer',
97 + array(&$this, 'header'),
98 + 9
99 + );
100 + } else {
101 + add_action(
102 + 'wp_head',
103 + array(&$this, 'header'),
104 + 9
105 + );
93 106 }
107 + }
94 108
95 - add_action('admin_menu',
96 - array(&$this, 'cryptx_meta_box')
97 - );
109 + if (@$cryptX_var[metaBox]) {
110 + add_action('admin_menu',
111 + array(&$this, 'cryptx_meta_box')
112 + );
113 +
114 + add_action('wp_insert_post',
115 + array(&$this, 'cryptx_insert_post')
116 + );
117 + add_action('wp_update_post',
118 + array(&$this, 'cryptx_insert_post')
119 + );
120 + }
121 +
122 + // Add FAQ and support information
123 + if ( version_compare( $wp_version, '2.8', '>' ) ) {
124 + add_filter( 'plugin_row_meta', array($this, 'init_row_meta'), 10, 2 ); // only 2.8 and higher
125 + } else {
126 + add_filter( 'plugin_action_links', array($this, 'init_row_meta'), 10, 2 );
127 + }
128 +
129 + // Add tinyurl for image action
130 + add_filter( 'init', array($this, 'init_tinyurl'));
131 + } // End function
98 132
99 - add_action('wp_insert_post',
100 - array(&$this, 'cryptx_insert_post')
101 - );
102 - add_action('wp_update_post',
103 - array(&$this, 'cryptx_insert_post')
104 - );
133 + // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
105 134
106 - } // End function
135 + function init_tinyurl() {
136 + global $cryptX_var;
137 + // check TinyURl
138 + $url = $_SERVER["REQUEST_URI"];
139 + $params = explode( '/', $url );
140 + if ( count( $params ) > 1 ) {
141 + $tiny_url = $params[count( $params ) -2];
142 + if ( $tiny_url == md5( get_bloginfo('url') ) ) {
143 + // define vars
144 + $font = $cryptX_var[c2i_font];
145 + $msg = $params[count( $params ) -1];
146 + $size = $cryptX_var[c2i_fontSize];
147 + $pad = 1;
148 + $transparent = 1;
149 + $red = hexdec(substr($cryptX_var[c2i_fontRGB],0,2));
150 + $grn = hexdec(substr($cryptX_var[c2i_fontRGB],2,2));
151 + $blu = hexdec(substr($cryptX_var[c2i_fontRGB],4,2));
152 + $bg_red = 255 - $red;
153 + $bg_grn = 255 - $grn;
154 + $bg_blu = 255 - $blu;
155 + $width = 0;
156 + $height = 0;
157 + $offset_x = 0;
158 + $offset_y = 0;
159 + $bounds = array();
160 + $image = "";
161 + // get the font height.
162 + $bounds = ImageTTFBBox($size, 0, $font, "W");
163 + if ($rot < 0)
164 + {
165 + $font_height = abs($bounds[7]-$bounds[1]);
166 + }
167 + else if ($rot > 0)
168 + {
169 + $font_height = abs($bounds[1]-$bounds[7]);
170 + }
171 + else
172 + {
173 + $font_height = abs($bounds[7]-$bounds[1]);
174 + }
175 + // determine bounding box.
176 + $bounds = ImageTTFBBox($size, 0, $font, $msg);
177 + $width = abs($bounds[4]-$bounds[6]);
178 + $height = abs($bounds[7]-$bounds[1]);
179 + $offset_y = $font_height+abs(($height - $font_height)/2)-1;
180 + $offset_x = 0;
181 + $image = imagecreatetruecolor($width+($pad*2),$height+($pad*2));
182 + imagesavealpha($image, true);
183 + //$background = ImageColorAllocate($image, $bg_red, $bg_grn, $bg_blu);
184 + $foreground = ImageColorAllocate($image, $red, $grn, $blu);
185 + $background = imagecolorallocatealpha($image, 0, 0, 0, 127);
186 + imagefill($image, 0, 0, $background);
187 + // render the image
188 + ImageTTFText($image, $size, 0, $offset_x+$pad, $offset_y+$pad, $foreground, $font, $msg);
189 + // output PNG object.
190 + Header("Content-type: image/png");
191 + imagePNG($image);
192 + die;
193 + }
194 + }
195 + }
107 196
108 - // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
197 + function init_row_meta($links, $file) {
198 + if (CRYPTX_BASENAME == $file) {
199 + return array_merge(
200 + $links,
201 + array(
202 + sprintf(
203 + '<a href="options-general.php?page=%s">%s</a>',
204 + CRYPTX_BASENAME,
205 + __('Settings')
206 + )
207 + ),
208 + array(
209 + sprintf(
210 + '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4026696">%s</a>',
211 + __('Donate', 'cryptx')
212 + )
213 + )
214 + );
215 + }
216 + return $links;
217 + }
109 218
110 219 function filter($apply)
111 220 {
112 - global $cryptX_var, $shortcode_tags;
221 + global $cryptX_var, $post, $shortcode_tags;
113 222
114 223 if (@$cryptX_var[autolink]) {
115 224 add_filter($apply, array(&$this, 'autolink'), 5);
225 + if (!empty($shortcode_tags) || is_array($shortcode_tags)) {
226 + add_filter($apply, array(&$this, 'autolink'), 11);
227 + }
116 228 }
117 -
118 - if (!empty($shortcode_tags) || is_array($shortcode_tags)) {
119 - add_filter($apply, array(&$this, 'autolink'), 11);
120 - }
121 -
122 229 add_filter($apply, array($this, 'encryptx'), 12);
123 230 add_filter($apply, array($this, 'linktext'), 13);
124 231 }
125 232
@@ -124,18 +231,20 @@
124 231 }
125 232
126 233 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
127 234
128 -
235 + function _excluded($ID) {
236 + global $cryptX_var;
237 + $return = false;
238 + $exIDs = explode(",", $cryptX_var[excludedIDs]);
239 + if(in_array($ID, $exIDs) > 0 ) $return = true;
240 + return $return;
241 + }
242 +
129 243 function linktext($content)
130 244 {
131 245 global $post;
132 - $cryptxoff = false;
133 - $cryptxoffmeta = get_post_meta($post->ID,'cryptxoff',true);
134 - if ($cryptxoffmeta == "true") {
135 - $cryptxoff = true;
136 - }
137 - if ($cryptxoff == false) {
246 + if (!$this->_excluded($post->ID)) {
138 247 $content = preg_replace_callback("/([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))/i", array(get_class($this), '_Linktext'), $content );
139 248 }
140 249 return $content;
141 250 }
@@ -149,14 +258,14 @@
149 258 $linktext = $cryptX_var[alt_linktext];
150 259 break;
151 260
152 261 case 2: // alternative image for mail link
153 - $linktext = "<img src=\"" . $cryptX_var[alt_linkimage] . "\" class=\"cryptxImage\" alt=\"" . $cryptX_var[alt_linkimage_title] . "\" title=\"" . $cryptX_var[alt_linkimage_title] . "\">";
262 + $linktext = "<img src=\"" . $cryptX_var[alt_linkimage] . "\" class=\"cryptxImage\" alt=\"" . $cryptX_var[alt_linkimage_title] . "\" title=\"" . $cryptX_var[alt_linkimage_title] . "\" />";
154 263 break;
155 264
156 265 case 3: // uploaded image for mail link
157 - $imgurl = "/" . PLUGINDIR . "/" . dirname(plugin_basename (__FILE__)) . "/images/" . $cryptX_var[alt_uploadedimage];
158 - $linktext = "<img src=\"" . $imgurl . "\" class=\"cryptxImage\" alt=\"" . $cryptX_var[http_linkimage_title] . "\" title=\"" . $cryptX_var[http_linkimage_title] . "\">";
266 + $imgurl = $cryptX_var[alt_uploadedimage];
267 + $linktext = "<img src=\"" . $imgurl . "\" class=\"cryptxImage\" alt=\"" . $cryptX_var[http_linkimage_title] . "\" title=\"" . $cryptX_var[http_linkimage_title] . "\" />";
159 268 break;
160 269
161 270 case 4: // text scrambled by antispambot
162 271 $linktext = antispambot($Match[1]);
@@ -161,8 +270,12 @@
161 270 case 4: // text scrambled by antispambot
162 271 $linktext = antispambot($Match[1]);
163 272 break;
164 273
274 + case 5: // convert to image
275 + $linktext = "<img src=\"" . get_bloginfo('url') . "/" . md5( get_bloginfo('url') ) . "/" . antispambot($Match[1]) . "\" class=\"cryptxImage\" style=\"vertical-align:text-bottom\" alt=\"" . antispambot($Match[1]) . "\" title=\"" . antispambot($Match[1]) . "\" />";
276 + break;
277 +
165 278 default:
166 279 $linktext = str_replace( "@", $cryptX_var[at], $Match[1]);
167 280 $linktext = str_replace( ".", $cryptX_var[dot], $linktext);
168 281
@@ -173,10 +286,10 @@
173 286 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
174 287
175 288 function _dirImages()
176 289 {
177 - $dir = $_SERVER["DOCUMENT_ROOT"].'/'.PLUGINDIR.'/'.dirname(plugin_basename (__FILE__)).'/images';
178 - $fh = opendir($dir); //Verzeichnis
290 + $dir = plugin_dir_path( __FILE__ ).'images';
291 + $fh = opendir($dir);
179 292 $verzeichnisinhalt = array();
180 293 while (true == ($file = readdir($fh)))
181 294 {
182 295 if ((substr(strtolower($file), -3)=="jpg") or (substr(strtolower($file), -3)=="gif"))
@@ -186,19 +299,30 @@
186 299 }
187 300 return $verzeichnisinhalt;
188 301 }
189 302
303 + function _dirFonts()
304 + {
305 + $dir = plugin_dir_path( __FILE__ ).'fonts';
306 + $fh = opendir($dir);
307 + $verzeichnisinhalt = array();
308 + while (true == ($file = readdir($fh)))
309 + {
310 + if ((substr(strtolower($file), -3)=="ttf") or (substr(strtolower($file), -3)=="ttf"))
311 + {
312 + $verzeichnisinhalt[] = $file;
313 + }
314 + }
315 + return $verzeichnisinhalt;
316 + }
317 +
190 318 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
191 319
192 320 function encryptx($content)
193 321 {
194 322 global $post;
195 - $cryptxoff = false;
196 - $cryptxoffmeta = get_post_meta($post->ID,'cryptxoff',true);
197 - if ($cryptxoffmeta == "true") {
198 - $cryptxoff = true;
199 - }
200 - if ($cryptxoff == false) {
323 +
324 + if (!$this->_excluded($post->ID)) {
201 325 $content = preg_replace_callback('/<a (.*?)(href=("|\')mailto:(.*?)("|\')(.*?)|)>(.*?)<\/a>/i', array(get_class($this), 'mailtocrypt'), $content );
202 326 }
203 327 return $content;
204 328 }
@@ -207,8 +331,10 @@
207 331 {
208 332 global $cryptX_var;
209 333 $return = $Match[0];
210 334 $mailto = "mailto:" . $Match[4];
335 + //* If mailto contains no email adress, like a link from "Sociable" do nothing *//
336 + if (substr($Match[4], 0, 9) =="?subject=") return $return;
211 337 if (@$cryptX_var[java]) {
212 338 $crypt = '';
213 339 $ascii = 0;
214 340 for ($i = 0; $i < strlen( $Match[4] ); $i++) {
@@ -229,27 +355,27 @@
229 355
230 356 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
231 357
232 358 function autolink($content) {
233 -
359 + global $post;
360 + if ($this->_excluded($post->ID)) return $content;
234 361 $src[]="/([\s])([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))/si";
235 362 $src[]="/(>)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))(<)/si";
363 + $src[]="/(\()([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))(\))/si";
236 364 $src[]="/(>)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))([\s])/si";
237 365 $src[]="/([\s])([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))(<)/si";
238 366 $src[]="/^([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))/si";
239 367 $src[]="/(<a[^>]*>)<a[^>]*>/";
240 368 $src[]="/(<\/A>)<\/A>/i";
241 -
242 369 $tar[]="\\1<a href=\"mailto:\\2\">\\2</a>";
243 370 $tar[]="\\1<a href=\"mailto:\\2\">\\2</a>\\6";
244 371 $tar[]="\\1<a href=\"mailto:\\2\">\\2</a>\\6";
245 372 $tar[]="\\1<a href=\"mailto:\\2\">\\2</a>\\6";
373 + $tar[]="\\1<a href=\"mailto:\\2\">\\2</a>\\6";
246 374 $tar[]="<a href=\"mailto:\\0\">\\0</a>";
247 375 $tar[]="\\1";
248 376 $tar[]="\\1";
249 -
250 377 $content = preg_replace($src,$tar,$content);
251 -
252 378 return $content;
253 379 }
254 380
255 381 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -255,8 +381,11 @@
255 381 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
256 382
257 383
258 384 function install() {
385 + global $cryptX_var, $wpdb;
386 + $firstImage = $this->_dirImages();
387 + $firstFont = $this->_dirFonts();
259 388 add_option(
260 389 'cryptX',
261 390 array(
262 391 'at' => ' [at] ',
@@ -266,11 +395,44 @@
266 395 'commentText' => 1,
267 396 'widgetText' => 0,
268 397 'java' => 1,
269 398 'opt_linktext' => 0,
399 + 'autolink' => 1,
400 + 'excludedIDs' => '',
401 + 'metaBox' => 1,
402 + 'alt_uploadedimage' => plugins_url('cryptx/images/').$firstImage[0],
403 + 'c2i_font' => plugin_dir_path( __FILE__ ).'fonts/'.$firstFont[0],
404 + 'c2i_fontSize' => 10,
405 + 'c2i_fontRGB' => '000000',
270 406 )
271 407 );
408 + $cryptX_var = (array) get_option('cryptX'); // reread Options
409 + if ($cryptX_var[excludedIDs] == "") {
410 + $tmp = array();
411 + $excludes = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'cryptxoff' AND meta_value = 'true'");
412 + if(count($excludes) > 0) {
413 + foreach ($excludes as $exclude) {
414 + $tmp[] = $exclude->post_id;
415 + }
416 + sort($tmp);
417 + $cryptX_var[excludedIDs] = implode(",", $tmp);
418 + update_option( 'cryptX', $cryptX_var);
419 + $cryptX_var = (array) get_option('cryptX'); // reread Options
420 + $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = 'cryptxoff'");
421 + }
272 422 }
423 + if (empty($cryptX_var[c2i_font])) {
424 + $cryptX_var[c2i_font] = plugin_dir_path( __FILE__ ).'fonts/'.$firstFont[0];
425 + }
426 + if (empty($cryptX_var[c2i_fontSize])) {
427 + $cryptX_var[c2i_fontSize] = 10;
428 + }
429 + if (empty($cryptX_var[c2i_fontRGB])) {
430 + $cryptX_var[c2i_fontRGB] = '000000';
431 + }
432 + update_option( 'cryptX', $cryptX_var);
433 + $cryptX_var = (array) get_option('cryptX'); // reread Options
434 + }
273 435
274 436 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
275 437
276 438 /**
@@ -277,9 +439,9 @@
277 439 * Attach the menu page to the `Options` tab
278 440 */
279 441 function header()
280 442 {
281 - $cryptX_script.= "<script type=\"text/javascript\" src=\"" . get_option('siteurl') . '/' . PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . "/js/cryptx.js\"></script>\n";
443 + $cryptX_script.= "<script type=\"text/javascript\" src=\"" . site_url() . '/' . PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . "/js/cryptx.js\"></script>\n";
282 444 print($cryptX_script);
283 445 }
284 446
285 447 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -286,30 +448,20 @@
286 448
287 449
288 450 function cryptx_meta() {
289 451 global $post;
290 - $cryptxoff = false;
291 - $cryptxoffmeta = get_post_meta($post->ID,'cryptxoff',true);
292 - if ($cryptxoffmeta == "true") {
293 - $cryptxoff = true;
294 - }
295 452 ?>
296 - <input type="checkbox" name="cryptxoff" <?php if ($cryptxoff) { echo 'checked="checked"'; } ?>/> Disable CryptX
453 + <input type="checkbox" name="cryptxoff" <?php if ($this->_excluded($post->ID)) { echo 'checked="checked"'; } ?>/> Disable CryptX for this post/page
297 454 <?php
298 455 }
299 456
300 457 function cryptx_option() {
301 458 global $post;
302 - $cryptxoff = false;
303 - $cryptxoffmeta = get_post_meta($post->ID,'cryptxoff',true);
304 - if ($cryptxoffmeta == "true") {
305 - $cryptxoff = true;
306 - }
307 459 if ( current_user_can('edit_posts') ) { ?>
308 460 <fieldset id="cryptxoption" class="dbx-box">
309 461 <h3 class="dbx-handle">CryptX</h3>
310 462 <div class="dbx-content">
311 - <input type="checkbox" name="cryptxon" <?php if ($cryptxoff) { echo 'checked="checked"'; } ?>/> CryptX disabled?
463 + <input type="checkbox" name="cryptxoff" <?php if ($this->_excluded($post->ID)) { echo 'checked="checked"'; } ?>/> Disable CryptX for this post/page
312 464 </div>
313 465 </fieldset>
314 466 <?php
315 467 }
@@ -328,19 +480,28 @@
328 480
329 481 //add_action('admin_menu', 'cryptx_meta_box');
330 482
331 483 function cryptx_insert_post($pID) {
332 - if (isset($_POST['cryptxoff'])) {
333 - add_post_meta($pID,'cryptxoff',"true", true) or update_post_meta($pID, 'cryptxoff', "true");
334 - } else {
335 - add_post_meta($pID,'cryptxoff',"false", true) or update_post_meta($pID, 'cryptxoff', "false");
484 + global $cryptX_var, $post;
485 +
486 + $rev = wp_is_post_revision($pID);
487 + if($rev) $pID = $rev;
488 + $b = explode(",", $cryptX_var[excludedIDs]);
489 + if($b[0] == '') unset($b[0]);
490 + foreach($b as $x=>$y) {
491 + if($y == $pID) {
492 + unset($b[$x]);
493 + break;
494 + }
336 495 }
496 + if (isset($_POST['cryptxoff'])) $b[] = $pID;
497 + $b = array_unique($b);
498 + sort($b);
499 + $cryptX_var[excludedIDs] = implode(",", $b);
500 + update_option( 'cryptX', $cryptX_var);
501 + $cryptX_var = (array) get_option('cryptX'); // reread Options
337 502 }
338 - //add_action('wp_insert_post', array(&$this, 'cryptx_insert_post'));
339 503
340 -
341 -
342 -
343 504 /**
344 505 * Attach the menu page to the `Options` tab
345 506 */
346 507 function menu() {
@@ -354,8 +515,9 @@
354 515 '_submenu'
355 516 )
356 517 );
357 518 }
519 +
358 520
359 521 /**
360 522 * Handles and renders the menu page
361 523 */
@@ -419,29 +581,56 @@
419 581 </tr>
420 582 <tr valign="top">
421 583 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext4" value="3" <?php echo ($cryptX_var[opt_linktext] == 3) ? 'checked="checked"' : ''; ?>/></td>
422 584 <th><label for="cryptX_var[alt_uploadedimage]"><?php _e("Select image from folder",'cryptx'); ?></label></th>
423 - <td><select name="cryptX_var[alt_uploadedimage]" onchange="cryptX_bild_wechsel(this)">
585 + <td> <select name="cryptX_var[alt_uploadedimage]" onchange="cryptX_bild_wechsel(this)">
424 586 <?php foreach($this->_dirImages() as $image) {
425 - $FirstIMG = (!isset($FirstIMG))? plugins_url('cryptx/images/').$image : ($cryptX_var[alt_uploadedimage] == plugins_url('cryptx/images/').$image) ? plugins_url('cryptx/images/').$image : $FirstIMG;
426 587 ?>
427 588 <option value="<?php echo plugins_url('cryptx/images/').$image; ?>" <?php echo ($cryptX_var[alt_uploadedimage] == plugins_url('cryptx/images/').$image) ? 'selected' : ''; ?> ><?php echo $image; ?></option>
428 589 <?php } ?>
429 - </select>&nbsp;&nbsp;<img src="<?php echo $FirstIMG; ?>" id="cryptXmailTo"></td>
590 + </select>
591 + <br/><?php _e("the selected image: ",'cryptx'); ?><img src="<?php echo $cryptX_var[alt_uploadedimage]; ?>" id="cryptXmailTo" align="top" style="padding: 3px;"><br/>
592 + <span class="setting-description"><?php echo sprintf( __("Upload your favorite email-image to '%s'. Only .jpg and .gif Supported!",'cryptx'), plugin_dir_path( __FILE__ ).'images/' ); ?></span></td>
430 593 </tr>
431 594 <tr valign="top">
432 595 <td>&nbsp;</td>
433 596 <th><label for="cryptX_var[alt_linkimage_title]"><?php _e("Title-Tag for the Image",'cryptx'); ?></label></th>
434 - <td><input name="cryptX_var[alt_linkimage_title]" value="<?php echo $cryptX_var[alt_linkimage_title]; ?>" type="text" class="regular-text" />
435 - <span class="setting-description"><?php _e("Upload your favorite email-image to ../plugins/cryptx/images. Only .jpg and .gif Supported!",'cryptx'); ?></span></td>
597 + <td><input name="cryptX_var[alt_linkimage_title]" value="<?php echo $cryptX_var[alt_linkimage_title]; ?>" type="text" class="regular-text" /></td>
436 598 </tr>
437 599 <tr valign="top">
438 - <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext" value="4" <?php echo ($cryptX_var[opt_linktext] == 4) ? 'checked="checked"' : ''; ?>/></td>
600 + <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext4" value="4" <?php echo ($cryptX_var[opt_linktext] == 4) ? 'checked="checked"' : ''; ?>/></td>
439 601 <th colspan="2"><?php _e("Text scrambled by AntiSpamBot (<small>Try it and look at your site and check the html source!</small>)",'cryptx'); ?></th>
440 602 </tr>
603 + <tr valign="top">
604 + <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext5" value="5" <?php echo ($cryptX_var[opt_linktext] == 5) ? 'checked="checked"' : ''; ?>/></td>
605 + <th><?php _e("Convert Email to PNG-image",'cryptx'); ?></th>
606 + <td><?php _e("Example with the saved options: ",'cryptx'); ?><img src="<?php echo get_bloginfo('url'); ?>/<?php echo md5( get_bloginfo('url') ); ?>/<?php echo antispambot("test@example.com"); ?>" align="absmiddle" alt="<?php echo antispambot("test@example.com"); ?>" title="<?php echo antispambot("test@example.com"); ?>"></td>
607 + </tr>
608 + <tr valign="top">
609 + <td>&nbsp;</td>
610 + <th><label for="cryptX_var[c2i_font]"><?php _e("Choose a Font",'cryptx'); ?></label></th>
611 + <td><select name="cryptX_var[c2i_font]">
612 + <?php foreach($this->_dirFonts() as $font) { ?>
613 + <option value="<?php echo plugin_dir_path( __FILE__ ).'fonts/'.$font; ?>" <?php echo ($cryptX_var[c2i_font] == plugin_dir_path( __FILE__ ).'fonts/'.$font) ? 'selected' : ''; ?> ><?php echo $font; ?></option>
614 + <?php } ?>
615 + </select><br/>
616 + <span class="setting-description"><?php echo sprintf( __("Upload your favorite font to '%s'. Only .ttf is Supported!",'cryptx'), plugin_dir_path( __FILE__ ).'fonts/' ); ?></span>
617 + </td>
618 + </tr>
619 + <tr valign="top">
620 + <td>&nbsp;</td>
621 + <th><label for="cryptX_var[c2i_fontSize]"><?php _e("Font size (pixel)",'cryptx'); ?></label></th>
622 + <td><input name="cryptX_var[c2i_fontSize]" value="<?php echo $cryptX_var[c2i_fontSize]; ?>" type="text" class="regular-text" /></td>
623 + </tr>
624 + <tr valign="top">
625 + <td>&nbsp;</td>
626 + <th><label for="cryptX_var[c2i_fontRGB]"><?php _e("Font color (RGB)",'cryptx'); ?></label></th>
627 + <td><input name="cryptX_var[c2i_fontRGB]" value="<?php echo $cryptX_var[c2i_fontRGB]; ?>" type="text" class="regular-text" /></td>
628 + </tr>
441 629 </table>
442 630 </div>
443 631 </div>
632 +
444 633 <p><input type="submit" name="cryptX" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
445 634
446 635 <div class="postbox">
447 636
@@ -456,13 +645,24 @@
456 645 <input name="cryptX_var[commentText]" <?php echo ($cryptX_var[commentText]) ? 'checked="checked"' : ''; ?> type="checkbox" />&nbsp;&nbsp;<?php _e("Comments",'cryptx'); ?><br/>
457 646 <input name="cryptX_var[widgetText]" <?php echo ($cryptX_var[widgetText]) ? 'checked="checked"' : ''; ?> type="checkbox" />&nbsp;&nbsp;<?php _e("Widgets",'cryptx'); ?> <?php _e("(<i>works only on all widgets, not on a single widget</i>!)",'cryptx'); ?></td>
458 647 </tr>
459 648 <tr valign="top">
649 + <th scope="row"><?php _e("Excluded ID's...",'cryptx'); ?></th>
650 + <td><input name="cryptX_var[excludedIDs]" value="<?php echo $cryptX_var[excludedIDs]; ?>" type="text" class="regular-text" />
651 + <br/><span class="setting-description"><?php _e("Enter all Page/Post ID's to exclude from CryptX as comma seperated list.",'cryptx'); ?></span>
652 + <br/><input name="cryptX_var[metaBox]" <?php echo ($cryptX_var[metaBox]) ? 'checked="checked"' : ''; ?> type="checkbox" />&nbsp;&nbsp;<?php _e("Enable the CryptX Widget on editing a post or page.",'cryptx'); ?></td>
653 + </tr>
654 + <tr valign="top">
460 655 <th scope="row"><?php _e("Type of decryption",'cryptx'); ?></th>
461 656 <td><input name="cryptX_var[java]" <?php echo ($cryptX_var[java]) ? 'checked="checked"' : ''; ?> type="radio" value="1" />&nbsp;&nbsp;<?php _e("Use javascript to hide the Email-Link.",'cryptx'); ?><br/>
462 657 <input name="cryptX_var[java]" <?php echo (!$cryptX_var[java]) ? 'checked="checked"' : ''; ?> type="radio" value="0" />&nbsp;&nbsp;<?php _e("Use Unicode to hide the Email-Link.",'cryptx'); ?></td>
463 658 </tr>
464 659 <tr valign="top">
660 + <th scope="row"><?php _e("Where to load the needed javascript...",'cryptx'); ?></th>
661 + <td><input name="cryptX_var[load_java]" <?php echo (!$cryptX_var[load_java]) ? 'checked="checked"' : ''; ?> type="radio" value="0" />&nbsp;&nbsp;<?php _e("Load the javascript in the <b>header</b> of the page.",'cryptx'); ?><br/>
662 + <input name="cryptX_var[load_java]" <?php echo ($cryptX_var[load_java]) ? 'checked="checked"' : ''; ?> type="radio" value="1" />&nbsp;&nbsp;<?php _e("Load the javascript in the <b>footer</b> of the page.",'cryptx'); ?></td>
663 + </tr>
664 + <tr valign="top">
465 665 <th scope="row" colspan="2"><input name="cryptX_var[autolink]" <?php echo ($cryptX_var[autolink]) ? 'checked="checked"' : ''; ?> type="checkbox" />&nbsp;&nbsp;<?php _e("Add mailto to all unlinked email addresses",'cryptx'); ?></th>
466 666 </tr>
467 667 </table>
468 668
@@ -510,16 +710,19 @@
510 710 <tr>
511 711 <td><?php
512 712 $data = get_plugin_data(__FILE__);
513 713 echo sprintf(
514 - '%1$s: %2$s | %3$s: %4$s | %5$s: <a href="http://weber-nrw.de" target="_blank">Ralf Weber</a> | <a href="http://twitter.com/Weber_NRW" target="_blank">%6$s</a><br />',
714 + '%1$s: %2$s | %3$s: %4$s | %5$s: <a href="http://weber-nrw.de" target="_blank">Ralf Weber</a> | <a href="http://twitter.com/Weber_NRW" target="_blank">%6$s</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4026696">%7$s</a><br />',
515 715 __('Plugin'),
516 716 'CryptX',
517 717 __('Version'),
518 718 $data['Version'],
519 719 __('Author'),
520 - __('Follow on Twitter', 'cryptx'));
720 + __('Follow on Twitter', 'cryptx'),
721 + __('Donate', 'cryptx')
722 + );
521 723 ?>
724 + Please support me by translating CryptX into other languages. You can download the cryptx.pot file from my <a href="http://weber-nrw.de/wordpress/cryptx/downloads/">site</a> and mail me the zipped language files. Thanks for it.
522 725 </td>
523 726 </tr>
524 727 </table>
525 728
@@ -567,15 +770,12 @@
567 770 */
568 771 function cryptx( $content, $text="", $css="", $echo=1 )
569 772 {
570 773 global $cryptX_var;
571 -
572 774 $cryptX = new cryptX;
573 -
574 775 $content = $cryptX->autolink( $content );
575 -
576 776 $content = $cryptX->encryptx( $content );
577 -
777 + $content = $cryptX->linktext( $content );
578 778 if("" != $text) {
579 779 $content = preg_replace( "/(<a[^>]*>)(.*)(<\/a>)/i", '$1'.$text.'$3', $content );
580 780 }
581 781 if("" != $css) {
@@ -581,8 +781,7 @@
581 781 if("" != $css) {
582 782 $content = preg_replace( "/(<a[^>]*)(>)/i", '$1 class="'.$css.'"$2', $content );
583 783 }
584 784 if(1 == $echo) echo $content;
585 -
586 785 return $content;
587 786 }
588 787 ?>