PluginProbe
CryptX / 3.2.2
CryptX v3.2.2
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 2.4.5 All 92 releases
cryptx / cryptx.php

cryptx.php in CryptX 3.2.2, at cryptx.php

153 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: CryptX
4 Plugin URI: http://weber-nrw.de/wordpress/cryptx/
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: 3.2.2
7 Author: Ralf Weber
8 Author URI: http://weber-nrw.de/
9 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4026696
10 */
11 /**
12 * "CryptX" WordPress Plugin
13 *
14 * @author Ralf Weber <ralf@weber-nrw.de>
15 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
16 */
17
18 /**
19 * Don't load this file direct!
20 */
21 if (!defined('ABSPATH')) {
22 return ;
23 }
24
25 /**
26 * some basics
27 */
28 global $wp_version;
29 define( 'CRYPTX_BASENAME', plugin_basename( __FILE__ ) );
30 define( 'CRYPTX_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
31 define( 'CRYPTX_FILENAME', str_replace( CRYPTX_BASEFOLDER.'/', '', plugin_basename(__FILE__) ) );
32 load_plugin_textdomain('cryptx', false, 'cryptx/languages/');
33 require_once(plugin_dir_path( __FILE__ ) . 'functions.php');
34 require_once(plugin_dir_path( __FILE__ ) . 'classes.php');
35 require_once(plugin_dir_path( __FILE__ ) . 'admin.php');
36 $cryptX_var = rw_loadDefaults();
37
38 foreach($cryptX_var['filter'] as $filter) {
39 if (@$cryptX_var[$filter]) {
40 rw_cryptx_filter($filter);
41 }
42 }
43
44 add_action( 'activate_' . plugin_basename( __FILE__ ), 'rw_cryptx_install' );
45
46 if (@$cryptX_var['java']) {
47 if (@$cryptX_var['load_java']) {
48 add_action( 'wp_footer', 'rw_cryptx_header', 9 );
49 } else {
50 add_action( 'wp_head', 'rw_cryptx_header', 9 );
51 }
52 }
53
54 if (@$cryptX_var['metaBox']) {
55 add_action('admin_menu', 'rw_cryptx_meta_box');
56 add_action('wp_insert_post', 'rw_cryptx_insert_post' );
57 add_action('wp_update_post', 'rw_cryptx_insert_post' );
58 }
59
60 if ( version_compare( $wp_version, '2.8', '>' ) ) {
61 add_filter( 'plugin_row_meta', 'rw_cryptx_init_row_meta', 10, 2 ); // only 2.8 and higher
62 } else {
63 add_filter( 'plugin_action_links', 'rw_cryptx_init_row_meta', 10, 2 );
64 }
65
66 add_filter( 'init', 'rw_cryptx_init_tinyurl');
67 add_action( 'parse_request', 'rw_cryptx_parse_request');
68
69 add_shortcode( 'cryptx', 'rw_cryptx_shortcode');
70
71 /**
72 * get CryptX Version
73 */
74 function rw_cryptx_version() {
75 if ( ! function_exists( 'get_plugins' ) )
76 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
77 $plugin_folder = get_plugins( '/' . plugin_basename( dirname( __FILE__ ) ) );
78 $plugin_file = basename( ( __FILE__ ) );
79 return $plugin_folder[$plugin_file]['Version'];
80 }
81
82
83 /**
84 * New Template functions...
85 * $content = string to convert
86 * $args = string/array with the following parameters
87 * array('text' => "", 'css_class' => "", 'css_id' => "", 'echo' => 1)
88 * or
89 * "text=&css_class=&css_id=&echo=1"
90 */
91 function encryptx( $content, $args="" ) {
92 global $cryptX_var;
93
94 $is_shortcode = true;
95
96 // Parse incomming $args into an array and merge it with $defaults
97 $encryptx_vars = rw_loadDefaults( $args );
98
99 // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
100 // extract( $args, EXTR_SKIP );
101
102 $tmp = explode("?", $content);
103 $content = $tmp[0];
104 $params = (!empty($tmp[1]))? $tmp[1] : '';
105 if($encryptx_vars['autolink']) {
106 $content = rw_cryptx_autolink( $content, true );
107 if (!empty($params)) {
108 $content = preg_replace( '/(.*\")(.*)(\".*>)(.*)(<\/a>)/i', '$1$2?'.$params.'$3$4$5', $content );
109 }
110 }
111 $content = rw_cryptx_encryptx( $content, true );
112 $content = rw_cryptx_linktext( $content, true );
113 if(!empty($encryptx_vars['text'])) {
114 $content = preg_replace( '/(.*">)(.*)(<.*)/i', '$1'.$encryptx_vars['text'].'$3', $content );
115 }
116 if(!empty($encryptx_vars['css_id'])) {
117 $content = preg_replace( '/(.*)(">)/i', '$1" id="'.$encryptx_vars['css_id'].'">', $content );
118 }
119 if(!empty($encryptx_vars['css_class'])) {
120 $content = preg_replace( '/(.*)(">)/i', '$1" class="'.$encryptx_vars['css_class'].'">', $content );
121 }
122
123 $is_shortcode = false;
124
125 if(!$encryptx_vars['echo'])
126 return $content;
127
128 echo $content;
129
130 }
131
132 /**
133 * Template function that encrypt the get_post_meta result
134 * call it with the default get_post_meta parameters
135 **/
136 function get_encryptx_meta( $post_id, $key, $single=false ) {
137
138 $values = get_post_meta( $post_id, $key, $single );
139
140 if(is_array($values)) {
141 $return = array();
142 foreach( $values as $value) {
143 $return[] = encryptx($value, array('echo' => 0));
144 }
145 } else {
146 $return = encryptx($values, array('echo' => 0));
147 }
148
149 return $return;
150
151 }
152
153 ?>