PluginProbe
Post Snippets – Custom WordPress Code Snippets Customizer / 4.2.2
Post Snippets – Custom WordPress Code Snippets Customizer v4.2.2
4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.1 1.7.2 1.7.3 1.8 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.8.9.1 1.8.9.2 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 All 115 releases
post-snippets / views / admin_snippets.php

admin_snippets.php in Post Snippets – Custom WordPress Code Snippets Customizer 4.2.2, at views/admin_snippets.php

344 lines 10.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3 ?>
4
5 <form method="post" action="" class="post-snippets-wrap">
6 <?php
7 wp_nonce_field( 'update_snippets', 'update_snippets_nonce' );
8 ?>
9 <div class="post-snippets-buttons-top">
10 <?php
11 \PostSnippets\Admin::submit(
12 'add-snippet',
13 __( 'Add New Snippet', 'post-snippets' ),
14 'button-secondary',
15 false
16 );
17 \PostSnippets\Admin::submit(
18 'delete-snippets',
19 __( 'Delete Selected', 'post-snippets' ),
20 'button-secondary',
21 false
22 );
23 ?>
24 <a href="#" class="button" data-ps-download><i class="wp-ps-cloud-download"></i> Download snippets</a>
25 </div>
26
27 <div>
28
29 </div>
30
31 <table class="widefat fixed mt-20 post-snippets-table" cellspacing="0">
32 <thead>
33 <tr>
34 <th scope="col" class="check-column"><input type="checkbox" /></th>
35 <th scope="col" class="text-right expand-collapse">
36 <a href="#" class="expand-all">
37 <?php
38 _e( 'Expand All', 'post-snippets' );
39 ?>
40 </a>
41 <a href="#" class="collapse-all">
42 <?php
43 _e( 'Collapse All', 'post-snippets' );
44 ?>
45 </a>
46 </th>
47 </tr>
48 </thead>
49 </table>
50
51 <div class="post-snippets post-snippets-list post-snippets-list-empty" style="display: none;">
52 <p>
53 <?php
54 echo __( 'You\'ve just installed Post Snippets, awesome!', 'post-snippets' ) ;
55 ?><br />
56 <?php
57 echo __( 'Click "Add New Snippet" to create your first snippet or read the documentation at the top right under "Help".', 'post-snippets' ) ;
58 ?>
59 </p>
60 </div>
61 <?php
62 wp_nonce_field( 'delete_snippet', 'delete_snippet' );
63 ?>
64 <?php
65 wp_nonce_field( 'sync_up', 'sync_up' );
66 ?>
67 <?php
68 wp_nonce_field( 'sync_down', 'sync_down' );
69 ?>
70 <?php
71 $snippets = get_option( \PostSnippets::OPTION_KEY );
72
73 if ( !empty($snippets) ) {
74 ?>
75
76 <div class="post-snippets post-snippets-list">
77 <?php
78 foreach ( $snippets as $key => $snippet ) {
79 ?>
80 <div class="post-snippets-item ui-state-highlight" data-order="<?php
81 echo esc_attr($key) ;
82 ?>" id="key-<?php
83 echo esc_attr($key) ;
84 ?>">
85 <div class="post-snippets-toolbar">
86 <div class="text-left">
87 <input type='checkbox' name='checked[]' value='<?php
88 echo esc_attr($key) ;
89 ?>'/>
90 <input type='text' class="post-snippet-title" name='<?php
91 echo "snippets[".esc_attr($key)."][title]" ;
92 ?>' value='<?php
93 echo esc_attr($snippet['title']) ;
94 ?>'/>
95 <span id="snippet-<?php
96 echo esc_attr($key) ;
97 ?>-title" class="post-snippet-title"><?php
98 echo esc_attr($snippet['title']) ;
99 ?></span>
100 <span class='ps-description'><?php
101 if ( !empty($snippet['description']) ) {
102 echo " (" . esc_html( $snippet['description'] ) . ")" ;
103 }
104 ?></span>
105 <a href="#" class="edit-title">
106 <i class="dashicons dashicons-edit"></i>
107 </a>
108 <a href="#" class="save-title">
109 <i class="dashicons dashicons-yes"></i>
110 </a>
111 </div>
112 <div class="text-right post-snippets-toolbar-right">
113
114 <?php
115 ?>
116
117 <a href="#" class="toggle-post-snippets-data" title="Expand/Collapse">
118 <i class="dashicons dashicons-arrow-down"></i>
119 <i class="dashicons dashicons-arrow-up"></i>
120 </a>
121 </div>
122 </div>
123 <div class="post-snippets-data">
124 <div class="post-snippets-data-cell">
125 <div>
126 <textarea id="snippet-<?php
127 echo esc_attr($key) ;
128 ?>" class="snippet" name="<?php
129 echo "snippets[".esc_attr($key)."][snippet]" ;
130 ?>" class="large-text" style='width: 100%;' rows="5"><?php
131 echo htmlspecialchars( $snippet['snippet'], ENT_NOQUOTES ) ;
132 ?></textarea>
133
134 <?php
135 ?>
136
137 <?php
138 _e( 'Description', 'post-snippets' );
139 ?>:
140 <input type='text' style='width: 100%;' id="description-<?php
141 echo esc_attr($key) ;
142 ?>" name="<?php
143 echo "snippets[".esc_attr($key)."][description]" ;
144 ?>" value='<?php
145 if ( isset( $snippet['description'] ) ) {
146 echo esc_html( $snippet['description'] ) ;
147 }
148 ?>'/>
149 <a style="margin-top:6px" href="#" data-save-snippet="<?php
150 echo esc_attr($key) ;
151 ?>" class="button-primary"><?php
152 _e( 'Save', 'post-snippets' );
153 ?></a>
154 <span id="saved-success-<?php
155 echo esc_attr($key) ;
156 ?>" style="display: none;">Snippet saved</span>
157 </div>
158 </div>
159 <div class="post-snippets-data-cell">
160 <strong>Variables:</strong><br/>
161 <input type='text' id="vars-<?php
162 echo esc_attr($key) ;
163 ?>" name="<?php
164 echo "snippets[".esc_attr($key)."][vars]" ;
165 ?>" value='<?php
166 echo esc_attr($snippet['vars']) ;
167 ?>'/>
168 <br/>
169 <br/>
170
171 <label for="<?php
172 echo "snippets[".esc_attr($key)."][shortcode]" ;
173 ?>">
174 <input type="checkbox" name="<?php
175 echo "snippets[".esc_attr($key)."][shortcode]" ;
176 ?>" id="shortcode-<?php
177 echo esc_attr($key) ;
178 ?>" value="1" <?php
179 checked( $snippet['shortcode'], '1', true );
180 ?>>
181 Shortcode
182 </label>
183
184 <br/><strong><?php
185 _e( 'Shortcode Options:', 'post-snippets' );
186 ?></strong><br/>
187 <?php
188
189 if ( !defined( 'POST_SNIPPETS_DISABLE_PHP' ) ) {
190 ?>
191 <label for="<?php
192 echo "snippets[".esc_attr($key)."][php]" ;
193 ?>">
194 <input type="checkbox" name="<?php
195 echo "snippets[".esc_attr($key)."][php]" ;
196 ?>" id="php-<?php
197 echo esc_attr($key) ;
198 ?>" value="1" <?php
199 checked( $snippet['php'], '1', true );
200 ?>>
201 PHP Code
202 </label>
203 <br/>
204 <?php
205 }
206
207 ?>
208
209 <label for="<?php
210 echo "snippets[".esc_attr($key)."][wptexturize]" ;
211 ?>">
212 <input type="checkbox" name="<?php
213 echo "snippets[".esc_attr($key)."][wptexturize]" ;
214 ?>" id="wptexturize-<?php
215 echo esc_attr($key) ;
216 ?>" value="1" <?php
217 checked( $snippet['wptexturize'], '1', true );
218 ?>>
219 wptexturize
220 </label>
221 </div>
222 </div>
223 </div>
224 <?php
225 }
226 ?>
227 </div>
228 <?php
229 }
230
231 ?>
232
233
234 <div id="delete-confirm" title="<?php
235 _e( 'Confirm', 'post-snippets' );
236 ?>" style="display:none;">
237 <p><span class="dashicons dashicons-warning" style="float:left; margin-right:12px;"></span>
238 <?php
239 _e( 'Do you wan to delete snippet', 'post-snippets' );
240 ?>: <strong></strong>?
241 </div>
242
243 <div id="sync-up-confirm" title="<?php
244 _e( 'Confirm', 'post-snippets' );
245 ?>" style="display:none;">
246 <p><span class="dashicons dashicons-warning" style="float:left; margin-right:12px;"></span>
247 <?php
248 _e( 'Do you want to upload the snippet', 'post-snippets' );
249 ?>: <strong></strong> <?php
250 _e( 'in your snippets cloud?', 'post-snippets' );
251 ?>
252 </div>
253
254 <div id="sync-up-success" title="<?php
255 _e( 'Success', 'post-snippets' );
256 ?>" style="display:none;">
257 <p><span class="dashicons dashicons-thumbs-up" style="float:left; margin-right:12px;"></span>
258 <?php
259 _e( 'Snippet successfully saved!', 'post-snippets' );
260 ?>
261 </div>
262
263 <div id="sync-success" title="<?php
264 _e( 'Success', 'post-snippets' );
265 ?>" style="display:none;">
266 <p><span class="dashicons dashicons-thumbs-up" style="float:left; margin-right:12px;"></span>
267 <?php
268 _e( 'Snippet successfully downloaded!', 'post-snippets' );
269 ?>
270 </div>
271
272 <div id="sync-up-error" title="<?php
273 _e( 'Error', 'post-snippets' );
274 ?>" style="display:none;">
275 <p><span class="dashicons dashicons-warning" style="float:left; margin-right:12px;"></span>
276 <p data-error></p>
277 </div>
278
279 <div id="sync-update-confirm" title="<?php
280 _e( 'Confirm', 'post-snippets' );
281 ?>" style="display:none;">
282 <p><span class="dashicons dashicons-warning" style="float:left; margin-right:12px;"></span>
283 <?php
284 _e( 'A snippet with title <strong data-title></strong> already exists in your online library:', 'post-snippets' );
285 ?>
286 <div class='snippet'>
287 <p><b>Title</b>: <span data-title></span></p>
288 <p><b>Description</b>: <span data-description></span></p>
289 <p><b>Variables</b>: <span data-vars></span></p>
290 <p><b>Snippet</b>: <textarea readonly></textarea></p>
291 <p><b>Options</b>: <span data-options></span></p>
292 </div>
293 </div>
294
295 <div id="sync-down-list" title="<?php
296 _e( 'Donwload your snippets', 'post-snippets' );
297 ?>">
298 <p class="message"></p>
299 <table class="wp-list-table widefat striped">
300 <thead>
301 <tr>
302 <td class="manage-column column-cb"><input type='checkbox' data-toggle-all></td>
303 <th class=""><?php
304 _e( 'Title', 'post-snippets' );
305 ?></th>
306 <th><?php
307 _e( 'Description', 'post-snippets' );
308 ?></th>
309 <th><?php
310 _e( 'Variables', 'post-snippets' );
311 ?></th>
312 <th><?php
313 _e( 'Snippet', 'post-snippets' );
314 ?></th>
315 </tr>
316 </thead>
317 <tbody>
318
319 </tbody>
320 </table>
321 </div>
322
323 <div id="sp-loading" style="display:none;">
324 <span></span>
325 </div>
326
327 <div class="post-snippets-buttons-bottom">
328 <?php
329 \PostSnippets\Admin::submit(
330 'add-snippet',
331 __( 'Add New Snippet', 'post-snippets' ),
332 'button-secondary',
333 false
334 );
335 \PostSnippets\Admin::submit(
336 'delete-snippets',
337 __( 'Delete Selected', 'post-snippets' ),
338 'button-secondary',
339 false
340 );
341 ?>
342 </div>
343 </form>
344