PluginProbe
CryptX / 3.2.15
CryptX v3.2.15
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.15, at admin.php

320 lines 17.7 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
138 <div id="rw_cryptx_presentation_box" class="postbox">
139 <h3><?php _e("Presentation",'cryptx'); ?></h3>
140 <div class="inside">
141
142 <h4><?php _e("Define CSS Options",'cryptx'); ?></h4>
143 <div class="postbox">
144 <table class="form-table">
145 <tr valign="top">
146 <th><label for="cryptX_var[css_id]"><?php _e("CSS ID",'cryptx'); ?></label></th>
147 <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>
148 </tr>
149 <tr valign="top">
150 <th><label for="cryptX_var[css_class]"><?php _e("CSS Class",'cryptx'); ?></label></th>
151 <td><input name="cryptX_var[css_class]" value="<?php echo $cryptX_var['css_class']; ?>" type="text" class="regular-text" /></td>
152 </tr>
153 </table>
154 </div>
155
156 <h4><?php _e("Define Presentation Options",'cryptx'); ?></h4>
157 <div class="postbox">
158 <table class="form-table">
159 <tr valign="top">
160 <td><input name="cryptX_var[opt_linktext]" type="radio" id="opt_linktext" value="0" <?php checked( $cryptX_var['opt_linktext'], 0 ); ?> /></td>
161 <th scope="row"><label for="cryptX_var[at]"><?php _e("Replacement for '@'",'cryptx'); ?></label></th>
162 <td><input name="cryptX_var[at]" value="<?php echo $cryptX_var['at']; ?>" type="text" class="regular-text" /></td>
163 </tr>
164 <tr valign="top">
165 <td>&nbsp;</td>
166 <th scope="row"><label for="cryptX_var[dot]"><?php _e("Replacement for '.'",'cryptx'); ?></label></th>
167 <td><input name="cryptX_var[dot]" value="<?php echo $cryptX_var['dot']; ?>" type="text" class="regular-text" /></td>
168 </tr>
169 <tr valign="top" style="background: #efefef;">
170 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext2" value="1" <?php checked( $cryptX_var['opt_linktext'], 1 ); ?> /></td>
171 <th><label for="cryptX_var[alt_linktext]"><?php _e("Text for link",'cryptx'); ?></label></th>
172 <td><input name="cryptX_var[alt_linktext]" value="<?php echo $cryptX_var['alt_linktext']; ?>" type="text" class="regular-text" /></td>
173 </tr>
174 <tr valign="top">
175 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext3" value="2" <?php checked( $cryptX_var['opt_linktext'], 2 ); ?> /></td>
176 <th><label for="cryptX_var[alt_linkimage]"><?php _e("Image-URL",'cryptx'); ?></label></th>
177 <td><input name="cryptX_var[alt_linkimage]" value="<?php echo $cryptX_var['alt_linkimage']; ?>" type="text" class="regular-text" /></td>
178 </tr>
179 <tr valign="top">
180 <td scope="row">&nbsp;</td>
181 <th><label for="cryptX_var[http_linkimage_title]"><?php _e("Title-Tag for the Image",'cryptx'); ?></label></th>
182 <td><input name="cryptX_var[http_linkimage_title]" value="<?php echo $cryptX_var['http_linkimage_title']; ?>" type="text" class="regular-text" /></td>
183 </tr>
184 <tr valign="top" style="background: #efefef;">
185 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext4" value="3" <?php checked( $cryptX_var['opt_linktext'], 3 ); ?> /></td>
186 <th><label for="cryptX_var[alt_uploadedimage]"><?php _e("Select image from folder",'cryptx'); ?></label></th>
187 <td> <select name="cryptX_var[alt_uploadedimage]" onchange="cryptX_bild_wechsel(this)">
188 <?php foreach(rw_cryptx_listDir(plugin_dir_path( __FILE__ ).'images', array("jpg","gif")) as $image) {
189 ?>
190 <option value="<?php echo plugins_url('cryptx/images/').$image; ?>" <?php selected( $cryptX_var['alt_uploadedimage'], plugins_url('cryptx/images/').$image ); ?> ><?php echo $image; ?></option>
191 <?php } ?>
192 </select>
193 <br/><?php _e("the selected image: ",'cryptx'); ?><img src="<?php echo $cryptX_var['alt_uploadedimage']; ?>" id="cryptXmailTo" align="top" style="padding: 3px;"><br/>
194 <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>
195 </tr>
196 <tr valign="top" style="background: #efefef;">
197 <td>&nbsp;</td>
198 <th><label for="cryptX_var[alt_linkimage_title]"><?php _e("Title-Tag for the Image",'cryptx'); ?></label></th>
199 <td><input name="cryptX_var[alt_linkimage_title]" value="<?php echo $cryptX_var['alt_linkimage_title']; ?>" type="text" class="regular-text" /></td>
200 </tr>
201 <tr valign="top">
202 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext4" value="4" <?php checked( $cryptX_var['opt_linktext'], 4 ); ?> /></td>
203 <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>
204 </tr>
205 <tr valign="top" style="background: #efefef;">
206 <td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext5" value="5" <?php checked( $cryptX_var['opt_linktext'], 5 ); ?> /></td>
207 <th><?php _e("Convert Email to PNG-image",'cryptx'); ?></th>
208 <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>
209 </tr>
210 <tr valign="top" style="background: #efefef;">
211 <td>&nbsp;</td>
212 <th><label for="cryptX_var[c2i_font]"><?php _e("Choose a Font",'cryptx'); ?></label></th>
213 <td><select name="cryptX_var[c2i_font]">
214 <?php foreach(rw_cryptx_listDir(plugin_dir_path( __FILE__ ).'fonts', "ttf") as $font) { ?>
215 <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>
216 <?php } ?>
217 </select><br/>
218 <span class="setting-description"><?php echo sprintf( __("Upload your favorite font to '%s'. Only .ttf is Supported!",'cryptx'), plugin_dir_path( __FILE__ ).'fonts/' ); ?></span>
219 </td>
220 </tr>
221 <tr valign="top" style="background: #efefef;">
222 <td>&nbsp;</td>
223 <th><label for="cryptX_var[c2i_fontSize]"><?php _e("Font size (pixel)",'cryptx'); ?></label></th>
224 <td><input name="cryptX_var[c2i_fontSize]" value="<?php echo $cryptX_var['c2i_fontSize']; ?>" type="text" class="regular-text" /></td>
225 </tr>
226 <tr valign="top" style="background: #efefef;">
227 <td>&nbsp;</td>
228 <th><label for="cryptX_var[c2i_fontRGB]"><?php _e("Font color (RGB)",'cryptx'); ?></label></th>
229 <td><input name="cryptX_var[c2i_fontRGB]" value="<?php echo $cryptX_var['c2i_fontRGB']; ?>" type="text" class="regular-text" /></td>
230 </tr>
231 </table>
232 </div>
233 <p><input type="submit" name="cryptX" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
234 </div>
235 </div>
236
237
238 <div id="rw_cryptx_general_box" class="postbox">
239 <h3><?php _e("General",'cryptx'); ?></h3>
240 <div class="inside">
241 <table class="form-table">
242 <tr valign="top">
243 <th scope="row"><?php _e("Apply CryptX to...",'cryptx'); ?></th>
244 <td>
245 <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/>
246 <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/>
247 <input name="cryptX_var[the_excerpt]" type="checkbox" value="1" <?php checked( $cryptX_var['the_excerpt'], 1 ); ?> />&nbsp;&nbsp;<?php _e("Excerpt",'cryptx'); ?><br/>
248 <input name="cryptX_var[comment_text]" type="checkbox" value="1" <?php checked( $cryptX_var['comment_text'], 1 ); ?> />&nbsp;&nbsp;<?php _e("Comments",'cryptx'); ?><br/>
249 <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'); ?>
250 </td>
251 </tr>
252 <tr valign="top">
253 <th scope="row"><?php _e("Excluded ID's...",'cryptx'); ?></th>
254 <td><input name="cryptX_var[excludedIDs]" value="<?php echo $cryptX_var['excludedIDs']; ?>" type="text" class="regular-text" />
255 <br/><span class="setting-description"><?php _e("Enter all Page/Post ID's to exclude from CryptX as comma seperated list.",'cryptx'); ?></span>
256 <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>
257 </tr>
258 <tr valign="top">
259 <th scope="row"><?php _e("Type of decryption",'cryptx'); ?></th>
260 <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/>
261 <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>
262 </tr>
263 <tr valign="top">
264 <th scope="row"><?php _e("Where to load the needed javascript...",'cryptx'); ?></th>
265 <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/>
266 <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>
267 </tr>
268 <tr valign="top">
269 <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>
270 </tr>
271 <tr valign="top">
272 <th scope="row"><?php _e("Whitelist of extensions",'cryptx'); ?></th>
273 <td><input name="cryptX_var[whiteList]" value="<?php echo $cryptX_var['whiteList']; ?>" type="text" class="regular-text" />
274 <br/><span class="setting-description"><?php _e("<strong>This is a workaround for the 'retina issue'.</strong><br/>You can provide a comma seperated list of extensions like 'jpeg,jpg,png,gif' which will be ignored by CryptX.",'cryptx'); ?></span>
275 </tr>
276 <tr valign="top">
277 <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>
278 </tr>
279 </table>
280 <p><input type="submit" name="cryptX" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
281 </div>
282 </div>
283
284
285 <div id="rw_encryptx_howto_box" class="postbox">
286 <h3><?php _e("How to use CryptX in your Template",'cryptx'); ?></h3>
287 <div class="inside">
288 <table class="form-table">
289 <tr>
290 <td><h4><?php _e("In your Template you can use the following function to encrypt a email address:",'cryptx'); ?></h4>
291 <p style="border:1px solid #000; background-color: #e9e9e9;padding: 10px;">
292 <i>&lt;?php <br/>
293 &nbsp;&nbsp;&nbsp;&nbsp;$content = "name@example.com"; <br/>
294 &nbsp;&nbsp;&nbsp;&nbsp;$args = array('text' => '',<br/>
295 &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/>
296 &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/>
297 &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/>
298 &nbsp;&nbsp;&nbsp;&nbsp;if (function_exists('encryptx')) { <br/>
299 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;encryptx($content, $args); <br/>
300 &nbsp;&nbsp;&nbsp;&nbsp;} else { <br/>
301 &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/>
302 &nbsp;&nbsp;&nbsp;&nbsp;} <br/>
303 ?&gt;</i>
304 </p>
305 </td>
306 </tr>
307 </table>
308 </div>
309 </div>
310
311 </form>
312 <script type="text/javascript">
313 function cryptX_bild_wechsel(select){
314 document.getElementById("cryptXmailTo").src = select.options[select.options.selectedIndex].value;
315 return true;
316 }
317 </script>
318 </div>
319 </div>
320 <?php } ?>