PluginProbe
Code Snippets / 2.14.3
Code Snippets v2.14.3
3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 3.0.1 All 64 releases
code-snippets / php / views / edit.php

edit.php in Code Snippets 2.14.3, at php/views/edit.php

183 lines 6.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * HTML code for the Add New/Edit Snippet page
5 *
6 * @package Code_Snippets
7 * @subpackage Views
8 *
9 * @var Code_Snippets_Edit_Menu $this
10 */
11
12 /* Bail if accessed directly */
13 if ( ! defined( 'ABSPATH' ) ) {
14 return;
15 }
16
17 $snippet = $this->snippet;
18 $classes = array();
19
20 if ( ! $snippet->id ) {
21 $classes[] = 'new-snippet';
22 } elseif ( 'single-use' === $snippet->scope ) {
23 $classes[] = 'single-use-snippet';
24 } else {
25 $classes[] = ( $snippet->active ? '' : 'in' ) . 'active-snippet';
26 }
27
28 ?>
29 <div class="wrap">
30 <h1><?php
31
32 if ( $snippet->id ) {
33 esc_html_e( 'Edit Snippet', 'code-snippets' );
34 printf( ' <a href="%1$s" class="page-title-action add-new-h2">%2$s</a>',
35 code_snippets()->get_menu_url( 'add' ),
36 esc_html_x( 'Add New', 'snippet', 'code-snippets' )
37 );
38 } else {
39 esc_html_e( 'Add New Snippet', 'code-snippets' );
40 }
41
42 $admin = code_snippets()->admin;
43
44 if ( code_snippets()->admin->is_compact_menu() ) {
45
46 printf( '<a href="%2$s" class="page-title-action">%1$s</a>',
47 esc_html_x( 'Manage', 'snippets', 'code-snippets' ),
48 code_snippets()->get_menu_url()
49 );
50
51 printf( '<a href="%2$s" class="page-title-action">%1$s</a>',
52 esc_html_x( 'Import', 'snippets', 'code-snippets' ),
53 code_snippets()->get_menu_url( 'import' )
54 );
55
56 if ( isset( $admin->menus['settings'] ) ) {
57
58 printf( '<a href="%2$s" class="page-title-action">%1$s</a>',
59 esc_html_x( 'Settings', 'snippets', 'code-snippets' ),
60 code_snippets()->get_menu_url( 'settings' )
61 );
62 }
63 }
64
65 ?></h1>
66
67 <form method="post" id="snippet-form" action="" style="margin-top: 10px;" class="<?php echo implode( ' ', $classes ); ?>">
68 <?php
69 /* Output the hidden fields */
70
71 if ( 0 !== $snippet->id ) {
72 printf( '<input type="hidden" name="snippet_id" value="%d">', $snippet->id );
73 }
74
75 printf( '<input type="hidden" name="snippet_active" value="%d">', $snippet->active );
76
77 do_action( 'code_snippets/admin/before_title_input', $snippet );
78 ?>
79
80 <div id="titlediv">
81 <div id="titlewrap">
82 <label for="title" style="display: none;"><?php _e( 'Name', 'code-snippets' ); ?></label>
83 <input id="title" type="text" autocomplete="off" name="snippet_name" value="<?php echo esc_attr( $snippet->name ); ?>" placeholder="<?php _e( 'Enter title here', 'code-snippets' ); ?>">
84 </div>
85 </div>
86
87 <?php do_action( 'code_snippets/admin/after_title_input', $snippet ); ?>
88
89 <p class="submit-inline"><?php do_action( 'code_snippets/admin/code_editor_toolbar', $snippet ); ?></p>
90
91 <h2><label for="snippet_code"><?php _e( 'Code', 'code-snippets' ); ?></label></h2>
92
93 <div class="snippet-editor">
94 <textarea id="snippet_code" name="snippet_code" rows="200" spellcheck="false" style="font-family: monospace; width: 100%;"><?php
95 echo esc_textarea( $snippet->code );
96 ?></textarea>
97
98 <div class="snippet-editor-help">
99
100 <div class="editor-help-tooltip cm-s-<?php
101 echo esc_attr( code_snippets_get_setting( 'editor', 'theme' ) ); ?>"><?php
102 echo esc_html_x( '?', 'help tooltip', 'code-snippets' ); ?></div>
103
104 <?php
105
106 $keys = array(
107 'Cmd' => esc_html_x( 'Cmd', 'keyboard key', 'code-snippets' ),
108 'Ctrl' => esc_html_x( 'Ctrl', 'keyboard key', 'code-snippets' ),
109 'Shift' => esc_html_x( 'Shift', 'keyboard key', 'code-snippets' ),
110 'Option' => esc_html_x( 'Option', 'keyboard key', 'code-snippets' ),
111 'Alt' => esc_html_x( 'Alt', 'keyboard key', 'code-snippets' ),
112 'F' => esc_html_x( 'F', 'keyboard key', 'code-snippets' ),
113 'G' => esc_html_x( 'G', 'keyboard key', 'code-snippets' ),
114 'R' => esc_html_x( 'R', 'keyboard key', 'code-snippets' ),
115 'S' => esc_html_x( 'S', 'keyboard key', 'code-snippets' ),
116 );
117
118 ?>
119
120 <div class="editor-help-text">
121 <table>
122 <tr>
123 <td><?php esc_html_e( 'Save changes', 'code-snippets' ); ?></td>
124 <td>
125 <kbd class="pc-key"><?php echo $keys['Ctrl']; ?></kbd><kbd class="mac-key"><?php
126 echo $keys['Cmd']; ?></kbd>&hyphen;<kbd><?php echo $keys['S']; ?></kbd>
127 </td>
128 </tr>
129 <tr>
130 <td><?php esc_html_e( 'Begin searching', 'code-snippets' ); ?></td>
131 <td>
132 <kbd class="pc-key"><?php echo $keys['Ctrl']; ?></kbd><kbd class="mac-key"><?php
133 echo $keys['Cmd']; ?></kbd>&hyphen;<kbd><?php echo $keys['F']; ?></kbd>
134 </td>
135 </tr>
136 <tr>
137 <td><?php esc_html_e( 'Find next', 'code-snippets' ); ?></td>
138 <td>
139 <kbd class="pc-key"><?php echo $keys['Ctrl']; ?></kbd><kbd class="mac-key"><?php echo $keys['Cmd']; ?></kbd>&hyphen;<kbd><?php echo $keys['G']; ?></kbd>
140 </td>
141 </tr>
142 <tr>
143 <td><?php esc_html_e( 'Find previous', 'code-snippets' ); ?></td>
144 <td>
145 <kbd><?php echo $keys['Shift']; ?></kbd>-<kbd class="pc-key"><?php echo $keys['Ctrl']; ?></kbd><kbd class="mac-key"><?php echo $keys['Cmd']; ?></kbd>&hyphen;<kbd><?php echo $keys['G']; ?></kbd>
146 </td>
147 </tr>
148 <tr>
149 <td><?php esc_html_e( 'Replace', 'code-snippets' ); ?></td>
150 <td>
151 <kbd><?php echo $keys['Shift']; ?></kbd>&hyphen;<kbd class="pc-key"><?php echo $keys['Ctrl']; ?></kbd><kbd class="mac-key"><?php echo $keys['Cmd']; ?></kbd>&hyphen;<kbd><?php echo $keys['F']; ?></kbd>
152 </td>
153 </tr>
154 <tr>
155 <td><?php esc_html_e( 'Replace all', 'code-snippets' ); ?></td>
156 <td>
157 <kbd><?php echo $keys['Shift']; ?></kbd>&hyphen;<kbd class="pc-key"><?php echo $keys['Ctrl']; ?></kbd><kbd class="mac-key"><?php echo $keys['Cmd']; ?></kbd><span class="mac-key">&hyphen;</span><kbd class="mac-key"><?php echo $keys['Option']; ?></kbd>&hyphen;<kbd><?php echo $keys['R']; ?></kbd>
158 </td>
159 </tr>
160 <tr>
161 <td><?php esc_html_e( 'Persistent search', 'code-snippets' ); ?></td>
162 <td>
163 <kbd><?php echo $keys['Alt']; ?></kbd>&hyphen;<kbd><?php echo $keys['F']; ?></kbd>
164 </td>
165 </tr>
166 </table>
167 </div>
168 </div>
169 </div>
170
171 <?php
172 /* Allow plugins to add fields and content to this page */
173 do_action( 'code_snippets/admin/single', $snippet );
174
175 /* Add a nonce for security */
176 wp_nonce_field( 'save_snippet' );
177
178 ?>
179
180 <p class="submit"><?php $this->render_submit_buttons( $snippet ); ?></p>
181 </form>
182 </div>
183