Version Description
- Added export option to 'Manage Snippets' page
- Added 'Import Snippets' page
Download this release
Release Info
Developer | bungeshea |
Plugin | Code Snippets |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- code-snippets.php +66 -101
- includes/admin-edit.php +10 -10
- includes/admin-import.php +19 -0
- includes/admin-manage.php +3 -0
- includes/export.php +59 -0
- includes/help/admin-edit-help.php +47 -0
- includes/help/admin-import-help.php +29 -0
- includes/help/admin-manage-help.php +30 -0
- readme.txt +18 -7
code-snippets.php
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/*
|
4 |
Plugin Name: Code Snippets
|
5 |
Plugin URI: http://bungeshea.wordpress.com/plugins/code-snippets/
|
6 |
Description: Provides an easy-to-manage GUI interface for adding code snippets to your blog.
|
7 |
Author: Shea Bunge
|
8 |
-
Version: 1.
|
9 |
Author URI: http://bungeshea.wordpress.com/
|
10 |
License: GPLv3 or later
|
11 |
|
@@ -33,16 +32,17 @@ if( !class_exists('Code_Snippets') ) :
|
|
33 |
|
34 |
class Code_Snippets {
|
35 |
|
36 |
-
public $table
|
37 |
-
public $version
|
38 |
|
39 |
public $file;
|
40 |
public $plugin_dir;
|
41 |
public $plugin_url;
|
42 |
public $basename;
|
43 |
|
44 |
-
var $admin_manage_url
|
45 |
-
var $admin_edit_url
|
|
|
46 |
|
47 |
public function Code_Snippets() {
|
48 |
$this->setup(); // initialise the varables and run the hooks
|
@@ -54,16 +54,13 @@ class Code_Snippets {
|
|
54 |
function setup() {
|
55 |
global $wpdb;
|
56 |
$this->file = __FILE__;
|
57 |
-
$this->table = $wpdb->prefix . $this->table;
|
58 |
$this->current_version = get_option( 'cs_db_version' );
|
59 |
-
|
60 |
$this->basename = plugin_basename( $this->file );
|
61 |
$this->plugin_dir = plugin_dir_path( $this->file );
|
62 |
$this->plugin_url = plugin_dir_url ( $this->file );
|
63 |
-
|
64 |
-
$this->admin_manage_url = admin_url( 'admin.php?page=' . $this->admin_manage_url );
|
65 |
-
$this->admin_edit_url = admin_url( 'admin.php?page=' . $this->admin_edit_url );
|
66 |
-
|
67 |
add_action( 'admin_menu', array( $this, 'add_admin_menus' ) );
|
68 |
add_filter( 'plugin_action_links_' . $this->basename, array( $this, 'settings_link' ) );
|
69 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), 10, 2 );
|
@@ -87,125 +84,79 @@ class Code_Snippets {
|
|
87 |
}
|
88 |
|
89 |
function upgrade() {
|
90 |
-
if( $this->current_version <
|
91 |
delete_option( 'cs_complete_uninstall' );
|
|
|
|
|
92 |
update_option( 'cs_db_version', $this->version );
|
93 |
}
|
94 |
}
|
95 |
|
96 |
function add_admin_menus() {
|
97 |
-
$this->admin_manage_page = add_menu_page( __('Snippets'), __('Snippets'), 'install_plugins',
|
98 |
-
add_submenu_page('snippets', __('Snippets'), __('Manage Snippets') , 'install_plugins',
|
99 |
-
$this->admin_edit_page = add_submenu_page( 'snippets', __('Add New Snippet'), __('Add New'), 'install_plugins',
|
|
|
100 |
|
|
|
|
|
|
|
|
|
101 |
add_action( "admin_print_styles-$this->admin_manage_page", array( $this, 'load_stylesheet' ), 5 );
|
102 |
add_action( "admin_print_styles-$this->admin_edit_page", array( $this, 'load_stylesheet' ), 5 );
|
|
|
103 |
add_action( "admin_print_scripts-$this->admin_edit_page", array( $this, 'load_editarea' ), 5 );
|
104 |
-
add_action( "load-$this->admin_manage_page", array( $this, '
|
105 |
-
add_action( "load-$this->admin_edit_page", array( $this, '
|
|
|
106 |
}
|
107 |
|
108 |
function load_stylesheet() {
|
109 |
-
wp_enqueue_style('code-snippets
|
110 |
}
|
111 |
|
112 |
function load_editarea() {
|
113 |
-
wp_register_script( 'editarea', plugins_url( 'includes/edit_area/edit_area_full.js', $this->file ),
|
114 |
wp_enqueue_script( 'editarea' );
|
115 |
}
|
116 |
|
117 |
-
function
|
118 |
|
119 |
-
$
|
120 |
-
$screen->add_help_tab( array(
|
121 |
-
'id' => 'overview',
|
122 |
-
'title' => 'Overview',
|
123 |
-
'content' =>
|
124 |
-
"<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 manage your existing snippets and preform tasks on them such as activating, deactivating, deleting and exporting.</p>"
|
125 |
-
) );
|
126 |
-
$screen->add_help_tab( array(
|
127 |
-
'id' => 'compatibility-problems',
|
128 |
-
'title' => 'Troubleshooting',
|
129 |
-
'content' =>
|
130 |
-
"<p>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.</p>" .
|
131 |
-
"<p>If something goes wrong with a snippet and you can’t use WordPress, you can use a database manager like phpMyAdmin to access the <code>$this->table</code> table in your WordPress database. Locate the offending snippet (if you know which one is the trouble) and change the 1 in the 'active' column into a 0. If this doesn't work try doing this for all snippets.<br/>You can also delete or rename the <code>$this->table</code> table and the table will automaticly be reconstructed so you can re-add snippets one at a time.</p>"
|
132 |
-
) );
|
133 |
|
134 |
-
$
|
135 |
-
'
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
$
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
);
|
148 |
}
|
149 |
|
150 |
function admin_edit_title( $title ) {
|
151 |
return str_ireplace( 'Add New Snippet', 'Edit Snippet', $title );
|
152 |
}
|
153 |
|
154 |
-
function
|
155 |
|
156 |
if( isset( $_GET['action'] ) && @$_GET['action'] == 'edit' )
|
157 |
add_filter( 'admin_title', array( $this, 'admin_edit_title' ) );
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
"<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.</p>"
|
165 |
-
) );
|
166 |
-
$screen->add_help_tab( array(
|
167 |
-
'id' => 'finding',
|
168 |
-
'title' => 'Finding Snippets',
|
169 |
-
'content' =>
|
170 |
-
"<p>Here are some links to websites which host a large number of snippets that you can add to your site.
|
171 |
-
<ul>
|
172 |
-
<li><a href='http://wp-snippets.com' title='WordPress Snippets'>WP-Snippets</a></li>
|
173 |
-
<li><a href='http://wpsnipp.com' title='WP Snipp'>WP Snipp</a></li>
|
174 |
-
<li><a href='http://www.catswhocode.com/blog/snippets' title='Cats Who Code Snippet Library'>Cats Who Code</a></li>
|
175 |
-
<li><a href='http://wpmu.org'>WPMU - The WordPress Experts</a></li>
|
176 |
-
</ul>
|
177 |
-
And below is a selection of snippets to get you started:
|
178 |
-
<ul>
|
179 |
-
<li><a title='Track post views using post meta' href='http://wpsnipp.com/index.php/functions-php/track-post-views-without-a-plugin-using-post-meta/' >Track post views using post meta</a></li>
|
180 |
-
<li><a title='Disable Admin Bar' href='http://wp-snippets.com/disable-wp-3-1-admin-bar/'>Disable Admin Bar</a></li>
|
181 |
-
<li><a title='Disable the Visual Editor' href='http://wp-snippets.com/disable-the-visual-editor/'>Disable the Visual Editor</a></li>
|
182 |
-
<li><a title='Change Admin Logo' href='http://wp-snippets.com/change-admin-logo/'>Change Admin Logo</a></li>
|
183 |
-
<li><a title='Display Code in Posts' href='http://wp-snippets.com/code-in-posts/'>Display Code in Posts</a></li>
|
184 |
-
<li><a title='Grab Tweets from Twitter Feed' href='http://www.catswhocode.com/blog/snippets/grab-tweets-from-twitter-feed'>Grab Tweets from Twitter Feed</a></li>
|
185 |
-
<li><a title='Watermark images on the fly' href='http://www.catswhocode.com/blog/snippets/watermark-images-on-the-fly'>Watermark images on the fly</a></li>
|
186 |
-
<li><a title='Display number of Facebook fans in full text' href='http://www.catswhocode.com/blog/snippets/display-number-of-facebook-fans-in-full-text'>Display number of Facebook fans in full text</a></li>
|
187 |
-
</ul>
|
188 |
-
Snippets can be installed through the <a href='$this->admin_edit_url'>Add New Snippet</a> page or by addng them to the <code>$this->table</code> table in the database (Warning: for advanced users only). Once a snippet has been installed, you can activate it here.</p>"
|
189 |
-
) );
|
190 |
-
$screen->add_help_tab( array(
|
191 |
-
'id' => 'adding',
|
192 |
-
'title' => 'Adding Snippets',
|
193 |
-
'content' =>
|
194 |
-
"<p>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.</p>" .
|
195 |
-
"<p>Make sure that you don't add the <code><?php</code>, <code><?</code> or <code>?></code> the beginning and end of the code. You can however use these tags in the code to stop and start PHP sections</p>" .
|
196 |
-
"<p>Please be sure to check thst your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straght away, it will help to minimise the chance of a faulty snippet becoming active on your site.</p>"
|
197 |
-
) );
|
198 |
-
|
199 |
-
$screen->set_help_sidebar(
|
200 |
-
"<p><strong>For more information:</strong></p>" .
|
201 |
-
"<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
|
202 |
-
"<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
|
203 |
-
"<p><a href='http://bungeshea.wordpress.com/plugins/code-snippets' target='_blank'>SheaPress</a></p>"
|
204 |
-
);
|
205 |
}
|
206 |
|
207 |
function bulk_action( $action, $ids ) {
|
208 |
-
if( !isset( $action ) && !isset( $ids ) && !is_array( $ids ) )
|
209 |
return false;
|
210 |
global $wpdb;
|
211 |
$count = 0;
|
@@ -237,7 +188,7 @@ class Code_Snippets {
|
|
237 |
}
|
238 |
}
|
239 |
|
240 |
-
function
|
241 |
global $wpdb;
|
242 |
|
243 |
$this->bulk_action( @$_POST['action'], @$_POST['ids'] );
|
@@ -261,7 +212,7 @@ class Code_Snippets {
|
|
261 |
require_once $this->plugin_dir . 'includes/admin-manage.php';
|
262 |
}
|
263 |
|
264 |
-
function
|
265 |
global $wpdb;
|
266 |
if( isset( $_POST['save_snippet'] ) ) {
|
267 |
$name = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_name' ] ) );
|
@@ -269,8 +220,8 @@ class Code_Snippets {
|
|
269 |
$code = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_code'] ) );
|
270 |
|
271 |
if( strlen( $name ) && strlen( $code ) ) {
|
272 |
-
if( isset($_POST['edit_id'] ) ) {
|
273 |
-
$wpdb->
|
274 |
description='".$description."',
|
275 |
code='".$code."'
|
276 |
where id=" . intval($_POST["edit_id"]." limit 1"));
|
@@ -288,6 +239,19 @@ class Code_Snippets {
|
|
288 |
require_once $this->plugin_dir . 'includes/admin-edit.php';
|
289 |
}
|
290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
function settings_link( $links ) {
|
292 |
array_unshift( $links, '<a href="' . $this->admin_manage_url . '" title="Manage your existing snippets">' . __('Manage') . '</a>' );
|
293 |
return $links;
|
@@ -304,6 +268,7 @@ class Code_Snippets {
|
|
304 |
}
|
305 |
|
306 |
function run_snippets() {
|
|
|
307 |
global $wpdb;
|
308 |
// grab the active snippets from the database
|
309 |
$active_snippets = $wpdb->get_results( 'select * FROM `' . $this->table . '` WHERE `active` = 1;' );
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
Plugin Name: Code Snippets
|
4 |
Plugin URI: http://bungeshea.wordpress.com/plugins/code-snippets/
|
5 |
Description: Provides an easy-to-manage GUI interface for adding code snippets to your blog.
|
6 |
Author: Shea Bunge
|
7 |
+
Version: 1.3
|
8 |
Author URI: http://bungeshea.wordpress.com/
|
9 |
License: GPLv3 or later
|
10 |
|
32 |
|
33 |
class Code_Snippets {
|
34 |
|
35 |
+
public $table = 'snippets';
|
36 |
+
public $version = '1.3';
|
37 |
|
38 |
public $file;
|
39 |
public $plugin_dir;
|
40 |
public $plugin_url;
|
41 |
public $basename;
|
42 |
|
43 |
+
var $admin_manage_url = 'snippets';
|
44 |
+
var $admin_edit_url = 'snippet';
|
45 |
+
var $admin_import_url = 'import-snippets';
|
46 |
|
47 |
public function Code_Snippets() {
|
48 |
$this->setup(); // initialise the varables and run the hooks
|
54 |
function setup() {
|
55 |
global $wpdb;
|
56 |
$this->file = __FILE__;
|
57 |
+
$this->table = apply_filters( 'cs_table', $wpdb->prefix . $this->table );
|
58 |
$this->current_version = get_option( 'cs_db_version' );
|
59 |
+
|
60 |
$this->basename = plugin_basename( $this->file );
|
61 |
$this->plugin_dir = plugin_dir_path( $this->file );
|
62 |
$this->plugin_url = plugin_dir_url ( $this->file );
|
63 |
+
|
|
|
|
|
|
|
64 |
add_action( 'admin_menu', array( $this, 'add_admin_menus' ) );
|
65 |
add_filter( 'plugin_action_links_' . $this->basename, array( $this, 'settings_link' ) );
|
66 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), 10, 2 );
|
84 |
}
|
85 |
|
86 |
function upgrade() {
|
87 |
+
if( $this->current_version < 1.2 ) {
|
88 |
delete_option( 'cs_complete_uninstall' );
|
89 |
+
}
|
90 |
+
if( $this->current_version < $this->version ) {
|
91 |
update_option( 'cs_db_version', $this->version );
|
92 |
}
|
93 |
}
|
94 |
|
95 |
function add_admin_menus() {
|
96 |
+
$this->admin_manage_page = add_menu_page( __('Snippets'), __('Snippets'), 'install_plugins', $this->admin_manage_url, array( $this, 'admin_manage' ), $this->plugin_url . 'images/icon16.png', 67 );
|
97 |
+
add_submenu_page('snippets', __('Snippets'), __('Manage Snippets') , 'install_plugins', $this->admin_manage_url, array( $this, 'admin_manage_loader') );
|
98 |
+
$this->admin_edit_page = add_submenu_page( 'snippets', __('Add New Snippet'), __('Add New'), 'install_plugins', $this->admin_edit_url, array( $this, 'admin_edit' ) );
|
99 |
+
$this->admin_import_page = add_submenu_page( 'snippets', __('Import Snippets'), __('Import'), 'install_plugins', $this->admin_import_url, array( $this, 'admin_import' ) );
|
100 |
|
101 |
+
$this->admin_manage_url = admin_url( 'admin.php?page=' . $this->admin_manage_url );
|
102 |
+
$this->admin_edit_url = admin_url( 'admin.php?page=' . $this->admin_edit_url );
|
103 |
+
$this->admin_import_url = admin_url( 'admin.php?page=' . $this->admin_import_url );
|
104 |
+
|
105 |
add_action( "admin_print_styles-$this->admin_manage_page", array( $this, 'load_stylesheet' ), 5 );
|
106 |
add_action( "admin_print_styles-$this->admin_edit_page", array( $this, 'load_stylesheet' ), 5 );
|
107 |
+
add_action( "admin_print_styles-$this->admin_import_page", array( $this, 'load_stylesheet' ), 5 );
|
108 |
add_action( "admin_print_scripts-$this->admin_edit_page", array( $this, 'load_editarea' ), 5 );
|
109 |
+
add_action( "load-$this->admin_manage_page", array( $this, 'admin_manage_loader' ), 5 );
|
110 |
+
add_action( "load-$this->admin_edit_page", array( $this, 'admin_edit_loader' ), 5 );
|
111 |
+
add_action( "load-$this->admin_import_page", array( $this, 'admin_import_loader' ), 5 );
|
112 |
}
|
113 |
|
114 |
function load_stylesheet() {
|
115 |
+
wp_enqueue_style( 'code-snippets', plugins_url( 'css/style.css', $this->file ), false, $this->version );
|
116 |
}
|
117 |
|
118 |
function load_editarea() {
|
119 |
+
wp_register_script( 'editarea', plugins_url( 'includes/edit_area/edit_area_full.js', $this->file ), false, '0.8.2' );
|
120 |
wp_enqueue_script( 'editarea' );
|
121 |
}
|
122 |
|
123 |
+
function admin_manage_loader() {
|
124 |
|
125 |
+
require_once $this->plugin_dir . 'includes/export.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
+
if( isset( $_POST['action'] ) && isset( $_POST['ids'] ) )
|
128 |
+
if( $_POST['action'] == 'export' && is_array( $_POST['ids'] ) )
|
129 |
+
cs_export( $_POST['ids'], $this->table );
|
130 |
+
|
131 |
+
if( isset( $_POST['action2'] ) && isset( $_POST['ids'] ) )
|
132 |
+
if( $_POST['action2'] == 'export' && is_array( $_POST['ids'] ) )
|
133 |
+
cs_export( $_POST['ids'], $this->table );
|
134 |
+
|
135 |
+
if( isset( $_GET['action'] ) && isset( $_GET['id'] ) )
|
136 |
+
if( $_GET['action'] == 'export' )
|
137 |
+
cs_export( $_GET['id'], $this->table );
|
138 |
+
|
139 |
+
require_once $this->plugin_dir . 'includes/help/admin-manage-help.php';
|
|
|
140 |
}
|
141 |
|
142 |
function admin_edit_title( $title ) {
|
143 |
return str_ireplace( 'Add New Snippet', 'Edit Snippet', $title );
|
144 |
}
|
145 |
|
146 |
+
function admin_edit_loader() {
|
147 |
|
148 |
if( isset( $_GET['action'] ) && @$_GET['action'] == 'edit' )
|
149 |
add_filter( 'admin_title', array( $this, 'admin_edit_title' ) );
|
150 |
|
151 |
+
require_once $this->plugin_dir . 'includes/help/admin-edit-help.php';
|
152 |
+
}
|
153 |
+
|
154 |
+
function admin_import_loader() {
|
155 |
+
require_once $this->plugin_dir . 'includes/help/admin-import-help.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
157 |
|
158 |
function bulk_action( $action, $ids ) {
|
159 |
+
if( ! isset( $action ) && ! isset( $ids ) && ! is_array( $ids ) )
|
160 |
return false;
|
161 |
global $wpdb;
|
162 |
$count = 0;
|
188 |
}
|
189 |
}
|
190 |
|
191 |
+
function admin_manage() {
|
192 |
global $wpdb;
|
193 |
|
194 |
$this->bulk_action( @$_POST['action'], @$_POST['ids'] );
|
212 |
require_once $this->plugin_dir . 'includes/admin-manage.php';
|
213 |
}
|
214 |
|
215 |
+
function admin_edit() {
|
216 |
global $wpdb;
|
217 |
if( isset( $_POST['save_snippet'] ) ) {
|
218 |
$name = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_name' ] ) );
|
220 |
$code = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_code'] ) );
|
221 |
|
222 |
if( strlen( $name ) && strlen( $code ) ) {
|
223 |
+
if( isset( $_POST['edit_id'] ) ) {
|
224 |
+
$wpdb->query( "update $this->table set name='".$name."',
|
225 |
description='".$description."',
|
226 |
code='".$code."'
|
227 |
where id=" . intval($_POST["edit_id"]." limit 1"));
|
239 |
require_once $this->plugin_dir . 'includes/admin-edit.php';
|
240 |
}
|
241 |
|
242 |
+
function admin_import() {
|
243 |
+
if( file_exists( $_FILES['cs_import_file']['tmp_name'] ) ) {
|
244 |
+
global $wpdb;
|
245 |
+
$xml = simplexml_load_string( file_get_contents( $_FILES['cs_import_file']['tmp_name'] ) );
|
246 |
+
foreach( $xml->children() as $child ) {
|
247 |
+
$wpdb->query( "insert into $this->table (name,description,code) VALUES ('$child->name','$child->description','$child->code')" );
|
248 |
+
}
|
249 |
+
|
250 |
+
$msg = 'Imported ' . $xml->count() . ' snippets';
|
251 |
+
}
|
252 |
+
require_once( $this->plugin_dir . 'includes/admin-import.php');
|
253 |
+
}
|
254 |
+
|
255 |
function settings_link( $links ) {
|
256 |
array_unshift( $links, '<a href="' . $this->admin_manage_url . '" title="Manage your existing snippets">' . __('Manage') . '</a>' );
|
257 |
return $links;
|
268 |
}
|
269 |
|
270 |
function run_snippets() {
|
271 |
+
if( defined( 'CS_SAFE_MODE' ) ) if( CS_SAFE_MODE ) return;
|
272 |
global $wpdb;
|
273 |
// grab the active snippets from the database
|
274 |
$active_snippets = $wpdb->get_results( 'select * FROM `' . $this->table . '` WHERE `active` = 1;' );
|
includes/admin-edit.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
if( !class_exists( 'Code_Snippets' ) ) exit;
|
3 |
-
$edit = isset( $_GET['
|
4 |
|
5 |
if( $edit )
|
6 |
-
$id = intval( $_GET['id'] );
|
7 |
?>
|
8 |
<div class="wrap">
|
9 |
<div id="icon-snippets" class="icon32"><br /></div><h2><?php
|
@@ -19,33 +19,33 @@ if( $edit )
|
|
19 |
<?php endif; ?>
|
20 |
<form method="post" action="">
|
21 |
<?php if( $edit ) : ?>
|
22 |
-
<?php $
|
23 |
<input type="hidden" name="edit_id" value="<?php echo $id;?>" />
|
24 |
<?php else: ?>
|
25 |
<?php
|
26 |
// define a empty object (or one with default values)
|
27 |
-
$
|
28 |
-
$
|
29 |
-
$
|
30 |
-
$
|
31 |
?>
|
32 |
<?php endif; ?>
|
33 |
|
34 |
<div id="titlediv">
|
35 |
<div id="titlewrap">
|
36 |
<label for="title" style="display:none">Name (short title)</label>
|
37 |
-
<input id="title" type="text" autocomplete="off" size="30" name="snippet_name" value="<?php echo stripslashes( $
|
38 |
</div>
|
39 |
</div>
|
40 |
|
41 |
<label for="snippet_code"><h3 style="display:inline">Code</h3>
|
42 |
<span style="float:right">Enter or paste the snippet code without the <code><?php</code> and <code>?></code> tags.</span></label><br />
|
43 |
-
<textarea id="snippet_code" name="snippet_code" rows="20" spellcheck="false" style="font-family:monospace;width:100%"><?php echo stripslashes( $
|
44 |
<br style="margin: 20px;" />
|
45 |
<div id="desclabel">
|
46 |
<label for="description" style="text-align:center; margin: 10px auto"><h3 style="display:inline">Description</h3> (Optional)</label><br />
|
47 |
</div>
|
48 |
-
<?php wp_editor( htmlspecialchars_decode( stripslashes( $
|
49 |
<p class="submit">
|
50 |
<input tabindex="15" type="submit" name="save_snippet" class="button-primary" value="Save" />
|
51 |
<a href="<?php echo $this->admin_manage_url; ?>" class="button">Cancel</a>
|
1 |
<?php
|
2 |
if( !class_exists( 'Code_Snippets' ) ) exit;
|
3 |
+
$edit = isset( $_GET['id'] ) && intval( @$_GET['id'] );
|
4 |
|
5 |
if( $edit )
|
6 |
+
$id = intval( $_GET['id'] );
|
7 |
?>
|
8 |
<div class="wrap">
|
9 |
<div id="icon-snippets" class="icon32"><br /></div><h2><?php
|
19 |
<?php endif; ?>
|
20 |
<form method="post" action="">
|
21 |
<?php if( $edit ) : ?>
|
22 |
+
<?php $snippet = $wpdb->get_row( "SELECT * FROM `$this->table` WHERE `id` = '$id';" ); ?>
|
23 |
<input type="hidden" name="edit_id" value="<?php echo $id;?>" />
|
24 |
<?php else: ?>
|
25 |
<?php
|
26 |
// define a empty object (or one with default values)
|
27 |
+
$snippet = new stdClass();
|
28 |
+
$snippet->name = '';
|
29 |
+
$snippet->description = '';
|
30 |
+
$snippet->code = '';
|
31 |
?>
|
32 |
<?php endif; ?>
|
33 |
|
34 |
<div id="titlediv">
|
35 |
<div id="titlewrap">
|
36 |
<label for="title" style="display:none">Name (short title)</label>
|
37 |
+
<input id="title" type="text" autocomplete="off" size="30" maxlength="36" name="snippet_name" value="<?php echo stripslashes( $snippet->name ); ?>" placeholder="Name (short title)" required>
|
38 |
</div>
|
39 |
</div>
|
40 |
|
41 |
<label for="snippet_code"><h3 style="display:inline">Code</h3>
|
42 |
<span style="float:right">Enter or paste the snippet code without the <code><?php</code> and <code>?></code> tags.</span></label><br />
|
43 |
+
<textarea id="snippet_code" name="snippet_code" rows="20" spellcheck="false" style="font-family:monospace;width:100%"><?php echo stripslashes( $snippet->code ); ?></textarea>
|
44 |
<br style="margin: 20px;" />
|
45 |
<div id="desclabel">
|
46 |
<label for="description" style="text-align:center; margin: 10px auto"><h3 style="display:inline">Description</h3> (Optional)</label><br />
|
47 |
</div>
|
48 |
+
<?php wp_editor( htmlspecialchars_decode( stripslashes( $snippet->description ) ), 'description', array( 'textarea_name' => 'snippet_description', 'textarea_rows' => 10 ) ); ?>
|
49 |
<p class="submit">
|
50 |
<input tabindex="15" type="submit" name="save_snippet" class="button-primary" value="Save" />
|
51 |
<a href="<?php echo $this->admin_manage_url; ?>" class="button">Cancel</a>
|
includes/admin-import.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<div id="icon-snippets" class="icon32"><br /></div><h2>Import Snippets</h2>
|
3 |
+
<?php if ( isset( $msg ) ) : ?>
|
4 |
+
<div id="message" class="updated fade"><p><?php echo $msg; ?></p></div>
|
5 |
+
<?php endif; ?>
|
6 |
+
<div class="narrow">
|
7 |
+
<p>Howdy! Upload your Code Snippets export file and we’ll import the snippets to this site.</p>
|
8 |
+
<p>You will need to go to the <a href="<?php echo $this->admin_manage_url; ?>">Manage Snippets</a> page to activate the imported snippets.</p>
|
9 |
+
<p>Choose a Code Snippets (.xml) file to upload, then click Upload file and import.</p>
|
10 |
+
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="" name="cs_import">
|
11 |
+
<p>
|
12 |
+
<label for="upload">Choose a file from your computer:</label> (Maximum size: 8MB)
|
13 |
+
<input type="file" id="upload" name="cs_import_file" size="25" accept="text/xml" />
|
14 |
+
<input type="hidden" name="action" value="save" />
|
15 |
+
<input type="hidden" name="max_file_size" value="8388608" />
|
16 |
+
</p>
|
17 |
+
<p class="submit"><input type="submit" name="submit" id="submit" class="button" value="Upload file and import" /></p></form>
|
18 |
+
</div>
|
19 |
+
</div>
|
includes/admin-manage.php
CHANGED
@@ -15,6 +15,7 @@ global $wpdb;
|
|
15 |
<option value='-1' selected='selected'>Bulk Actions</option>
|
16 |
<option value='activate'>Activate</option>
|
17 |
<option value='deactivate'>Deactivate</option>
|
|
|
18 |
<option value='delete'>Delete</option>
|
19 |
</select>
|
20 |
<input type="submit" id="doaction" class="button-secondary" value="Apply" />
|
@@ -45,6 +46,7 @@ global $wpdb;
|
|
45 |
<span class='deactivate'><a href="<?php echo $this->admin_manage_url . '&action=deactivate&id=' . $snippet->id; ?>" title="Deactivate this snippet" class="edit">Deactivate</a> | </span>
|
46 |
<?php endif; ?>
|
47 |
<span class='edit'><a href="<?php echo $this->admin_edit_url . '&action=edit&id=' . $snippet->id; ?>" title="Edit this snippet" class="edit">Edit</a> | </span>
|
|
|
48 |
<span class='delete'><a href="<?php echo $this->admin_manage_url . '&action=delete&id=' . $snippet->id; ?>" title="Delete this snippet" class="delete" onclick="return confirm('Are you sure? This action is non-reversable');">Delete</a></span>
|
49 |
</div>
|
50 |
</td>
|
@@ -71,6 +73,7 @@ global $wpdb;
|
|
71 |
<option value='-1' selected='selected'>Bulk Actions</option>
|
72 |
<option value='activate'>Activate</option>
|
73 |
<option value='deactivate'>Dectivate</option>
|
|
|
74 |
<option value='delete'>Delete</option>
|
75 |
</select>
|
76 |
<input type="submit" id="doaction2" class="button-secondary action" value="Apply" />
|
15 |
<option value='-1' selected='selected'>Bulk Actions</option>
|
16 |
<option value='activate'>Activate</option>
|
17 |
<option value='deactivate'>Deactivate</option>
|
18 |
+
<option value='export'>Export</option>
|
19 |
<option value='delete'>Delete</option>
|
20 |
</select>
|
21 |
<input type="submit" id="doaction" class="button-secondary" value="Apply" />
|
46 |
<span class='deactivate'><a href="<?php echo $this->admin_manage_url . '&action=deactivate&id=' . $snippet->id; ?>" title="Deactivate this snippet" class="edit">Deactivate</a> | </span>
|
47 |
<?php endif; ?>
|
48 |
<span class='edit'><a href="<?php echo $this->admin_edit_url . '&action=edit&id=' . $snippet->id; ?>" title="Edit this snippet" class="edit">Edit</a> | </span>
|
49 |
+
<span class='edit'><a href="<?php echo $this->admin_manage_url . '&action=export&id=' . $snippet->id; ?>" title="Export this snippet" class="edit">Export</a> | </span>
|
50 |
<span class='delete'><a href="<?php echo $this->admin_manage_url . '&action=delete&id=' . $snippet->id; ?>" title="Delete this snippet" class="delete" onclick="return confirm('Are you sure? This action is non-reversable');">Delete</a></span>
|
51 |
</div>
|
52 |
</td>
|
73 |
<option value='-1' selected='selected'>Bulk Actions</option>
|
74 |
<option value='activate'>Activate</option>
|
75 |
<option value='deactivate'>Dectivate</option>
|
76 |
+
<option value='export'>Export</option>
|
77 |
<option value='delete'>Delete</option>
|
78 |
</select>
|
79 |
<input type="submit" id="doaction2" class="button-secondary action" value="Apply" />
|
includes/export.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* cs_export
|
4 |
+
* Exports seleted snippets as a Code Snippets (.xml) export file.
|
5 |
+
*
|
6 |
+
* @package Code Snippets
|
7 |
+
* @since Code Snippets 1.3
|
8 |
+
*/
|
9 |
+
|
10 |
+
if( ! function_exists( 'cs_export') ) :
|
11 |
+
|
12 |
+
function cs_export( $ids, $table ) {
|
13 |
+
|
14 |
+
global $wpdb;
|
15 |
+
|
16 |
+
if( ! isset( $table ) )
|
17 |
+
$table = apply_filters( 'cs_table', $wpdb->prefix . 'snippets' );
|
18 |
+
|
19 |
+
if( ! is_array( $ids ) ) {
|
20 |
+
$ids = array( $ids );
|
21 |
+
}
|
22 |
+
|
23 |
+
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
24 |
+
|
25 |
+
$filename = 'code-snippets.' . $sitename;
|
26 |
+
|
27 |
+
if( count( $ids ) < 2 ) {
|
28 |
+
$entry = $wpdb->get_row( "select * from $table where id=" . intval( $ids ) );
|
29 |
+
$filename = sanitize_title( $entry->name, 'snippet' ) . '.code-snippets';
|
30 |
+
}
|
31 |
+
|
32 |
+
$filename = apply_filters( 'cs_export_filename', $filename );
|
33 |
+
|
34 |
+
header( 'Content-Disposition: attachment; filename='.$filename.'.xml;' );
|
35 |
+
header( 'Content-Type: text/xml; charset=utf-8' );
|
36 |
+
|
37 |
+
echo '<?xml version="1.0"?>' . "\n";
|
38 |
+
echo '<snippets sitename="' . $sitename . '">';
|
39 |
+
|
40 |
+
foreach( $ids as $id ) {
|
41 |
+
|
42 |
+
$id = intval( mysql_real_escape_string( $id ) );
|
43 |
+
|
44 |
+
if( ! $id > 0 ) continue; // skip this one if we don't have a valid ID
|
45 |
+
|
46 |
+
$snippet = $wpdb->get_row( "select * from $table where id=$id" );
|
47 |
+
|
48 |
+
echo "\n\t" . '<snippet>';
|
49 |
+
echo "\n\t\t" . "<name>$snippet->name</name>";
|
50 |
+
echo "\n\t\t" . "<description>$snippet->description</description>";
|
51 |
+
echo "\n\t\t" . "<code>$snippet->code</code>";
|
52 |
+
echo "\n\t" . '</snippet>';
|
53 |
+
}
|
54 |
+
|
55 |
+
echo "\n</snippets>";
|
56 |
+
exit;
|
57 |
+
}
|
58 |
+
|
59 |
+
endif; // function exists check
|
includes/help/admin-edit-help.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$screen = get_current_screen();
|
3 |
+
$screen->add_help_tab( array(
|
4 |
+
'id' => 'overview',
|
5 |
+
'title' => 'Overview',
|
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.</p>"
|
8 |
+
) );
|
9 |
+
$screen->add_help_tab( array(
|
10 |
+
'id' => 'finding',
|
11 |
+
'title' => 'Finding Snippets',
|
12 |
+
'content' =>
|
13 |
+
"<p>Here are some links to websites which host a large number of snippets that you can add to your site.
|
14 |
+
<ul>
|
15 |
+
<li><a href='http://wp-snippets.com' title='WordPress Snippets'>WP-Snippets</a></li>
|
16 |
+
<li><a href='http://wpsnipp.com' title='WP Snipp'>WP Snipp</a></li>
|
17 |
+
<li><a href='http://www.catswhocode.com/blog/snippets' title='Cats Who Code Snippet Library'>Cats Who Code</a></li>
|
18 |
+
<li><a href='http://wpmu.org'>WPMU - The WordPress Experts</a></li>
|
19 |
+
</ul>
|
20 |
+
And below is a selection of snippets to get you started:
|
21 |
+
<ul>
|
22 |
+
<li><a title='Track post views using post meta' href='http://wpsnipp.com/index.php/functions-php/track-post-views-without-a-plugin-using-post-meta/' >Track post views using post meta</a></li>
|
23 |
+
<li><a title='Disable Admin Bar' href='http://wp-snippets.com/disable-wp-3-1-admin-bar/'>Disable Admin Bar</a></li>
|
24 |
+
<li><a title='Disable the Visual Editor' href='http://wp-snippets.com/disable-the-visual-editor/'>Disable the Visual Editor</a></li>
|
25 |
+
<li><a title='Change Admin Logo' href='http://wp-snippets.com/change-admin-logo/'>Change Admin Logo</a></li>
|
26 |
+
<li><a title='Display Code in Posts' href='http://wp-snippets.com/code-in-posts/'>Display Code in Posts</a></li>
|
27 |
+
<li><a title='Grab Tweets from Twitter Feed' href='http://www.catswhocode.com/blog/snippets/grab-tweets-from-twitter-feed'>Grab Tweets from Twitter Feed</a></li>
|
28 |
+
<li><a title='Watermark images on the fly' href='http://www.catswhocode.com/blog/snippets/watermark-images-on-the-fly'>Watermark images on the fly</a></li>
|
29 |
+
<li><a title='Display number of Facebook fans in full text' href='http://www.catswhocode.com/blog/snippets/display-number-of-facebook-fans-in-full-text'>Display number of Facebook fans in full text</a></li>
|
30 |
+
</ul>
|
31 |
+
Snippets can be installed through the <a href='$this->admin_edit_url'>Add New Snippet</a> page or by addng them to the <code>$this->table</code> table in the database (Warning: for advanced users only). Once a snippet has been installed, you can activate it here.</p>"
|
32 |
+
) );
|
33 |
+
$screen->add_help_tab( array(
|
34 |
+
'id' => 'adding',
|
35 |
+
'title' => 'Adding Snippets',
|
36 |
+
'content' =>
|
37 |
+
"<p>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.</p>" .
|
38 |
+
"<p>Make sure that you don't add the <code><?php</code>, <code><?</code> or <code>?></code> the beginning and end of the code. You can however use these tags in the code to stop and start PHP sections</p>" .
|
39 |
+
"<p>Please be sure to check thst your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straght away, it will help to minimise the chance of a faulty snippet becoming active on your site.</p>"
|
40 |
+
) );
|
41 |
+
|
42 |
+
$screen->set_help_sidebar(
|
43 |
+
"<p><strong>For more information:</strong></p>" .
|
44 |
+
"<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
|
45 |
+
"<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
|
46 |
+
"<p><a href='http://bungeshea.wordpress.com/plugins/code-snippets' target='_blank'>SheaPress</a></p>"
|
47 |
+
);
|
includes/help/admin-import-help.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$screen = get_current_screen();
|
3 |
+
$screen->add_help_tab( array(
|
4 |
+
'id' => 'overview',
|
5 |
+
'title' => 'Overview',
|
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 load snippets from a Code Snippets (.xml) import file into the database with your existing snippets.</p>"
|
8 |
+
) );
|
9 |
+
|
10 |
+
$screen->add_help_tab( array(
|
11 |
+
'id' => 'import',
|
12 |
+
'title' => 'Importing',
|
13 |
+
'content' =>
|
14 |
+
"<p>You can load your snippets from a Code Snippets (.xml) import file using this page. 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='$this->admin_manage_url'>Manage Snippets</a> page.</p>"
|
15 |
+
) );
|
16 |
+
|
17 |
+
$screen->add_help_tab( array(
|
18 |
+
'id' => 'export',
|
19 |
+
'title' => 'Exporting',
|
20 |
+
'content' =>
|
21 |
+
"<p>You can save your snippets to a Code Snippets (.xml) export file using the <a href='$this->admin_manage_url'>Manage Snippets</a> page.</p>"
|
22 |
+
) );
|
23 |
+
|
24 |
+
$screen->set_help_sidebar(
|
25 |
+
"<p><strong>For more information:</strong></p>" .
|
26 |
+
"<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
|
27 |
+
"<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
|
28 |
+
"<p><a href='http://bungeshea.wordpress.com/plugins/code-snippets' target='_blank'>SheaPress</a></p>"
|
29 |
+
);
|
includes/help/admin-manage-help.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$screen = get_current_screen();
|
3 |
+
$screen->add_help_tab( array(
|
4 |
+
'id' => 'overview',
|
5 |
+
'title' => 'Overview',
|
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 manage your existing snippets and preform tasks on them such as activating, deactivating, deleting and exporting.</p>"
|
8 |
+
) );
|
9 |
+
$screen->add_help_tab( array(
|
10 |
+
'id' => 'compatibility-problems',
|
11 |
+
'title' => 'Troubleshooting',
|
12 |
+
'content' =>
|
13 |
+
"<p>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.</p>" .
|
14 |
+
"<p>If something goes wrong with a snippet and you can’t use WordPress, you can use a database manager like phpMyAdmin to access the <code>$this->table</code> table in your WordPress database. Locate the offending snippet (if you know which one is the trouble) and change the 1 in the 'active' column into a 0. If this doesn't work try doing this for all snippets.<br/>You can also delete or rename the <code>$this->table</code> table and the table will automaticly be reconstructed so you can re-add snippets one at a time.</p>"
|
15 |
+
) );
|
16 |
+
|
17 |
+
$screen->add_help_tab( array(
|
18 |
+
'id' => 'uninstall',
|
19 |
+
'title' => 'Uninstall',
|
20 |
+
'content' =>
|
21 |
+
"<p>When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>$this->table</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>".dirname(__FILE__)."</code> folder using FTP." .
|
22 |
+
"<p>Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installaion, you may want to use phpMyAdmin to back up the <code>$this->table</code> table in the database. You can later use phpMyAdmin to import it back.</p>"
|
23 |
+
) );
|
24 |
+
|
25 |
+
$screen->set_help_sidebar(
|
26 |
+
"<p><strong>For more information:</strong></p>" .
|
27 |
+
"<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
|
28 |
+
"<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
|
29 |
+
"<p><a href='http://bungeshea.wordpress.com/plugins/code-snippets' target='_blank'>SheaPress</a></p>"
|
30 |
+
);
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://bungeshea.wordpress.com/donate/
|
|
4 |
Tags: snippets, code, php
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.4.1
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/copyleft/gpl.html
|
10 |
|
@@ -24,7 +24,7 @@ Further information and screenshots are available on the [plugin homepage](http:
|
|
24 |
|
25 |
Code Snippets was featured on WPMU: [WordPress Code Snippets: Keep them Organized with this Plugin!](http://wpmu.org/wordpress-code-snippets)
|
26 |
|
27 |
-
If you have any feedback, issues or suggestions for improvements please start a topic in the [Support Forum](http://wordpress.org/support/plugin/code-snippets) and if you like the plugin please give it a perfect rating at [WordPress.org](http://wordpress.org/extend/plugins/code-snippets) :-)
|
28 |
|
29 |
You can also contribute to the code at [GitHub](https://github.com/bungeshea/code-snippets).
|
30 |
|
@@ -54,11 +54,14 @@ No, the snippets are added to the WordPress database so are independent of the t
|
|
54 |
Yes, when you delete Code Snippets using the 'Plugins' menu in WordPress it will clean up the database table and a few other bits of data. Be careful not to remove Code Snippets using the Plugins menu unless you want this to happen.
|
55 |
|
56 |
= Can I copy any snippets I've created to another WordPress site? =
|
57 |
-
|
58 |
|
59 |
= Can I run network-wide snippets on a multisite installation? =
|
60 |
No, this feature is currently not avalible and will be coming in a future release. In the mean time activate Code Snippets individualy on the desired sites.
|
61 |
|
|
|
|
|
|
|
62 |
== Screenshots ==
|
63 |
|
64 |
1. The Manage Snippets page
|
@@ -68,10 +71,15 @@ No, this feature is currently not avalible and will be coming in a future releas
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
71 |
= 1.2 =
|
72 |
* Minor improvements
|
73 |
* Added code highlighting
|
74 |
-
* Removed 'Uninstall Plugin' page
|
|
|
75 |
|
76 |
= 1.1 =
|
77 |
* Fixed a permissions bug with `DISALLOW_FILE_EDIT` being set to true
|
@@ -82,10 +90,13 @@ No, this feature is currently not avalible and will be coming in a future releas
|
|
82 |
|
83 |
== Upgrade Notice ==
|
84 |
|
|
|
|
|
|
|
85 |
= 1.2 =
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
|
90 |
= 1.1 =
|
91 |
* Minor bug fixes and improvements on the the 'Edit Snippet' page
|
4 |
Tags: snippets, code, php
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.4.1
|
7 |
+
Stable tag: 1.3
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/copyleft/gpl.html
|
10 |
|
24 |
|
25 |
Code Snippets was featured on WPMU: [WordPress Code Snippets: Keep them Organized with this Plugin!](http://wpmu.org/wordpress-code-snippets)
|
26 |
|
27 |
+
If you have any feedback, issues or suggestions for improvements please leave start a topic in the [Support Forum](http://wordpress.org/support/plugin/code-snippets) and if you like the plugin please give it a perfect rating at [WordPress.org](http://wordpress.org/extend/plugins/code-snippets) :-)
|
28 |
|
29 |
You can also contribute to the code at [GitHub](https://github.com/bungeshea/code-snippets).
|
30 |
|
54 |
Yes, when you delete Code Snippets using the 'Plugins' menu in WordPress it will clean up the database table and a few other bits of data. Be careful not to remove Code Snippets using the Plugins menu unless you want this to happen.
|
55 |
|
56 |
= Can I copy any snippets I've created to another WordPress site? =
|
57 |
+
Yes! You can individualy export a single snippet using the link below the snippet name on the 'Manage Snippets' page or bulk export multiple snippets using the 'Bulk Actions' feature. Snippets can later be imported using the 'Import Snippets' page by uploading the export file.
|
58 |
|
59 |
= Can I run network-wide snippets on a multisite installation? =
|
60 |
No, this feature is currently not avalible and will be coming in a future release. In the mean time activate Code Snippets individualy on the desired sites.
|
61 |
|
62 |
+
= I have an idea for a cool feature for Code Snippets! =
|
63 |
+
That's great! Let me know by starting (or adding to) a topic in the [Support Forums](http://wordpress.org/support/plugin/code-snippets/).
|
64 |
+
|
65 |
== Screenshots ==
|
66 |
|
67 |
1. The Manage Snippets page
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 1.3 =
|
75 |
+
* Added export option to 'Manage Snippets' page
|
76 |
+
* Added 'Import Snippets' page
|
77 |
+
|
78 |
= 1.2 =
|
79 |
* Minor improvements
|
80 |
* Added code highlighting
|
81 |
+
* Removed 'Uninstall Plugin' page
|
82 |
+
* Data will now be cleaned up when plugin is deleted through WordPress admin.
|
83 |
|
84 |
= 1.1 =
|
85 |
* Fixed a permissions bug with `DISALLOW_FILE_EDIT` being set to true
|
90 |
|
91 |
== Upgrade Notice ==
|
92 |
|
93 |
+
= 1.3 =
|
94 |
+
Added import/export feature
|
95 |
+
|
96 |
= 1.2 =
|
97 |
+
Minor improvments |
|
98 |
+
Added code highlighting |
|
99 |
+
Plugin data will now be cleaned up when you delete the plugin.
|
100 |
|
101 |
= 1.1 =
|
102 |
* Minor bug fixes and improvements on the the 'Edit Snippet' page
|