PluginProbe
CryptX / 3.2.5
CryptX v3.2.5
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.5, at cryptx.php

149 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.5
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 //avoid direct calls to this file, because now WP core and framework has been used
19 if ( ! function_exists('add_action') ) {
20 header('Status: 403 Forbidden');
21 header('HTTP/1.1 403 Forbidden');
22 exit();
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 add_action( 'wp_enqueue_scripts', 'rw_cryptx_javascript' );
48 }
49
50 if (@$cryptX_var['metaBox']) {
51 add_action('admin_menu', 'rw_cryptx_meta_box');
52 add_action('wp_insert_post', 'rw_cryptx_insert_post' );
53 add_action('wp_update_post', 'rw_cryptx_insert_post' );
54 }
55
56 if ( version_compare( $wp_version, '2.8', '>' ) ) {
57 add_filter( 'plugin_row_meta', 'rw_cryptx_init_row_meta', 10, 2 ); // only 2.8 and higher
58 } else {
59 add_filter( 'plugin_action_links', 'rw_cryptx_init_row_meta', 10, 2 );
60 }
61
62 add_filter( 'init', 'rw_cryptx_init_tinyurl');
63 add_action( 'parse_request', 'rw_cryptx_parse_request');
64
65 add_shortcode( 'cryptx', 'rw_cryptx_shortcode');
66
67 /**
68 * get CryptX Version
69 */
70 function rw_cryptx_version() {
71 if ( ! function_exists( 'get_plugins' ) )
72 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
73 $plugin_folder = get_plugins( '/' . plugin_basename( dirname( __FILE__ ) ) );
74 $plugin_file = basename( ( __FILE__ ) );
75 return $plugin_folder[$plugin_file]['Version'];
76 }
77
78
79 /**
80 * New Template functions...
81 * $content = string to convert
82 * $args = string/array with the following parameters
83 * array('text' => "", 'css_class' => "", 'css_id' => "", 'echo' => 1)
84 * or
85 * "text=&css_class=&css_id=&echo=1"
86 */
87 function encryptx( $content, $args="" ) {
88 global $cryptX_var;
89
90 $is_shortcode = true;
91
92 // Parse incomming $args into an array and merge it with $defaults
93 $encryptx_vars = rw_loadDefaults( $args );
94
95 // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
96 // extract( $args, EXTR_SKIP );
97
98 $tmp = explode("?", $content);
99 $content = $tmp[0];
100 $params = (!empty($tmp[1]))? $tmp[1] : '';
101 if($encryptx_vars['autolink']) {
102 $content = rw_cryptx_autolink( $content, true );
103 if (!empty($params)) {
104 $content = preg_replace( '/(.*\")(.*)(\".*>)(.*)(<\/a>)/i', '$1$2?'.$params.'$3$4$5', $content );
105 }
106 }
107 $content = rw_cryptx_encryptx( $content, true );
108 $content = rw_cryptx_linktext( $content, true );
109 if(!empty($encryptx_vars['text'])) {
110 $content = preg_replace( '/(.*">)(.*)(<.*)/i', '$1'.$encryptx_vars['text'].'$3', $content );
111 }
112 if(!empty($encryptx_vars['css_id'])) {
113 $content = preg_replace( '/(.*)(">)/i', '$1" id="'.$encryptx_vars['css_id'].'">', $content );
114 }
115 if(!empty($encryptx_vars['css_class'])) {
116 $content = preg_replace( '/(.*)(">)/i', '$1" class="'.$encryptx_vars['css_class'].'">', $content );
117 }
118
119 $is_shortcode = false;
120
121 if(!$encryptx_vars['echo'])
122 return $content;
123
124 echo $content;
125
126 }
127
128 /**
129 * Template function that encrypt the get_post_meta result
130 * call it with the default get_post_meta parameters
131 **/
132 function get_encryptx_meta( $post_id, $key, $single=false ) {
133
134 $values = get_post_meta( $post_id, $key, $single );
135
136 if(is_array($values)) {
137 $return = array();
138 foreach( $values as $value) {
139 $return[] = encryptx($value, array('echo' => 0));
140 }
141 } else {
142 $return = encryptx($values, array('echo' => 0));
143 }
144
145 return $return;
146
147 }
148
149 ?>