PluginProbe
Wp-Insert / 1.5.3
Wp-Insert v1.5.3
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
wp-insert / highlighter / syntax.php

syntax.php in Wp-Insert 1.5.3, at highlighter/syntax.php

87 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 add_action("plugins_loaded", "smart_syntaxhighlighting_init");
3 function smart_syntaxhighlighting_init() {
4 if(get_option('smart_enable_sh')) {
5 add_action('admin_footer', 'smart_init_syntaxhighlighting');
6 }
7 }
8
9 function smart_init_syntaxhighlighting() {
10 if(basename($_SERVER['SCRIPT_NAME']) == 'plugin-editor.php' || basename($_SERVER['SCRIPT_NAME']) == 'theme-editor.php') {
11 global $file;
12 $ext=strstr(basename($file),'.');
13 if($ext == '.php') {
14 $ext = 'php';
15 }
16 else if($ext == '.css') {
17 $ext = 'css';
18 }
19 else if($ext == '.js') {
20 $ext = 'javascript';
21 }
22 else if($ext == '.html' ||$ext == '.htm') {
23 $ext = 'html';
24 }
25 else {
26 $ext = '';
27 } ?>
28 <script type="text/javascript" src="<?php echo get_bloginfo('url') ?>/wp-content/plugins/wp-insert/codepress/codepress.js"></script>
29 <script type="text/javascript">
30 try {
31 var smart_editor = document.getElementById('newcontent');
32 smart_editor.form.onsubmit=function() {
33 var smart_input = document.createElement("input");
34 smart_input.setAttribute("type","hidden");
35 smart_input.setAttribute("name","newcontent");
36 smart_input.setAttribute("value",newcontent.getCode());
37 smart_editor.form.appendChild(smart_input);
38 return true;
39 }
40 smart_editor.className="codepress <?php echo $ext ?> linenumbers-on autocomplete-off readonly-off";
41 var smart_options_content = "<table><tr><td colspan='6'><b><a title='WP-Insert by Smart Logix' href='http://www.smartlogix.co.in'>WP-insert</a> : Syntax Highlighter Options</b></td></tr><tr><td>&nbsp;</td></tr><tr><td><input type='checkbox' onclick='newcontent.toggleAutoComplete()' />&nbsp;Turn on Autocomplete</td><td>&nbsp;&nbsp;&nbsp;</td><td><input type='checkbox' onclick='newcontent.toggleLineNumbers()' />&nbsp;Turn off Linenumbers</td><td>&nbsp;&nbsp;&nbsp;</td><td><input type='checkbox' onclick='newcontent.toggleEditor()' />&nbsp;Turn off Syntax Highlighting</td></tr></table>"
42 var smart_options = document.createElement("div");
43 smart_options.innerHTML = smart_options_content;
44 smart_editor.form.appendChild(smart_options);
45 }
46 catch (e) { void(0); }
47 </script>
48 <?php }
49 }
50
51 function smart_add_syntaxhighlighting_pages() { ?>
52 <div class="wrap">
53 <h2>WP-INSERT : Syntax Highlighting</h2>
54 <?php show_support_options(); ?>
55 <form method="post" action="options.php">
56 <?php wp_nonce_field('update-options'); ?>
57 <table class="form-table">
58 <tr valign="top">
59 <th scope="row"></th>
60 <td></td>
61 </tr>
62 <tr valign="top">
63 <th scope="row"><input id="smart_enable_sh" name="smart_enable_sh" type="checkbox" value="1"<?php if(get_option('smart_enable_sh')) echo ' checked="checked"'; ?>/> <b>Plugin/Theme Editor</b></th>
64 <td>( Syntax highlighting in plugin and theme editor )<br/>
65 Syntax highlighting by codepress</td>
66 </tr>
67 <tr><th>Codepress Features</th>
68 <td>
69 <ul>
70 <li>Real-time syntax highlighting</li>
71 <li>Code snippets - on PHP pages just type "if" and press [tab]</li>
72 <li>Auto completion - simple type single/double quotes or ( or [ or {</li>
73 <li>Shortcuts - on PHP pages press [ctrl][shift][space]. Its shortcut to <code>&<b></b>nbsp;</code></li></ul>
74 </td>
75 </tr>
76 </table>
77 <input type="hidden" name="action" value="update" />
78 <input type="hidden" name="page_options" value="smart_enable_sh" />
79 <p class="submit">
80 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
81 </p>
82 </form>
83 <p>
84 <script type="text/javascript" src="http://www.wp-insert.smartlogix.co.in/wp-content/plugins/wp-adnetwork/wp-adnetwork.php?showad=1"></script>
85 </p>
86 </div>
87 <?php } ?>