PluginProbe
CryptX / 3.2.11
CryptX v3.2.11
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 / admin.php

admin.php in CryptX 3.2.11, at admin.php

375 lines 20.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Menue
4 **/
5
6 /**
7 * Don't load this file direct!
8 */
9 if (!defined('ABSPATH')) {
10 return ;
11 }
12
13 if (is_admin()) {
14 add_action('admin_menu', 'rw_cryptx_menu');
15 }
16
17 /**
18 * load admin notice after activate/update if needed
19 */
20 if(isset($cryptX_var['admin_notices_deprecated'])) {
21 add_action('admin_notices', 'rw_cryptx_showAdminMessages');
22 $cryptX_var['admin_notices_deprecated']=false;
23 update_option( 'cryptX', $cryptX_var);
24 }
25
26 /**
27 * print admin notice
28 */
29 function rw_cryptx_showAdminMessages()
30 {
31 $searcher = new rw_cryptx_FileSystemStringSearch(get_template_directory().'/', ' cryptx(');
32 $searcher->run();
33
34 if (current_user_can('manage_options')) {
35 if($searcher->getResultCount() > 0) {
36 $msg = '<p><strong>';
37 $msg .= __('You use the deprecated CryptX function cryptx() in your template. You should use the new function encryptx() described at the plugin', 'cryptx');
38 $msg .= sprintf(
39 ' <a href="options-general.php?page=%s">%s</a>',
40 plugin_basename( __FILE__ ),
41 __('Settings')
42 );
43 $msg .= '.</strong></p>';
44 $msg .= '<ul>';
45 foreach($searcher->getResults() as $result) {
46 $msg .= '<li><em>'.$result['filePath'].', line '.$result['lineNumber'].'</em></li>';
47 }
48 $msg .= '</ul>';
49 rw_cryptx_showMessage($msg, true);
50 } elseif(isset($_POST['cryptX_rescan_theme'])) {
51 rw_cryptx_showMessage('<p>'.__('Your theme is OK! You have nothing to do.','cryptx').'</p>');
52 }
53 }
54 }
55
56 /**
57 * add links to plugin site
58 */
59 function rw_cryptx_init_row_meta($links, $file) {
60 if (CRYPTX_BASENAME == $file) {
61 return array_merge(
62 $links,
63 array(
64 sprintf(
65 '<a href="options-general.php?page=%s">%s</a>',
66 plugin_basename( __FILE__ ),
67 __('Settings')
68 )
69 ),
70 array(
71 sprintf(
72 '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4026696">%s</a>',
73 __('Donate', 'cryptx')
74 )
75 )
76 );
77 }
78 return $links;
79 }
80
81 /**
82 * add CryptX to Option menu
83 */
84 function rw_cryptx_menu() {
85 add_options_page(
86 'CryptX',
87 'CryptX',
88 'manage_options',
89 __FILE__,
90 'rw_cryptx_submenu'
91 );
92 }
93
94 /**
95 * print CryptX Option Page
96 */
97 function rw_cryptx_submenu() {
98 global $cryptX_var, $data;
99 if (isset($_POST) && !empty($_POST)) {
100 if (function_exists('current_user_can') === true && current_user_can('manage_options') === false) {
101 wp_die("You don't have permission to access!");
102 }
103 $saveOptions = $_POST['cryptX_var'];
104 check_admin_referer('cryptX');
105 if(isset($_POST['cryptX_var_reset'])) {
106 delete_option('cryptX');
107 $saveOptions = rw_loadDefaults();
108 }
109 if(isset($_POST['cryptX_rescan_theme'])) {
110 rw_cryptx_showAdminMessages();
111 } else {
112 $checkboxes = array(
113 'the_content' => 0,
114 'the_meta_key' => 0,
115 'the_excerpt' => 0,
116 'comment_text' => 0,
117 'widget_text' => 0,
118 'autolink' => 0,
119 'metaBox' => 0,
120 );
121 $saveOptions = wp_parse_args( $saveOptions, $checkboxes );
122 update_option( 'cryptX', $saveOptions);
123 $cryptX_var = rw_loadDefaults();
124 ?>
125 <div id="message" class="updated fade">
126 <p><strong><?php _e('Settings saved.') ?></strong></p>
127 </div>
128 <?php } ?>
129 <?php } ?>
130
131 <div class="wrap">
132 <h2>CryptX</h2>
133 <br class="clear" />
134 <form method="post" action="">
135 <?php wp_nonce_field('cryptX') ?>
136 <div id="poststuff" class="meta-box-sortables ui-sortable">
137 <div id="rw_cryptx_information_box" class="postbox">
138 <h3><span><?php _e("Information",'cryptx'); ?></span></h3>
139 <div class="inside">
140 <table class="form-table">
141 <tr>
142 <td valign="top" width="1%" nowrap><b><i><u>NEWS:</u></i>&nbsp;</b></td>
143 <td valign="top" style="padding:0;"><div id="cryptx-news-content" style="display:none;"></div></td>
144 <td valign="top" width="50%" style="border-left: 1px solid #999;"><?php
145 $data = get_plugin_data(__FILE__);
146 echo sprintf(
147 '%1$s: %2$s <br /> %3$s: %4$s <br /> %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 />',
148 __('Plugin'),
149 'CryptX',
150 __('Version'),
151 rw_cryptx_version() /*$data['Version']*/,
152 __('Author'),
153 __('Follow on Twitter', 'cryptx'),
154 __('Donate', 'cryptx')
155 );
156 ?>
157 </td>
158 </tr>
159 <tr>
160 <td colspan="3" align="center" style="font-weight: bold;"><?php _e("Please support me by translating CryptX into other languages. You can download the cryptx.pot file from my",'cryptx'); ?> <a href="http://weber-nrw.de/wordpress/cryptx/downloads/"><?php _e("site",'cryptx'); ?></a> <?php _e("and mail me the zipped language files. Thanks for it.",'cryptx'); ?>
161 </td>
162 </tr>
163 </table>
164 </div>
165 </div>
166
167 <div id="rw_cryptx_presentation_box" class="postbox">
168 <h3><?php _e("Presentation",'cryptx'); ?></h3>
169 <div class="inside">
170
171 <h4><?php _e("Define CSS Options",'cryptx'); ?></h4>
172 <div class="postbox">
173 <table class="form-table">
174 <tr valign="top">
175 <th><label for="cryptX_var[css_id]"><?php _e("CSS ID",'cryptx'); ?></label></th>
176 <td><input name="cryptX_var[css_id]" value="<?php echo $cryptX_var['css_id']; ?>" type="text" class="regular-text" /><br /><?php _e("Please be careful using this feature! IDs should be unique. You should prefer of using a css class instead.",'cryptx'); ?></td>
177 </tr>
178 <tr valign="top">
179 <th><label for="cryptX_var[css_class]"><?php _e("CSS Class",'cryptx'); ?></label></th>
180 <td><input name="cryptX_var[css_class]" value="<?php echo $cryptX_var['css_class']; ?>" type="text" class="regular-text" /></td>
181 </tr>
182 </table>
183 </div>
184
185 <h4><?php _e("Define Presentation Options",'cryptx'); ?></h4>
186 <div class="postbox">
187 <table class="form-table">
188 <tr valign="top">
189 <td><input name="cryptX_var[opt_linktext]" type="radio" id="opt_linktext" value="0" <?php checked( $cryptX_var['opt_linktext'], 0 ); ?> /></td>
190 <th scope="row"><label for="cryptX_var[at]"><?php _e("Replacement for '@'",'cryptx'); ?></label></th>
191 <td><input name="cryptX_var[at]" value="<?php echo $cryptX_var['at']; ?>" type="text" class="regular-text" /></td>
192 </tr>
193 <tr valign="top">
194 <td>&nbsp;</td>
195 <th scope="row"><label for="cryptX_var[dot]"><?php _e("Replacement for '.'",'cryptx'); ?></label></th>
196 <td><input name="cryptX_var[dot]" value="<?php echo $cryptX_var['dot']; ?>" type="text" class="regular-text" /></td>
197 </tr>
198 <tr valign="top" style="background: #efefef;">
199 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext2" value="1" <?php checked( $cryptX_var['opt_linktext'], 1 ); ?> /></td>
200 <th><label for="cryptX_var[alt_linktext]"><?php _e("Text for link",'cryptx'); ?></label></th>
201 <td><input name="cryptX_var[alt_linktext]" value="<?php echo $cryptX_var['alt_linktext']; ?>" type="text" class="regular-text" /></td>
202 </tr>
203 <tr valign="top">
204 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext3" value="2" <?php checked( $cryptX_var['opt_linktext'], 2 ); ?> /></td>
205 <th><label for="cryptX_var[alt_linkimage]"><?php _e("Image-URL",'cryptx'); ?></label></th>
206 <td><input name="cryptX_var[alt_linkimage]" value="<?php echo $cryptX_var['alt_linkimage']; ?>" type="text" class="regular-text" /></td>
207 </tr>
208 <tr valign="top">
209 <td scope="row">&nbsp;</td>
210 <th><label for="cryptX_var[http_linkimage_title]"><?php _e("Title-Tag for the Image",'cryptx'); ?></label></th>
211 <td><input name="cryptX_var[http_linkimage_title]" value="<?php echo $cryptX_var['http_linkimage_title']; ?>" type="text" class="regular-text" /></td>
212 </tr>
213 <tr valign="top" style="background: #efefef;">
214 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext4" value="3" <?php checked( $cryptX_var['opt_linktext'], 3 ); ?> /></td>
215 <th><label for="cryptX_var[alt_uploadedimage]"><?php _e("Select image from folder",'cryptx'); ?></label></th>
216 <td> <select name="cryptX_var[alt_uploadedimage]" onchange="cryptX_bild_wechsel(this)">
217 <?php foreach(rw_cryptx_listDir(plugin_dir_path( __FILE__ ).'images', array("jpg","gif")) as $image) {
218 ?>
219 <option value="<?php echo plugins_url('cryptx/images/').$image; ?>" <?php selected( $cryptX_var['alt_uploadedimage'], plugins_url('cryptx/images/').$image ); ?> ><?php echo $image; ?></option>
220 <?php } ?>
221 </select>
222 <br/><?php _e("the selected image: ",'cryptx'); ?><img src="<?php echo $cryptX_var['alt_uploadedimage']; ?>" id="cryptXmailTo" align="top" style="padding: 3px;"><br/>
223 <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>
224 </tr>
225 <tr valign="top" style="background: #efefef;">
226 <td>&nbsp;</td>
227 <th><label for="cryptX_var[alt_linkimage_title]"><?php _e("Title-Tag for the Image",'cryptx'); ?></label></th>
228 <td><input name="cryptX_var[alt_linkimage_title]" value="<?php echo $cryptX_var['alt_linkimage_title']; ?>" type="text" class="regular-text" /></td>
229 </tr>
230 <tr valign="top">
231 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext4" value="4" <?php checked( $cryptX_var['opt_linktext'], 4 ); ?> /></td>
232 <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>
233 </tr>
234 <tr valign="top" style="background: #efefef;">
235 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext5" value="5" <?php checked( $cryptX_var['opt_linktext'], 5 ); ?> /></td>
236 <th><?php _e("Convert Email to PNG-image",'cryptx'); ?></th>
237 <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>
238 </tr>
239 <tr valign="top" style="background: #efefef;">
240 <td>&nbsp;</td>
241 <th><label for="cryptX_var[c2i_font]"><?php _e("Choose a Font",'cryptx'); ?></label></th>
242 <td><select name="cryptX_var[c2i_font]">
243 <?php foreach(rw_cryptx_listDir(plugin_dir_path( __FILE__ ).'fonts', "ttf") as $font) { ?>
244 <option value="<?php echo plugin_dir_path( __FILE__ ).'fonts/'.$font; ?>" <?php selected( $cryptX_var['c2i_font'], plugin_dir_path( __FILE__ ).'fonts/'.$font ); ?> ><?php echo $font; ?></option>
245 <?php } ?>
246 </select><br/>
247 <span class="setting-description"><?php echo sprintf( __("Upload your favorite font to '%s'. Only .ttf is Supported!",'cryptx'), plugin_dir_path( __FILE__ ).'fonts/' ); ?></span>
248 </td>
249 </tr>
250 <tr valign="top" style="background: #efefef;">
251 <td>&nbsp;</td>
252 <th><label for="cryptX_var[c2i_fontSize]"><?php _e("Font size (pixel)",'cryptx'); ?></label></th>
253 <td><input name="cryptX_var[c2i_fontSize]" value="<?php echo $cryptX_var['c2i_fontSize']; ?>" type="text" class="regular-text" /></td>
254 </tr>
255 <tr valign="top" style="background: #efefef;">
256 <td>&nbsp;</td>
257 <th><label for="cryptX_var[c2i_fontRGB]"><?php _e("Font color (RGB)",'cryptx'); ?></label></th>
258 <td><input name="cryptX_var[c2i_fontRGB]" value="<?php echo $cryptX_var['c2i_fontRGB']; ?>" type="text" class="regular-text" /></td>
259 </tr>
260 </table>
261 </div>
262 <p><input type="submit" name="cryptX" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
263 </div>
264 </div>
265
266
267 <div id="rw_cryptx_general_box" class="postbox">
268 <h3><?php _e("General",'cryptx'); ?></h3>
269 <div class="inside">
270 <table class="form-table">
271 <tr valign="top">
272 <th scope="row"><?php _e("Apply CryptX to...",'cryptx'); ?></th>
273 <td>
274 <input name="cryptX_var[the_content]" type="checkbox" value="1" <?php checked( $cryptX_var['the_content'], 1 ); ?> />&nbsp;&nbsp;<?php _e("Content",'cryptx'); ?> <?php _e("(<i>this can be disabled per Post by an Option</i>)",'cryptx'); ?><br/>
275 <input name="cryptX_var[the_meta_key]" type="checkbox" value="1" <?php checked( $cryptX_var['the_meta_key'], 1 ); ?> />&nbsp;&nbsp;<?php _e("Custom fields (<strong>works only with the_meta()!</strong>)",'cryptx'); ?><br/>
276 <input name="cryptX_var[the_excerpt]" type="checkbox" value="1" <?php checked( $cryptX_var['the_excerpt'], 1 ); ?> />&nbsp;&nbsp;<?php _e("Excerpt",'cryptx'); ?><br/>
277 <input name="cryptX_var[comment_text]" type="checkbox" value="1" <?php checked( $cryptX_var['comment_text'], 1 ); ?> />&nbsp;&nbsp;<?php _e("Comments",'cryptx'); ?><br/>
278 <input name="cryptX_var[widget_text]" type="checkbox" value="1" <?php checked( $cryptX_var['widget_text'], 1 ); ?> />&nbsp;&nbsp;<?php _e("Widgets",'cryptx'); ?> <?php _e("(<i>works only on all widgets, not on a single widget</i>!)",'cryptx'); ?>
279 </td>
280 </tr>
281 <tr valign="top">
282 <th scope="row"><?php _e("Excluded ID's...",'cryptx'); ?></th>
283 <td><input name="cryptX_var[excludedIDs]" value="<?php echo $cryptX_var['excludedIDs']; ?>" type="text" class="regular-text" />
284 <br/><span class="setting-description"><?php _e("Enter all Page/Post ID's to exclude from CryptX as comma seperated list.",'cryptx'); ?></span>
285 <br/><input name="cryptX_var[metaBox]" type="checkbox" value="1" <?php checked( $cryptX_var['metaBox'], 1 ); ?> />&nbsp;&nbsp;<?php _e("Enable the CryptX Widget on editing a post or page.",'cryptx'); ?></td>
286 </tr>
287 <tr valign="top">
288 <th scope="row"><?php _e("Type of decryption",'cryptx'); ?></th>
289 <td><input name="cryptX_var[java]" type="radio" value="1" <?php checked( $cryptX_var['java'], 1 ); ?>/>&nbsp;&nbsp;<?php _e("Use javascript to hide the Email-Link.",'cryptx'); ?><br/>
290 <input name="cryptX_var[java]" type="radio" value="0" <?php checked( $cryptX_var['java'], 0 ); ?>/>&nbsp;&nbsp;<?php _e("Use Unicode to hide the Email-Link.",'cryptx'); ?></td>
291 </tr>
292 <tr valign="top">
293 <th scope="row"><?php _e("Where to load the needed javascript...",'cryptx'); ?></th>
294 <td><input name="cryptX_var[load_java]" type="radio" value="0" <?php checked( $cryptX_var['load_java'], 0 ); ?>/>&nbsp;&nbsp;<?php _e("Load the javascript in the <b>header</b> of the page.",'cryptx'); ?><br/>
295 <input name="cryptX_var[load_java]" type="radio" value="1" <?php checked( $cryptX_var['load_java'], 1 ); ?>/>&nbsp;&nbsp;<?php _e("Load the javascript in the <b>footer</b> of the page.",'cryptx'); ?></td>
296 </tr>
297 <tr valign="top">
298 <th scope="row" colspan="2"><input name="cryptX_var[autolink]" type="checkbox" value="1" <?php checked( $cryptX_var['autolink'], 1 ); ?>/>&nbsp;&nbsp;<?php _e("Add mailto to all unlinked email addresses",'cryptx'); ?></th>
299 </tr>
300 <tr valign="top">
301 <th scope="row" colspan="2"><input name="cryptX_var_reset" type="checkbox" value="1"/>&nbsp;&nbsp;<?php _e("Reset CryptX options to defaults. Use it carefully and at your own risk. All changes will be deleted!",'cryptx'); ?></th>
302 </tr>
303 </table>
304 <p><input type="submit" name="cryptX" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
305 </div>
306 </div>
307
308
309 <div id="rw_encryptx_howto_box" class="postbox">
310 <h3><?php _e("How to use CryptX in your Template",'cryptx'); ?></h3>
311 <div class="inside">
312 <table class="form-table">
313 <tr>
314 <td><h4><?php _e("In your Template you can use the following function to encrypt a email address:",'cryptx'); ?></h4>
315 <p style="border:1px solid #000; background-color: #e9e9e9;padding: 10px;">
316 <i>&lt;?php <br/>
317 &nbsp;&nbsp;&nbsp;&nbsp;$content = "name@example.com"; <br/>
318 &nbsp;&nbsp;&nbsp;&nbsp;$args = array('text' => '',<br/>
319 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'css_class' => '',<br/>
320 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'css_id' => '',<br/>
321 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'echo' => 1); <br/>
322 &nbsp;&nbsp;&nbsp;&nbsp;if (function_exists('encryptx')) { <br/>
323 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;encryptx($content, $args); <br/>
324 &nbsp;&nbsp;&nbsp;&nbsp;} else { <br/>
325 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo sprintf('&lt;a href="mailto:%s" id="%s" class="%s"&gt;%s&lt;/a&gt;', $content, $args['css_id'], $args['css_class'], ($args['text'] != '' ? $args['text'] : $content)); <br/>
326 &nbsp;&nbsp;&nbsp;&nbsp;} <br/>
327 ?&gt;</i>
328 </p>
329 </td>
330 </tr>
331 <tr>
332 <td><h4><?php _e("In your Template you can use the following function to encrypt mail adresses at custom fields:",'cryptx'); ?></h4>
333 <?php _e("Replace the call of get_post_meta in yout template with the CryptX function <strong>get_encryptx_meta</strong>. The parameters are the same!<br/>1. Example:", 'cryptx'); ?><br/>
334 <p style="border:1px solid #000; background-color: #e9e9e9;padding: 10px;">
335 <i>
336 &lt;?php <br/>
337 &nbsp;&nbsp;&nbsp;&nbsp;foreach(get_encryptx_meta($post->ID, $key, false) as $mail) {<br/>
338 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $mail.'&lt;br/&gt;';</br/>
339 &nbsp;&nbsp;&nbsp;&nbsp;}<br/>
340 ?&gt;
341 </i></p>
342 <?php _e("2. Example:", 'cryptx'); ?><br/>
343 <p style="border:1px solid #000; background-color: #e9e9e9;padding: 10px;">
344 <i>
345 &lt;?php echo get_encryptx_meta($post->ID, $key, true); ?&gt;
346 </i><br/>
347 </p>
348 <input type="submit" name="cryptX_rescan_theme" class="button-primary" value="<?php _e('Rescan current theme', 'cryptx') ?>" />
349 </td>
350 </tr>
351 </table>
352 </div>
353 </div>
354
355 </form>
356 <script type="text/javascript">
357 function cryptX_bild_wechsel(select){
358 document.getElementById("cryptXmailTo").src = select.options[select.options.selectedIndex].value;
359 return true;
360 }
361 </script>
362 <script type="text/javascript">
363 jQuery.ajax({
364 url: "<?php bloginfo('wpurl'); ?>?cryptx=news",
365 success: function(data) {
366 jQuery("#cryptx-news-content").html(data).fadeIn();
367 },
368 error: function() {
369 jQuery("#cryptx-news-content").html('An error ocured while loading News.').fadeIn();
370 }
371 });
372 </script>
373 </div>
374 </div>
375 <?php } ?>