Code Snippets - Version 1.7.1

Version Description

  • Fix a bug with snippet being set as deactivated when saved
  • Updated PHP Documentation completely. [View online]
  • Only load admin functions when viewing dashboard
  • Added German translation thanks to David Decker
  • Allow or deny site administrators access to snippet admin menus. Set your preference in the Enable Administration Menus setting under the Settings > Network Settings network admin menu.
  • Improve database table creation and upgrade process
  • Optimized to use less database queries
Download this release

Release Info

Developer bungeshea
Plugin Icon Code Snippets
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.7 to 1.7.1

assets/admin-single.css CHANGED
@@ -16,19 +16,19 @@ label {
16
  }
17
 
18
  /**
19
- * Customise the CodeMirror editor
20
  * to look pretty and support auto-resizing
21
  */
22
  .CodeMirror {
23
- height: auto;
24
  min-height: 300px;
25
- border: 1px solid #eee;
26
- -moz-border-radius: 3px; -webkit-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px;
 
27
  }
28
 
29
  .CodeMirror-scroll {
30
- overflow-y: hidden;
31
  overflow-x: auto;
 
32
  }
33
 
34
  .CodeMirror-sizer {
@@ -40,11 +40,6 @@ label {
40
  */
41
  .admin-color-mp6 .CodeMirror {
42
  width: 100%;
43
- background-color: #fff;
44
  border-color: #dfdfdf;
 
45
  }
46
-
47
- .admin-color-mp6 .CodeMirror * {
48
- /* Override Open Sans font */
49
- font-family: monospace !important;
50
- }
16
  }
17
 
18
  /**
19
+ * Customize the CodeMirror editor
20
  * to look pretty and support auto-resizing
21
  */
22
  .CodeMirror {
 
23
  min-height: 300px;
24
+ height: auto;
25
+ border: 1px solid #eee; -webkit-border-radius: 3px;
26
+ -moz-border-radius: 3px; border-radius: 3px; -o-border-radius: 3px;
27
  }
28
 
29
  .CodeMirror-scroll {
 
30
  overflow-x: auto;
31
+ overflow-y: hidden;
32
  }
33
 
34
  .CodeMirror-sizer {
40
  */
41
  .admin-color-mp6 .CodeMirror {
42
  width: 100%;
 
43
  border-color: #dfdfdf;
44
+ background-color: #fff;
45
  }
 
 
 
 
 
assets/screen-icon.css CHANGED
@@ -7,4 +7,4 @@
7
 
8
  #icon-snippets.icon32 {
9
  background: url('../images/screen-icon.png') no-repeat scroll transparent;
10
- }
7
 
8
  #icon-snippets.icon32 {
9
  background: url('../images/screen-icon.png') no-repeat scroll transparent;
10
+ }
assets/table.mp6.css CHANGED
@@ -17,8 +17,8 @@
17
  .snippets a.delete:hover,
18
  #all-snippets-table .snippets a.delete:hover,
19
  #search-snippets-table .snippets a.delete:hover {
20
- color: #f00;
21
  border-bottom: 1px solid #f00;
 
22
  }
23
 
24
  .snippets .column-description p {
@@ -48,8 +48,8 @@
48
  .snippets .inactive th,
49
  .snippets .active td,
50
  .snippets .active th {
51
- border: none;
52
  padding: 10px 9px;
 
53
  -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
54
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);;
55
  }
17
  .snippets a.delete:hover,
18
  #all-snippets-table .snippets a.delete:hover,
19
  #search-snippets-table .snippets a.delete:hover {
 
20
  border-bottom: 1px solid #f00;
21
+ color: #f00;
22
  }
23
 
24
  .snippets .column-description p {
48
  .snippets .inactive th,
49
  .snippets .active td,
50
  .snippets .active th {
 
51
  padding: 10px 9px;
52
+ border: none;
53
  -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
54
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);;
55
  }
code-snippets.php CHANGED
@@ -8,34 +8,19 @@
8
  *
9
  * @package Code Snippets
10
  * @subpackage Main
11
- *
12
- *
 
13
  * Plugin Name: Code Snippets
14
  * Plugin URI: http://code-snippets.bungeshea.com
15
  * Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
16
  * Author: Shea Bunge
17
  * Author URI: http://bungeshea.com
18
- * Version: 1.7
19
  * License: MIT
 
20
  * Text Domain: code-snippets
21
  * Domain Path: /languages/
22
- *
23
- *
24
- * Code Snippets - WordPress Plugin
25
- * Copyright (C) 2012 Shea Bunge
26
- *
27
- * This program is free software: you can redistribute it and/or modify
28
- * it under the terms of the GNU General Public License as published by
29
- * the Free Software Foundation, either version 3 of the License, or
30
- * (at your option) any later version.
31
- *
32
- * This program is distributed in the hope that it will be useful,
33
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
34
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35
- * GNU General Public License for more details.
36
- *
37
- * You should have received a copy of the GNU General Public License
38
- * along with this program. If not, see <http://www.gnu.org/licenses>.
39
  */
40
 
41
  // Exit if accessed directly
@@ -44,14 +29,15 @@ if ( ! defined( 'ABSPATH' ) ) exit;
44
  if ( ! class_exists( 'Code_Snippets' ) ) :
45
 
46
  /**
47
- * The main class for our plugin
48
  * It all happens here, folks
49
  *
50
  * Please use the global variable $code_snippets to access
51
- * the methods in this class. Anything you need
52
  * to access should be publicly available there
53
  *
54
- * @since Code Snippets 1.0
 
55
  * @access private
56
  */
57
  final class Code_Snippets {
@@ -63,84 +49,118 @@ final class Code_Snippets {
63
  * This should be set to the 'Plugin Version' value,
64
  * as defined above in the plugin header
65
  *
66
- * @since Code Snippets 1.0
67
  * @access public
 
68
  */
69
- public $version = 1.7;
70
 
71
  /**
72
- * The full URLs to the admin pages
73
  *
74
- * @since Code Snippets 1.0
75
  * @access public
 
76
  */
77
- public $admin_manage_url, $admin_single_url, $admin_import_url;
78
 
79
  /**
80
- * The hooks for the admin pages
81
- * Used primarily for enqueueing scripts and styles
82
  *
83
- * @since Code Snippets 1.0
84
  * @access public
 
85
  */
86
- public $admin_manage, $admin_single, $admin_import;
87
 
88
  /**
89
- * Variables to hold plugin paths
90
  *
91
- * @since Code Snippets 1.0
92
  * @access public
 
93
  */
94
- public $file, $basename, $plugin_dir, $plugin_url;
95
 
96
  /**
97
- * Stores an instance of the list table class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  *
99
- * @since Code Snippets 1.5
 
100
  * @access public
 
101
  */
102
- public $list_table;
103
 
104
  /**
105
  * The constructor function for our class
106
- * Hooks our initialize function to the plugins_loaded action
107
  *
108
- * @since Code Snippets 1.0
 
 
 
 
109
  * @access private
110
  *
111
  * @return void
112
  */
113
  function __construct() {
114
- add_action( 'plugins_loaded', array( $this, 'init' ) );
115
 
116
- /* execute the snippets once the plugins are loaded */
117
- add_action( 'plugins_loaded', array( $this, 'run_snippets' ), 1 );
118
 
119
- /* add backwards-compatibly for the CS_SAFE_MODE constant */
120
  if ( defined( 'CS_SAFE_MODE' ) && ! defined( 'CODE_SNIPPETS_SAFE_MODE' ) ) {
121
  define( 'CODE_SNIPPETS_SAFE_MODE', CS_SAFE_MODE );
122
  }
 
 
 
 
 
 
123
  }
124
 
125
  /**
126
- * Call our loader functions
127
  *
128
- * @since Code Snippets 1.7
129
- * @access private
 
 
 
130
  *
131
  * @return void
132
  */
133
- function init() {
134
 
135
- /**
136
- * Call the functions required to load Code Snippets
137
- */
138
- $this->setup_vars(); // initialise the variables
139
- $this->setup_hooks(); // register the action and filter hooks
140
- $this->upgrade(); // check if we need to change some stuff
141
 
142
  /*
143
- * Load up the localization file if we're using WordPress in a different language
144
  * Place it in this plugin's "languages" folder and name it "code-snippets-[value in wp-config].mo"
145
  *
146
  * If you wish to contribute a language file to be included in the Code Snippets package,
@@ -148,75 +168,54 @@ final class Code_Snippets {
148
  */
149
  load_plugin_textdomain( 'code-snippets', false, dirname( $this->basename ) . '/languages/' );
150
 
 
 
 
 
 
151
  /**
152
- * Let extention plugins know that it's okay to load
153
  */
154
  do_action( 'code_snippets_init' );
155
  }
156
 
157
  /**
158
- * Initialise variables
159
  *
160
- * @since Code Snippets 1.2
161
  * @access private
162
  *
163
  * @return void
164
  */
165
  function setup_vars() {
166
- global $wpdb;
167
- $this->file = __FILE__;
168
 
 
 
169
  $this->basename = plugin_basename( $this->file );
170
  $this->plugin_dir = plugin_dir_path( $this->file );
171
  $this->plugin_url = plugin_dir_url ( $this->file );
172
 
173
- $this->admin_manage_slug = apply_filters( 'code_snippets_admin_manage', 'snippets' );
174
- $this->admin_single_slug = apply_filters( 'code_snippets_admin_single', 'snippet' );
175
 
176
- $this->admin_manage_url = self_admin_url( 'admin.php?page=' . $this->admin_manage_slug );
177
- $this->admin_single_url = self_admin_url( 'admin.php?page=' . $this->admin_single_slug );
178
- }
179
 
180
- /**
181
- * Register action and filter hooks
182
- *
183
- * @since Code Snippets 1.6
184
- * @access private
185
- *
186
- * @return void
187
- */
188
- function setup_hooks() {
189
-
190
- /* add the administration menus */
191
- add_action( 'admin_menu', array( $this, 'add_admin_menus' ), 5 );
192
- add_action( 'network_admin_menu', array( $this, 'add_admin_menus' ), 5 );
193
 
194
- /* register the importer */
195
- add_action( 'admin_init', array( $this, 'load_importer' ) );
196
- add_action( 'network_admin_menu', array( $this, 'add_import_admin_menu' ) );
197
-
198
- /* add helpful links to the Plugins menu */
199
- add_filter( 'plugin_action_links_' . $this->basename, array( $this, 'settings_link' ) );
200
- add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), 10, 2 );
201
-
202
- /* Add a custom icon to Snippets menu pages */
203
- add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_icon_style' ) );
204
-
205
- /* Register the table name with WordPress */
206
- add_action( 'init', array( $this, 'set_table_vars' ), 1 );
207
- add_action( 'switch_blog', array( $this, 'set_table_vars' ), 1 );
208
-
209
- /* Add the description editor to the Snippets > Add New page */
210
- add_action( 'code_snippets_admin_single', array( $this, 'description_editor_box' ), 5 );
211
-
212
- /* Handle saving the user's screen option preferences */
213
- add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 10, 3 );
214
  }
215
 
216
  /**
217
- * Initialize the variables holding the table names
218
  *
219
- * @since Code Snippets 1.7
220
  * @access public
221
  *
222
  * @uses $wpdb
@@ -226,78 +225,44 @@ final class Code_Snippets {
226
  public function set_table_vars() {
227
  global $wpdb;
228
 
229
- $wpdb->snippets = apply_filters( 'code_snippets_table', $wpdb->prefix . 'snippets' );
230
- $wpdb->ms_snippets = apply_filters( 'code_snippets_multisite_table', $wpdb->base_prefix . 'ms_snippets' );
 
231
 
232
- $this->table = &$wpdb->snippets;
233
- $this->ms_table = &$wpdb->ms_snippets;
234
- }
235
-
236
- /**
237
- * Load the Code Snippets importer
238
- *
239
- * Add both an importer to the Tools menu
240
- * and an Import Snippets page to the network admin menu
241
- *
242
- * @since Code Snippets 1.6
243
- * @access private
244
- *
245
- * @return void
246
- */
247
- function load_importer() {
248
 
249
- if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
250
-
251
- // Load Importer API
252
- require_once ABSPATH . 'wp-admin/includes/import.php';
253
-
254
- if ( ! class_exists( 'WP_Importer' ) ) {
255
- $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
256
- if ( file_exists( $class_wp_importer ) )
257
- require_once $class_wp_importer;
258
- }
259
-
260
- register_importer(
261
- 'code-snippets',
262
- __('Code Snippets', 'code-snippets'),
263
- __('Import snippets from a <strong>Code Snippets</strong> export file', 'code-snippets'),
264
- array( $this, 'display_admin_import' )
265
- );
266
- }
267
-
268
- $this->admin_import_url = self_admin_url( 'admin.php?import=code-snippets' );
269
- add_action( 'load-importer-code-snippets', array( $this, 'load_admin_import' ) );
270
  }
271
 
272
  /**
273
  * Return the appropriate snippet table name
274
  *
275
- * @since Code Snippets 1.6
276
- * @access private
277
  *
278
- * @param string $scope Retrieve the multisite table name or the site table name?
279
- * @param bool $check_screen Query the current screen if no scope passed?
280
- * @return string $table The snippet table name
281
  */
282
- function get_table_name( $scope = '', $check_screen = true ) {
283
 
284
  global $wpdb;
285
 
286
- $this->create_tables(); // create the snippet tables if they do not exist
287
 
288
  if ( ! is_multisite() ) {
289
  $network = false;
290
  }
291
- elseif ( empty( $network ) && $check_screen && function_exists( 'get_current_screen' ) ) {
292
- /* if no scope is set, query the current screen to see if in network admin */
293
- $screen = get_current_screen();
294
- $network = $screen->is_network;
295
- }
296
- elseif ( 'multisite' === $scope || 'network' === $scope ) {
297
  $network = true;
298
  }
299
- elseif ( 'site' === $scope || 'single' === $scope ) {
300
- $network = false;
 
301
  }
302
  else {
303
  $network = false;
@@ -311,32 +276,73 @@ final class Code_Snippets {
311
  /**
312
  * Create the snippet tables if they do not already exist
313
  *
314
- * @since Code Snippets 1.2
315
  * @access public
316
  *
317
  * @uses $this->create_table() To create a single snippet table
318
  * @uses $wpdb->get_var() To test of the table exists
 
 
 
319
  *
320
  * @return void
321
  */
322
- public function create_tables() {
 
 
 
323
 
324
  global $wpdb;
325
 
326
- if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->snippets'" ) !== $wpdb->snippets )
327
- $this->create_table( $wpdb->snippets );
 
 
328
 
329
- if ( is_multisite() && $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->ms_snippets'" ) !== $wpdb->ms_snippets )
330
- $this->create_table( $wpdb->ms_snippets );
 
 
 
 
 
 
 
 
 
 
 
331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  }
333
 
334
  /**
335
  * Create a single snippet table
336
  * if one of the same name does not already exist
337
  *
338
- * @since Code Snippets 1.6
339
- * @access public
340
  *
341
  * @uses dbDelta() To add the table to the database
342
  *
@@ -348,6 +354,8 @@ final class Code_Snippets {
348
 
349
  global $wpdb;
350
 
 
 
351
  if ( ! empty( $wpdb->charset ) ) {
352
  $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
353
  }
@@ -356,12 +364,18 @@ final class Code_Snippets {
356
  $charset_collate .= " COLLATE $wpdb->collate";
357
  }
358
 
 
 
 
 
 
 
 
 
359
  $sql = "CREATE TABLE $table_name (
360
- id bigint(20) auto_increment,
361
- name tinytext not null,
362
- description text,
363
- code longtext not null,
364
- active tinyint(1) not null default 0,
365
  PRIMARY KEY (id),
366
  KEY id (id)
367
 
@@ -375,7 +389,7 @@ final class Code_Snippets {
375
  /**
376
  * Preform upgrade tasks such as deleting and updating options
377
  *
378
- * @since Code Snippets 1.2
379
  * @access private
380
  *
381
  * @return void
@@ -383,118 +397,70 @@ final class Code_Snippets {
383
  function upgrade() {
384
  global $wpdb;
385
 
386
- /* get the current plugin version from the database */
387
- if ( get_option( 'cs_db_version' ) ) {
388
- $this->current_version = get_option( 'cs_db_version', $this->version );
389
- delete_option( 'cs_db_version' );
390
- add_site_option( 'code_snippets_version', $this->current_version );
391
- }
392
- else {
393
- $this->current_version = get_site_option( 'code_snippets_version', $this->version );
394
- }
395
-
396
- if ( ! get_site_option( 'code_snippets_version' ) || $this->current_version < 1.5 ) {
397
-
398
- /* This is the first time the plugin has run */
399
 
400
- $this->add_caps(); // register the capabilities once only
401
 
402
- if ( is_multisite() ) {
403
- $this->add_caps( 'multisite' ); // register the multisite capabilities once only
404
- }
 
405
  }
406
 
 
 
407
  /* skip this if we're on the latest version */
408
- if ( get_site_option( 'code_snippets_version' ) < $this->version ) {
409
 
410
- /* migrate the recently_network_activated_snippets to the site options */
411
- if ( is_multisite() && get_option( 'recently_network_activated_snippets' ) ) {
412
- add_site_option( 'recently_activated_snippets', get_option( 'recently_network_activated_snippets', array() ) );
413
- delete_option( 'recently_network_activated_snippets' );
414
  }
415
 
416
- if ( $this->current_version < 1.2 ) {
417
- /* The 'Complete Uninstall' option was removed in version 1.2 */
418
  delete_option( 'cs_complete_uninstall' );
419
  }
420
 
421
- /* Update the current version */
422
- update_site_option( 'code_snippets_version', $this->version );
423
  }
424
- }
425
 
426
- /**
427
- * Handles saving the user's screen option preference
428
- *
429
- * @since Code Snippets 1.5
430
- * @access private
431
- */
432
- function set_screen_option( $status, $option, $value ) {
433
- if ( 'snippets_per_page' === $option ) return $value;
434
- }
435
 
436
- /**
437
- * Add the user capabilities
438
- *
439
- * @since Code Snippets 1.5
440
- * @access public
441
- *
442
- * @uses $this->setup_roles() To register the capabilities
443
- *
444
- * @param string $scope Add site-specific or multisite-specific capabilities?
445
- * @return void
446
- */
447
- public function add_caps( $scope = '' ) {
448
 
449
- $network = ( 'multisite' === $scope || 'network' === $scope ? true : false );
450
 
451
- if ( $network && is_multisite() )
452
- $this->setup_ms_roles( 'add' );
453
- else
454
- $this->setup_roles( 'add' );
455
- }
456
 
457
- /**
458
- * Remove the user capabilities
459
- *
460
- * @since Code Snippets 1.5
461
- * @access public
462
- *
463
- * @uses $this->setup_roles() To register the capabilities
464
- *
465
- * @param string $scope Add site-specific or multisite-specific capabilities?
466
- * @return void
467
- */
468
- public function remove_caps( $scope = '' ) {
469
 
470
- $network = ( 'multisite' === $scope || 'network' === $scope ? true : false );
 
 
 
471
 
472
- if ( $network && is_multisite() )
473
- $this->setup_ms_roles( 'remove' );
474
- else
475
- $this->setup_roles( 'remove' );
476
  }
477
 
478
  /**
479
  * Register the user roles and capabilities
480
  *
481
- * @since Code Snippets 1.5
482
  * @access private
483
  *
484
- * @param string $install True to add the capabilities, false to remove
485
  * @return void
486
  */
487
- function setup_roles( $action = 'install' ) {
488
-
489
- if ( 'install' === $action || 'add' === $action )
490
- $install = true;
491
-
492
- elseif ( 'uninstall' === $action || 'remove' === $action )
493
- $install = false;
494
-
495
- else
496
- $install = true;
497
-
498
 
499
  $this->caps = apply_filters( 'code_snippets_caps', array(
500
  'manage_snippets',
@@ -515,25 +481,16 @@ final class Code_Snippets {
515
  /**
516
  * Register the multisite user roles and capabilities
517
  *
518
- * @since Code Snippets 1.5
519
  * @access private
520
  *
521
- * @param string $action Add or remove the capabilities
522
  * @return void
523
  */
524
- function setup_ms_roles( $action = 'install' ) {
525
 
526
  if ( ! is_multisite() ) return;
527
 
528
- if ( 'install' === $action || 'add' === $action )
529
- $install = true;
530
-
531
- elseif ( 'uninstall' === $action || 'remove' === $action )
532
- $install = false;
533
-
534
- else
535
- $install = true;
536
-
537
  $this->network_caps = apply_filters( 'code_snippets_network_caps', array(
538
  'manage_network_snippets',
539
  'install_network_snippets',
@@ -553,138 +510,34 @@ final class Code_Snippets {
553
  }
554
 
555
  /**
556
- * Add the dashboard admin menu and subpages
557
  *
558
- * @since Code Snippets 1.0
559
- * @access private
560
  *
561
- * @uses add_menu_page() To register a top-level menu
562
- * @uses add_submenu_page() To register a submenu page
563
- * @uses apply_filters() To retrieve the current menu slug
564
- * @uses plugins_url() To retrieve the URL to a resource
565
- * @return void
566
- */
567
- function add_admin_menus() {
568
-
569
- /* Use a different screen icon for the MP6 interface */
570
- if ( get_user_option( 'admin_color' ) !== 'mp6' )
571
- $menu_icon = apply_filters( 'code_snippets_menu_icon', plugins_url( 'images/menu-icon.png', $this->file ) );
572
- else
573
- $menu_icon = 'div';
574
-
575
- /* Add the top-level menu and relevant subpage */
576
- $this->admin_manage = add_menu_page(
577
- __('Snippets', 'code-snippets'),
578
- __('Snippets', 'code-snippets'),
579
- is_network_admin() ? 'manage_network_snippets' : 'manage_snippets',
580
- $this->admin_manage_slug,
581
- array( $this, 'display_admin_manage' ),
582
- $menu_icon,
583
- is_network_admin() ? 21 : 67
584
- );
585
-
586
- add_submenu_page(
587
- $this->admin_manage_slug,
588
- __('Snippets', 'code-snippets'),
589
- __('Manage', 'code-snippets'),
590
- is_network_admin() ? 'manage_network_snippets' : 'manage_snippets',
591
- $this->admin_manage_slug,
592
- array( $this, 'display_admin_manage')
593
- );
594
-
595
- /* Add the Edit/Add New Snippet page */
596
- if ( isset( $_REQUEST['page'], $_REQUEST['edit'] ) &&
597
- $this->admin_single_slug === $_REQUEST['page'] ) {
598
-
599
- $this->admin_single = add_submenu_page(
600
- $this->admin_manage_slug,
601
- __('Edit Snippet', 'code-snippets'),
602
- __('Edit', 'code-snippets'),
603
- is_network_admin() ? 'install_network_snippets' : 'install_snippets',
604
- $this->admin_single_slug,
605
- array( $this, 'display_admin_single' )
606
- );
607
-
608
- } else {
609
-
610
- $this->admin_single = add_submenu_page(
611
- $this->admin_manage_slug,
612
- __('Add New Snippet', 'code-snippets'),
613
- __('Add New', 'code-snippets'),
614
- is_network_admin() ? 'install_network_snippets' : 'install_snippets',
615
- $this->admin_single_slug,
616
- array( $this, 'display_admin_single' )
617
- );
618
- }
619
-
620
- add_action( "load-$this->admin_manage", array( $this, 'load_admin_manage' ) );
621
- add_action( "load-$this->admin_single", array( $this, 'load_admin_single' ) );
622
- }
623
-
624
- /**
625
- * Add an Import Snippets page to the network admin menu
626
- * We need to do this as there is no Tools menu in the network
627
- * admin, and so we cannot register an importer
628
  *
629
- * @since Code Snippets 1.6
630
- * @access private
631
- *
632
- * @uses add_submenu_page() To register the menu page
633
- * @uses apply_filters() To retrieve the current menu slug
634
- * @uses add_action() To enqueue scripts and styles
635
- * @return void
636
  */
637
- function add_import_admin_menu() {
638
-
639
- $this->admin_import = add_submenu_page(
640
- $this->admin_manage_slug,
641
- __('Import Snippets', 'code-snippets'),
642
- __('Import', 'code-snippets'),
643
- 'import_snippets',
644
- 'import-code-snippets',
645
- array( $this, 'display_admin_import' )
646
- );
647
 
648
- $this->admin_import_url = self_admin_url( 'admin.php?page=import-code-snippets' );
649
- add_action( "load-$this->admin_import", array( $this, 'load_admin_import' ) );
650
- }
651
 
652
- /**
653
- * Enqueue the icon stylesheet
654
- *
655
- * @since Code Snippets 1.0
656
- * @access private
657
- *
658
- * @uses wp_enqueue_style() To add the stylesheet to the queue
659
- *
660
- * @return void
661
- */
662
- function load_admin_icon_style() {
663
-
664
- if ( 'mp6' === get_user_option( 'admin_color' ) ) {
665
-
666
- wp_enqueue_style(
667
- 'icon-snippets',
668
- plugins_url( 'assets/menu-icon.mp6.css', $this->file ),
669
- false,
670
- $this->version
671
- );
672
 
673
  } else {
674
-
675
- wp_enqueue_style(
676
- 'icon-snippets',
677
- plugins_url( 'assets/screen-icon.css', $this->file ),
678
- false,
679
- $this->version
680
- );
681
  }
682
  }
683
 
684
  /**
685
  * Converts an array of snippet data into a snippet object
686
  *
687
- * @since Code Snippets 1.7
688
  * @access public
689
  *
690
  * @param mixed $data The snippet data to convert
@@ -746,7 +599,7 @@ final class Code_Snippets {
746
  /**
747
  * Retrieve a list of snippets from the database
748
  *
749
- * @since Code Snippets 1.7
750
  * @access public
751
  *
752
  * @uses $wpdb To query the database for snippets
@@ -771,7 +624,7 @@ final class Code_Snippets {
771
  /**
772
  * Escape snippet data for inserting into the database
773
  *
774
- * @since Code Snippets 1.7
775
  * @access public
776
  *
777
  * @param mixed $snippet An object or array containing the data to escape
@@ -797,10 +650,10 @@ final class Code_Snippets {
797
  }
798
 
799
  /**
800
- * Unescape snippet data after retrieving from the database
801
  * ready for use
802
  *
803
- * @since Code Snippets 1.7
804
  * @access public
805
  *
806
  * @param mixed $snippet An object or array containing the data to unescape
@@ -818,30 +671,31 @@ final class Code_Snippets {
818
  }
819
 
820
  /**
821
- * Retrieve a single snippets from the database
822
  * Will return empty snippet object if no snippet
823
  * ID is specified
824
  *
825
- * @since Code Snippets 1.7
826
  * @access public
827
  *
828
  * @uses $wpdb To query the database for snippets
829
  * @uses $this->get_table_name() To dynamically retrieve the snippet table name
830
  *
831
- * @param string $scope Retrieve a multisite-wide or site-wide snippet?
 
832
  * @return object A single snippet object
833
  */
834
  public function get_snippet( $id = 0, $scope = '' ) {
835
  global $wpdb;
836
  $table = $this->get_table_name( $scope );
837
 
838
- if ( ! empty( $id ) && 0 !== intval( $id ) ) {
839
  /* Retrieve the snippet from the database */
840
  $snippet = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE id = %d", $id ) );
841
  /* Unescape the snippet data, ready for use */
842
  $snippet = $this->unescape_snippet_data( $snippet );
843
  } else {
844
- // get an empty snippet object
845
  $snippet = $this->build_snippet_object();
846
  }
847
  return apply_filters( 'code_snippets_get_snippet', $snippet, $id, $scope );
@@ -850,7 +704,7 @@ final class Code_Snippets {
850
  /**
851
  * Activates a snippet
852
  *
853
- * @since Code Snippets 1.5
854
  * @access public
855
  *
856
  * @uses $wpdb To set the snippets' active status
@@ -884,7 +738,7 @@ final class Code_Snippets {
884
  /**
885
  * Deactivates selected snippets
886
  *
887
- * @since Code Snippets 1.5
888
  * @access public
889
  *
890
  * @uses $wpdb To set the snippets' active status
@@ -931,11 +785,14 @@ final class Code_Snippets {
931
  /**
932
  * Deletes a snippet from the database
933
  *
934
- * @since Code Snippets 1.5
935
  * @access public
936
  *
937
  * @uses $wpdb To access the database
938
  * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table
 
 
 
939
  */
940
  public function delete_snippet( $id, $scope = '' ) {
941
  global $wpdb;
@@ -950,13 +807,14 @@ final class Code_Snippets {
950
  /**
951
  * Saves a snippet to the database.
952
  *
953
- * @since Code Snippets 1.5
954
  * @access public
955
  *
956
  * @uses $wpdb To update/add the snippet to the database
957
  * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table
958
  *
959
  * @param object $snippet The snippet to add/update to the database
 
960
  * @return int|bool The ID of the snippet on success, false on failure
961
  */
962
  public function save_snippet( $snippet, $scope = '' ) {
@@ -1000,7 +858,7 @@ final class Code_Snippets {
1000
  /**
1001
  * Imports snippets from an XML file
1002
  *
1003
- * @since Code Snippets 1.5
1004
  * @access public
1005
  *
1006
  * @uses $this->save_snippet() To add the snippets to the database
@@ -1030,13 +888,13 @@ final class Code_Snippets {
1030
  /**
1031
  * Exports snippets as an XML file
1032
  *
1033
- * @since Code Snippets 1.5
1034
  * @access public
1035
  *
1036
  * @uses code_snippets_export() To export selected snippets
1037
  * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table
1038
  *
1039
- * @param array $id An array if the IDs of the snippets to export
1040
  * @param string $scope Is the snippet a network-wide or site-wide snippet?
1041
  * @return void
1042
  */
@@ -1053,13 +911,13 @@ final class Code_Snippets {
1053
  /**
1054
  * Exports snippets as a PHP file
1055
  *
1056
- * @since Code Snippets 1.5
1057
  * @access public
1058
  *
1059
  * @uses code_snippets_export() To export selected snippets
1060
  * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table
1061
  *
1062
- * @param array $id An array if the IDs of the snippets to export
1063
  * @param string $scope Is the snippet a network-wide or site-wide snippet?
1064
  * @return void
1065
  */
@@ -1079,7 +937,7 @@ final class Code_Snippets {
1079
  * Code must NOT be escaped, as
1080
  * it will be executed directly
1081
  *
1082
- * @since Code Snippets 1.5
1083
  * @access public
1084
  *
1085
  * @param string $code The snippet code to execute
@@ -1095,464 +953,103 @@ final class Code_Snippets {
1095
  }
1096
 
1097
  /**
1098
- * Returns the (de)activate link for a snippet
1099
  *
1100
- * @since Code Snippets 1.7
1101
  * @access public
1102
  *
1103
- * @param mixed $snippet A snippet object
1104
- * @return The HTML code for the (de)activation link
1105
- */
1106
- public function get_activate_link( $snippet ) {
1107
-
1108
- $snippet = $this->build_snippet_object( $snippet );
1109
- $screen = get_current_screen();
1110
-
1111
- if ( $snippet->active ) {
1112
- $activate_link = sprintf(
1113
- '<a href="%1$s">%2$s</a>',
1114
- add_query_arg( array(
1115
- 'action' => 'deactivate',
1116
- 'id' => $snippet->id
1117
- ), $this->admin_manage_url ),
1118
- $screen->is_network ? __('Network Deactivate', 'code-snippets') : __('Deactivate', 'code-snippets')
1119
- );
1120
- } else {
1121
- $activate_link = sprintf(
1122
- '<a href="%1$s">%2$s</a>',
1123
- add_query_arg( array(
1124
- 'action' => 'activate',
1125
- 'id' => $snippet->id
1126
- ), $this->admin_manage_url ),
1127
- $screen->is_network ? __('Network Activate', 'code-snippets') : __('Activate', 'code-snippets')
1128
- );
1129
- }
1130
-
1131
- return apply_filters( 'code_snippets_activate_link', $activate_link, $snippet );
1132
- }
1133
-
1134
- /**
1135
- * Replaces the text 'Add New Snippet' with 'Edit Snippet'
1136
- *
1137
- * @since Code Snippets 1.1
1138
- * @access private
1139
- *
1140
- * @param $title The current page title
1141
- * @return $title The modified page title
1142
- */
1143
- function admin_single_title( $title ) {
1144
- return str_ireplace(
1145
- __('Add New Snippet', 'code-snippets'),
1146
- __('Edit Snippet', 'code-snippets'),
1147
- $title
1148
- );
1149
- }
1150
-
1151
- /**
1152
- * Processes any action command and loads the help tabs
1153
- *
1154
- * @since Code Snippets 1.0
1155
- * @access private
1156
- *
1157
- * @uses $wpdb To activate, deactivate and delete snippets
1158
- *
1159
- * @return void
1160
- */
1161
- function load_admin_manage() {
1162
- global $wpdb;
1163
-
1164
- $this->create_tables(); // create the snippet tables if they do not exist
1165
-
1166
- if ( isset( $_GET['action'], $_GET['id'] ) ) :
1167
-
1168
- $id = intval( $_GET['id'] );
1169
-
1170
- $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'action', 'id' ) );
1171
-
1172
- $action = sanitize_key( $_GET['action'] );
1173
-
1174
- if ( 'activate' === $action ) {
1175
- $this->activate( $id );
1176
- }
1177
- elseif ( 'deactivate' === $action ) {
1178
- $this->deactivate( $id );
1179
- }
1180
- elseif ( 'delete' === $action ) {
1181
- $this->delete_snippet( $id );
1182
- }
1183
- elseif ( 'export' === $action ) {
1184
- $this->export( $id );
1185
- }
1186
- elseif ( 'export-php' === $action ) {
1187
- $this->export_php( $id );
1188
- }
1189
-
1190
- if ( 'export' !== $action || 'export-php' !== $action ) {
1191
- wp_redirect( apply_filters(
1192
- "code_snippets_{$action}_redirect",
1193
- add_query_arg( $action, true )
1194
- ) );
1195
- }
1196
-
1197
- endif;
1198
-
1199
- include $this->plugin_dir . 'includes/help/manage.php'; // Load the help tabs
1200
-
1201
- /**
1202
- * Initialize the snippet table class
1203
- */
1204
- require_once $this->plugin_dir . 'includes/class-list-table.php';
1205
-
1206
- $this->list_table = new Code_Snippets_List_Table();
1207
- $this->list_table->prepare_items();
1208
- }
1209
-
1210
- /**
1211
- * Loads the help tabs for the Edit Snippets page
1212
- *
1213
- * @since Code Snippets 1.0
1214
- * @access private
1215
- *
1216
- * @uses $wpdb To save the posted snippet to the database
1217
- * @uses wp_redirect To pass the results to the page
1218
- *
1219
- * @return void
1220
- */
1221
- function load_admin_single() {
1222
-
1223
- $screen = get_current_screen();
1224
- $can_edit = current_user_can( $screen->is_network ? 'edit_network_snippets' : 'edit_snippets' );
1225
-
1226
- if ( isset( $_REQUEST['edit'] ) && ! $can_edit )
1227
- wp_die( __("Sorry, you're not allowed to edit snippets", 'code-snippets') );
1228
-
1229
- $this->create_tables(); // create the snippet tables if they do not exist
1230
-
1231
- if ( isset( $_REQUEST['save_snippet'] ) || isset( $_REQUEST['save_snippet_activate'] ) ) {
1232
-
1233
- $result = $this->save_snippet( $_POST );
1234
-
1235
- $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'added', 'updated', 'activated', 'invalid' ) );
1236
-
1237
- if ( isset( $_REQUEST['save_snippet_activate'] ) && $result ) {
1238
- $this->activate( $result );
1239
- $_SERVER['REQUEST_URI'] = add_query_arg( 'activated', true );
1240
- }
1241
-
1242
- if ( ! $result || $result < 1 ) {
1243
- wp_redirect( add_query_arg( 'invalid', true ) );
1244
- }
1245
- elseif ( isset( $_REQUEST['snippet_id'] ) ) {
1246
- wp_redirect( add_query_arg( array(
1247
- 'edit' => $result,
1248
- 'updated' => true
1249
- ) ) );
1250
- }
1251
- else {
1252
- wp_redirect( add_query_arg( array(
1253
- 'edit' => $result,
1254
- 'added' => true
1255
- ) ) );
1256
- }
1257
- }
1258
-
1259
- if ( isset( $_GET['edit'] ) )
1260
- add_filter( 'admin_title', array( $this, 'admin_single_title' ) );
1261
-
1262
- include $this->plugin_dir . 'includes/help/single.php'; // Load the help tabs
1263
-
1264
- add_filter( 'admin_enqueue_scripts', array( $this, 'admin_single_enqueue_scripts' ) );
1265
- }
1266
-
1267
- /**
1268
- * Registers and loads the code editor's scripts
1269
- *
1270
- * @since Code Snippets 1.7
1271
- * @access private
1272
- *
1273
- * @uses wp_register_script()
1274
- * @uses wp_register_style()
1275
- * @uses wp_enqueue_script() To add the scripts to the queue
1276
- * @uses wp_enqueue_style() To add the stylesheets to the queue
1277
  *
1278
- * @return void
1279
  */
1280
- function admin_single_enqueue_scripts( $hook ) {
1281
-
1282
- if ( $hook !== $this->admin_single )
1283
- return;
1284
-
1285
- /* CodeMirror package version */
1286
- $codemirror_version = '3.11';
1287
-
1288
- /* CodeMirror base framework */
1289
-
1290
- wp_register_script(
1291
- 'codemirror',
1292
- plugins_url( 'assets/codemirror/lib/codemirror.js', $this->file ),
1293
- false,
1294
- $codemirror_version
1295
- );
1296
 
1297
- wp_register_style(
1298
- 'codemirror',
1299
- plugins_url( 'assets/codemirror/lib/codemirror.css', $this->file ),
1300
- false,
1301
- $codemirror_version
1302
- );
1303
-
1304
- /* CodeMirror modes */
1305
-
1306
- $modes = array( 'php', 'clike' );
1307
-
1308
- foreach ( $modes as $mode ) {
1309
-
1310
- wp_register_script(
1311
- "codemirror-mode-$mode",
1312
- plugins_url( "assets/codemirror/mode/$mode.js", $this->file ),
1313
- array( 'codemirror' ),
1314
- $codemirror_version
1315
- );
1316
- }
1317
 
1318
- /* CodeMirror addons */
1319
 
1320
- $addons = array( 'dialog', 'searchcursor', 'search', 'matchbrackets' );
 
1321
 
1322
- foreach ( $addons as $addon ) {
 
 
1323
 
1324
- wp_register_script(
1325
- "codemirror-addon-$addon",
1326
- plugins_url( "assets/codemirror/addon/$addon.js", $this->file ),
1327
- array( 'codemirror' ),
1328
- $codemirror_version
1329
- );
1330
  }
1331
 
1332
- wp_register_style(
1333
- 'codemirror-addon-dialog',
1334
- plugins_url( 'assets/codemirror/addon/dialog.css', $this->file ),
1335
- array( 'codemirror' ),
1336
- $codemirror_version
1337
- );
1338
-
1339
- /* Enqueue the registered scripts */
1340
- wp_enqueue_script( array(
1341
- 'codemirror-addon-matchbrackets',
1342
- 'codemirror-mode-clike',
1343
- 'codemirror-mode-php',
1344
- 'codemirror-addon-search',
1345
- ) );
1346
-
1347
- /* Enqueue the registered stylesheets */
1348
- wp_enqueue_style( array(
1349
- 'codemirror',
1350
- 'codemirror-addon-dialog',
1351
- ) );
1352
-
1353
- /* Enqueue custom styling */
1354
- wp_enqueue_style(
1355
- 'code-snippets-admin-single',
1356
- plugins_url( 'assets/admin-single.css', $this->file ),
1357
- false,
1358
- $this->version
1359
- );
1360
- }
1361
-
1362
- /**
1363
- * Processes import files and loads the help tabs for the Import Snippets page
1364
- *
1365
- * @since Code Snippets 1.3
1366
- *
1367
- * @uses $this->import() To process the import file
1368
- * @uses wp_redirect() To pass the import results to the page
1369
- * @uses add_query_arg() To append the results to the current URI
1370
- *
1371
- * @return void
1372
- */
1373
- function load_admin_import() {
1374
 
1375
- $this->create_tables(); // create the snippet tables if they do not exist
 
1376
 
1377
- if ( isset( $_FILES['code_snippets_import_file']['tmp_name'] ) ) {
1378
- $count = $this->import( $_FILES['code_snippets_import_file']['tmp_name'] );
1379
- if ( $count ) {
1380
- wp_redirect( add_query_arg( 'imported', $count ) );
 
 
1381
  }
1382
  }
1383
- require_once $this->plugin_dir . 'includes/help/import.php';
1384
- }
1385
-
1386
- /**
1387
- * Displays the Manage Snippets page
1388
- *
1389
- * @since Code Snippets 1.0
1390
- * @access private
1391
- *
1392
- * @return void
1393
- */
1394
- function display_admin_manage() {
1395
- require_once $this->plugin_dir . 'includes/admin/manage.php';
1396
- }
1397
 
1398
- /**
1399
- * Displays the Add New/Edit Snippet page
1400
- *
1401
- * @since Code Snippets 1.0
1402
- * @access private
1403
- *
1404
- * @return void
1405
- */
1406
- function display_admin_single() {
1407
- require_once $this->plugin_dir . 'includes/admin/single.php';
1408
- }
1409
-
1410
- /**
1411
- * Displays the Import Snippets page
1412
- *
1413
- * @since Code Snippets 1.3
1414
- * @access private
1415
- *
1416
- * @return void
1417
- */
1418
- function display_admin_import() {
1419
- require_once $this->plugin_dir . 'includes/admin/import.php';
1420
  }
1421
 
1422
  /**
1423
- * Add a description editor to the Add New/Edit Snippet page
1424
  *
1425
- * @since Code Snippets 1.7
1426
  * @access private
1427
  *
1428
- */
1429
- function description_editor_box( $snippet ) {
1430
- ?>
1431
-
1432
- <label for="snippet_description">
1433
- <h3><div style="position: absolute;"><?php _e('Description', 'code-snippets');
1434
- ?> <span style="font-weight: normal;"><?php esc_html_e('(Optional)', 'code-snippets'); ?></span></div></h3>
1435
- </label>
1436
-
1437
- <?php
1438
-
1439
- remove_editor_styles(); // stop custom theme styling interfering with the editor
1440
-
1441
- wp_editor(
1442
- $snippet->description,
1443
- 'description',
1444
- apply_filters( 'code_snippets_description_editor_settings', array(
1445
- 'textarea_name' => 'snippet_description',
1446
- 'textarea_rows' => 10,
1447
- 'teeny' => true,
1448
- 'media_buttons' => false,
1449
- ) )
1450
- );
1451
- }
1452
-
1453
- /**
1454
- * Adds a link pointing to the Manage Snippets page
1455
- *
1456
- * @since Code Snippets 1.0
1457
- * @access private
1458
  *
1459
  * @return void
1460
  */
1461
- function settings_link( $links ) {
1462
- array_unshift( $links, sprintf(
1463
- '<a href="%1$s" title="%2$s">%3$s</a>',
1464
- $this->admin_manage_url,
1465
- __('Manage your existing snippets', 'code-snippets'),
1466
- __('Manage', 'code-snippets')
1467
- ) );
1468
- return $links;
1469
- }
1470
-
1471
- /**
1472
- * Adds extra links related to the plugin
1473
- *
1474
- * @since Code Snippets 1.2
1475
- * @access private
1476
- */
1477
- function plugin_meta( $links, $file ) {
1478
-
1479
- if ( $file !== $this->basename ) return $links;
1480
-
1481
- $format = '<a href="%1$s" title="%2$s">%3$s</a>';
1482
-
1483
- return array_merge( $links, array(
1484
- sprintf( $format,
1485
- 'http://wordpress.org/extend/plugins/code-snippets/',
1486
- __('Visit the WordPress.org plugin page', 'code-snippets'),
1487
- __('About', 'code-snippets')
1488
- ),
1489
- sprintf( $format,
1490
- 'http://wordpress.org/support/plugin/code-snippets/',
1491
- __('Visit the support forums', 'code-snippets'),
1492
- __('Support', 'code-snippets')
1493
- ),
1494
- sprintf( $format,
1495
- 'http://code-snippets.bungeshea.com/donate/',
1496
- __("Support this plugin's development", 'code-snippets'),
1497
- __('Donate', 'code-snippets')
1498
- )
1499
- ) );
1500
- }
1501
-
1502
- /**
1503
- * Run the active snippets
1504
- *
1505
- * @since Code Snippets 1.0
1506
- * @access private
1507
- *
1508
- * @uses $wpdb To grab the active snippets from the database
1509
- * @uses $this->execute_snippet() To execute a snippet
1510
- * @uses $this->get_table_name() To retrieve the name of the snippet table
1511
- *
1512
- * @param string $scope Execute network-wide or site-wide snippets?
1513
- * @return void
1514
- */
1515
- function run_snippets() {
1516
-
1517
- if ( defined( 'CODE_SNIPPETS_SAFE_MODE' ) && CODE_SNIPPETS_SAFE_MODE ) return;
1518
-
1519
- global $wpdb;
1520
-
1521
- if ( ! isset( $wpdb->table ) )
1522
- $this->set_table_vars();
1523
-
1524
- $active_snippets = array();
1525
-
1526
- // check that the table exists before continuing
1527
- if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->snippets}';" ) ) {
1528
-
1529
- // grab the active snippets from the database
1530
- $active_snippets = $wpdb->get_col( "SELECT code FROM {$wpdb->snippets} WHERE active=1;" );
1531
-
1532
- }
1533
-
1534
- if ( is_multisite() && $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->ms_snippets}';" ) ) {
1535
-
1536
- // grab the network active snippets from the database
1537
- $active_snippets = array_merge(
1538
- $wpdb->get_col( "SELECT code FROM {$wpdb->ms_snippets} WHERE active=1;" ),
1539
- $active_snippets
1540
- );
1541
- }
1542
-
1543
- if ( count( $active_snippets ) ) {
1544
- foreach( $active_snippets as $snippet ) {
1545
- // execute the php code
1546
- $this->execute_snippet( htmlspecialchars_decode( stripslashes( $snippet ) ) );
1547
  }
 
 
 
 
 
 
 
 
 
1548
  }
1549
  }
 
1550
  }
1551
 
1552
  /**
1553
- * The global variable in which the Code Snippets class is stored
1554
  *
1555
- * @since Code Snippets 1.0
1556
  * @access public
1557
  */
1558
  global $code_snippets;
@@ -1562,47 +1059,4 @@ $code_snippets = new Code_Snippets;
1562
  global $cs;
1563
  $cs = &$code_snippets;
1564
 
1565
- register_uninstall_hook( $code_snippets->file, 'code_snippets_uninstall' );
1566
-
1567
- /**
1568
- * Cleans up data created by the Code_Snippets class
1569
- *
1570
- * @since Code Snippets 1.2
1571
- * @access private
1572
- *
1573
- * @uses $wpdb To remove tables from the database
1574
- * @uses $code_snippets->get_table_name() To find out which table to drop
1575
- * @uses is_multisite() To check the type of installation
1576
- * @uses switch_to_blog() To switch between blogs
1577
- * @uses restore_current_blog() To switch between blogs
1578
- * @uses delete_option() To remove site options
1579
- *
1580
- * @return void
1581
- */
1582
- function code_snippets_uninstall() {
1583
- global $wpdb, $code_snippets;
1584
- if ( is_multisite() ) {
1585
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
1586
- if ( $blog_ids ) {
1587
- foreach ( $blog_ids as $blog_id ) {
1588
- switch_to_blog( $blog_id );
1589
- $wpdb->query( "DROP TABLE IF EXISTS $wpdb->snippets" );
1590
- delete_option( 'cs_db_version' );
1591
- delete_option( 'recently_activated_snippets' );
1592
- $code_snippets->remove_caps();
1593
- }
1594
- restore_current_blog();
1595
- }
1596
- $wpdb->query( "DROP TABLE IF EXISTS $wpdb->ms_snippets" );
1597
- delete_site_option( 'recently_activated_snippets' );
1598
- $code_snippets->remove_caps( 'multisite' );
1599
- } else {
1600
- $wpdb->query( "DROP TABLE IF EXISTS $wpdb->snippets" );
1601
- delete_option( 'recently_activated_snippets' );
1602
- delete_option( 'cs_db_version' );
1603
- $code_snippets->remove_caps();
1604
- }
1605
- delete_site_option( 'code_snippets_version' );
1606
- }
1607
-
1608
- endif; // class exists check
8
  *
9
  * @package Code Snippets
10
  * @subpackage Main
11
+ */
12
+
13
+ /*
14
  * Plugin Name: Code Snippets
15
  * Plugin URI: http://code-snippets.bungeshea.com
16
  * Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
17
  * Author: Shea Bunge
18
  * Author URI: http://bungeshea.com
19
+ * Version: 1.7.1
20
  * License: MIT
21
+ * License URI: license.txt
22
  * Text Domain: code-snippets
23
  * Domain Path: /languages/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  */
25
 
26
  // Exit if accessed directly
29
  if ( ! class_exists( 'Code_Snippets' ) ) :
30
 
31
  /**
32
+ * The main class for our plugin.
33
  * It all happens here, folks
34
  *
35
  * Please use the global variable $code_snippets to access
36
+ * the methods or variables in this class. Anything you need
37
  * to access should be publicly available there
38
  *
39
+ * @since 1.0
40
+ * @package Code Snippets
41
  * @access private
42
  */
43
  final class Code_Snippets {
49
  * This should be set to the 'Plugin Version' value,
50
  * as defined above in the plugin header
51
  *
52
+ * @since 1.0
53
  * @access public
54
+ * @var string A PHP-standardized version number string
55
  */
56
+ public $version = '1.7.1';
57
 
58
  /**
59
+ * Variables to hold plugin paths
60
  *
61
+ * @since 1.0
62
  * @access public
63
+ * @var string
64
  */
65
+ public $file, $basename, $plugin_dir, $plugin_url;
66
 
67
  /**
68
+ * Stores an instance of the list table class
 
69
  *
70
+ * @since 1.5
71
  * @access public
72
+ * @see Code_Snippets_List_Table
73
  */
74
+ public $list_table;
75
 
76
  /**
77
+ * Stores an instance of the administration class
78
  *
79
+ * @since Code_Snippets 1.7.1
80
  * @access public
81
+ * @see Code_Snippets_Admin
82
  */
83
+ public $admin;
84
 
85
  /**
86
+ * Used by maybe_create_tables() for bailing early
87
+ * @var boolean
88
+ */
89
+ static $tables_created = false;
90
+
91
+ /**
92
+ * Stores the snippet table names
93
+ *
94
+ * It's better to use $wpdb->snippets and
95
+ * $wpdb->ms_snippets, but these are maintained
96
+ * as references for backwards-compatibility
97
+ *
98
+ * @var string
99
+ */
100
+ public $table, $ms_table;
101
+
102
+ /**
103
+ * These are now deprecated in favor of those in
104
+ * the Code_Snippets_Admin class, but maintained as
105
+ * references so we don't break existing code
106
  *
107
+ * @since 1.0
108
+ * @deprecated Moved to the Code_Snippets_Admin class in 1.7.1
109
  * @access public
110
+ * @var string
111
  */
112
+ public $admin_manage, $admin_single, $admin_import, $admin_manage_url, $admin_single_url, $admin_import_url;
113
 
114
  /**
115
  * The constructor function for our class
 
116
  *
117
+ * This method is called just as this plugin is included,
118
+ * so other plugins may not have loaded yet. Only do stuff
119
+ * here that really can't wait
120
+ *
121
+ * @since 1.0
122
  * @access private
123
  *
124
  * @return void
125
  */
126
  function __construct() {
 
127
 
128
+ /* Initialize the variables holding the snippet table names */
129
+ $this->set_table_vars();
130
 
131
+ /* Add backwards-compatibly for the CS_SAFE_MODE constant */
132
  if ( defined( 'CS_SAFE_MODE' ) && ! defined( 'CODE_SNIPPETS_SAFE_MODE' ) ) {
133
  define( 'CODE_SNIPPETS_SAFE_MODE', CS_SAFE_MODE );
134
  }
135
+
136
+ /* Execute the snippets once the plugins are loaded */
137
+ add_action( 'plugins_loaded', array( $this, 'run_snippets' ), 1 );
138
+
139
+ /* Hook our initialize function to the plugins_loaded action */
140
+ add_action( 'plugins_loaded', array( $this, 'init' ) );
141
  }
142
 
143
  /**
144
+ * Load the plugin completely
145
  *
146
+ * This method is called *after* other plugins
147
+ * have been run
148
+ *
149
+ * @since 1.7
150
+ * @access public
151
  *
152
  * @return void
153
  */
154
+ public function init() {
155
 
156
+ /* Initialize core variables */
157
+ $this->setup_vars();
158
+
159
+ /* Check if we need to change some stuff */
160
+ $this->upgrade();
 
161
 
162
  /*
163
+ * Load up the localization file if we're using WordPress in a different language.
164
  * Place it in this plugin's "languages" folder and name it "code-snippets-[value in wp-config].mo"
165
  *
166
  * If you wish to contribute a language file to be included in the Code Snippets package,
168
  */
169
  load_plugin_textdomain( 'code-snippets', false, dirname( $this->basename ) . '/languages/' );
170
 
171
+ /*
172
+ * Cleanup the plugin data on uninstall
173
+ */
174
+ register_uninstall_hook( $this->file, array( __CLASS__, 'uninstall' ) );
175
+
176
  /**
177
+ * Let extension plugins know that it's okay to load
178
  */
179
  do_action( 'code_snippets_init' );
180
  }
181
 
182
  /**
183
+ * Initialize variables
184
  *
185
+ * @since 1.2
186
  * @access private
187
  *
188
  * @return void
189
  */
190
  function setup_vars() {
 
 
191
 
192
+ /* Plugin directory variables */
193
+ $this->file = __FILE__;
194
  $this->basename = plugin_basename( $this->file );
195
  $this->plugin_dir = plugin_dir_path( $this->file );
196
  $this->plugin_url = plugin_dir_url ( $this->file );
197
 
198
+ if ( is_admin() ) {
 
199
 
200
+ /* Load our administration class */
201
+ require_once $this->plugin_dir . 'includes/class-admin.php';
202
+ $this->admin = new Code_Snippets_Admin;
203
 
204
+ /* Remap deprecated variables */
205
+ $this->admin_manage_url = &$this->admin->manage_url;
206
+ $this->admin_single_url = &$this->admin->single_url;
207
+ $this->admin_import_url = &$this->admin->import_url;
 
 
 
 
 
 
 
 
 
208
 
209
+ $this->admin_manage = &$this->admin->manage_page;
210
+ $this->admin_single = &$this->admin->single_page;
211
+ $this->admin_import = &$this->admin->import_page;
212
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  }
214
 
215
  /**
216
+ * Register the snippet table names with WordPress
217
  *
218
+ * @since 1.7
219
  * @access public
220
  *
221
  * @uses $wpdb
225
  public function set_table_vars() {
226
  global $wpdb;
227
 
228
+ /* Register the snippet table names with WordPress */
229
+ $wpdb->tables[] = 'snippets';
230
+ $wpdb->ms_global_tables[] = 'ms_snippets';
231
 
232
+ /* Setup initial table variables */
233
+ $wpdb->snippets = $wpdb->prefix . 'snippets';
234
+ $wpdb->ms_snippets = $wpdb->base_prefix . 'ms_snippets';
 
 
 
 
 
 
 
 
 
 
 
 
 
235
 
236
+ /* Add a pointer to the old variables */
237
+ $this->table = &$wpdb->snippets;
238
+ $this->ms_table = &$wpdb->ms_snippets;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  }
240
 
241
  /**
242
  * Return the appropriate snippet table name
243
  *
244
+ * @since 1.6
245
+ * @access public
246
  *
247
+ * @param string $scope Retrieve the multisite table name or the site table name?
248
+ * @param bool $check_screen Query the current screen if no scope passed?
249
+ * @return string $table The snippet table name
250
  */
251
+ public function get_table_name( $scope = '', $check_screen = true ) {
252
 
253
  global $wpdb;
254
 
255
+ $this->maybe_create_tables(); // create the snippet tables if they do not exist
256
 
257
  if ( ! is_multisite() ) {
258
  $network = false;
259
  }
260
+ elseif ( in_array( $scope, array( 'multisite', 'network' ) ) ) {
 
 
 
 
 
261
  $network = true;
262
  }
263
+ elseif ( empty( $scope ) && $check_screen && function_exists( 'get_current_screen' ) ) {
264
+ /* if no scope is set, query the current screen to see if in network admin */
265
+ $network = get_current_screen()->is_network;
266
  }
267
  else {
268
  $network = false;
276
  /**
277
  * Create the snippet tables if they do not already exist
278
  *
279
+ * @since 1.7.1
280
  * @access public
281
  *
282
  * @uses $this->create_table() To create a single snippet table
283
  * @uses $wpdb->get_var() To test of the table exists
284
+ * @uses self::$tables_created To check if we've already done this or not
285
+ *
286
+ * @param bool $force Force table creation/upgrade
287
  *
288
  * @return void
289
  */
290
+ public function maybe_create_tables( $force = false ) {
291
+
292
+ /* Bail early if we've done this already */
293
+ if ( self::$tables_created && ! $force ) return;
294
 
295
  global $wpdb;
296
 
297
+ if ( ! isset( $wpdb->snippets, $wpdb->ms_snippets ) )
298
+ $this->set_table_vars();
299
+
300
+ $table_exists = $force || $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->snippets'" ) === $wpdb->snippets;
301
 
302
+ if ( ! is_multisite() && ! $table_exists ) {
303
+ $table = $wpdb->snippets;
304
+ }
305
+ elseif ( is_multisite() ) {
306
+ $ms_table_exists = $force || $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->ms_snippets'" ) === $wpdb->ms_snippets;
307
+
308
+ if ( ! $ms_table_exists && ! $table_exists )
309
+ $table = $wpdb->snippets . ',' . $wpdb->ms_snippets;
310
+ elseif ( ! $table_exists && $ms_table_exists )
311
+ $table = $wpdb->snippets;
312
+ elseif ( $table_exists && ! $ms_table_exists )
313
+ $table = $wpdb->ms_snippets;
314
+ }
315
 
316
+ if ( isset( $table ) )
317
+ $this->create_table( $table );
318
+
319
+ self::$tables_created = true;
320
+ }
321
+
322
+ /**
323
+ * Create the snippet tables if they do not already exist
324
+ *
325
+ * @since Code Snippets 1.2
326
+ * @deprecated Code Snippets 1.7.1
327
+ * @access public
328
+ *
329
+ * @return void
330
+ */
331
+ public function create_tables() {
332
+ _deprecated_function(
333
+ '$code_snippets->create_tables()',
334
+ 'Code Snippets 1.7.1',
335
+ '$code_snippets->maybe_create_tables()'
336
+ );
337
+ $this->maybe_create_tables();
338
  }
339
 
340
  /**
341
  * Create a single snippet table
342
  * if one of the same name does not already exist
343
  *
344
+ * @since 1.6
345
+ * @access private
346
  *
347
  * @uses dbDelta() To add the table to the database
348
  *
354
 
355
  global $wpdb;
356
 
357
+ $charset_collate = '';
358
+
359
  if ( ! empty( $wpdb->charset ) ) {
360
  $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
361
  }
364
  $charset_collate .= " COLLATE $wpdb->collate";
365
  }
366
 
367
+ $table_columns = apply_filters( 'code_snippets_database_table_columns', array(
368
+ 'name tinytext not null',
369
+ 'description text',
370
+ 'code longtext not null',
371
+ ) );
372
+
373
+ $table_columns_sql = implode( ",\n", $table_columns );
374
+
375
  $sql = "CREATE TABLE $table_name (
376
+ id bigint(20) unsigned not null auto_increment,
377
+ {$table_columns_sql},
378
+ active tinyint(1) not null default 0,
 
 
379
  PRIMARY KEY (id),
380
  KEY id (id)
381
 
389
  /**
390
  * Preform upgrade tasks such as deleting and updating options
391
  *
392
+ * @since 1.2
393
  * @access private
394
  *
395
  * @return void
397
  function upgrade() {
398
  global $wpdb;
399
 
400
+ // get the current plugin version from the database
 
 
 
 
 
 
 
 
 
 
 
 
401
 
402
+ $current_version = get_option( 'code_snippets_version' );
403
 
404
+ if ( ! $current_version && get_option( 'cs_db_version' ) ) {
405
+ $current_version = get_option( 'cs_db_version' );
406
+ delete_option( 'cs_db_version' );
407
+ add_option( 'code_snippets_version', $current_version );
408
  }
409
 
410
+ $previous_version = ( $current_version ? $current_version : $this->version );
411
+
412
  /* skip this if we're on the latest version */
413
+ if ( version_compare( $current_version, $this->version, '<' ) ) {
414
 
415
+ // Register the capabilities once only
416
+ if ( version_compare( $current_version, '1.5', '<' ) ) {
417
+ $this->setup_roles( true );
 
418
  }
419
 
420
+ if ( version_compare( $previous_version, '1.2', '<' ) ) {
421
+ // The 'Complete Uninstall' option was removed in version 1.2
422
  delete_option( 'cs_complete_uninstall' );
423
  }
424
 
425
+ // Update the current version stored in the database
426
+ update_option( 'code_snippets_version', $this->version );
427
  }
 
428
 
429
+ /* Multisite-only upgrades */
 
 
 
 
 
 
 
 
430
 
431
+ if ( is_multisite() && is_main_site() ) {
 
 
 
 
 
 
 
 
 
 
 
432
 
433
+ $current_ms_version = get_site_option( 'code_snippets_version' );
434
 
435
+ if ( version_compare( $current_ms_version, $this->version, '<' ) ) {
 
 
 
 
436
 
437
+ if ( version_compare( $current_ms_version, '1.5', '<' ) ) {
438
+ $this->setup_ms_roles( true );
439
+ }
440
+
441
+ // migrate the recently_network_activated_snippets to the site options
442
+ if ( get_option( 'recently_network_activated_snippets' ) ) {
443
+ add_site_option( 'recently_activated_snippets', get_option( 'recently_network_activated_snippets', array() ) );
444
+ delete_option( 'recently_network_activated_snippets' );
445
+ }
 
 
 
446
 
447
+ }
448
+
449
+ update_site_option( 'code_snippets_version', $this->version );
450
+ }
451
 
 
 
 
 
452
  }
453
 
454
  /**
455
  * Register the user roles and capabilities
456
  *
457
+ * @since 1.5
458
  * @access private
459
  *
460
+ * @param bool $install true to add the capabilities, false to remove
461
  * @return void
462
  */
463
+ function setup_roles( $install = true ) {
 
 
 
 
 
 
 
 
 
 
464
 
465
  $this->caps = apply_filters( 'code_snippets_caps', array(
466
  'manage_snippets',
481
  /**
482
  * Register the multisite user roles and capabilities
483
  *
484
+ * @since 1.5
485
  * @access private
486
  *
487
+ * @param bool $install true to add the capabilities, false to remove
488
  * @return void
489
  */
490
+ function setup_ms_roles( $install = true ) {
491
 
492
  if ( ! is_multisite() ) return;
493
 
 
 
 
 
 
 
 
 
 
494
  $this->network_caps = apply_filters( 'code_snippets_network_caps', array(
495
  'manage_network_snippets',
496
  'install_network_snippets',
510
  }
511
 
512
  /**
513
+ * Check if the current user can perform some action on snippets or not
514
  *
515
+ * If multisite, checks if *Enable Administration Menus: Snippets* is active
516
+ * under the *Settings > Network Settings* network admin menu
517
  *
518
+ * @uses current_user_can() To check if the current user can perform a task
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
  *
520
+ * @param string $do_what The task to check against.
521
+ * @return bool Whether the current user can perform this task or not
 
 
 
 
 
522
  */
523
+ public function user_can( $do_what ) {
 
 
 
 
 
 
 
 
 
524
 
525
+ if ( is_multisite() ) {
 
 
526
 
527
+ if ( in_array( 'snippets', get_site_option( 'menu_items' ) ) )
528
+ return current_user_can( "{$do_what}_snippets" );
529
+ else
530
+ return current_user_can( "{$do_what}_network_snippets" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
 
532
  } else {
533
+ return current_user_can( "{$do_what}_snippets" );
 
 
 
 
 
 
534
  }
535
  }
536
 
537
  /**
538
  * Converts an array of snippet data into a snippet object
539
  *
540
+ * @since 1.7
541
  * @access public
542
  *
543
  * @param mixed $data The snippet data to convert
599
  /**
600
  * Retrieve a list of snippets from the database
601
  *
602
+ * @since 1.7
603
  * @access public
604
  *
605
  * @uses $wpdb To query the database for snippets
624
  /**
625
  * Escape snippet data for inserting into the database
626
  *
627
+ * @since 1.7
628
  * @access public
629
  *
630
  * @param mixed $snippet An object or array containing the data to escape
650
  }
651
 
652
  /**
653
+ * Unescape snippet data after retrieval from the database
654
  * ready for use
655
  *
656
+ * @since 1.7
657
  * @access public
658
  *
659
  * @param mixed $snippet An object or array containing the data to unescape
671
  }
672
 
673
  /**
674
+ * Retrieve a single snippets from the database.
675
  * Will return empty snippet object if no snippet
676
  * ID is specified
677
  *
678
+ * @since 1.7
679
  * @access public
680
  *
681
  * @uses $wpdb To query the database for snippets
682
  * @uses $this->get_table_name() To dynamically retrieve the snippet table name
683
  *
684
+ * @param int $id The ID of the snippet to retrieve. 0 to build a new snippet
685
+ * @param string $scope Retrieve a multisite-wide or site-wide snippet?
686
  * @return object A single snippet object
687
  */
688
  public function get_snippet( $id = 0, $scope = '' ) {
689
  global $wpdb;
690
  $table = $this->get_table_name( $scope );
691
 
692
+ if ( intval( $id ) > 0 ) {
693
  /* Retrieve the snippet from the database */
694
  $snippet = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE id = %d", $id ) );
695
  /* Unescape the snippet data, ready for use */
696
  $snippet = $this->unescape_snippet_data( $snippet );
697
  } else {
698
+ /* Get an empty snippet object */
699
  $snippet = $this->build_snippet_object();
700
  }
701
  return apply_filters( 'code_snippets_get_snippet', $snippet, $id, $scope );
704
  /**
705
  * Activates a snippet
706
  *
707
+ * @since 1.5
708
  * @access public
709
  *
710
  * @uses $wpdb To set the snippets' active status
738
  /**
739
  * Deactivates selected snippets
740
  *
741
+ * @since 1.5
742
  * @access public
743
  *
744
  * @uses $wpdb To set the snippets' active status
785
  /**
786
  * Deletes a snippet from the database
787
  *
788
+ * @since 1.5
789
  * @access public
790
  *
791
  * @uses $wpdb To access the database
792
  * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table
793
+ *
794
+ * @param int $id The ID of the snippet to delete
795
+ * @param string $scope Delete from site-wide or network-wide table?
796
  */
797
  public function delete_snippet( $id, $scope = '' ) {
798
  global $wpdb;
807
  /**
808
  * Saves a snippet to the database.
809
  *
810
+ * @since 1.5
811
  * @access public
812
  *
813
  * @uses $wpdb To update/add the snippet to the database
814
  * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table
815
  *
816
  * @param object $snippet The snippet to add/update to the database
817
+ * @param string $scope Save the snippet to the site-wide or network-wide table?
818
  * @return int|bool The ID of the snippet on success, false on failure
819
  */
820
  public function save_snippet( $snippet, $scope = '' ) {
858
  /**
859
  * Imports snippets from an XML file
860
  *
861
+ * @since 1.5
862
  * @access public
863
  *
864
  * @uses $this->save_snippet() To add the snippets to the database
888
  /**
889
  * Exports snippets as an XML file
890
  *
891
+ * @since 1.5
892
  * @access public
893
  *
894
  * @uses code_snippets_export() To export selected snippets
895
  * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table
896
  *
897
+ * @param array $ids The IDs of the snippets to export
898
  * @param string $scope Is the snippet a network-wide or site-wide snippet?
899
  * @return void
900
  */
911
  /**
912
  * Exports snippets as a PHP file
913
  *
914
+ * @since 1.5
915
  * @access public
916
  *
917
  * @uses code_snippets_export() To export selected snippets
918
  * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table
919
  *
920
+ * @param array $ids The IDs of the snippets to export
921
  * @param string $scope Is the snippet a network-wide or site-wide snippet?
922
  * @return void
923
  */
937
  * Code must NOT be escaped, as
938
  * it will be executed directly
939
  *
940
+ * @since 1.5
941
  * @access public
942
  *
943
  * @param string $code The snippet code to execute
953
  }
954
 
955
  /**
956
+ * Run the active snippets
957
  *
958
+ * @since 1.0
959
  * @access public
960
  *
961
+ * @uses $wpdb To grab the active snippets from the database
962
+ * @uses $this->execute_snippet() To execute a snippet
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
963
  *
964
+ * @return bool true on success, false on failure
965
  */
966
+ public function run_snippets() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
967
 
968
+ /* Bail early if safe mode is active */
969
+ if ( defined( 'CODE_SNIPPETS_SAFE_MODE' ) && CODE_SNIPPETS_SAFE_MODE )
970
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971
 
972
+ global $wpdb;
973
 
974
+ if ( ! isset( $wpdb->snippets, $wpdb->ms_snippets ) )
975
+ $this->set_table_vars();
976
 
977
+ /* Check if the snippets table exists */
978
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->snippets'" ) === $wpdb->snippets )
979
+ $sql = "SELECT code FROM {$wpdb->snippets} WHERE active=1";
980
 
981
+ /* Check if the multisite snippets table exists */
982
+ if ( is_multisite() && $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->ms_snippets'" ) === $wpdb->ms_snippets ) {
983
+ $sql = ( isset( $sql ) ? $sql . "\nUNION ALL\n" : '' );
984
+ $sql .= "SELECT code FROM {$wpdb->ms_snippets} WHERE active=1;";
 
 
985
  }
986
 
987
+ if ( ! empty( $sql ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
988
 
989
+ /* Grab the active snippets from the database */
990
+ $active_snippets = $wpdb->get_col( $sql );
991
 
992
+ if ( count( $active_snippets ) ) {
993
+ foreach( $active_snippets as $snippet ) {
994
+ /* Execute the PHP code */
995
+ $this->execute_snippet( htmlspecialchars_decode( stripslashes( $snippet ) ) );
996
+ }
997
+ return true;
998
  }
999
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1000
 
1001
+ /* If we're made it this far without returning true, assume failure */
1002
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1003
  }
1004
 
1005
  /**
1006
+ * Cleans up data created by the Code_Snippets class
1007
  *
1008
+ * @since 1.2
1009
  * @access private
1010
  *
1011
+ * @uses $wpdb To remove tables from the database
1012
+ * @uses $code_snippets->get_table_name() To find out which table to drop
1013
+ * @uses is_multisite() To check the type of installation
1014
+ * @uses switch_to_blog() To switch between blogs
1015
+ * @uses restore_current_blog() To switch between blogs
1016
+ * @uses delete_option() To remove site options
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1017
  *
1018
  * @return void
1019
  */
1020
+ static function uninstall() {
1021
+ global $wpdb, $code_snippets;
1022
+ if ( is_multisite() ) {
1023
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
1024
+ if ( $blog_ids ) {
1025
+ foreach ( $blog_ids as $blog_id ) {
1026
+ switch_to_blog( $blog_id );
1027
+ $wpdb->query( "DROP TABLE IF EXISTS $wpdb->snippets" );
1028
+ delete_option( 'cs_db_version' );
1029
+ delete_option( 'recently_activated_snippets' );
1030
+ delete_option( 'code_snippets_version' );
1031
+ $code_snippets->setup_roles( false );
1032
+ }
1033
+ restore_current_blog();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1034
  }
1035
+ $wpdb->query( "DROP TABLE IF EXISTS $wpdb->ms_snippets" );
1036
+ delete_site_option( 'code_snippets_version' );
1037
+ delete_site_option( 'recently_activated_snippets' );
1038
+ $code_snippets->setup_ms_roles( false );
1039
+ } else {
1040
+ $wpdb->query( "DROP TABLE IF EXISTS $wpdb->snippets" );
1041
+ delete_option( 'code_snippets_version' );
1042
+ delete_option( 'recently_activated_snippets' );
1043
+ $code_snippets->setup_roles( false );
1044
  }
1045
  }
1046
+
1047
  }
1048
 
1049
  /**
1050
+ * The global variable in which the Code_Snippets class is stored
1051
  *
1052
+ * @since 1.0
1053
  * @access public
1054
  */
1055
  global $code_snippets;
1059
  global $cs;
1060
  $cs = &$code_snippets;
1061
 
1062
+ endif; // class exists check
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/import.php CHANGED
@@ -9,6 +9,8 @@
9
 
10
  if ( ! class_exists( 'Code_Snippets' ) ) exit;
11
 
 
 
12
  /* Display the admin notice */
13
 
14
  if ( isset( $_REQUEST['imported'] ) && 0 !== intval( $_REQUEST['imported'] ) ) {
@@ -37,7 +39,7 @@ if ( isset( $_REQUEST['imported'] ) && 0 !== intval( $_REQUEST['imported'] ) ) {
37
 
38
  <p><?php _e('Howdy! Upload your Code Snippets export file and we&#8217;ll import the snippets to this site.', 'code-snippets' ); ?></p>
39
 
40
- <p><?php printf( __('You will need to go to the <a href="%s">Manage Snippets</a> page to activate the imported snippets.', 'code-snippets'), $this->admin_manage_url ); ?></p>
41
 
42
  <p><?php _e('Choose a Code Snippets (.xml) file to upload, then click Upload file and import.', 'code-snippets'); ?></p>
43
 
@@ -56,4 +58,4 @@ if ( isset( $_REQUEST['imported'] ) && 0 !== intval( $_REQUEST['imported'] ) ) {
56
  </p>
57
  </form>
58
  </div>
59
- </div>
9
 
10
  if ( ! class_exists( 'Code_Snippets' ) ) exit;
11
 
12
+ global $code_snippets;
13
+
14
  /* Display the admin notice */
15
 
16
  if ( isset( $_REQUEST['imported'] ) && 0 !== intval( $_REQUEST['imported'] ) ) {
39
 
40
  <p><?php _e('Howdy! Upload your Code Snippets export file and we&#8217;ll import the snippets to this site.', 'code-snippets' ); ?></p>
41
 
42
+ <p><?php printf( __('You will need to go to the <a href="%s">Manage Snippets</a> page to activate the imported snippets.', 'code-snippets'), $code_snippets->admin->manage_url ); ?></p>
43
 
44
  <p><?php _e('Choose a Code Snippets (.xml) file to upload, then click Upload file and import.', 'code-snippets'); ?></p>
45
 
58
  </p>
59
  </form>
60
  </div>
61
+ </div>
includes/admin/manage.php CHANGED
@@ -9,8 +9,7 @@
9
 
10
  if ( ! class_exists( 'Code_Snippets' ) ) exit;
11
 
12
- require_once $this->plugin_dir . 'includes/class-list-table.php';
13
-
14
  $screen = get_current_screen();
15
  ?>
16
  <?php if ( defined( 'CODE_SNIPPETS_SAFE_MODE' ) && CODE_SNIPPETS_SAFE_MODE ) : ?>
@@ -34,24 +33,24 @@ $screen = get_current_screen();
34
  <div class="wrap">
35
  <?php screen_icon(); ?>
36
  <h2><?php esc_html_e('Snippets', 'code-snippets'); ?>
37
- <?php if ( current_user_can( $screen->is_network ? 'install_network_snippets' : 'install_snippets' ) ) { ?>
38
- <a href="<?php echo $this->admin_single_url; ?>" class="add-new-h2"><?php echo esc_html_x('Add New', 'snippet', 'code-snippets'); ?></a>
39
  <?php }
40
- $this->list_table->search_notice(); ?></h2>
41
 
42
- <?php $this->list_table->views(); ?>
43
 
44
  <form method="get" action="">
45
  <?php
46
- $this->list_table->required_form_fields( 'search_box' );
47
- $this->list_table->search_box( __( 'Search Installed Snippets', 'code-snippets' ), 'search_id' );
48
  ?>
49
  </form>
50
  <form method="post" action="">
51
- <?php $this->list_table->required_form_fields(); ?>
52
- <?php $this->list_table->display(); ?>
53
  </form>
54
 
55
  <?php do_action( 'code_snippets_admin_manage' ); ?>
56
 
57
- </div>
9
 
10
  if ( ! class_exists( 'Code_Snippets' ) ) exit;
11
 
12
+ global $code_snippets;
 
13
  $screen = get_current_screen();
14
  ?>
15
  <?php if ( defined( 'CODE_SNIPPETS_SAFE_MODE' ) && CODE_SNIPPETS_SAFE_MODE ) : ?>
33
  <div class="wrap">
34
  <?php screen_icon(); ?>
35
  <h2><?php esc_html_e('Snippets', 'code-snippets'); ?>
36
+ <?php if ( $code_snippets->user_can( 'install' ) ) { ?>
37
+ <a href="<?php echo $code_snippets->admin->single_url; ?>" class="add-new-h2"><?php echo esc_html_x('Add New', 'snippet', 'code-snippets'); ?></a>
38
  <?php }
39
+ $code_snippets->list_table->search_notice(); ?></h2>
40
 
41
+ <?php $code_snippets->list_table->views(); ?>
42
 
43
  <form method="get" action="">
44
  <?php
45
+ $code_snippets->list_table->required_form_fields( 'search_box' );
46
+ $code_snippets->list_table->search_box( __( 'Search Installed Snippets', 'code-snippets' ), 'search_id' );
47
  ?>
48
  </form>
49
  <form method="post" action="">
50
+ <?php $code_snippets->list_table->required_form_fields(); ?>
51
+ <?php $code_snippets->list_table->display(); ?>
52
  </form>
53
 
54
  <?php do_action( 'code_snippets_admin_manage' ); ?>
55
 
56
+ </div>
includes/admin/single.php CHANGED
@@ -9,12 +9,13 @@
9
 
10
  if ( ! class_exists( 'Code_Snippets' ) ) exit;
11
 
12
- $table = $this->get_table_name();
 
 
13
  $screen = get_current_screen();
14
- $can_install = current_user_can( $screen->is_network ? 'install_network_snippets' : 'install_snippets' );
15
 
16
  $edit_id = ( isset( $_REQUEST['edit'] ) ? intval( $_REQUEST['edit'] ) : 0 );
17
- $snippet = $this->get_snippet( $edit_id );
18
 
19
  ?>
20
 
@@ -36,9 +37,9 @@ $snippet = $this->get_snippet( $edit_id );
36
  if ( $edit_id ) {
37
  esc_html_e('Edit Snippet', 'code-snippets');
38
 
39
- if ( $can_install )
40
  printf( ' <a href="%1$s" class="add-new-h2">%2$s</a>',
41
- $this->admin_single_url,
42
  esc_html_x('Add New', 'snippet', 'code-snippets')
43
  );
44
  } else {
@@ -47,8 +48,14 @@ $snippet = $this->get_snippet( $edit_id );
47
  ?></h2>
48
 
49
  <form method="post" action="" style="margin-top: 10px;">
50
- <?php if ( intval( $snippet->id ) > 0 )
 
 
 
 
51
  printf ( '<input type="hidden" name="snippet_id" value="%d" />', $snippet->id );
 
 
52
  ?>
53
  <div id="titlediv">
54
  <div id="titlewrap">
@@ -71,7 +78,7 @@ $snippet = $this->get_snippet( $edit_id );
71
 
72
  if ( ! $snippet->active ) {
73
  echo '&nbsp;&nbsp;&nbsp;';
74
- submit_button( 'Save Changes &amp; Activate', 'secondary', 'save_snippet_activate', false );
75
  }
76
  ?>
77
  </p>
@@ -89,4 +96,4 @@ var editor = CodeMirror.fromTextArea(document.getElementById("snippet_code"), {
89
  enterMode: "keep",
90
  tabMode: "shift"
91
  });
92
- </script>
9
 
10
  if ( ! class_exists( 'Code_Snippets' ) ) exit;
11
 
12
+ global $code_snippets;
13
+
14
+ $table = $code_snippets->get_table_name();
15
  $screen = get_current_screen();
 
16
 
17
  $edit_id = ( isset( $_REQUEST['edit'] ) ? intval( $_REQUEST['edit'] ) : 0 );
18
+ $snippet = $code_snippets->get_snippet( $edit_id );
19
 
20
  ?>
21
 
37
  if ( $edit_id ) {
38
  esc_html_e('Edit Snippet', 'code-snippets');
39
 
40
+ if ( $code_snippets->user_can( 'install' ) )
41
  printf( ' <a href="%1$s" class="add-new-h2">%2$s</a>',
42
+ $code_snippets->admin->single_url,
43
  esc_html_x('Add New', 'snippet', 'code-snippets')
44
  );
45
  } else {
48
  ?></h2>
49
 
50
  <form method="post" action="" style="margin-top: 10px;">
51
+ <?php
52
+
53
+ /* Output the hidden fields */
54
+
55
+ if ( intval( $snippet->id ) > 0 )
56
  printf ( '<input type="hidden" name="snippet_id" value="%d" />', $snippet->id );
57
+
58
+ printf ( '<input type="hidden" name="snippet_active" value="%d" />', $snippet->active );
59
  ?>
60
  <div id="titlediv">
61
  <div id="titlewrap">
78
 
79
  if ( ! $snippet->active ) {
80
  echo '&nbsp;&nbsp;&nbsp;';
81
+ submit_button( __( 'Save Changes &amp; Activate', 'code-snippets' ), 'secondary', 'save_snippet_activate', false );
82
  }
83
  ?>
84
  </p>
96
  enterMode: "keep",
97
  tabMode: "shift"
98
  });
99
+ </script>
includes/class-admin.php ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Contains the class for handling the administration interface
5
+ *
6
+ * @package Code Snippets
7
+ * @subpackage Administration
8
+ */
9
+
10
+ /**
11
+ * This class handles the admin interface for Code Snippets
12
+ *
13
+ * Don't directly access the methods in this class or attempt to
14
+ * re-initialize it. Instead, use the instance in $code_snippets->admin
15
+ *
16
+ * @since 1.7.1
17
+ * @package Code Snippets
18
+ */
19
+ class Code_Snippets_Admin {
20
+
21
+ /**
22
+ * The full URLs to the admin pages
23
+ *
24
+ * @since 1.7.1
25
+ * @access public
26
+ */
27
+ public $manage_url, $single_url, $import_url;
28
+
29
+ /**
30
+ * The hooks for the admin pages
31
+ * Used primarily for enqueueing scripts and styles
32
+ *
33
+ * @since 1.7.1
34
+ * @access public
35
+ */
36
+ public $manage_page, $single_page, $import_page;
37
+
38
+ /**
39
+ * Initializes the variables and
40
+ * loads everything needed for the class
41
+ *
42
+ * @since 1.7.1
43
+ */
44
+ function __construct() {
45
+ global $code_snippets;
46
+
47
+ $this->include_dir = trailingslashit( $code_snippets->plugin_dir . 'includes' );
48
+
49
+ $this->manage_slug = apply_filters( 'code_snippets_admin_manage', 'snippets' );
50
+ $this->single_slug = apply_filters( 'code_snippets_admin_single', 'snippet' );
51
+
52
+ $this->manage_url = self_admin_url( 'admin.php?page=' . $this->manage_slug );
53
+ $this->single_url = self_admin_url( 'admin.php?page=' . $this->single_slug );
54
+
55
+ $this->setup_hooks();
56
+ }
57
+
58
+ /**
59
+ * Register action and filter hooks
60
+ *
61
+ * @since 1.7.1
62
+ * @access private
63
+ *
64
+ * @return void
65
+ */
66
+ function setup_hooks() {
67
+ global $code_snippets;
68
+
69
+ /* add the administration menus */
70
+ add_action( 'admin_menu', array( $this, 'add_admin_menus' ), 5 );
71
+ add_action( 'network_admin_menu', array( $this, 'add_admin_menus' ), 5 );
72
+
73
+ /* register the importer */
74
+ add_action( 'admin_init', array( $this, 'load_importer' ) );
75
+ add_action( 'network_admin_menu', array( $this, 'add_import_admin_menu' ) );
76
+
77
+ /* add helpful links to the Plugins menu */
78
+ add_filter( 'plugin_action_links_' . $code_snippets->basename, array( $this, 'settings_link' ) );
79
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), 10, 2 );
80
+
81
+ /* Add a custom icon to Snippets menu pages */
82
+ add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_icon_style' ) );
83
+
84
+ /* Add the description editor to the Snippets > Add New page */
85
+ add_action( 'code_snippets_admin_single', array( $this, 'description_editor_box' ), 5 );
86
+
87
+ /* Handle saving the user's screen option preferences */
88
+ add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 10, 3 );
89
+
90
+ /* Allow super admins to control site admins access to snippet admin menus */
91
+ add_filter( 'mu_menu_items', array( $this, 'mu_menu_items') );
92
+ }
93
+
94
+ /**
95
+ * Handles saving the user's snippets per page preference
96
+ * @param unknown $status
97
+ * @param string $option
98
+ * @param unknown $value
99
+ * @return unknown
100
+ */
101
+ function set_screen_option( $status, $option, $value ) {
102
+ if ( 'snippets_per_page' === $option ) return $value;
103
+ }
104
+
105
+ /**
106
+ * Allow super admins to control site admin access to
107
+ * snippet admin menus
108
+ *
109
+ * Adds a checkbox to the *Settings > Network Settings*
110
+ * network admin menu
111
+ *
112
+ * @since 1.7.1
113
+ * @access private
114
+ *
115
+ * @param array $menu_items The current mu menu items
116
+ * @return array The modified mu menu items
117
+ */
118
+ function mu_menu_items( $menu_items ) {
119
+ $menu_items['snippets'] = __('Snippets', 'code-snippets');
120
+ return $menu_items;
121
+ }
122
+
123
+ /**
124
+ * Load the Code Snippets importer
125
+ *
126
+ * Add both an importer to the Tools menu
127
+ * and an Import Snippets page to the network admin menu
128
+ *
129
+ * @since 1.6
130
+ * @access private
131
+ *
132
+ * @return void
133
+ */
134
+ function load_importer() {
135
+
136
+ if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
137
+
138
+ // Load Importer API
139
+ require_once ABSPATH . 'wp-admin/includes/import.php';
140
+
141
+ if ( ! class_exists( 'WP_Importer' ) ) {
142
+ $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
143
+ if ( file_exists( $class_wp_importer ) )
144
+ require_once $class_wp_importer;
145
+ }
146
+
147
+ register_importer(
148
+ 'code-snippets',
149
+ __('Code Snippets', 'code-snippets'),
150
+ __('Import snippets from a <strong>Code Snippets</strong> export file', 'code-snippets'),
151
+ array( $this, 'display_import_menu' )
152
+ );
153
+ }
154
+
155
+ $this->import_url = self_admin_url( 'admin.php?import=code-snippets' );
156
+ add_action( 'load-importer-code-snippets', array( $this, 'load_import_menu' ) );
157
+ }
158
+
159
+ /**
160
+ * Add the dashboard admin menu and subpages
161
+ *
162
+ * @since 1.0
163
+ * @access private
164
+ *
165
+ * @uses add_menu_page() To register a top-level menu
166
+ * @uses add_submenu_page() To register a submenu page
167
+ * @uses apply_filters() To retrieve the current menu slug
168
+ * @uses plugins_url() To retrieve the URL to a resource
169
+ * @return void
170
+ */
171
+ function add_admin_menus() {
172
+ global $code_snippets;
173
+
174
+ /* Use a different screen icon for the MP6 interface */
175
+ if ( get_user_option( 'admin_color' ) !== 'mp6' )
176
+ $menu_icon = apply_filters( 'code_snippets_menu_icon', plugins_url( 'images/menu-icon.png', $code_snippets->file ) );
177
+ else
178
+ $menu_icon = 'div';
179
+
180
+ /* Add the top-level menu and relevant subpage */
181
+ $this->manage_page = add_menu_page(
182
+ __('Snippets', 'code-snippets'),
183
+ __('Snippets', 'code-snippets'),
184
+ is_multisite() ? 'manage_network_snippets' : 'manage_snippets',
185
+ $this->manage_slug,
186
+ array( $this, 'display_manage_menu' ),
187
+ $menu_icon,
188
+ is_network_admin() ? 21 : 67
189
+ );
190
+
191
+ add_submenu_page(
192
+ $this->manage_slug,
193
+ __('Snippets', 'code-snippets'),
194
+ __('Manage', 'code-snippets'),
195
+ $code_snippets->user_can( 'manage' ),
196
+ $this->manage_slug,
197
+ array( $this, 'display_manage_menu')
198
+ );
199
+
200
+ /* Add the Edit/Add New Snippet page */
201
+ $editing = ( isset( $_REQUEST['page'], $_REQUEST['edit'] ) && $this->single_slug === $_REQUEST['page'] );
202
+
203
+ $this->single_page = add_submenu_page(
204
+ $this->manage_slug,
205
+ $editing ? __('Edit Snippet', 'code-snippets') : __('Add New Snippet', 'code-snippets'),
206
+ $editing ? __('Edit', 'code-snippets') : __('Add New', 'code-snippets'),
207
+ $code_snippets->user_can( 'install' ),
208
+ $this->single_slug,
209
+ array( $this, 'display_single_menu' )
210
+ );
211
+
212
+ add_action( "load-$this->manage_page", array( $this, 'load_manage_menu' ) );
213
+ add_action( "load-$this->single_page", array( $this, 'load_single_menu' ) );
214
+
215
+ add_action( "load-$this->manage_page", array( $code_snippets, 'maybe_create_tables' ) );
216
+ add_action( "load-$this->single_page", array( $code_snippets, 'maybe_create_tables' ) );
217
+ }
218
+
219
+ /**
220
+ * Add an Import Snippets page to the network admin menu.
221
+ * We need to do this as there is no Tools menu in the network
222
+ * admin, and so we cannot register an importer
223
+ *
224
+ * @since 1.6
225
+ * @access private
226
+ *
227
+ * @uses add_submenu_page() To register the menu page
228
+ * @uses apply_filters() To retrieve the current menu slug
229
+ * @uses add_action() To enqueue scripts and styles
230
+ * @return void
231
+ */
232
+ function add_import_admin_menu() {
233
+ global $code_snippets;
234
+
235
+ $this->import_page = add_submenu_page(
236
+ $this->manage_slug,
237
+ __('Import Snippets', 'code-snippets'),
238
+ __('Import', 'code-snippets'),
239
+ $code_snippets->user_can( 'import' ),
240
+ 'import-code-snippets',
241
+ array( $this, 'display_import_menu' )
242
+ );
243
+
244
+ $this->import_url = self_admin_url( 'admin.php?page=import-code-snippets' );
245
+ add_action( "load-$this->import_page", array( $this, 'load_import_menu' ) );
246
+ add_action( "load-$this->import_page", array( $code_snippets, 'maybe_create_tables' ) );
247
+ }
248
+
249
+ /**
250
+ * Enqueue the icon stylesheet
251
+ *
252
+ * @since 1.0
253
+ * @access private
254
+ *
255
+ * @uses wp_enqueue_style() To add the stylesheet to the queue
256
+ *
257
+ * @return void
258
+ */
259
+ function load_admin_icon_style() {
260
+ global $code_snippets;
261
+
262
+ $stylesheet = ( 'mp6' === get_user_option( 'admin_color' ) ? 'menu-icon.mp6' : 'screen-icon');
263
+
264
+ wp_enqueue_style(
265
+ 'icon-snippets',
266
+ plugins_url( "assets/{$stylesheet}.css", $code_snippets->file ),
267
+ false,
268
+ $code_snippets->version
269
+ );
270
+ }
271
+
272
+ /**
273
+ * Initializes the list table class and loads the help tabs
274
+ * for the Manage Snippets page
275
+ *
276
+ * @since 1.0
277
+ * @access private
278
+ *
279
+ * @return void
280
+ */
281
+ function load_manage_menu() {
282
+ global $code_snippets;
283
+
284
+ /* Load the screen help tabs */
285
+ include $this->include_dir . 'help/manage.php';
286
+
287
+ /* Initialize the snippet table class */
288
+ require_once $this->include_dir . 'class-list-table.php';
289
+ $code_snippets->list_table = new Code_Snippets_List_Table();
290
+ $code_snippets->list_table->prepare_items();
291
+ }
292
+
293
+ /**
294
+ * Loads the help tabs for the Edit Snippets page
295
+ *
296
+ * @since 1.0
297
+ * @access private
298
+ *
299
+ * @uses $wpdb To save the posted snippet to the database
300
+ * @uses wp_redirect To pass the results to the page
301
+ *
302
+ * @return void
303
+ */
304
+ function load_single_menu() {
305
+ global $code_snippets;
306
+
307
+ $screen = get_current_screen();
308
+
309
+ /* Don't let the user pass if they can't edit (install check is done by WP) */
310
+ if ( isset( $_REQUEST['edit'] ) && ! $code_snippets->user_can( 'edit' ) )
311
+ wp_die( __("Sorry, you're not allowed to edit snippets", 'code-snippets') );
312
+
313
+ /* Save the snippet if one has been submitted */
314
+ if ( isset( $_REQUEST['save_snippet'] ) || isset( $_REQUEST['save_snippet_activate'] ) ) {
315
+
316
+ /* Set the snippet to active if we used the 'Save Changed & Activate' button */
317
+ if ( isset( $_REQUEST['save_snippet_activate'] ) )
318
+ $_POST['snippet_active'] = 1;
319
+
320
+ /* Save the snippet to the database */
321
+ $result = $code_snippets->save_snippet( $_POST );
322
+
323
+ /* Strip old status query vars from URL */
324
+ $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'added', 'updated', 'activated', 'invalid' ) );
325
+
326
+ /* Build the status message and redirect */
327
+
328
+ if ( isset( $_REQUEST['save_snippet_activate'] ) && $result ) {
329
+ /* Snippet was activated */
330
+ $_SERVER['REQUEST_URI'] = add_query_arg( 'activated', true );
331
+ }
332
+
333
+ if ( ! $result || $result < 1 ) {
334
+ /* An error occurred */
335
+ wp_redirect( add_query_arg( 'invalid', true ) );
336
+ }
337
+ elseif ( isset( $_REQUEST['snippet_id'] ) ) {
338
+ /* Existing snippet was updated */
339
+ wp_redirect( add_query_arg( array( 'edit' => $result, 'updated' => true ) ) );
340
+ }
341
+ else {
342
+ /* New snippet was added */
343
+ wp_redirect( add_query_arg( array( 'edit' => $result, 'added' => true ) ) );
344
+ }
345
+ }
346
+
347
+ /* Load the screen help tabs */
348
+ include $this->include_dir . 'help/single.php';
349
+
350
+ /* Enqueue the code editor and other scripts and styles */
351
+ add_filter( 'admin_enqueue_scripts', array( $this, 'single_menu_enqueue_scripts' ) );
352
+ }
353
+
354
+ /**
355
+ * Registers and loads the code editor's scripts
356
+ *
357
+ * @since 1.7
358
+ * @access private
359
+ *
360
+ * @uses wp_register_script()
361
+ * @uses wp_register_style()
362
+ * @uses wp_enqueue_script() To add the scripts to the queue
363
+ * @uses wp_enqueue_style() To add the stylesheets to the queue
364
+ *
365
+ * @param string $hook The current page hook, to be compared with the single snippet page hook
366
+ *
367
+ * @return void
368
+ */
369
+ function single_menu_enqueue_scripts( $hook ) {
370
+ global $code_snippets;
371
+
372
+ /* If we're not on the right admin page, bail early */
373
+ if ( $hook !== $this->single_page )
374
+ return;
375
+
376
+ /* CodeMirror package version */
377
+ $codemirror_version = '3.11';
378
+
379
+ /* CodeMirror base framework */
380
+
381
+ wp_register_script(
382
+ 'codemirror',
383
+ plugins_url( 'assets/codemirror/lib/codemirror.js', $code_snippets->file ),
384
+ false,
385
+ $codemirror_version
386
+ );
387
+
388
+ wp_register_style(
389
+ 'codemirror',
390
+ plugins_url( 'assets/codemirror/lib/codemirror.css', $code_snippets->file ),
391
+ false,
392
+ $codemirror_version
393
+ );
394
+
395
+ /* CodeMirror modes */
396
+
397
+ $modes = array( 'php', 'clike' );
398
+
399
+ foreach ( $modes as $mode ) {
400
+
401
+ wp_register_script(
402
+ "codemirror-mode-$mode",
403
+ plugins_url( "assets/codemirror/mode/$mode.js", $code_snippets->file ),
404
+ array( 'codemirror' ),
405
+ $codemirror_version
406
+ );
407
+ }
408
+
409
+ /* CodeMirror addons */
410
+
411
+ $addons = array( 'dialog', 'searchcursor', 'search', 'matchbrackets' );
412
+
413
+ foreach ( $addons as $addon ) {
414
+
415
+ wp_register_script(
416
+ "codemirror-addon-$addon",
417
+ plugins_url( "assets/codemirror/addon/$addon.js", $code_snippets->file ),
418
+ array( 'codemirror' ),
419
+ $codemirror_version
420
+ );
421
+ }
422
+
423
+ wp_register_style(
424
+ 'codemirror-addon-dialog',
425
+ plugins_url( 'assets/codemirror/addon/dialog.css', $code_snippets->file ),
426
+ array( 'codemirror' ),
427
+ $codemirror_version
428
+ );
429
+
430
+ /* Enqueue the registered scripts */
431
+ wp_enqueue_script( array(
432
+ 'codemirror-addon-matchbrackets',
433
+ 'codemirror-mode-clike',
434
+ 'codemirror-mode-php',
435
+ 'codemirror-addon-search',
436
+ ) );
437
+
438
+ /* Enqueue the registered stylesheets */
439
+ wp_enqueue_style( array(
440
+ 'codemirror',
441
+ 'codemirror-addon-dialog',
442
+ ) );
443
+
444
+ /* Enqueue custom styling */
445
+ wp_enqueue_style(
446
+ 'code-snippets-admin-single',
447
+ plugins_url( 'assets/admin-single.css', $code_snippets->file ),
448
+ false,
449
+ $code_snippets->version
450
+ );
451
+ }
452
+
453
+ /**
454
+ * Processes import files and loads the help tabs for the Import Snippets page
455
+ *
456
+ * @since 1.3
457
+ *
458
+ * @uses $code_snippets->import() To process the import file
459
+ * @uses wp_redirect() To pass the import results to the page
460
+ * @uses add_query_arg() To append the results to the current URI
461
+ *
462
+ * @return void
463
+ */
464
+ function load_import_menu() {
465
+ global $code_snippets;
466
+
467
+ /* Process import files */
468
+ if ( isset( $_FILES['code_snippets_import_file']['tmp_name'] ) ) {
469
+ $count = $code_snippets->import( $_FILES['code_snippets_import_file']['tmp_name'] );
470
+ if ( $count ) {
471
+ wp_redirect( add_query_arg( 'imported', $count ) );
472
+ }
473
+ }
474
+
475
+ /* Load the screen help tabs */
476
+ require_once $this->include_dir . 'help/import.php';
477
+ }
478
+
479
+ /**
480
+ * Displays the manage snippets page
481
+ *
482
+ * @since 1.0
483
+ * @access private
484
+ *
485
+ * @return void
486
+ */
487
+ function display_manage_menu() {
488
+ require_once $this->include_dir . 'admin/manage.php';
489
+ }
490
+
491
+ /**
492
+ * Displays the single snippet page
493
+ *
494
+ * @since 1.0
495
+ * @access private
496
+ *
497
+ * @return void
498
+ */
499
+ function display_single_menu() {
500
+ require_once $this->include_dir . 'admin/single.php';
501
+ }
502
+
503
+ /**
504
+ * Displays the import snippets page
505
+ *
506
+ * @since 1.3
507
+ * @access private
508
+ *
509
+ * @return void
510
+ */
511
+ function display_import_menu() {
512
+ require_once $this->include_dir . 'admin/import.php';
513
+ }
514
+
515
+ /**
516
+ * Add a description editor to the single snippet page
517
+ *
518
+ * @since 1.7
519
+ * @access private
520
+ *
521
+ * @param object $snippet The snippet being used for this page
522
+ */
523
+ function description_editor_box( $snippet ) {
524
+ ?>
525
+
526
+ <label for="snippet_description">
527
+ <h3><div style="position: absolute;"><?php _e('Description', 'code-snippets');
528
+ ?> <span style="font-weight: normal;"><?php esc_html_e('(Optional)', 'code-snippets'); ?></span></div></h3>
529
+ </label>
530
+
531
+ <?php
532
+
533
+ remove_editor_styles(); // stop custom theme styling interfering with the editor
534
+
535
+ wp_editor(
536
+ $snippet->description,
537
+ 'description',
538
+ apply_filters( 'code_snippets_description_editor_settings', array(
539
+ 'textarea_name' => 'snippet_description',
540
+ 'textarea_rows' => 10,
541
+ 'teeny' => true,
542
+ 'media_buttons' => false,
543
+ ) )
544
+ );
545
+ }
546
+
547
+ /**
548
+ * Adds a link pointing to the Manage Snippets page
549
+ *
550
+ * @since 1.0
551
+ * @access private
552
+ *
553
+ * @param array $links The existing plugin action links
554
+ * @return array The modified plugin action links
555
+ */
556
+ function settings_link( $links ) {
557
+ array_unshift( $links, sprintf(
558
+ '<a href="%1$s" title="%2$s">%3$s</a>',
559
+ $this->manage_url,
560
+ __('Manage your existing snippets', 'code-snippets'),
561
+ __('Manage', 'code-snippets')
562
+ ) );
563
+ return $links;
564
+ }
565
+
566
+ /**
567
+ * Adds extra links related to the plugin
568
+ *
569
+ * @since 1.2
570
+ * @access private
571
+ *
572
+ * @param array $links The existing plugin info links
573
+ * @param string $file The plugin the links are for
574
+ * @return array The modified plugin info links
575
+ */
576
+ function plugin_meta( $links, $file ) {
577
+ global $code_snippets;
578
+
579
+ /* We only want to affect the Code Snippets plugin listing */
580
+ if ( $file !== $code_snippets->basename ) return $links;
581
+
582
+ $format = '<a href="%1$s" title="%2$s">%3$s</a>';
583
+
584
+ /* array_merge appends the links to the end */
585
+ return array_merge( $links, array(
586
+ sprintf( $format,
587
+ 'http://wordpress.org/extend/plugins/code-snippets/',
588
+ __('Visit the WordPress.org plugin page', 'code-snippets'),
589
+ __('About', 'code-snippets')
590
+ ),
591
+ sprintf( $format,
592
+ 'http://wordpress.org/support/plugin/code-snippets/',
593
+ __('Visit the support forums', 'code-snippets'),
594
+ __('Support', 'code-snippets')
595
+ ),
596
+ sprintf( $format,
597
+ 'http://code-snippets.bungeshea.com/donate/',
598
+ __("Support this plugin's development", 'code-snippets'),
599
+ __('Donate', 'code-snippets')
600
+ )
601
+ ) );
602
+ }
603
+
604
+ }
includes/class-list-table.php CHANGED
@@ -1,18 +1,30 @@
1
  <?php
2
 
 
 
 
 
 
 
 
3
  if ( ! class_exists( 'WP_List_Table' ) ) {
4
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
5
  }
6
 
7
  /**
8
- * Code Snippets List Table class.
9
  *
10
- * @package Code Snippets
11
  * @since 1.5
 
12
  * @access private
13
  */
14
  class Code_Snippets_List_Table extends WP_List_Table {
15
 
 
 
 
 
 
16
  /**
17
  * The constructor function for our class
18
  *
@@ -53,17 +65,16 @@ class Code_Snippets_List_Table extends WP_List_Table {
53
  /**
54
  * Enqueue the table stylesheet
55
  *
56
- * @since Code Snippets 1.6
57
- * @access private
58
  *
59
  * @uses wp_enqueue_style() To add the stylesheet to the queue
60
  *
61
- * @return void
62
  */
63
  function load_table_style( $hook ) {
64
  global $code_snippets;
65
 
66
- if ( $hook !== $code_snippets->admin_manage )
67
  return;
68
 
69
  if ( 'mp6' === get_user_option( 'admin_color' ) ) {
@@ -86,7 +97,17 @@ class Code_Snippets_List_Table extends WP_List_Table {
86
  }
87
  }
88
 
89
- function format_description( $desc ) {
 
 
 
 
 
 
 
 
 
 
90
  $desc = wptexturize( $desc );
91
  $desc = convert_smilies( $desc );
92
  $desc = convert_chars( $desc );
@@ -96,6 +117,13 @@ class Code_Snippets_List_Table extends WP_List_Table {
96
  return $desc;
97
  }
98
 
 
 
 
 
 
 
 
99
  function column_default( $snippet, $column_name ) {
100
 
101
  switch( $column_name ) {
@@ -111,50 +139,58 @@ class Code_Snippets_List_Table extends WP_List_Table {
111
  }
112
  }
113
 
 
 
 
 
 
114
  function column_name( $snippet ) {
115
  global $code_snippets;
 
 
 
 
116
  $screen = get_current_screen();
117
- $actions = array(); // Build row actions
118
 
119
  if ( $snippet->active ) {
120
  $actions['deactivate'] = sprintf(
121
- '<a href="%1$s">%2$s</a>',
 
122
  add_query_arg( array(
123
- 'page' => $_REQUEST['page'],
124
  'action' => 'deactivate',
125
  'id' => $snippet->id
126
- ) ),
127
- $screen->is_network ? __('Network Deactivate', 'code-snippets') : __('Deactivate', 'code-snippets')
128
  );
129
  } else {
130
  $actions['activate'] = sprintf(
131
- '<a href="%1$s">%2$s</a>',
 
132
  add_query_arg( array(
133
- 'page' => $_REQUEST['page'],
134
  'action' => 'activate',
135
  'id' => $snippet->id
136
- ) ),
137
- $screen->is_network ? __('Network Activate', 'code-snippets') : __('Activate', 'code-snippets')
138
  );
139
  }
140
 
141
  $actions['edit'] = sprintf(
142
- '<a href="%s&edit=%s">Edit</a>',
143
- $code_snippets->admin_single_url,
144
- $snippet->id
145
  );
 
146
  $actions['export'] = sprintf(
147
- '<a href="%s">Export</a>',
 
148
  add_query_arg( array(
149
- 'page' => $_REQUEST['page'],
150
  'action' => 'export',
151
  'id' => $snippet->id
152
  ) )
153
  );
 
154
  $actions['delete'] = sprintf(
155
- '<a href="%1$s" class="delete" onclick="%2$s">Delete</a>',
 
156
  add_query_arg( array(
157
- 'page' => $_REQUEST['page'],
158
  'action' => 'delete',
159
  'id' => $snippet->id
160
  ) ),
@@ -173,6 +209,11 @@ class Code_Snippets_List_Table extends WP_List_Table {
173
  );
174
  }
175
 
 
 
 
 
 
176
  function column_cb( $snippet ) {
177
  return apply_filters(
178
  'code_snippets_list_table_column_cb',
@@ -181,6 +222,10 @@ class Code_Snippets_List_Table extends WP_List_Table {
181
  );
182
  }
183
 
 
 
 
 
184
  function get_columns() {
185
  $columns = array(
186
  'cb' => '<input type="checkbox" />',
@@ -191,6 +236,10 @@ class Code_Snippets_List_Table extends WP_List_Table {
191
  return apply_filters( 'code_snippets_list_table_columns', $columns );
192
  }
193
 
 
 
 
 
194
  function get_sortable_columns() {
195
  $sortable_columns = array(
196
  'id' => array( 'id', true ),
@@ -199,6 +248,11 @@ class Code_Snippets_List_Table extends WP_List_Table {
199
  return apply_filters( 'code_snippets_list_table_sortable_columns', $sortable_columns );
200
  }
201
 
 
 
 
 
 
202
  function get_default_hidden_columns( $result ) {
203
  if ( ! $result )
204
  return array( 'id' );
@@ -206,6 +260,10 @@ class Code_Snippets_List_Table extends WP_List_Table {
206
  return $result;
207
  }
208
 
 
 
 
 
209
  function get_bulk_actions() {
210
  $screen = get_current_screen();
211
  $actions = array(
@@ -218,11 +276,26 @@ class Code_Snippets_List_Table extends WP_List_Table {
218
  return apply_filters( 'code_snippets_bulk_actions', $actions );
219
  }
220
 
 
 
 
 
 
 
 
 
221
  function get_table_classes() {
222
  $classes = array( 'widefat', $this->_args['plural'] );
223
  return apply_filters( 'code_snippets_table_classes', $classes );
224
  }
225
 
 
 
 
 
 
 
 
226
  function get_views() {
227
  global $totals, $status;
228
 
@@ -257,6 +330,10 @@ class Code_Snippets_List_Table extends WP_List_Table {
257
  return apply_filters( 'code_snippets_list_table_views', $status_links );
258
  }
259
 
 
 
 
 
260
  function extra_tablenav( $which ) {
261
  global $status, $code_snippets;
262
 
@@ -283,6 +360,12 @@ class Code_Snippets_List_Table extends WP_List_Table {
283
  echo '</div>';
284
  }
285
 
 
 
 
 
 
 
286
  function required_form_fields( $context = 'main' ) {
287
 
288
  $vars = apply_filters( 'code_snippets_list_table_required_form_fields', array( 'page', 's', 'status', 'paged' ), $context );
@@ -303,6 +386,10 @@ class Code_Snippets_List_Table extends WP_List_Table {
303
  }
304
 
305
 
 
 
 
 
306
  function current_action() {
307
  if ( isset( $_POST['clear-recent-list'] ) )
308
  $action = 'clear-recent-list';
@@ -324,7 +411,41 @@ class Code_Snippets_List_Table extends WP_List_Table {
324
  function process_bulk_actions() {
325
  global $code_snippets;
326
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  if ( ! isset( $_POST['ids'] ) ) return;
 
328
  $ids = $_POST['ids'];
329
 
330
  $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'activate', 'deactivate', 'delete', 'activate-multi', 'deactivate-multi', 'delete-multi' ) );
@@ -438,7 +559,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
438
 
439
  $data = $snippets[ $status ];
440
 
441
- /**
442
  * First, lets decide how many records per page to show
443
  * by getting the user's setting in the Screen Options
444
  * panel.
@@ -458,6 +579,8 @@ class Code_Snippets_List_Table extends WP_List_Table {
458
 
459
  /**
460
  * This checks for sorting input and sorts the data in our array accordingly.
 
 
461
  */
462
  function usort_reorder( $a, $b ) {
463
 
@@ -515,6 +638,10 @@ class Code_Snippets_List_Table extends WP_List_Table {
515
  ) );
516
  }
517
 
 
 
 
 
518
  function _search_callback( $snippet ) {
519
  static $term;
520
  if ( is_null( $term ) )
@@ -535,13 +662,19 @@ class Code_Snippets_List_Table extends WP_List_Table {
535
  return false;
536
  }
537
 
538
- function search_notice() {
 
 
 
 
 
 
539
  if ( ! empty( $_REQUEST['s'] ) || apply_filters( 'code_snippets_list_table_search_notice', '' ) ) {
540
 
541
  echo '<span class="subtitle">' . __('Search results', 'code-snippets');
542
 
543
  if ( ! empty ( $_REQUEST['s'] ) )
544
- echo sprintf ( __(' for &#8220;%s&#8221;'), esc_html( $_REQUEST['s'] ) );
545
 
546
  echo apply_filters( 'code_snippets_list_table_search_notice', '' );
547
  echo '</span>';
@@ -554,7 +687,8 @@ class Code_Snippets_List_Table extends WP_List_Table {
554
  }
555
 
556
  /**
557
- * Generates content for a single row of the table
 
558
  */
559
  function single_row( $snippet ) {
560
  static $row_class = '';
@@ -564,4 +698,4 @@ class Code_Snippets_List_Table extends WP_List_Table {
564
  echo $this->single_row_columns( $snippet );
565
  echo '</tr>';
566
  }
567
- }
1
  <?php
2
 
3
+ /**
4
+ * Contains the class for handling the administration interface
5
+ *
6
+ * @package Code Snippets
7
+ * @subpackage Administration
8
+ */
9
+
10
  if ( ! class_exists( 'WP_List_Table' ) ) {
11
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
12
  }
13
 
14
  /**
15
+ * This class handles the table for the manage snippets menu
16
  *
 
17
  * @since 1.5
18
+ * @package Code Snippets
19
  * @access private
20
  */
21
  class Code_Snippets_List_Table extends WP_List_Table {
22
 
23
+ /**#@+
24
+ * @since 1.5
25
+ * @access private
26
+ */
27
+
28
  /**
29
  * The constructor function for our class
30
  *
65
  /**
66
  * Enqueue the table stylesheet
67
  *
68
+ * @since 1.6
 
69
  *
70
  * @uses wp_enqueue_style() To add the stylesheet to the queue
71
  *
72
+ * @param string $hook The current page hook, to be compared with the manage snippets page hook
73
  */
74
  function load_table_style( $hook ) {
75
  global $code_snippets;
76
 
77
+ if ( $hook !== $code_snippets->admin->manage_page )
78
  return;
79
 
80
  if ( 'mp6' === get_user_option( 'admin_color' ) ) {
97
  }
98
  }
99
 
100
+ /**
101
+ * Formats the snippet description
102
+ * in the same way the post content is formatted
103
+ *
104
+ * @since 1.7
105
+ * @access public
106
+ *
107
+ * @param string $desc The snippet description to format
108
+ * @return string The formatted snippet description
109
+ */
110
+ public function format_description( $desc ) {
111
  $desc = wptexturize( $desc );
112
  $desc = convert_smilies( $desc );
113
  $desc = convert_chars( $desc );
117
  return $desc;
118
  }
119
 
120
+ /**
121
+ * Define the output of all columns
122
+ * that have no callback function
123
+ * @param object $snippet The snippet object used for the current row
124
+ * @param string $column_name The name of the column being printed
125
+ * @return string The content of the column to output
126
+ */
127
  function column_default( $snippet, $column_name ) {
128
 
129
  switch( $column_name ) {
139
  }
140
  }
141
 
142
+ /**
143
+ * Builds content of the snippet name column
144
+ * @param object $snippet The snippet object being used for the current row
145
+ * @return string The content of the column to output
146
+ */
147
  function column_name( $snippet ) {
148
  global $code_snippets;
149
+
150
+ /* Build row actions */
151
+
152
+ $actions = array();
153
  $screen = get_current_screen();
 
154
 
155
  if ( $snippet->active ) {
156
  $actions['deactivate'] = sprintf(
157
+ '<a href="%2$s">%1$s</a>',
158
+ $screen->is_network ? __('Network Deactivate', 'code-snippets') : __('Deactivate', 'code-snippets'),
159
  add_query_arg( array(
 
160
  'action' => 'deactivate',
161
  'id' => $snippet->id
162
+ ) )
 
163
  );
164
  } else {
165
  $actions['activate'] = sprintf(
166
+ '<a href="%2$s">%1$s</a>',
167
+ $screen->is_network ? __('Network Activate', 'code-snippets') : __('Activate', 'code-snippets'),
168
  add_query_arg( array(
 
169
  'action' => 'activate',
170
  'id' => $snippet->id
171
+ ) )
 
172
  );
173
  }
174
 
175
  $actions['edit'] = sprintf(
176
+ '<a href="%2$s">%1$s</a>',
177
+ __( 'Edit', 'code-snippets' ),
178
+ add_query_arg( 'edit', $snippet->id, $code_snippets->admin_single_url )
179
  );
180
+
181
  $actions['export'] = sprintf(
182
+ '<a href="%2$s">%1$s</a>',
183
+ __( 'Export', 'code-snippets' ),
184
  add_query_arg( array(
 
185
  'action' => 'export',
186
  'id' => $snippet->id
187
  ) )
188
  );
189
+
190
  $actions['delete'] = sprintf(
191
+ '<a href="%2$s" class="delete" onclick="%3$s">%1$s</a>',
192
+ __( 'Delete', 'code-snippets' ),
193
  add_query_arg( array(
 
194
  'action' => 'delete',
195
  'id' => $snippet->id
196
  ) ),
209
  );
210
  }
211
 
212
+ /**
213
+ * Builds the checkbox column content
214
+ * @param object $snippet The snippet object being used for the current row
215
+ * @return string The column content to be printed
216
+ */
217
  function column_cb( $snippet ) {
218
  return apply_filters(
219
  'code_snippets_list_table_column_cb',
222
  );
223
  }
224
 
225
+ /**
226
+ * Define the column headers for the table
227
+ * @return array The column headers, ID paired with label
228
+ */
229
  function get_columns() {
230
  $columns = array(
231
  'cb' => '<input type="checkbox" />',
236
  return apply_filters( 'code_snippets_list_table_columns', $columns );
237
  }
238
 
239
+ /**
240
+ * Define the columns that can be sorted
241
+ * @return array The IDs of the columns that can be sorted
242
+ */
243
  function get_sortable_columns() {
244
  $sortable_columns = array(
245
  'id' => array( 'id', true ),
248
  return apply_filters( 'code_snippets_list_table_sortable_columns', $sortable_columns );
249
  }
250
 
251
+ /**
252
+ * Define the columns that are hidden by default
253
+ * @param unknown $result
254
+ * @return unknown
255
+ */
256
  function get_default_hidden_columns( $result ) {
257
  if ( ! $result )
258
  return array( 'id' );
260
  return $result;
261
  }
262
 
263
+ /**
264
+ * Define the bulk actions to include in the drop-down menus
265
+ * @return array An array of menu items with the ID paired to the label
266
+ */
267
  function get_bulk_actions() {
268
  $screen = get_current_screen();
269
  $actions = array(
276
  return apply_filters( 'code_snippets_bulk_actions', $actions );
277
  }
278
 
279
+ /**
280
+ * Retrieve the classes for the table
281
+ *
282
+ * We override this in order to add 'snippets' as a class
283
+ * for custom styling
284
+ *
285
+ * @return array The classes to include on the table element
286
+ */
287
  function get_table_classes() {
288
  $classes = array( 'widefat', $this->_args['plural'] );
289
  return apply_filters( 'code_snippets_table_classes', $classes );
290
  }
291
 
292
+ /**
293
+ * Retrieve the 'views' of the table
294
+ *
295
+ * Example: active, inactive, recently active
296
+ *
297
+ * @return array A list of the view labels linked to the view
298
+ */
299
  function get_views() {
300
  global $totals, $status;
301
 
330
  return apply_filters( 'code_snippets_list_table_views', $status_links );
331
  }
332
 
333
+ /**
334
+ * Add filters and extra actions above and below the table
335
+ * @param string $which Are the actions displayed on the table top or bottom
336
+ */
337
  function extra_tablenav( $which ) {
338
  global $status, $code_snippets;
339
 
360
  echo '</div>';
361
  }
362
 
363
+ /**
364
+ * Output form fields needed to preserve important
365
+ * query vars over form submissions
366
+ *
367
+ * @param string $context In what context are the fields being outputted?
368
+ */
369
  function required_form_fields( $context = 'main' ) {
370
 
371
  $vars = apply_filters( 'code_snippets_list_table_required_form_fields', array( 'page', 's', 'status', 'paged' ), $context );
386
  }
387
 
388
 
389
+ /**
390
+ * Clear the recently activated snippets list if we've clicked the button
391
+ * @return string The action to execute
392
+ */
393
  function current_action() {
394
  if ( isset( $_POST['clear-recent-list'] ) )
395
  $action = 'clear-recent-list';
411
  function process_bulk_actions() {
412
  global $code_snippets;
413
 
414
+ if ( isset( $_GET['action'], $_GET['id'] ) ) :
415
+
416
+ $id = intval( $_GET['id'] );
417
+
418
+ $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'action', 'id' ) );
419
+
420
+ $action = sanitize_key( $_GET['action'] );
421
+
422
+ if ( 'activate' === $action ) {
423
+ $code_snippets->activate( $id );
424
+ }
425
+ elseif ( 'deactivate' === $action ) {
426
+ $code_snippets->deactivate( $id );
427
+ }
428
+ elseif ( 'delete' === $action ) {
429
+ $code_snippets->delete_snippet( $id );
430
+ }
431
+ elseif ( 'export' === $action ) {
432
+ $code_snippets->export( $id );
433
+ }
434
+ elseif ( 'export-php' === $action ) {
435
+ $code_snippets->export_php( $id );
436
+ }
437
+
438
+ if ( 'export' !== $action || 'export-php' !== $action ) {
439
+ wp_redirect( apply_filters(
440
+ "code_snippets_{$action}_redirect",
441
+ add_query_arg( $action, true )
442
+ ) );
443
+ }
444
+
445
+ endif;
446
+
447
  if ( ! isset( $_POST['ids'] ) ) return;
448
+
449
  $ids = $_POST['ids'];
450
 
451
  $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'activate', 'deactivate', 'delete', 'activate-multi', 'deactivate-multi', 'delete-multi' ) );
559
 
560
  $data = $snippets[ $status ];
561
 
562
+ /*
563
  * First, lets decide how many records per page to show
564
  * by getting the user's setting in the Screen Options
565
  * panel.
579
 
580
  /**
581
  * This checks for sorting input and sorts the data in our array accordingly.
582
+ *
583
+ * @ignore
584
  */
585
  function usort_reorder( $a, $b ) {
586
 
638
  ) );
639
  }
640
 
641
+ /**
642
+ * Used internally
643
+ * @ignore
644
+ */
645
  function _search_callback( $snippet ) {
646
  static $term;
647
  if ( is_null( $term ) )
662
  return false;
663
  }
664
 
665
+ /**
666
+ * Display a notice showing the current search terms
667
+ *
668
+ * @since 1.7
669
+ * @access public
670
+ */
671
+ public function search_notice() {
672
  if ( ! empty( $_REQUEST['s'] ) || apply_filters( 'code_snippets_list_table_search_notice', '' ) ) {
673
 
674
  echo '<span class="subtitle">' . __('Search results', 'code-snippets');
675
 
676
  if ( ! empty ( $_REQUEST['s'] ) )
677
+ echo sprintf ( __( ' for &#8220;%s&#8221;', 'code-snippets' ), esc_html( $_REQUEST['s'] ) );
678
 
679
  echo apply_filters( 'code_snippets_list_table_search_notice', '' );
680
  echo '</span>';
687
  }
688
 
689
  /**
690
+ * Outputs content for a single row of the table
691
+ * @param object $snippet The snippet being used for the current row
692
  */
693
  function single_row( $snippet ) {
694
  static $row_class = '';
698
  echo $this->single_row_columns( $snippet );
699
  echo '</tr>';
700
  }
701
+ }
includes/export.php CHANGED
@@ -7,17 +7,16 @@
7
  * and $code_snippets->export_php() methods then
8
  * directly use those in this file
9
  *
10
- * @package Code Snippets
11
- * @subpackage Export
12
  */
13
 
14
  if ( ! function_exists( 'code_snippets_export' ) ) :
15
 
16
  /**
17
- * Exports seleted snippets to a XML or PHP file.
18
  *
19
- * @package Code Snippets
20
- * @since Code Snippets 1.3
21
  *
22
  * @param array $ids The IDs of the snippets to export
23
  * @param string $format The format of the export file
@@ -143,4 +142,4 @@ function code_snippets_export( $ids, $format = 'xml' ) {
143
  exit;
144
  }
145
 
146
- endif; // function exists check
7
  * and $code_snippets->export_php() methods then
8
  * directly use those in this file
9
  *
10
+ * @package Code Snippets
11
+ * @subpackage Main
12
  */
13
 
14
  if ( ! function_exists( 'code_snippets_export' ) ) :
15
 
16
  /**
17
+ * Exports selected snippets to a XML or PHP file.
18
  *
19
+ * @since 1.3
 
20
  *
21
  * @param array $ids The IDs of the snippets to export
22
  * @param string $format The format of the export file
142
  exit;
143
  }
144
 
145
+ endif; // function exists check
includes/help/import.php CHANGED
@@ -1,5 +1,16 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
  $screen = get_current_screen();
 
3
  $screen->add_help_tab( array(
4
  'id' => 'overview',
5
  'title' => __('Overview', 'code-snippets'),
@@ -12,14 +23,14 @@ $screen->add_help_tab( array(
12
  'title' => __('Importing', 'code-snippets'),
13
  'content' =>
14
  '<p>' . __('You can load your snippets from a code snippets (.xml) export file using this page.', 'code-snippets') .
15
- sprintf( __('Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href="%s">Manage Snippets</a> page.</p>', 'code-snippets'), $this->admin_manage_url ) . '</p>'
16
  ) );
17
 
18
  $screen->add_help_tab( array(
19
  'id' => 'export',
20
- 'title' => __('Exporting'),
21
  'content' =>
22
- '<p>' . sprintf( __('You can save your snippets to a Code Snippets (.xml) export file using the <a href="%s">Manage Snippets</a> page.', 'code-snippets'), $this->admin_manage_url ) . '</p>'
23
  ) );
24
 
25
  $screen->set_help_sidebar(
1
  <?php
2
+
3
+ /**
4
+ * Register and handle the help tabs for the
5
+ * import snippets admin page
6
+ *
7
+ * @package Code Snippets
8
+ * @subpackage Help
9
+ */
10
+
11
+ global $code_snippets;
12
  $screen = get_current_screen();
13
+
14
  $screen->add_help_tab( array(
15
  'id' => 'overview',
16
  'title' => __('Overview', 'code-snippets'),
23
  'title' => __('Importing', 'code-snippets'),
24
  'content' =>
25
  '<p>' . __('You can load your snippets from a code snippets (.xml) export file using this page.', 'code-snippets') .
26
+ sprintf( __('Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href="%s">Manage Snippets</a> page.</p>', 'code-snippets'), $code_snippets->admin->manage_url ) . '</p>'
27
  ) );
28
 
29
  $screen->add_help_tab( array(
30
  'id' => 'export',
31
+ 'title' => __( 'Exporting', 'code-snippets' ),
32
  'content' =>
33
+ '<p>' . sprintf( __('You can save your snippets to a Code Snippets (.xml) export file using the <a href="%s">Manage Snippets</a> page.', 'code-snippets'), $code_snippets->admin->manage_url ) . '</p>'
34
  ) );
35
 
36
  $screen->set_help_sidebar(
includes/help/manage.php CHANGED
@@ -1,5 +1,16 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
  $screen = get_current_screen();
 
3
  $screen->add_help_tab( array(
4
  'id' => 'overview',
5
  'title' => __('Overview', 'code-snippets'),
@@ -19,7 +30,7 @@ $screen->add_help_tab( array(
19
  'id' => 'uninstall',
20
  'title' => __('Uninstall', 'code-snippets'),
21
  'content' =>
22
- '<p>' . sprintf( __('When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>%1$s</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>%2$s</code> folder using FTP.', 'code-snippets'), $this->table, $this->plugin_dir ) .
23
  '<p>' . __("Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets.", 'code-snippets') . '</p>'
24
  ) );
25
 
@@ -28,4 +39,4 @@ $screen->set_help_sidebar(
28
  '<p>' . __('<a href="http://wordpress.org/extend/plugins/code-snippets" target="_blank">WordPress Extend</a></p>', 'code-snippets') . '</p>' .
29
  '<p>' . __('<a href="http://wordpress.org/support/plugin/code-snippets" target="_blank">Support Forums</a>', 'code-snippets') . '</p>' .
30
  '<p>' . __('<a href="http://code-snippets.bungeshea.com/" target="_blank">Project Website</a>', 'code-snippets') . '</p>'
31
- );
1
  <?php
2
+
3
+ /**
4
+ * Register and handle the help tabs for the
5
+ * manage snippets admin page
6
+ *
7
+ * @package Code Snippets
8
+ * @subpackage Help
9
+ */
10
+
11
+ global $code_snippets;
12
  $screen = get_current_screen();
13
+
14
  $screen->add_help_tab( array(
15
  'id' => 'overview',
16
  'title' => __('Overview', 'code-snippets'),
30
  'id' => 'uninstall',
31
  'title' => __('Uninstall', 'code-snippets'),
32
  'content' =>
33
+ '<p>' . sprintf( __('When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>%1$s</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>%2$s</code> folder using FTP.', 'code-snippets'), $code_snippets->get_table_name(), $code_snippets->plugin_dir ) .
34
  '<p>' . __("Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets.", 'code-snippets') . '</p>'
35
  ) );
36
 
39
  '<p>' . __('<a href="http://wordpress.org/extend/plugins/code-snippets" target="_blank">WordPress Extend</a></p>', 'code-snippets') . '</p>' .
40
  '<p>' . __('<a href="http://wordpress.org/support/plugin/code-snippets" target="_blank">Support Forums</a>', 'code-snippets') . '</p>' .
41
  '<p>' . __('<a href="http://code-snippets.bungeshea.com/" target="_blank">Project Website</a>', 'code-snippets') . '</p>'
42
+ );
includes/help/single.php CHANGED
@@ -1,11 +1,22 @@
1
  <?php
 
 
 
 
 
 
 
 
 
2
  $screen = get_current_screen();
 
3
  $screen->add_help_tab( array(
4
  'id' => 'overview',
5
  'title' => __('Overview', 'code-snippets'),
6
  'content' =>
7
  '<p>' . __('Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can add a new snippet, or edit an existing one.', 'code-snippets') . '</p>',
8
  ) );
 
9
  $screen->add_help_tab( array(
10
  'id' => 'finding',
11
  'title' => __('Finding Snippets', 'code-snippets'),
@@ -19,6 +30,7 @@ $screen->add_help_tab( array(
19
  </ul>', 'code-snippets') .
20
  __('More places to find snippets, as well as a selection of example snippets, can be found in the <a href="http://code-snippets.bungeshea.com/docs/finding-snippets/">plugin documentation</a>', 'code-snippets') . '</p>'
21
  ) );
 
22
  $screen->add_help_tab( array(
23
  'id' => 'adding',
24
  'title' => __('Adding Snippets', 'code-snippets'),
1
  <?php
2
+
3
+ /**
4
+ * Register and handle the help tabs for the
5
+ * single snippet admin page
6
+ *
7
+ * @package Code Snippets
8
+ * @subpackage Help
9
+ */
10
+
11
  $screen = get_current_screen();
12
+
13
  $screen->add_help_tab( array(
14
  'id' => 'overview',
15
  'title' => __('Overview', 'code-snippets'),
16
  'content' =>
17
  '<p>' . __('Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can add a new snippet, or edit an existing one.', 'code-snippets') . '</p>',
18
  ) );
19
+
20
  $screen->add_help_tab( array(
21
  'id' => 'finding',
22
  'title' => __('Finding Snippets', 'code-snippets'),
30
  </ul>', 'code-snippets') .
31
  __('More places to find snippets, as well as a selection of example snippets, can be found in the <a href="http://code-snippets.bungeshea.com/docs/finding-snippets/">plugin documentation</a>', 'code-snippets') . '</p>'
32
  ) );
33
+
34
  $screen->add_help_tab( array(
35
  'id' => 'adding',
36
  'title' => __('Adding Snippets', 'code-snippets'),
languages/code-snippets-de_DE.mo ADDED
Binary file
languages/code-snippets-de_DE.po ADDED
@@ -0,0 +1,581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This German Language File: Copyright (C) 2013 by David Decker of deckerweb.de & genesisthemes.de
2
+ # This file is distributed under the same license as the Code Snippets Plugin package.
3
+ #
4
+ # Weitere deutsche Sprachdateien fuer WordPress-Plugins und -Themes finden Sie unter:
5
+ # --> http://deckerweb.de/sprachdateien/
6
+ #
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Code Snippets v1.7\n"
10
+ "Report-Msgid-Bugs-To: http://deckerweb.de/kontakt/\n"
11
+ "POT-Creation-Date: 2013-03-27 15:41:09+0000\n"
12
+ "PO-Revision-Date: 2013-03-27 16:44+0100\n"
13
+ "Last-Translator: David Decker <deckerweb.mobil@googlemail.com>\n"
14
+ "Language-Team: David Decker -- http://deckerweb.de/kontakt/\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
19
+ "X-Generator: CSL v1.x\n"
20
+ "X-Poedit-Language: German\n"
21
+ "X-Poedit-Country: GERMANY\n"
22
+ "X-Poedit-SourceCharset: utf-8\n"
23
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
24
+ "X-Poedit-Basepath: ../\n"
25
+ "X-Textdomain-Support: yes\n"
26
+ "X-Poedit-SearchPath-0: .\n"
27
+
28
+ #@ code-snippets
29
+ #. translators: plugin header field 'Name'
30
+ #: code-snippets.php:0
31
+ #: code-snippets.php:262
32
+ msgid "Code Snippets"
33
+ msgstr "Codeschnipsel"
34
+
35
+ #@ code-snippets
36
+ #. translators: plugin header field 'Description'
37
+ #: code-snippets.php:0
38
+ msgid "An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!"
39
+ msgstr "Auf einfache, saubere und elegante Weise Codeschnipsel für Ihre Webseite hinzufügen. Änderungen an der 'functions.php' des Themes sind nicht mehr notwendig!"
40
+
41
+ #@ code-snippets
42
+ #. translators: plugin header field 'Author'
43
+ #: code-snippets.php:0
44
+ msgid "Shea Bunge"
45
+ msgstr "Shea Bunge"
46
+
47
+ #@ code-snippets
48
+ #. translators: plugin header field 'AuthorURI'
49
+ #: code-snippets.php:0
50
+ msgid "http://bungeshea.com"
51
+ msgstr "http://bungeshea.com/"
52
+
53
+ #@ code-snippets
54
+ #: code-snippets.php:577
55
+ #: code-snippets.php:578
56
+ #: code-snippets.php:588
57
+ #: includes/admin/manage.php:36
58
+ msgid "Snippets"
59
+ msgstr "Codeschnipsel"
60
+
61
+ #@ code-snippets
62
+ #: code-snippets.php:612
63
+ #: code-snippets.php:1145
64
+ #: includes/admin/single.php:45
65
+ msgid "Add New Snippet"
66
+ msgstr "Neuen Codeschnipsel hinzufügen"
67
+
68
+ #@ code-snippets
69
+ #: code-snippets.php:613
70
+ msgid "Add New"
71
+ msgstr "Hinzufügen"
72
+
73
+ #@ code-snippets
74
+ #: code-snippets.php:641
75
+ #: includes/admin/import.php:34
76
+ msgid "Import Snippets"
77
+ msgstr "Codeschnipsel importieren"
78
+
79
+ #@ code-snippets
80
+ #: code-snippets.php:642
81
+ msgid "Import"
82
+ msgstr "Importieren"
83
+
84
+ #@ code-snippets
85
+ #: code-snippets.php:601
86
+ #: code-snippets.php:1146
87
+ #: includes/admin/single.php:37
88
+ msgid "Edit Snippet"
89
+ msgstr "Codeschnipsel bearbeiten"
90
+
91
+ #@ code-snippets
92
+ #: code-snippets.php:1465
93
+ msgid "Manage your existing snippets"
94
+ msgstr "Bestehende Codeschnipsel verwalten"
95
+
96
+ #@ code-snippets
97
+ #: code-snippets.php:589
98
+ #: code-snippets.php:1466
99
+ msgid "Manage"
100
+ msgstr "Verwalten"
101
+
102
+ #@ code-snippets
103
+ #: code-snippets.php:1486
104
+ msgid "Visit the WordPress.org plugin page"
105
+ msgstr "Die Plugin-Seite bei WordPress.org aufrufen"
106
+
107
+ #@ code-snippets
108
+ #: code-snippets.php:1487
109
+ msgid "About"
110
+ msgstr "Über"
111
+
112
+ #@ code-snippets
113
+ #: code-snippets.php:1491
114
+ msgid "Visit the support forums"
115
+ msgstr "Die Support-Foren aufrufen"
116
+
117
+ #@ code-snippets
118
+ #: code-snippets.php:1492
119
+ msgid "Support"
120
+ msgstr "Support"
121
+
122
+ #@ code-snippets
123
+ #: code-snippets.php:1496
124
+ msgid "Support this plugin's development"
125
+ msgstr "Die Entwicklung dieses Plugins unterstützen"
126
+
127
+ #@ code-snippets
128
+ #: code-snippets.php:1497
129
+ msgid "Donate"
130
+ msgstr "Spenden"
131
+
132
+ #@ code-snippets
133
+ #: includes/admin/import.php:38
134
+ msgid "Howdy! Upload your Code Snippets export file and we&#8217;ll import the snippets to this site."
135
+ msgstr "Servus! Laden Sie hier Ihre Codeschnipsel-XML-Exportdatei hoch und wir werden die Codeschnipsel dieser Installation hinzufügen."
136
+
137
+ #@ code-snippets
138
+ #: includes/admin/import.php:40
139
+ #, php-format
140
+ msgid "You will need to go to the <a href=\"%s\">Manage Snippets</a> page to activate the imported snippets."
141
+ msgstr "Danach müssen Sie zur <a href=\"%s\">Codeschnispel verwalten-Seite</a> gehen und die importierten Codeschnipsel entsprechend aktivieren."
142
+
143
+ #@ code-snippets
144
+ #: includes/admin/import.php:42
145
+ msgid "Choose a Code Snippets (.xml) file to upload, then click Upload file and import."
146
+ msgstr "Wählen Sie eine Codeschnipsel-XML-Datei zum Hochladen, klicken Sie dann auf 'Datei hochladen &amp; importieren'."
147
+
148
+ #@ code-snippets
149
+ #: includes/admin/import.php:46
150
+ msgid "Choose a file from your computer:"
151
+ msgstr "Datei von Ihrem Rechner wählen:"
152
+
153
+ #@ code-snippets
154
+ #: includes/admin/import.php:46
155
+ msgid "(Maximum size: 8MB)"
156
+ msgstr "(Maximalgröße: 8 MB)"
157
+
158
+ #@ code-snippets
159
+ #: includes/admin/import.php:55
160
+ msgid "Upload file and import"
161
+ msgstr "Datei hochladen &amp; importieren"
162
+
163
+ #@ code-snippets
164
+ #: includes/admin/manage.php:21
165
+ msgid "Snippet <strong>activated</strong>."
166
+ msgstr "Codeschnipsel <strong>aktiviert</strong>."
167
+
168
+ #@ code-snippets
169
+ #: includes/admin/manage.php:23
170
+ msgid "Selected snippets <strong>activated</strong>."
171
+ msgstr "Ausgewählte Codeschnipsel wurden <strong>aktiviert</strong>."
172
+
173
+ #@ code-snippets
174
+ #: includes/admin/manage.php:25
175
+ msgid "Snippet <strong>deactivated</strong>."
176
+ msgstr "Codeschnipsel <strong>deaktiviert</strong>."
177
+
178
+ #@ code-snippets
179
+ #: includes/admin/manage.php:27
180
+ msgid "Selected snippets <strong>deactivated</strong>."
181
+ msgstr "Ausgewählte Codeschnipsel wurden <strong>deaktiviert</strong>."
182
+
183
+ #@ code-snippets
184
+ #: includes/admin/manage.php:29
185
+ msgid "Snippet <strong>deleted</strong>."
186
+ msgstr "Codeschnipsel <strong>gelöscht</strong>."
187
+
188
+ #@ code-snippets
189
+ #: includes/admin/manage.php:31
190
+ msgid "Selected snippets <strong>deleted</strong>."
191
+ msgstr "Ausgewählte Codeschnipsel wurden <strong>gelöscht</strong>."
192
+
193
+ #@ code-snippets
194
+ #: includes/admin/manage.php:38
195
+ #: includes/admin/single.php:42
196
+ msgctxt "snippet"
197
+ msgid "Add New"
198
+ msgstr "Hinzufügen"
199
+
200
+ #@ code-snippets
201
+ #: includes/admin/manage.php:47
202
+ msgid "Search Installed Snippets"
203
+ msgstr "Installierte Codeschnipsel suchen"
204
+
205
+ #@ code-snippets
206
+ #: includes/admin/single.php:22
207
+ msgid "Please provide a name for the snippet and its code."
208
+ msgstr "Bitte geben Sie einen Namen für den Codeschnipsel und dessen Code an."
209
+
210
+ #@ code-snippets
211
+ #: includes/admin/single.php:28
212
+ msgid "Snippet <strong>updated</strong>."
213
+ msgstr "Codeschnipsel <strong>aktualisiert</strong>."
214
+
215
+ #@ code-snippets
216
+ #: includes/admin/single.php:30
217
+ msgid "Snippet <strong>added</strong>."
218
+ msgstr "Codeschnipsel <strong>hinzugefügt</strong>."
219
+
220
+ #@ code-snippets
221
+ #: includes/admin/single.php:55
222
+ #: includes/admin/single.php:56
223
+ msgid "Name (short title)"
224
+ msgstr "Name (Kurztitel)"
225
+
226
+ #@ code-snippets
227
+ #: includes/admin/single.php:61
228
+ msgid "Code"
229
+ msgstr "Code"
230
+
231
+ #@ code-snippets
232
+ #: code-snippets.php:1433
233
+ #: includes/class-list-table.php:189
234
+ msgid "Description"
235
+ msgstr "Beschreibung"
236
+
237
+ #@ code-snippets
238
+ #: code-snippets.php:1434
239
+ msgid "(Optional)"
240
+ msgstr "(optional, aber empfohlen für bessere Organisation &amp; Übersicht)"
241
+
242
+ #@ code-snippets
243
+ #: includes/class-list-table.php:36
244
+ msgid "Snippets per page"
245
+ msgstr "Codeschnipsel pro Seite"
246
+
247
+ #@ code-snippets
248
+ #: code-snippets.php:1118
249
+ #: includes/class-list-table.php:127
250
+ #: includes/class-list-table.php:213
251
+ msgid "Network Deactivate"
252
+ msgstr "Netzwerk-weit deaktivieren"
253
+
254
+ #@ code-snippets
255
+ #: code-snippets.php:1118
256
+ #: includes/class-list-table.php:127
257
+ #: includes/class-list-table.php:213
258
+ msgid "Deactivate"
259
+ msgstr "Deaktivieren"
260
+
261
+ #@ code-snippets
262
+ #: code-snippets.php:1127
263
+ #: includes/class-list-table.php:137
264
+ #: includes/class-list-table.php:212
265
+ msgid "Network Activate"
266
+ msgstr "Netzwerk-weit aktivieren"
267
+
268
+ #@ code-snippets
269
+ #: code-snippets.php:1127
270
+ #: includes/class-list-table.php:137
271
+ #: includes/class-list-table.php:212
272
+ msgid "Activate"
273
+ msgstr "Aktivieren"
274
+
275
+ #@ code-snippets
276
+ #: includes/class-list-table.php:187
277
+ msgid "Name"
278
+ msgstr "Name"
279
+
280
+ #@ code-snippets
281
+ #: includes/class-list-table.php:188
282
+ msgid "ID"
283
+ msgstr "ID"
284
+
285
+ #@ code-snippets
286
+ #: includes/class-list-table.php:147
287
+ #: includes/class-list-table.php:214
288
+ msgid "Export"
289
+ msgstr "Exportieren"
290
+
291
+ #@ code-snippets
292
+ #: includes/class-list-table.php:155
293
+ #: includes/class-list-table.php:215
294
+ msgid "Delete"
295
+ msgstr "Löschen"
296
+
297
+ #@ code-snippets
298
+ #: includes/class-list-table.php:216
299
+ msgid "Export to PHP"
300
+ msgstr "Exportieren als PHP"
301
+
302
+ #@ code-snippets
303
+ #: includes/class-list-table.php:236
304
+ #, php-format
305
+ msgid "All <span class=\"count\">(%s)</span>"
306
+ msgid_plural "All <span class=\"count\">(%s)</span>"
307
+ msgstr[0] "Alle <span class=\"count\">(%s)</span>"
308
+ msgstr[1] "Alle <span class=\"count\">(%s)</span>"
309
+
310
+ #@ code-snippets
311
+ #: includes/class-list-table.php:239
312
+ #, php-format
313
+ msgid "Active <span class=\"count\">(%s)</span>"
314
+ msgid_plural "Active <span class=\"count\">(%s)</span>"
315
+ msgstr[0] "Aktiv <span class=\"count\">(%s)</span>"
316
+ msgstr[1] "Aktive <span class=\"count\">(%s)</span>"
317
+
318
+ #@ code-snippets
319
+ #: includes/class-list-table.php:242
320
+ #, php-format
321
+ msgid "Recently Active <span class=\"count\">(%s)</span>"
322
+ msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
323
+ msgstr[0] "Kürzlich aktiv <span class=\"count\">(%s)</span>"
324
+ msgstr[1] "Kürzlich aktive <span class=\"count\">(%s)</span>"
325
+
326
+ #@ code-snippets
327
+ #: includes/class-list-table.php:245
328
+ #, php-format
329
+ msgid "Inactive <span class=\"count\">(%s)</span>"
330
+ msgid_plural "Inactive <span class=\"count\">(%s)</span>"
331
+ msgstr[0] "Inaktiv <span class=\"count\">(%s)</span>"
332
+ msgstr[1] "Inaktive <span class=\"count\">(%s)</span>"
333
+
334
+ #@ code-snippets
335
+ #: includes/class-list-table.php:279
336
+ msgid "Clear List"
337
+ msgstr "Liste säubern"
338
+
339
+ #@ code-snippets
340
+ #: includes/class-list-table.php:374
341
+ #, php-format
342
+ msgid "You do not appear to have any snippets available at this time. <a href=\"%s\">Add New&rarr;</a>"
343
+ msgstr "Sie scheinen derzeit keine Codeschnipsel in der Verwaltung zu haben. Einen neuen <a href=\"%s\">hinzufügen &rarr;</a>"
344
+
345
+ #@ code-snippets
346
+ #: includes/help/import.php:5
347
+ #: includes/help/manage.php:5
348
+ #: includes/help/single.php:5
349
+ msgid "Overview"
350
+ msgstr "Übersicht"
351
+
352
+ #@ code-snippets
353
+ #: includes/help/import.php:7
354
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can load snippets from a Code Snippets (.xml) import file into the database with your existing snippets."
355
+ msgstr "Codeschnipsel sind ähnlich wie Plugins - beide erweitern bzw. verändern die Funktionalität. Codeschnipsel sind jedoch weniger komplex und leichtgewichtiger; nur einige Zeilen Code. Damit fällt auch weniger Last auf dem Webserver an. Hier können Sie Codeschnipsel aus einer Codeschipsel-XML-Importdatei hinzufügen."
356
+
357
+ #@ code-snippets
358
+ #: includes/help/import.php:12
359
+ msgid "Importing"
360
+ msgstr "Importieren"
361
+
362
+ #@ code-snippets
363
+ #: includes/help/import.php:15
364
+ #, php-format
365
+ msgid "Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href=\"%s\">Manage Snippets</a> page.</p>"
366
+ msgstr "Codeschnipsel werden der Datenbank hinzugefügt, zusammen mit Ihren bereits bestehenden Codeschnipseln. Unabhängig davon, ob diese Codeschnipsel auf der vorherigen Installation aktiv waren, sind importierte Codeschnipsel standardmäßig immer deaktiviert, solange Sie von Ihnen auf der <a href=\"%s\">Codeschnispel verwalten-Seite</a> aktiviert werden.</p>"
367
+
368
+ #@ code-snippets
369
+ #: includes/help/import.php:20
370
+ msgid "Exporting"
371
+ msgstr "Exportieren"
372
+
373
+ #@ code-snippets
374
+ #: includes/help/import.php:22
375
+ #, php-format
376
+ msgid "You can save your snippets to a Code Snippets (.xml) export file using the <a href=\"%s\">Manage Snippets</a> page."
377
+ msgstr "Sie können Ihre Codeschnipsel auch als Codeschnipsel-XML-Exportdatei exportieren, über die <a href=\"%s\">Codeschnipsel verwalten-Seite</a>."
378
+
379
+ #@ code-snippets
380
+ #: includes/help/import.php:26
381
+ #: includes/help/manage.php:27
382
+ #: includes/help/single.php:31
383
+ msgid "For more information:"
384
+ msgstr "Weitere Informationen:"
385
+
386
+ #@ code-snippets
387
+ #: includes/help/import.php:27
388
+ #: includes/help/single.php:32
389
+ msgid "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank\">WordPress Extend</a>"
390
+ msgstr "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank\">Plugin-Seite bei WordPress.org</a>"
391
+
392
+ #@ code-snippets
393
+ #: includes/help/import.php:28
394
+ #: includes/help/manage.php:29
395
+ #: includes/help/single.php:33
396
+ msgid "<a href=\"http://wordpress.org/support/plugin/code-snippets\" target=\"_blank\">Support Forums</a>"
397
+ msgstr "<a href=\"http://wordpress.org/support/plugin/code-snippets\" target=\"_blank\">Offizielles Support-Forum (Engl.)</a>"
398
+
399
+ #@ code-snippets
400
+ #: includes/help/manage.php:7
401
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can manage your existing snippets and preform tasks on them such as activating, deactivating, deleting and exporting."
402
+ msgstr "Codeschnipsel sind ähnlich wie Plugins - beide erweitern bzw. verändern die Funktionalität. Codeschnipsel sind jedoch weniger komplex und leichtgewichtiger; nur einige Zeilen Code. Damit fällt auch weniger Last auf dem Webserver an. Hier können Sie bereits existierende Codeschnipsel bearbeiten bzw. Aktionen damit ausführen, wie Aktivieren, Deaktivieren, Löschen sowie Exportieren."
403
+
404
+ #@ code-snippets
405
+ #: includes/help/manage.php:12
406
+ msgid "Safe Mode"
407
+ msgstr "Sicherheitsmodus"
408
+
409
+ #@ code-snippets
410
+ #: includes/help/manage.php:14
411
+ msgid "Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time."
412
+ msgstr "Stellen Sie sicher, dass Sie Ihre Codeschnipsel vor dem Aktivieren überprüfen. Fehlerhafte Codeschnipsel können Ihre gesamte Webseite zum Crash bringen. Falls Ihre Webseite eigenartige Dinge vollführt oder komische Sachen anzeigt, deaktivieren Sie bitte alle Codeschnipsel und aktivieren Sie diese eins nach dem anderen."
413
+
414
+ #@ code-snippets
415
+ #: includes/help/manage.php:20
416
+ msgid "Uninstall"
417
+ msgstr "Deinstallieren"
418
+
419
+ #@ code-snippets
420
+ #: includes/help/manage.php:22
421
+ #, php-format
422
+ msgid "When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>%1$s</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>%2$s</code> folder using FTP."
423
+ msgstr "Wenn Sie das Codeschnipsel-Plugin <strong>über das Plugins-Menü in WordPress löschen</strong>, wird es die <code>%1$s</code> Tabelle leeren und einige anderen (Einstellungs-) Datenbits in Ihrer Datenbank. Falls Sie diese Daten jedoch sichern wollen (mit anderen Worten: Sie wollen das Plugin nur temporär deinstallieren), dann sollten Sie den <code>%2$s</code> Ordner lediglich <strong>via FTP</strong> entfernen."
424
+
425
+ #@ code-snippets
426
+ #: includes/help/manage.php:23
427
+ msgid "Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets."
428
+ msgstr "Auch wenn Sie sicher sind, dass Sie das Codeschnipsel-Plugin niemals mehr in dieser WordPress-Installation verwenden werden, wollen Sie vielleicht dennoch die Export-Funktion verwenden, um Ihre Codeschnipsel zu sichern."
429
+
430
+ #@ code-snippets
431
+ #: includes/help/manage.php:28
432
+ msgid "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank\">WordPress Extend</a></p>"
433
+ msgstr "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank\">Plugin-Seite bei WordPress.org</a></p>"
434
+
435
+ #@ code-snippets
436
+ #: includes/help/single.php:7
437
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can add a new snippet, or edit an existing one."
438
+ msgstr "Codeschnipsel sind ähnlich wie Plugins - beide erweitern bzw. verändern die Funktionalität. Codeschnipsel sind jedoch weniger komplex und leichtgewichtiger; nur einige Zeilen Code. Damit fällt auch weniger Last auf dem Webserver an. Hier können Sie einen neuen Codeschnipsel hinzufügen oder bereits Existierende bearbeiten."
439
+
440
+ #@ code-snippets
441
+ #: includes/help/single.php:11
442
+ msgid "Finding Snippets"
443
+ msgstr "Codeschnipsel finden"
444
+
445
+ #@ code-snippets
446
+ #: includes/help/single.php:13
447
+ msgid ""
448
+ "Here are some links to websites which host a large number of snippets that you can add to your site.\n"
449
+ "\t\t<ul>\n"
450
+ "\t\t\t<li><a href=\"http://wp-snippets.com\" title=\"WordPress Snippets\">WP-Snippets</a></li>\n"
451
+ "\t\t\t<li><a href=\"http://wpsnipp.com\" title=\"WP Snipp\">WP Snipp</a></li>\n"
452
+ "\t\t\t<li><a href=\"http://www.catswhocode.com/blog/snippets\" title=\"Cats Who Code Snippet Library\">Cats Who Code</a></li>\n"
453
+ "\t\t\t<li><a href=\"http://www.wpfunction.me\">WP Function Me</a></li>\n"
454
+ "\t\t</ul>"
455
+ msgstr ""
456
+ "Hier sind einige Links zu Webseiten, welche eine große Anzahl von WordPress-Codeschnipseln anbieten, die Sie vielleicht für Ihre Webseite verwenden könnten. Bitte seien Sie äußerst vorsichtig mit fremden Codeschnipseln, überprüfen Sie immer den Anbieter/ Herausgeber. Setzen Sie nur vertrauenswürdige Quellen ein!\n"
457
+ "\\\t\\\t<ul>\n"
458
+ "\\\t\\\t\\\t<li><a href=\"http://wp-snippets.com\" title=\"WordPress Snippets\">WP-Snippets</a></li>\n"
459
+ "\\\t\\\t\\\t<li><a href=\"http://wpsnipp.com\" title=\"WP Snipp\">WP Snipp</a></li>\n"
460
+ "\\\t\\\t\\\t<li><a href=\"http://www.catswhocode.com/blog/snippets\" title=\"Cats Who Code Snippet Library\">Cats Who Code</a></li>\n"
461
+ "\\\t\\\t\\\t<li><a href=\"http://www.wpfunction.me\">WP Function Me</a></li>\n"
462
+ "\\\t\\\t</ul>"
463
+
464
+ #@ code-snippets
465
+ #: includes/help/single.php:24
466
+ msgid "Adding Snippets"
467
+ msgstr "Codeschnipsel hinzufügen"
468
+
469
+ #@ code-snippets
470
+ #: includes/help/single.php:26
471
+ msgid "You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional."
472
+ msgstr "Sie müssen die Felder für 'Name' und 'Code' ausfüllen, damit der Schnipsel hinzugefügt werden kann. Das Beschreibungsfeld ist völlig optional, es wird jedoch sehr empfohlen. Damit können Sie kurz notieren, was der Code eigentlich macht und bewahren sich so auf elegante Weise die Übersicht."
473
+
474
+ #@ code-snippets
475
+ #: includes/help/single.php:27
476
+ msgid "Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site."
477
+ msgstr "Bitte stellen Sie vor dem Einfügen von Codeschnipseln sicher, dass Ihr entsprechender Codeschipsel valider PHP-Code ist und keine Fehler produziert. Somit erhöhen Sie von vornherein die Wahrscheinlichkeit, dass überhaupt fehlerhafte Codeschnipsel in Ihrer Installation aktiviert werden."
478
+
479
+ #@ code-snippets
480
+ #. translators: plugin header field 'PluginURI'
481
+ #: code-snippets.php:0
482
+ msgid "http://code-snippets.bungeshea.com"
483
+ msgstr "http://code-snippets.bungeshea.com/"
484
+
485
+ #@ code-snippets
486
+ #: code-snippets.php:263
487
+ msgid "Import snippets from a <strong>Code Snippets</strong> export file"
488
+ msgstr "Codeschnipsel aus einer <strong>Code Snippets</strong>-Exportdatei importieren"
489
+
490
+ #@ code-snippets
491
+ #: includes/admin/import.php:20
492
+ #, php-format
493
+ msgid "Imported <strong>%d</strong> snippet."
494
+ msgid_plural "Imported <strong>%d</strong> snippets."
495
+ msgstr[0] " <strong>%d</strong> Codeschnipsel importiert."
496
+ msgstr[1] " <strong>%d</strong> Codeschnipsel importiert."
497
+
498
+ #@ code-snippets
499
+ #: includes/help/import.php:29
500
+ #: includes/help/manage.php:30
501
+ #: includes/help/single.php:34
502
+ msgid "<a href=\"http://code-snippets.bungeshea.com/\" target=\"_blank\">Project Website</a>"
503
+ msgstr "<a href=\"http://code-snippets.bungeshea.com/\" target=\"_blank\">Projektwebseite</a>"
504
+
505
+ #@ code-snippets
506
+ #: includes/help/manage.php:15
507
+ msgid "If something goes wrong with a snippet and you can't use WordPress, you can cause all snippets to stop executing by adding <code>define('CODE_SNIPPETS_SAFE_MODE', true);</code> to your <code>wp-config.php</code> file. After you have deactivated the offending snippet, you can turn off safe mode by removing this line or replacing <strong>true</strong> with <strong>false</strong>."
508
+ msgstr "Falls etwas schief läuft und Sie WordPress nicht mehr verwenden können - sprich: den Admin-Bereich - können Sie alle Codeschnipsel dieses Plugins von der Ausführung abhalten, indem Sie folgende Konstante <code>define( 'CODE_SNIPPETS_SAFE_MODE', true );</code> Ihrer WordPress-Konfigurationsdatei <code>wp-config.php</code> hinzufügen. Nachdem Sie den fehlerhaften Codeschnipsel gefunden und deaktiviert haben, können Sie den Sicherheitsmodus in der <code>wp-config.php</code> wieder entfernen bzw. den Wert der Konstante von <strong>true</strong> auf dann <strong>false</strong> setzen."
509
+
510
+ #@ code-snippets
511
+ #: includes/help/single.php:20
512
+ msgid "More places to find snippets, as well as a selection of example snippets, can be found in the <a href=\"http://code-snippets.bungeshea.com/docs/finding-snippets/\">plugin documentation</a>"
513
+ msgstr "Weitere Orte, um Codeschnipsel zu finden und ebenso eine Sammlung von Beispiel-Schnipseln finden Sie in der <a href=\"http://code-snippets.bungeshea.com/docs/finding-snippets/\">Dokumentation des Plugins</a>."
514
+
515
+ #@ code-snippets
516
+ #. translators: plugin header field 'Version'
517
+ #: code-snippets.php:0
518
+ msgid "1.7"
519
+ msgstr "1.7"
520
+
521
+ #@ code-snippets
522
+ #: code-snippets.php:602
523
+ #: includes/class-list-table.php:142
524
+ msgid "Edit"
525
+ msgstr "Bearbeiten"
526
+
527
+ #@ code-snippets
528
+ #: code-snippets.php:1227
529
+ msgid "Sorry, you're not allowed to edit snippets"
530
+ msgstr "Entschuldigung, aber Sie haben keine Berechtigung zum Bearbeiten von Codeschnipseln."
531
+
532
+ #@ code-snippets
533
+ #: includes/admin/single.php:24
534
+ msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
535
+ msgstr "Codeschnipsel <strong>aktualisiert</strong> und <strong>aktiviert</strong>."
536
+
537
+ #@ code-snippets
538
+ #: includes/admin/single.php:26
539
+ msgid "Snippet <strong>added</strong> and <strong>activated</strong>."
540
+ msgstr "Codeschnipsel <strong>hinzugefügt</strong> und <strong>aktiviert</strong>."
541
+
542
+ #@ code-snippets
543
+ #: includes/class-list-table.php:163
544
+ msgid ""
545
+ "You are about to permanently delete the selected item.\n"
546
+ "\t\t\t\t'Cancel' to stop, 'OK' to delete."
547
+ msgstr ""
548
+ "Sie sind dabei das ausgewählte Element dauerhaft zu löschen.\n"
549
+ "\\\t\\\t\\\t\\\t'Abbrechen', um das zu stoppen, 'OK', um wirklich zu löschen."
550
+
551
+ #@ code-snippets
552
+ #: includes/class-list-table.php:270
553
+ msgid "Filter"
554
+ msgstr "Filter"
555
+
556
+ #@ code-snippets
557
+ #: includes/class-list-table.php:541
558
+ msgid "Search results"
559
+ msgstr "Suchergebnisse"
560
+
561
+ #@ code-snippets
562
+ #: includes/class-list-table.php:544
563
+ #, php-format
564
+ msgid " for &#8220;%s&#8221;"
565
+ msgstr " für &#8220;%s&#8221;"
566
+
567
+ #@ code-snippets
568
+ #: includes/class-list-table.php:550
569
+ msgid "Clear Filters"
570
+ msgstr "Filter zurücksetzen"
571
+
572
+ #@ code-snippets
573
+ #: includes/help/import.php:14
574
+ msgid "You can load your snippets from a code snippets (.xml) export file using this page."
575
+ msgstr "Auf dieser Seite können Sie Ihre Codeschnipsel von einer Codeschnipsel-Exportdatei (<code>.xml</code>) laden."
576
+
577
+ #@ code-snippets
578
+ #: includes/admin/single.php:74
579
+ msgid "Save Changes &amp; Activate"
580
+ msgstr "Änderungen speichern &amp; Aktivieren"
581
+
languages/code-snippets.po ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is distributed under the same license as the Code Snippets package.
2
+ msgid ""
3
+ msgstr ""
4
+ "PO-Revision-Date: 2013-03-27 15:45:42+0000\n"
5
+ "MIME-Version: 1.0\n"
6
+ "Content-Type: text/plain; charset=UTF-8\n"
7
+ "Content-Transfer-Encoding: 8bit\n"
8
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
9
+ "X-Generator: GlotPress/0.1\n"
10
+ "Project-Id-Version: Code Snippets\n"
11
+
12
+ #: code-snippets.php:0 code-snippets.php:262
13
+ msgid "Code Snippets"
14
+ msgstr ""
15
+
16
+ #: code-snippets.php:0
17
+ msgid "An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!"
18
+ msgstr ""
19
+
20
+ #: code-snippets.php:0
21
+ msgid "Shea Bunge"
22
+ msgstr ""
23
+
24
+ #: code-snippets.php:0
25
+ msgid "http://bungeshea.com"
26
+ msgstr ""
27
+
28
+ #: code-snippets.php:577 code-snippets.php:578 code-snippets.php:588
29
+ #: includes/admin/manage.php:36
30
+ msgid "Snippets"
31
+ msgstr ""
32
+
33
+ #: code-snippets.php:612 code-snippets.php:1145 includes/admin/single.php:45
34
+ msgid "Add New Snippet"
35
+ msgstr ""
36
+
37
+ #: code-snippets.php:613
38
+ msgid "Add New"
39
+ msgstr ""
40
+
41
+ #: code-snippets.php:641 includes/admin/import.php:34
42
+ msgid "Import Snippets"
43
+ msgstr ""
44
+
45
+ #: code-snippets.php:642
46
+ msgid "Import"
47
+ msgstr ""
48
+
49
+ #: code-snippets.php:601 code-snippets.php:1146 includes/admin/single.php:37
50
+ msgid "Edit Snippet"
51
+ msgstr ""
52
+
53
+ #: code-snippets.php:1465
54
+ msgid "Manage your existing snippets"
55
+ msgstr ""
56
+
57
+ #: code-snippets.php:589 code-snippets.php:1466
58
+ msgid "Manage"
59
+ msgstr ""
60
+
61
+ #: code-snippets.php:1486
62
+ msgid "Visit the WordPress.org plugin page"
63
+ msgstr ""
64
+
65
+ #: code-snippets.php:1487
66
+ msgid "About"
67
+ msgstr ""
68
+
69
+ #: code-snippets.php:1491
70
+ msgid "Visit the support forums"
71
+ msgstr ""
72
+
73
+ #: code-snippets.php:1492
74
+ msgid "Support"
75
+ msgstr ""
76
+
77
+ #: code-snippets.php:1496
78
+ msgid "Support this plugin's development"
79
+ msgstr ""
80
+
81
+ #: code-snippets.php:1497
82
+ msgid "Donate"
83
+ msgstr ""
84
+
85
+ #: includes/admin/import.php:38
86
+ msgid "Howdy! Upload your Code Snippets export file and we&#8217;ll import the snippets to this site."
87
+ msgstr ""
88
+
89
+ #: includes/admin/import.php:40
90
+ msgid "You will need to go to the <a href=\"%s\">Manage Snippets</a> page to activate the imported snippets."
91
+ msgstr ""
92
+
93
+ #: includes/admin/import.php:42
94
+ msgid "Choose a Code Snippets (.xml) file to upload, then click Upload file and import."
95
+ msgstr ""
96
+
97
+ #: includes/admin/import.php:46
98
+ msgid "Choose a file from your computer:"
99
+ msgstr ""
100
+
101
+ #: includes/admin/import.php:46
102
+ msgid "(Maximum size: 8MB)"
103
+ msgstr ""
104
+
105
+ #: includes/admin/import.php:55
106
+ msgid "Upload file and import"
107
+ msgstr ""
108
+
109
+ #: includes/admin/manage.php:21
110
+ msgid "Snippet <strong>activated</strong>."
111
+ msgstr ""
112
+
113
+ #: includes/admin/manage.php:23
114
+ msgid "Selected snippets <strong>activated</strong>."
115
+ msgstr ""
116
+
117
+ #: includes/admin/manage.php:25
118
+ msgid "Snippet <strong>deactivated</strong>."
119
+ msgstr ""
120
+
121
+ #: includes/admin/manage.php:27
122
+ msgid "Selected snippets <strong>deactivated</strong>."
123
+ msgstr ""
124
+
125
+ #: includes/admin/manage.php:29
126
+ msgid "Snippet <strong>deleted</strong>."
127
+ msgstr ""
128
+
129
+ #: includes/admin/manage.php:31
130
+ msgid "Selected snippets <strong>deleted</strong>."
131
+ msgstr ""
132
+
133
+ #: includes/admin/manage.php:38 includes/admin/single.php:42
134
+ msgctxt "snippet"
135
+ msgid "Add New"
136
+ msgstr ""
137
+
138
+ #: includes/admin/manage.php:47
139
+ msgid "Search Installed Snippets"
140
+ msgstr ""
141
+
142
+ #: includes/admin/single.php:22
143
+ msgid "Please provide a name for the snippet and its code."
144
+ msgstr ""
145
+
146
+ #: includes/admin/single.php:28
147
+ msgid "Snippet <strong>updated</strong>."
148
+ msgstr ""
149
+
150
+ #: includes/admin/single.php:30
151
+ msgid "Snippet <strong>added</strong>."
152
+ msgstr ""
153
+
154
+ #: includes/admin/single.php:55 includes/admin/single.php:56
155
+ msgid "Name (short title)"
156
+ msgstr ""
157
+
158
+ #: includes/admin/single.php:61
159
+ msgid "Code"
160
+ msgstr ""
161
+
162
+ #: code-snippets.php:1433 includes/class-list-table.php:189
163
+ msgid "Description"
164
+ msgstr ""
165
+
166
+ #: code-snippets.php:1434
167
+ msgid "(Optional)"
168
+ msgstr ""
169
+
170
+ #: includes/class-list-table.php:36
171
+ msgid "Snippets per page"
172
+ msgstr ""
173
+
174
+ #: code-snippets.php:1118 includes/class-list-table.php:127
175
+ #: includes/class-list-table.php:213
176
+ msgid "Network Deactivate"
177
+ msgstr ""
178
+
179
+ #: code-snippets.php:1118 includes/class-list-table.php:127
180
+ #: includes/class-list-table.php:213
181
+ msgid "Deactivate"
182
+ msgstr ""
183
+
184
+ #: code-snippets.php:1127 includes/class-list-table.php:137
185
+ #: includes/class-list-table.php:212
186
+ msgid "Network Activate"
187
+ msgstr ""
188
+
189
+ #: code-snippets.php:1127 includes/class-list-table.php:137
190
+ #: includes/class-list-table.php:212
191
+ msgid "Activate"
192
+ msgstr ""
193
+
194
+ #: includes/class-list-table.php:187
195
+ msgid "Name"
196
+ msgstr ""
197
+
198
+ #: includes/class-list-table.php:188
199
+ msgid "ID"
200
+ msgstr ""
201
+
202
+ #: includes/class-list-table.php:147 includes/class-list-table.php:214
203
+ msgid "Export"
204
+ msgstr ""
205
+
206
+ #: includes/class-list-table.php:155 includes/class-list-table.php:215
207
+ msgid "Delete"
208
+ msgstr ""
209
+
210
+ #: includes/class-list-table.php:216
211
+ msgid "Export to PHP"
212
+ msgstr ""
213
+
214
+ #: includes/class-list-table.php:236
215
+ msgid "All <span class=\"count\">(%s)</span>"
216
+ msgid_plural "All <span class=\"count\">(%s)</span>"
217
+ msgstr[0] ""
218
+ msgstr[1] ""
219
+
220
+ #: includes/class-list-table.php:239
221
+ msgid "Active <span class=\"count\">(%s)</span>"
222
+ msgid_plural "Active <span class=\"count\">(%s)</span>"
223
+ msgstr[0] ""
224
+ msgstr[1] ""
225
+
226
+ #: includes/class-list-table.php:242
227
+ msgid "Recently Active <span class=\"count\">(%s)</span>"
228
+ msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
229
+ msgstr[0] ""
230
+ msgstr[1] ""
231
+
232
+ #: includes/class-list-table.php:245
233
+ msgid "Inactive <span class=\"count\">(%s)</span>"
234
+ msgid_plural "Inactive <span class=\"count\">(%s)</span>"
235
+ msgstr[0] ""
236
+ msgstr[1] ""
237
+
238
+ #: includes/class-list-table.php:279
239
+ msgid "Clear List"
240
+ msgstr ""
241
+
242
+ #: includes/class-list-table.php:374
243
+ msgid "You do not appear to have any snippets available at this time. <a href=\"%s\">Add New&rarr;</a>"
244
+ msgstr ""
245
+
246
+ #: includes/help/import.php:5 includes/help/manage.php:5
247
+ #: includes/help/single.php:5
248
+ msgid "Overview"
249
+ msgstr ""
250
+
251
+ #: includes/help/import.php:7
252
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can load snippets from a Code Snippets (.xml) import file into the database with your existing snippets."
253
+ msgstr ""
254
+
255
+ #: includes/help/import.php:12
256
+ msgid "Importing"
257
+ msgstr ""
258
+
259
+ #: includes/help/import.php:15
260
+ msgid "Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href=\"%s\">Manage Snippets</a> page.</p>"
261
+ msgstr ""
262
+
263
+ #: includes/help/import.php:20
264
+ msgid "Exporting"
265
+ msgstr ""
266
+
267
+ #: includes/help/import.php:22
268
+ msgid "You can save your snippets to a Code Snippets (.xml) export file using the <a href=\"%s\">Manage Snippets</a> page."
269
+ msgstr ""
270
+
271
+ #: includes/help/import.php:26 includes/help/manage.php:27
272
+ #: includes/help/single.php:31
273
+ msgid "For more information:"
274
+ msgstr ""
275
+
276
+ #: includes/help/import.php:27 includes/help/single.php:32
277
+ msgid "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank\">WordPress Extend</a>"
278
+ msgstr ""
279
+
280
+ #: includes/help/import.php:28 includes/help/manage.php:29
281
+ #: includes/help/single.php:33
282
+ msgid "<a href=\"http://wordpress.org/support/plugin/code-snippets\" target=\"_blank\">Support Forums</a>"
283
+ msgstr ""
284
+
285
+ #: includes/help/manage.php:7
286
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can manage your existing snippets and preform tasks on them such as activating, deactivating, deleting and exporting."
287
+ msgstr ""
288
+
289
+ #: includes/help/manage.php:12
290
+ msgid "Safe Mode"
291
+ msgstr ""
292
+
293
+ #: includes/help/manage.php:14
294
+ msgid "Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time."
295
+ msgstr ""
296
+
297
+ #: includes/help/manage.php:20
298
+ msgid "Uninstall"
299
+ msgstr ""
300
+
301
+ #: includes/help/manage.php:22
302
+ msgid "When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>%1$s</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>%2$s</code> folder using FTP."
303
+ msgstr ""
304
+
305
+ #: includes/help/manage.php:23
306
+ msgid "Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets."
307
+ msgstr ""
308
+
309
+ #: includes/help/manage.php:28
310
+ msgid "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank\">WordPress Extend</a></p>"
311
+ msgstr ""
312
+
313
+ #: includes/help/single.php:7
314
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can add a new snippet, or edit an existing one."
315
+ msgstr ""
316
+
317
+ #: includes/help/single.php:11
318
+ msgid "Finding Snippets"
319
+ msgstr ""
320
+
321
+ #: includes/help/single.php:13
322
+ msgid ""
323
+ "Here are some links to websites which host a large number of snippets that you can add to your site.\n"
324
+ "\t\t<ul>\n"
325
+ "\t\t\t<li><a href=\"http://wp-snippets.com\" title=\"WordPress Snippets\">WP-Snippets</a></li>\n"
326
+ "\t\t\t<li><a href=\"http://wpsnipp.com\" title=\"WP Snipp\">WP Snipp</a></li>\n"
327
+ "\t\t\t<li><a href=\"http://www.catswhocode.com/blog/snippets\" title=\"Cats Who Code Snippet Library\">Cats Who Code</a></li>\n"
328
+ "\t\t\t<li><a href=\"http://www.wpfunction.me\">WP Function Me</a></li>\n"
329
+ "\t\t</ul>"
330
+ msgstr ""
331
+
332
+ #: includes/help/single.php:24
333
+ msgid "Adding Snippets"
334
+ msgstr ""
335
+
336
+ #: includes/help/single.php:26
337
+ msgid "You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional."
338
+ msgstr ""
339
+
340
+ #: includes/help/single.php:27
341
+ msgid "Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site."
342
+ msgstr ""
343
+
344
+ #: code-snippets.php:0
345
+ msgid "http://code-snippets.bungeshea.com"
346
+ msgstr ""
347
+
348
+ #: code-snippets.php:263
349
+ msgid "Import snippets from a <strong>Code Snippets</strong> export file"
350
+ msgstr ""
351
+
352
+ #: includes/admin/import.php:20
353
+ msgid "Imported <strong>%d</strong> snippet."
354
+ msgid_plural "Imported <strong>%d</strong> snippets."
355
+ msgstr[0] ""
356
+ msgstr[1] ""
357
+
358
+ #: includes/help/import.php:29 includes/help/manage.php:30
359
+ #: includes/help/single.php:34
360
+ msgid "<a href=\"http://code-snippets.bungeshea.com/\" target=\"_blank\">Project Website</a>"
361
+ msgstr ""
362
+
363
+ #: includes/help/manage.php:15
364
+ msgid "If something goes wrong with a snippet and you can't use WordPress, you can cause all snippets to stop executing by adding <code>define('CODE_SNIPPETS_SAFE_MODE', true);</code> to your <code>wp-config.php</code> file. After you have deactivated the offending snippet, you can turn off safe mode by removing this line or replacing <strong>true</strong> with <strong>false</strong>."
365
+ msgstr ""
366
+
367
+ #: includes/help/single.php:20
368
+ msgid "More places to find snippets, as well as a selection of example snippets, can be found in the <a href=\"http://code-snippets.bungeshea.com/docs/finding-snippets/\">plugin documentation</a>"
369
+ msgstr ""
370
+
371
+ #: code-snippets.php:0
372
+ msgid "1.7"
373
+ msgstr ""
374
+
375
+ #: code-snippets.php:602 includes/class-list-table.php:142
376
+ msgid "Edit"
377
+ msgstr ""
378
+
379
+ #: code-snippets.php:1227
380
+ msgid "Sorry, you're not allowed to edit snippets"
381
+ msgstr ""
382
+
383
+ #: includes/admin/single.php:24
384
+ msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
385
+ msgstr ""
386
+
387
+ #: includes/admin/single.php:26
388
+ msgid "Snippet <strong>added</strong> and <strong>activated</strong>."
389
+ msgstr ""
390
+
391
+ #: includes/class-list-table.php:163
392
+ msgid ""
393
+ "You are about to permanently delete the selected item.\n"
394
+ "\t\t\t\t'Cancel' to stop, 'OK' to delete."
395
+ msgstr ""
396
+
397
+ #: includes/class-list-table.php:270
398
+ msgid "Filter"
399
+ msgstr ""
400
+
401
+ #: includes/class-list-table.php:541
402
+ msgid "Search results"
403
+ msgstr ""
404
+
405
+ #: includes/class-list-table.php:544
406
+ msgid " for &#8220;%s&#8221;"
407
+ msgstr ""
408
+
409
+ #: includes/class-list-table.php:550
410
+ msgid "Clear Filters"
411
+ msgstr ""
412
+
413
+ #: includes/help/import.php:14
414
+ msgid "You can load your snippets from a code snippets (.xml) export file using this page."
415
+ msgstr ""
416
+
417
+ #: includes/admin/single.php:74
418
+ msgid "Save Changes &amp; Activate"
419
+ msgstr ""
languages/code-snippets.pot CHANGED
@@ -1,483 +1,419 @@
1
- # Copyright (C) 2013 Code Snippets
2
- # This file is distributed under the same license as the Code Snippets package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Code Snippets 1.7\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/code-snippets\n"
7
- "POT-Creation-Date: 2013-03-26 07:01:58+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
- "Language-Team: LANGUAGE <LL@li.org>\n"
14
-
15
- #. #-#-#-#-# plugin.pot (Code Snippets 1.7) #-#-#-#-#
16
- #. Plugin Name of the plugin/theme
17
- #: code-snippets.php:245
18
- msgid "Code Snippets"
19
- msgstr ""
20
-
21
- #: code-snippets.php:246
22
- msgid "Import snippets from a <strong>Code Snippets</strong> export file"
23
- msgstr ""
24
-
25
- #: code-snippets.php:581 code-snippets.php:582 code-snippets.php:592
26
- #: includes/admin/manage.php:36
27
- msgid "Snippets"
28
- msgstr ""
29
-
30
- #: code-snippets.php:593 code-snippets.php:1467
31
- msgid "Manage"
32
- msgstr ""
33
-
34
- #: code-snippets.php:605 code-snippets.php:1150 includes/admin/single.php:37
35
- msgid "Edit Snippet"
36
- msgstr ""
37
-
38
- #: code-snippets.php:606
39
- msgid "Edit"
40
- msgstr ""
41
-
42
- #: code-snippets.php:616 code-snippets.php:1149 includes/admin/single.php:45
43
- msgid "Add New Snippet"
44
- msgstr ""
45
-
46
- #: code-snippets.php:617
47
- msgid "Add New"
48
- msgstr ""
49
-
50
- #: code-snippets.php:645 includes/admin/import.php:34
51
- msgid "Import Snippets"
52
- msgstr ""
53
-
54
- #: code-snippets.php:646
55
- msgid "Import"
56
- msgstr ""
57
-
58
- #: code-snippets.php:1122 includes/class-list-table.php:127
59
- #: includes/class-list-table.php:213
60
- msgid "Network Deactivate"
61
- msgstr ""
62
-
63
- #: code-snippets.php:1122 includes/class-list-table.php:127
64
- #: includes/class-list-table.php:213
65
- msgid "Deactivate"
66
- msgstr ""
67
-
68
- #: code-snippets.php:1131 includes/class-list-table.php:137
69
- #: includes/class-list-table.php:212
70
- msgid "Network Activate"
71
- msgstr ""
72
-
73
- #: code-snippets.php:1131 includes/class-list-table.php:137
74
- #: includes/class-list-table.php:212
75
- msgid "Activate"
76
- msgstr ""
77
-
78
- #: code-snippets.php:1231
79
- msgid "Sorry, you're not allowed to edit snippets"
80
- msgstr ""
81
-
82
- #: code-snippets.php:1434 includes/class-list-table.php:189
83
- msgid "Description"
84
- msgstr ""
85
-
86
- #: code-snippets.php:1435
87
- msgid "(Optional)"
88
- msgstr ""
89
-
90
- #: code-snippets.php:1466
91
- msgid "Manage your existing snippets"
92
- msgstr ""
93
-
94
- #: code-snippets.php:1487
95
- msgid "Visit the WordPress.org plugin page"
96
- msgstr ""
97
-
98
- #: code-snippets.php:1488
99
- msgid "About"
100
- msgstr ""
101
-
102
- #: code-snippets.php:1492
103
- msgid "Visit the support forums"
104
- msgstr ""
105
-
106
- #: code-snippets.php:1493
107
- msgid "Support"
108
- msgstr ""
109
-
110
- #: code-snippets.php:1497
111
- msgid "Support this plugin's development"
112
- msgstr ""
113
-
114
- #: code-snippets.php:1498
115
- msgid "Donate"
116
- msgstr ""
117
-
118
- #: includes/admin/import.php:19
119
- msgid "Imported <strong>%d</strong> snippet."
120
- msgid_plural "Imported <strong>%d</strong> snippets."
121
- msgstr[0] ""
122
- msgstr[1] ""
123
-
124
- #: includes/admin/import.php:38
125
- msgid ""
126
- "Howdy! Upload your Code Snippets export file and we&#8217;ll import the "
127
- "snippets to this site."
128
- msgstr ""
129
-
130
- #: includes/admin/import.php:40
131
- msgid ""
132
- "You will need to go to the <a href=\"%s\">Manage Snippets</a> page to "
133
- "activate the imported snippets."
134
- msgstr ""
135
-
136
- #: includes/admin/import.php:42
137
- msgid ""
138
- "Choose a Code Snippets (.xml) file to upload, then click Upload file and "
139
- "import."
140
- msgstr ""
141
-
142
- #: includes/admin/import.php:46
143
- msgid "Choose a file from your computer:"
144
- msgstr ""
145
-
146
- #: includes/admin/import.php:46
147
- msgid "(Maximum size: 8MB)"
148
- msgstr ""
149
-
150
- #: includes/admin/import.php:55
151
- msgid "Upload file and import"
152
- msgstr ""
153
-
154
- #: includes/admin/manage.php:21
155
- msgid "Snippet <strong>activated</strong>."
156
- msgstr ""
157
-
158
- #: includes/admin/manage.php:23
159
- msgid "Selected snippets <strong>activated</strong>."
160
- msgstr ""
161
-
162
- #: includes/admin/manage.php:25
163
- msgid "Snippet <strong>deactivated</strong>."
164
- msgstr ""
165
-
166
- #: includes/admin/manage.php:27
167
- msgid "Selected snippets <strong>deactivated</strong>."
168
- msgstr ""
169
-
170
- #: includes/admin/manage.php:29
171
- msgid "Snippet <strong>deleted</strong>."
172
- msgstr ""
173
-
174
- #: includes/admin/manage.php:31
175
- msgid "Selected snippets <strong>deleted</strong>."
176
- msgstr ""
177
-
178
- #: includes/admin/manage.php:38 includes/admin/single.php:42
179
- msgctxt "snippet"
180
- msgid "Add New"
181
- msgstr ""
182
-
183
- #: includes/admin/manage.php:47
184
- msgid "Search Installed Snippets"
185
- msgstr ""
186
-
187
- #: includes/admin/single.php:22
188
- msgid "Please provide a name for the snippet and its code."
189
- msgstr ""
190
-
191
- #: includes/admin/single.php:24 includes/admin/single.php:26
192
- msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
193
- msgstr ""
194
-
195
- #: includes/admin/single.php:28
196
- msgid "Snippet <strong>updated</strong>."
197
- msgstr ""
198
-
199
- #: includes/admin/single.php:30
200
- msgid "Snippet <strong>added</strong>."
201
- msgstr ""
202
-
203
- #: includes/admin/single.php:55 includes/admin/single.php:56
204
- msgid "Name (short title)"
205
- msgstr ""
206
-
207
- #: includes/admin/single.php:61
208
- msgid "Code"
209
- msgstr ""
210
-
211
- #: includes/class-list-table.php:36
212
- msgid "Snippets per page"
213
- msgstr ""
214
-
215
- #: includes/class-list-table.php:163
216
- msgid ""
217
- "You are about to permanently delete the selected item.\r\n"
218
- "\t\t\t\t'Cancel' to stop, 'OK' to delete."
219
- msgstr ""
220
-
221
- #: includes/class-list-table.php:187
222
- msgid "Name"
223
- msgstr ""
224
-
225
- #: includes/class-list-table.php:188
226
- msgid "ID"
227
- msgstr ""
228
-
229
- #: includes/class-list-table.php:214
230
- msgid "Export"
231
- msgstr ""
232
-
233
- #: includes/class-list-table.php:215
234
- msgid "Delete"
235
- msgstr ""
236
-
237
- #: includes/class-list-table.php:216
238
- msgid "Export to PHP"
239
- msgstr ""
240
-
241
- #: includes/class-list-table.php:236
242
- msgid "All <span class=\"count\">(%s)</span>"
243
- msgid_plural "All <span class=\"count\">(%s)</span>"
244
- msgstr[0] ""
245
- msgstr[1] ""
246
-
247
- #: includes/class-list-table.php:239
248
- msgid "Active <span class=\"count\">(%s)</span>"
249
- msgid_plural "Active <span class=\"count\">(%s)</span>"
250
- msgstr[0] ""
251
- msgstr[1] ""
252
-
253
- #: includes/class-list-table.php:242
254
- msgid "Recently Active <span class=\"count\">(%s)</span>"
255
- msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
256
- msgstr[0] ""
257
- msgstr[1] ""
258
-
259
- #: includes/class-list-table.php:245
260
- msgid "Inactive <span class=\"count\">(%s)</span>"
261
- msgid_plural "Inactive <span class=\"count\">(%s)</span>"
262
- msgstr[0] ""
263
- msgstr[1] ""
264
-
265
- #: includes/class-list-table.php:270
266
- msgid "Filter"
267
- msgstr ""
268
-
269
- #: includes/class-list-table.php:279
270
- msgid "Clear List"
271
- msgstr ""
272
-
273
- #: includes/class-list-table.php:374
274
- msgid ""
275
- "You do not appear to have any snippets available at this time. <a href=\"%s"
276
- "\">Add New&rarr;</a>"
277
- msgstr ""
278
-
279
- #: includes/class-list-table.php:541
280
- msgid "Search results"
281
- msgstr ""
282
-
283
- #: includes/class-list-table.php:544
284
- msgid " for &#8220;%s&#8221;"
285
- msgstr ""
286
-
287
- #: includes/class-list-table.php:550
288
- msgid "Clear Filters"
289
- msgstr ""
290
-
291
- #: includes/help/import.php:5 includes/help/manage.php:5
292
- #: includes/help/single.php:5
293
- msgid "Overview"
294
- msgstr ""
295
-
296
- #: includes/help/import.php:7
297
- msgid ""
298
- "Snippets are similar to plugins - they both extend and expand the "
299
- "functionality of WordPress. Snippets are more light-weight, just a few lines "
300
- "of code, and do not put as much load on your server. Here you can load "
301
- "snippets from a Code Snippets (.xml) import file into the database with your "
302
- "existing snippets."
303
- msgstr ""
304
-
305
- #: includes/help/import.php:12
306
- msgid "Importing"
307
- msgstr ""
308
-
309
- #: includes/help/import.php:14
310
- msgid ""
311
- "You can load your snippets from a code snippets (.xml) export file using "
312
- "this page."
313
- msgstr ""
314
-
315
- #: includes/help/import.php:15
316
- msgid ""
317
- "Snippets will be added to the database along with your existing snippets. "
318
- "Regardless of whether the snippets were active on the previous site, "
319
- "imported snippets are always inactive until activated using the <a href=\"%s"
320
- "\">Manage Snippets</a> page.</p>"
321
- msgstr ""
322
-
323
- #: includes/help/import.php:20
324
- msgid "Exporting"
325
- msgstr ""
326
-
327
- #: includes/help/import.php:22
328
- msgid ""
329
- "You can save your snippets to a Code Snippets (.xml) export file using the "
330
- "<a href=\"%s\">Manage Snippets</a> page."
331
- msgstr ""
332
-
333
- #: includes/help/import.php:26 includes/help/manage.php:27
334
- #: includes/help/single.php:31
335
- msgid "For more information:"
336
- msgstr ""
337
-
338
- #: includes/help/import.php:27 includes/help/single.php:32
339
- msgid ""
340
- "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank"
341
- "\">WordPress Extend</a>"
342
- msgstr ""
343
-
344
- #: includes/help/import.php:28 includes/help/manage.php:29
345
- #: includes/help/single.php:33
346
- msgid ""
347
- "<a href=\"http://wordpress.org/support/plugin/code-snippets\" target=\"_blank"
348
- "\">Support Forums</a>"
349
- msgstr ""
350
-
351
- #: includes/help/import.php:29 includes/help/manage.php:30
352
- #: includes/help/single.php:34
353
- msgid ""
354
- "<a href=\"http://code-snippets.bungeshea.com/\" target=\"_blank\">Project "
355
- "Website</a>"
356
- msgstr ""
357
-
358
- #: includes/help/manage.php:7
359
- msgid ""
360
- "Snippets are similar to plugins - they both extend and expand the "
361
- "functionality of WordPress. Snippets are more light-weight, just a few lines "
362
- "of code, and do not put as much load on your server. Here you can manage "
363
- "your existing snippets and preform tasks on them such as activating, "
364
- "deactivating, deleting and exporting."
365
- msgstr ""
366
-
367
- #: includes/help/manage.php:12
368
- msgid "Safe Mode"
369
- msgstr ""
370
-
371
- #: includes/help/manage.php:14
372
- msgid ""
373
- "Be sure to check your snippets for errors before you activate them, as a "
374
- "faulty snippet could bring your whole blog down. If your site starts doing "
375
- "strange things, deactivate all your snippets and activate them one at a time."
376
- msgstr ""
377
-
378
- #: includes/help/manage.php:15
379
- msgid ""
380
- "If something goes wrong with a snippet and you can't use WordPress, you can "
381
- "cause all snippets to stop executing by adding <code>define"
382
- "('CODE_SNIPPETS_SAFE_MODE', true);</code> to your <code>wp-config.php</code> "
383
- "file. After you have deactivated the offending snippet, you can turn off "
384
- "safe mode by removing this line or replacing <strong>true</strong> with "
385
- "<strong>false</strong>."
386
- msgstr ""
387
-
388
- #: includes/help/manage.php:20
389
- msgid "Uninstall"
390
- msgstr ""
391
-
392
- #: includes/help/manage.php:22
393
- msgid ""
394
- "When you delete Code Snippets through the Plugins menu in WordPress it will "
395
- "clear up the <code>%1$s</code> table and a few other bits of data stored in "
396
- "the database. If you want to keep this data (ie: you are only temporally "
397
- "uninstalling Code Snippets) then remove the <code>%2$s</code> folder using "
398
- "FTP."
399
- msgstr ""
400
-
401
- #: includes/help/manage.php:23
402
- msgid ""
403
- "Even if you're sure that you don't want to use Code Snippets ever again on "
404
- "this WordPress installation, you may want to use the export feature to back "
405
- "up your snippets."
406
- msgstr ""
407
-
408
- #: includes/help/manage.php:28
409
- msgid ""
410
- "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank"
411
- "\">WordPress Extend</a></p>"
412
- msgstr ""
413
-
414
- #: includes/help/single.php:7
415
- msgid ""
416
- "Snippets are similar to plugins - they both extend and expand the "
417
- "functionality of WordPress. Snippets are more light-weight, just a few lines "
418
- "of code, and do not put as much load on your server. Here you can add a new "
419
- "snippet, or edit an existing one."
420
- msgstr ""
421
-
422
- #: includes/help/single.php:11
423
- msgid "Finding Snippets"
424
- msgstr ""
425
-
426
- #: includes/help/single.php:13
427
- msgid ""
428
- "Here are some links to websites which host a large number of snippets that "
429
- "you can add to your site.\r\n"
430
- "\t\t<ul>\r\n"
431
- "\t\t\t<li><a href=\"http://wp-snippets.com\" title=\"WordPress Snippets\">WP-"
432
- "Snippets</a></li>\r\n"
433
- "\t\t\t<li><a href=\"http://wpsnipp.com\" title=\"WP Snipp\">WP Snipp</a></li>"
434
- "\r\n"
435
- "\t\t\t<li><a href=\"http://www.catswhocode.com/blog/snippets\" title=\"Cats "
436
- "Who Code Snippet Library\">Cats Who Code</a></li>\r\n"
437
- "\t\t\t<li><a href=\"http://www.wpfunction.me\">WP Function Me</a></li>\r\n"
438
- "\t\t</ul>"
439
- msgstr ""
440
-
441
- #: includes/help/single.php:20
442
- msgid ""
443
- "More places to find snippets, as well as a selection of example snippets, "
444
- "can be found in the <a href=\"http://code-snippets.bungeshea.com/docs/"
445
- "finding-snippets/\">plugin documentation</a>"
446
- msgstr ""
447
-
448
- #: includes/help/single.php:24
449
- msgid "Adding Snippets"
450
- msgstr ""
451
-
452
- #: includes/help/single.php:26
453
- msgid ""
454
- "You need to fill out the name and code fields for your snippet to be added. "
455
- "While the description field will add more information about how your snippet "
456
- "works, what is does and where you found it, it is completely optional."
457
- msgstr ""
458
-
459
- #: includes/help/single.php:27
460
- msgid ""
461
- "Please be sure to check that your snippet is valid PHP code and will not "
462
- "produce errors before adding it through this page. While doing so will not "
463
- "become active straight away, it will help to minimise the chance of a faulty "
464
- "snippet becoming active on your site."
465
- msgstr ""
466
-
467
- #. Plugin URI of the plugin/theme
468
- msgid "http://code-snippets.bungeshea.com"
469
- msgstr ""
470
-
471
- #. Description of the plugin/theme
472
- msgid ""
473
- "An easy, clean and simple way to add code snippets to your site. No need to "
474
- "edit to your theme's functions.php file again!"
475
- msgstr ""
476
-
477
- #. Author of the plugin/theme
478
- msgid "Shea Bunge"
479
- msgstr ""
480
-
481
- #. Author URI of the plugin/theme
482
- msgid "http://bungeshea.com"
483
- msgstr ""
1
+ # This file is distributed under the same license as the Code Snippets package.
2
+ msgid ""
3
+ msgstr ""
4
+ "PO-Revision-Date: 2013-03-27 15:45:42+0000\n"
5
+ "MIME-Version: 1.0\n"
6
+ "Content-Type: text/plain; charset=UTF-8\n"
7
+ "Content-Transfer-Encoding: 8bit\n"
8
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
9
+ "X-Generator: GlotPress/0.1\n"
10
+ "Project-Id-Version: Code Snippets\n"
11
+
12
+ #: code-snippets.php:0 code-snippets.php:262
13
+ msgid "Code Snippets"
14
+ msgstr ""
15
+
16
+ #: code-snippets.php:0
17
+ msgid "An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!"
18
+ msgstr ""
19
+
20
+ #: code-snippets.php:0
21
+ msgid "Shea Bunge"
22
+ msgstr ""
23
+
24
+ #: code-snippets.php:0
25
+ msgid "http://bungeshea.com"
26
+ msgstr ""
27
+
28
+ #: code-snippets.php:577 code-snippets.php:578 code-snippets.php:588
29
+ #: includes/admin/manage.php:36
30
+ msgid "Snippets"
31
+ msgstr ""
32
+
33
+ #: code-snippets.php:612 code-snippets.php:1145 includes/admin/single.php:45
34
+ msgid "Add New Snippet"
35
+ msgstr ""
36
+
37
+ #: code-snippets.php:613
38
+ msgid "Add New"
39
+ msgstr ""
40
+
41
+ #: code-snippets.php:641 includes/admin/import.php:34
42
+ msgid "Import Snippets"
43
+ msgstr ""
44
+
45
+ #: code-snippets.php:642
46
+ msgid "Import"
47
+ msgstr ""
48
+
49
+ #: code-snippets.php:601 code-snippets.php:1146 includes/admin/single.php:37
50
+ msgid "Edit Snippet"
51
+ msgstr ""
52
+
53
+ #: code-snippets.php:1465
54
+ msgid "Manage your existing snippets"
55
+ msgstr ""
56
+
57
+ #: code-snippets.php:589 code-snippets.php:1466
58
+ msgid "Manage"
59
+ msgstr ""
60
+
61
+ #: code-snippets.php:1486
62
+ msgid "Visit the WordPress.org plugin page"
63
+ msgstr ""
64
+
65
+ #: code-snippets.php:1487
66
+ msgid "About"
67
+ msgstr ""
68
+
69
+ #: code-snippets.php:1491
70
+ msgid "Visit the support forums"
71
+ msgstr ""
72
+
73
+ #: code-snippets.php:1492
74
+ msgid "Support"
75
+ msgstr ""
76
+
77
+ #: code-snippets.php:1496
78
+ msgid "Support this plugin's development"
79
+ msgstr ""
80
+
81
+ #: code-snippets.php:1497
82
+ msgid "Donate"
83
+ msgstr ""
84
+
85
+ #: includes/admin/import.php:38
86
+ msgid "Howdy! Upload your Code Snippets export file and we&#8217;ll import the snippets to this site."
87
+ msgstr ""
88
+
89
+ #: includes/admin/import.php:40
90
+ msgid "You will need to go to the <a href=\"%s\">Manage Snippets</a> page to activate the imported snippets."
91
+ msgstr ""
92
+
93
+ #: includes/admin/import.php:42
94
+ msgid "Choose a Code Snippets (.xml) file to upload, then click Upload file and import."
95
+ msgstr ""
96
+
97
+ #: includes/admin/import.php:46
98
+ msgid "Choose a file from your computer:"
99
+ msgstr ""
100
+
101
+ #: includes/admin/import.php:46
102
+ msgid "(Maximum size: 8MB)"
103
+ msgstr ""
104
+
105
+ #: includes/admin/import.php:55
106
+ msgid "Upload file and import"
107
+ msgstr ""
108
+
109
+ #: includes/admin/manage.php:21
110
+ msgid "Snippet <strong>activated</strong>."
111
+ msgstr ""
112
+
113
+ #: includes/admin/manage.php:23
114
+ msgid "Selected snippets <strong>activated</strong>."
115
+ msgstr ""
116
+
117
+ #: includes/admin/manage.php:25
118
+ msgid "Snippet <strong>deactivated</strong>."
119
+ msgstr ""
120
+
121
+ #: includes/admin/manage.php:27
122
+ msgid "Selected snippets <strong>deactivated</strong>."
123
+ msgstr ""
124
+
125
+ #: includes/admin/manage.php:29
126
+ msgid "Snippet <strong>deleted</strong>."
127
+ msgstr ""
128
+
129
+ #: includes/admin/manage.php:31
130
+ msgid "Selected snippets <strong>deleted</strong>."
131
+ msgstr ""
132
+
133
+ #: includes/admin/manage.php:38 includes/admin/single.php:42
134
+ msgctxt "snippet"
135
+ msgid "Add New"
136
+ msgstr ""
137
+
138
+ #: includes/admin/manage.php:47
139
+ msgid "Search Installed Snippets"
140
+ msgstr ""
141
+
142
+ #: includes/admin/single.php:22
143
+ msgid "Please provide a name for the snippet and its code."
144
+ msgstr ""
145
+
146
+ #: includes/admin/single.php:28
147
+ msgid "Snippet <strong>updated</strong>."
148
+ msgstr ""
149
+
150
+ #: includes/admin/single.php:30
151
+ msgid "Snippet <strong>added</strong>."
152
+ msgstr ""
153
+
154
+ #: includes/admin/single.php:55 includes/admin/single.php:56
155
+ msgid "Name (short title)"
156
+ msgstr ""
157
+
158
+ #: includes/admin/single.php:61
159
+ msgid "Code"
160
+ msgstr ""
161
+
162
+ #: code-snippets.php:1433 includes/class-list-table.php:189
163
+ msgid "Description"
164
+ msgstr ""
165
+
166
+ #: code-snippets.php:1434
167
+ msgid "(Optional)"
168
+ msgstr ""
169
+
170
+ #: includes/class-list-table.php:36
171
+ msgid "Snippets per page"
172
+ msgstr ""
173
+
174
+ #: code-snippets.php:1118 includes/class-list-table.php:127
175
+ #: includes/class-list-table.php:213
176
+ msgid "Network Deactivate"
177
+ msgstr ""
178
+
179
+ #: code-snippets.php:1118 includes/class-list-table.php:127
180
+ #: includes/class-list-table.php:213
181
+ msgid "Deactivate"
182
+ msgstr ""
183
+
184
+ #: code-snippets.php:1127 includes/class-list-table.php:137
185
+ #: includes/class-list-table.php:212
186
+ msgid "Network Activate"
187
+ msgstr ""
188
+
189
+ #: code-snippets.php:1127 includes/class-list-table.php:137
190
+ #: includes/class-list-table.php:212
191
+ msgid "Activate"
192
+ msgstr ""
193
+
194
+ #: includes/class-list-table.php:187
195
+ msgid "Name"
196
+ msgstr ""
197
+
198
+ #: includes/class-list-table.php:188
199
+ msgid "ID"
200
+ msgstr ""
201
+
202
+ #: includes/class-list-table.php:147 includes/class-list-table.php:214
203
+ msgid "Export"
204
+ msgstr ""
205
+
206
+ #: includes/class-list-table.php:155 includes/class-list-table.php:215
207
+ msgid "Delete"
208
+ msgstr ""
209
+
210
+ #: includes/class-list-table.php:216
211
+ msgid "Export to PHP"
212
+ msgstr ""
213
+
214
+ #: includes/class-list-table.php:236
215
+ msgid "All <span class=\"count\">(%s)</span>"
216
+ msgid_plural "All <span class=\"count\">(%s)</span>"
217
+ msgstr[0] ""
218
+ msgstr[1] ""
219
+
220
+ #: includes/class-list-table.php:239
221
+ msgid "Active <span class=\"count\">(%s)</span>"
222
+ msgid_plural "Active <span class=\"count\">(%s)</span>"
223
+ msgstr[0] ""
224
+ msgstr[1] ""
225
+
226
+ #: includes/class-list-table.php:242
227
+ msgid "Recently Active <span class=\"count\">(%s)</span>"
228
+ msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
229
+ msgstr[0] ""
230
+ msgstr[1] ""
231
+
232
+ #: includes/class-list-table.php:245
233
+ msgid "Inactive <span class=\"count\">(%s)</span>"
234
+ msgid_plural "Inactive <span class=\"count\">(%s)</span>"
235
+ msgstr[0] ""
236
+ msgstr[1] ""
237
+
238
+ #: includes/class-list-table.php:279
239
+ msgid "Clear List"
240
+ msgstr ""
241
+
242
+ #: includes/class-list-table.php:374
243
+ msgid "You do not appear to have any snippets available at this time. <a href=\"%s\">Add New&rarr;</a>"
244
+ msgstr ""
245
+
246
+ #: includes/help/import.php:5 includes/help/manage.php:5
247
+ #: includes/help/single.php:5
248
+ msgid "Overview"
249
+ msgstr ""
250
+
251
+ #: includes/help/import.php:7
252
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can load snippets from a Code Snippets (.xml) import file into the database with your existing snippets."
253
+ msgstr ""
254
+
255
+ #: includes/help/import.php:12
256
+ msgid "Importing"
257
+ msgstr ""
258
+
259
+ #: includes/help/import.php:15
260
+ msgid "Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href=\"%s\">Manage Snippets</a> page.</p>"
261
+ msgstr ""
262
+
263
+ #: includes/help/import.php:20
264
+ msgid "Exporting"
265
+ msgstr ""
266
+
267
+ #: includes/help/import.php:22
268
+ msgid "You can save your snippets to a Code Snippets (.xml) export file using the <a href=\"%s\">Manage Snippets</a> page."
269
+ msgstr ""
270
+
271
+ #: includes/help/import.php:26 includes/help/manage.php:27
272
+ #: includes/help/single.php:31
273
+ msgid "For more information:"
274
+ msgstr ""
275
+
276
+ #: includes/help/import.php:27 includes/help/single.php:32
277
+ msgid "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank\">WordPress Extend</a>"
278
+ msgstr ""
279
+
280
+ #: includes/help/import.php:28 includes/help/manage.php:29
281
+ #: includes/help/single.php:33
282
+ msgid "<a href=\"http://wordpress.org/support/plugin/code-snippets\" target=\"_blank\">Support Forums</a>"
283
+ msgstr ""
284
+
285
+ #: includes/help/manage.php:7
286
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can manage your existing snippets and preform tasks on them such as activating, deactivating, deleting and exporting."
287
+ msgstr ""
288
+
289
+ #: includes/help/manage.php:12
290
+ msgid "Safe Mode"
291
+ msgstr ""
292
+
293
+ #: includes/help/manage.php:14
294
+ msgid "Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time."
295
+ msgstr ""
296
+
297
+ #: includes/help/manage.php:20
298
+ msgid "Uninstall"
299
+ msgstr ""
300
+
301
+ #: includes/help/manage.php:22
302
+ msgid "When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>%1$s</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>%2$s</code> folder using FTP."
303
+ msgstr ""
304
+
305
+ #: includes/help/manage.php:23
306
+ msgid "Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets."
307
+ msgstr ""
308
+
309
+ #: includes/help/manage.php:28
310
+ msgid "<a href=\"http://wordpress.org/extend/plugins/code-snippets\" target=\"_blank\">WordPress Extend</a></p>"
311
+ msgstr ""
312
+
313
+ #: includes/help/single.php:7
314
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can add a new snippet, or edit an existing one."
315
+ msgstr ""
316
+
317
+ #: includes/help/single.php:11
318
+ msgid "Finding Snippets"
319
+ msgstr ""
320
+
321
+ #: includes/help/single.php:13
322
+ msgid ""
323
+ "Here are some links to websites which host a large number of snippets that you can add to your site.\n"
324
+ "\t\t<ul>\n"
325
+ "\t\t\t<li><a href=\"http://wp-snippets.com\" title=\"WordPress Snippets\">WP-Snippets</a></li>\n"
326
+ "\t\t\t<li><a href=\"http://wpsnipp.com\" title=\"WP Snipp\">WP Snipp</a></li>\n"
327
+ "\t\t\t<li><a href=\"http://www.catswhocode.com/blog/snippets\" title=\"Cats Who Code Snippet Library\">Cats Who Code</a></li>\n"
328
+ "\t\t\t<li><a href=\"http://www.wpfunction.me\">WP Function Me</a></li>\n"
329
+ "\t\t</ul>"
330
+ msgstr ""
331
+
332
+ #: includes/help/single.php:24
333
+ msgid "Adding Snippets"
334
+ msgstr ""
335
+
336
+ #: includes/help/single.php:26
337
+ msgid "You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional."
338
+ msgstr ""
339
+
340
+ #: includes/help/single.php:27
341
+ msgid "Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site."
342
+ msgstr ""
343
+
344
+ #: code-snippets.php:0
345
+ msgid "http://code-snippets.bungeshea.com"
346
+ msgstr ""
347
+
348
+ #: code-snippets.php:263
349
+ msgid "Import snippets from a <strong>Code Snippets</strong> export file"
350
+ msgstr ""
351
+
352
+ #: includes/admin/import.php:20
353
+ msgid "Imported <strong>%d</strong> snippet."
354
+ msgid_plural "Imported <strong>%d</strong> snippets."
355
+ msgstr[0] ""
356
+ msgstr[1] ""
357
+
358
+ #: includes/help/import.php:29 includes/help/manage.php:30
359
+ #: includes/help/single.php:34
360
+ msgid "<a href=\"http://code-snippets.bungeshea.com/\" target=\"_blank\">Project Website</a>"
361
+ msgstr ""
362
+
363
+ #: includes/help/manage.php:15
364
+ msgid "If something goes wrong with a snippet and you can't use WordPress, you can cause all snippets to stop executing by adding <code>define('CODE_SNIPPETS_SAFE_MODE', true);</code> to your <code>wp-config.php</code> file. After you have deactivated the offending snippet, you can turn off safe mode by removing this line or replacing <strong>true</strong> with <strong>false</strong>."
365
+ msgstr ""
366
+
367
+ #: includes/help/single.php:20
368
+ msgid "More places to find snippets, as well as a selection of example snippets, can be found in the <a href=\"http://code-snippets.bungeshea.com/docs/finding-snippets/\">plugin documentation</a>"
369
+ msgstr ""
370
+
371
+ #: code-snippets.php:0
372
+ msgid "1.7"
373
+ msgstr ""
374
+
375
+ #: code-snippets.php:602 includes/class-list-table.php:142
376
+ msgid "Edit"
377
+ msgstr ""
378
+
379
+ #: code-snippets.php:1227
380
+ msgid "Sorry, you're not allowed to edit snippets"
381
+ msgstr ""
382
+
383
+ #: includes/admin/single.php:24
384
+ msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
385
+ msgstr ""
386
+
387
+ #: includes/admin/single.php:26
388
+ msgid "Snippet <strong>added</strong> and <strong>activated</strong>."
389
+ msgstr ""
390
+
391
+ #: includes/class-list-table.php:163
392
+ msgid ""
393
+ "You are about to permanently delete the selected item.\n"
394
+ "\t\t\t\t'Cancel' to stop, 'OK' to delete."
395
+ msgstr ""
396
+
397
+ #: includes/class-list-table.php:270
398
+ msgid "Filter"
399
+ msgstr ""
400
+
401
+ #: includes/class-list-table.php:541
402
+ msgid "Search results"
403
+ msgstr ""
404
+
405
+ #: includes/class-list-table.php:544
406
+ msgid " for &#8220;%s&#8221;"
407
+ msgstr ""
408
+
409
+ #: includes/class-list-table.php:550
410
+ msgid "Clear Filters"
411
+ msgstr ""
412
+
413
+ #: includes/help/import.php:14
414
+ msgid "You can load your snippets from a code snippets (.xml) export file using this page."
415
+ msgstr ""
416
+
417
+ #: includes/admin/single.php:74
418
+ msgid "Save Changes &amp; Activate"
419
+ msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: bungeshea
3
  Donate link: http://code-snippets.bungeshea.com/donate/
4
  Tags: code-snippets, snippets, code, php, network, multisite
5
  Requires at least: 3.3
6
- Tested up to: 3.5.1
7
- Stable tag: 1.7
8
  License: MIT
9
  License URI: license.txt
10
 
@@ -22,6 +22,8 @@ You can use a graphical interface, similar to the Plugins menu, to manage, activ
22
 
23
  Although Code Snippets is designed to be easy-to-use and its interface looks, feels and acts as if it was a native part of WordPress, each screen includes a help tab, just in case you get stuck.
24
 
 
 
25
  Further information, documentation and updates are available on the [plugin homepage](http://code-snippets.bungeshea.com). You can also contribute to the code at [GitHub](https://github.com/bungeshea/code-snippets).
26
 
27
  [As featured on the WPMU blog](http://wpmu.org/wordpress-code-snippets)
@@ -109,6 +111,15 @@ That's fantastic! Join me on [GitHub](https://github.com/bungeshea/code-snippets
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
 
 
112
  = 1.7 =
113
  * Improved plugin API
114
  * Fixed a bug with saving snippets per page option ([#](http://wordpress.org/support/topic/plugin-code-snippets-snippets-per-page-does-not-work#post-3710991))
@@ -193,6 +204,9 @@ Plugin updates will be posted on the [plugin's homepage](http://code-snippets.bu
193
 
194
  == Upgrade Notice ==
195
 
 
 
 
196
  = 1.7 =
197
  Many improvments and optimization. Download "Code Snippets Tags" plugin to add tags to snippets
198
 
@@ -217,4 +231,4 @@ Added code highlighting |
217
  Plugin data will now be cleaned up when you delete the plugin.
218
 
219
  = 1.1 =
220
- Minor bug fixes and improvements on the the 'Edit Snippet' page
3
  Donate link: http://code-snippets.bungeshea.com/donate/
4
  Tags: code-snippets, snippets, code, php, network, multisite
5
  Requires at least: 3.3
6
+ Tested up to: 3.6
7
+ Stable tag: 1.7.1
8
  License: MIT
9
  License URI: license.txt
10
 
22
 
23
  Although Code Snippets is designed to be easy-to-use and its interface looks, feels and acts as if it was a native part of WordPress, each screen includes a help tab, just in case you get stuck.
24
 
25
+ An addon-plugin for Code Snippets is available: [Code Snippets Tags](http://wordpress.org/extend/plugins/code-snippets-tags) will allow you to assign tags to your snippets and organize them in the table.
26
+
27
  Further information, documentation and updates are available on the [plugin homepage](http://code-snippets.bungeshea.com). You can also contribute to the code at [GitHub](https://github.com/bungeshea/code-snippets).
28
 
29
  [As featured on the WPMU blog](http://wpmu.org/wordpress-code-snippets)
111
 
112
  == Changelog ==
113
 
114
+ = 1.7.1 =
115
+ * Fix a bug with snippet being set as deactivated when saved
116
+ * Updated PHP Documentation completely. [[View online](http://bungeshea.github.io/code-snippets/api)]
117
+ * Only load admin functions when viewing dashboard
118
+ * Added German translation thanks to [David Decker](http://deckerweb.de)
119
+ * Allow or deny site administrators access to snippet admin menus. Set your preference in the **Enable Administration Menus** setting under the *Settings > Network Settings* network admin menu.
120
+ * Improve database table creation and upgrade process
121
+ * Optimized to use less database queries
122
+
123
  = 1.7 =
124
  * Improved plugin API
125
  * Fixed a bug with saving snippets per page option ([#](http://wordpress.org/support/topic/plugin-code-snippets-snippets-per-page-does-not-work#post-3710991))
204
 
205
  == Upgrade Notice ==
206
 
207
+ = 1.7.1 =
208
+ Added German translation thanks to David Decker; bug fixes and improvements
209
+
210
  = 1.7 =
211
  Many improvments and optimization. Download "Code Snippets Tags" plugin to add tags to snippets
212
 
231
  Plugin data will now be cleaned up when you delete the plugin.
232
 
233
  = 1.1 =
234
+ Minor bug fixes and improvements on the the 'Edit Snippet' page