Version Description
- Stable version released.
=
Download this release
Release Info
Developer | bungeshea |
Plugin | Code Snippets |
Version | 1.0 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.0
- code-snippets.php +27 -50
- inc/edit-snippets.php +4 -8
- readme.txt +7 -16
code-snippets.php
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
*/
|
28 |
|
29 |
// Exit if accessed directly
|
30 |
if ( !defined( 'ABSPATH' ) ) exit;
|
@@ -109,9 +109,9 @@ class code_snippets {
|
|
109 |
}
|
110 |
|
111 |
function add_admin_menus() {
|
112 |
-
$this->manage_snippets_page = add_menu_page( 'Snippets', 'Snippets', '
|
113 |
add_submenu_page('snippets', 'Snippets', 'Manage Snippets' , 'install_plugins', 'snippets', array( &$this, 'manage_snippets') );
|
114 |
-
$this->edit_snippets_page = add_submenu_page( 'snippets', 'Add New Snippet', 'Add New', '
|
115 |
$this->uninstall_plugin_page = add_submenu_page( 'snippets', 'Uninstall Code Snippets', 'Uninstall', 'install_plugins', 'uninstall-cs', array( &$this, 'uninstall_plugin' ) );
|
116 |
|
117 |
add_action( 'admin_print_styles-' . $this->manage_snippets_page, array( $this, 'load_stylesheet' ), 5 );
|
@@ -156,10 +156,6 @@ class code_snippets {
|
|
156 |
}
|
157 |
|
158 |
function edit_snippets_help() {
|
159 |
-
|
160 |
-
if( isset( $_GET['action'] ) && @$_GET['action'] == 'edit' )
|
161 |
-
add_filter('admin_title', array( &$this, 'edit_snippets_title' ), 10, 2);
|
162 |
-
|
163 |
$screen = get_current_screen();
|
164 |
$screen->add_help_tab( array(
|
165 |
'id' => 'overview',
|
@@ -324,25 +320,6 @@ class code_snippets {
|
|
324 |
require_once( $this->dirname . '/inc/edit-snippets.php');
|
325 |
}
|
326 |
|
327 |
-
function edit_snippets_title( $admin_title, $title ) {
|
328 |
-
|
329 |
-
$title = 'Edit Snippet';
|
330 |
-
|
331 |
-
if ( is_network_admin() )
|
332 |
-
$admin_title = __( 'Network Admin' );
|
333 |
-
elseif ( is_user_admin() )
|
334 |
-
$admin_title = __( 'Global Dashboard' );
|
335 |
-
else
|
336 |
-
$admin_title = get_bloginfo( 'name' );
|
337 |
-
|
338 |
-
if ( $admin_title == $title )
|
339 |
-
$admin_title = sprintf( __( '%1$s — WordPress' ), $title );
|
340 |
-
else
|
341 |
-
$admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title );
|
342 |
-
|
343 |
-
return $admin_title;
|
344 |
-
}
|
345 |
-
|
346 |
function uninstall_plugin(){
|
347 |
$msg = '';
|
348 |
if( isset( $_POST['uninstall'] ) ) {
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Plugin Name: Code Snippets
|
5 |
+
* Plugin URI: http://wordpress.org/extend/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.0
|
9 |
+
* Author URI: http://bungeshea.wordpress.com/plugins/code-snippets/
|
10 |
+
* License: GPLv3 or later
|
11 |
+
*
|
12 |
+
* Code Snippets - WordPress Plugin
|
13 |
+
* Copyright (C) 2012 Shea Bunge
|
14 |
+
*
|
15 |
+
* This program is free software: you can redistribute it and/or modify
|
16 |
+
* it under the terms of the GNU General Public License as published by
|
17 |
+
* the Free Software Foundation, either version 3 of the License, or
|
18 |
+
* (at your option) any later version.
|
19 |
+
*
|
20 |
+
* This program is distributed in the hope that it will be useful,
|
21 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
+
* GNU General Public License for more details.
|
24 |
+
*
|
25 |
+
* You should have received a copy of the GNU General Public License
|
26 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
+
*/
|
28 |
|
29 |
// Exit if accessed directly
|
30 |
if ( !defined( 'ABSPATH' ) ) exit;
|
109 |
}
|
110 |
|
111 |
function add_admin_menus() {
|
112 |
+
$this->manage_snippets_page = add_menu_page( 'Snippets', 'Snippets', 'activate_plugins', 'snippets', array( &$this, 'manage_snippets' ), $this->plugin_url . 'img/icon16.png', 67 );
|
113 |
add_submenu_page('snippets', 'Snippets', 'Manage Snippets' , 'install_plugins', 'snippets', array( &$this, 'manage_snippets') );
|
114 |
+
$this->edit_snippets_page = add_submenu_page( 'snippets', 'Add New Snippet', 'Add New', 'edit_plugins', 'snippet-new', array( &$this, 'edit_snippets' ) );
|
115 |
$this->uninstall_plugin_page = add_submenu_page( 'snippets', 'Uninstall Code Snippets', 'Uninstall', 'install_plugins', 'uninstall-cs', array( &$this, 'uninstall_plugin' ) );
|
116 |
|
117 |
add_action( 'admin_print_styles-' . $this->manage_snippets_page, array( $this, 'load_stylesheet' ), 5 );
|
156 |
}
|
157 |
|
158 |
function edit_snippets_help() {
|
|
|
|
|
|
|
|
|
159 |
$screen = get_current_screen();
|
160 |
$screen->add_help_tab( array(
|
161 |
'id' => 'overview',
|
320 |
require_once( $this->dirname . '/inc/edit-snippets.php');
|
321 |
}
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
function uninstall_plugin(){
|
324 |
$msg = '';
|
325 |
if( isset( $_POST['uninstall'] ) ) {
|
inc/edit-snippets.php
CHANGED
@@ -1,22 +1,18 @@
|
|
1 |
-
<?php
|
2 |
-
$edit = isset( $_GET['action'] ) && $_GET['action'] == 'edit';
|
3 |
-
if( $edit )
|
4 |
-
$id = intval( $_GET['id'] );
|
5 |
-
?>
|
6 |
<div class="wrap">
|
7 |
<div id="icon-snippets" class="icon32"><br /></div><h2><?php
|
8 |
-
if( $edit ) :
|
9 |
?>Edit Snippet<a href="<?php echo $this->edit_snippets_url; ?>" class="add-new-h2">Add New</a></h2><?php
|
10 |
else:
|
11 |
?>Add New Snippet</h2>
|
12 |
<?php endif; ?>
|
13 |
-
<?php if ( strlen(
|
14 |
<div id="message" class="updated fade"><p><?php echo $msg; ?></p></div>
|
15 |
<?php else: ?>
|
16 |
<br />
|
17 |
<?php endif; ?>
|
18 |
<form method="post" action="">
|
19 |
-
<?php if( $edit ) : ?>
|
20 |
<?php $record = $wpdb->get_row( "SELECT * FROM `$this->table_name` WHERE `id` = '$id';" ); ?>
|
21 |
<input type="hidden" name="edit_id" value="<?php echo $id;?>" />
|
22 |
<?php else: ?>
|
1 |
+
<?php $id = intval( @$_GET['id'] ); ?>
|
|
|
|
|
|
|
|
|
2 |
<div class="wrap">
|
3 |
<div id="icon-snippets" class="icon32"><br /></div><h2><?php
|
4 |
+
if( $_GET['action'] == 'edit' ) :
|
5 |
?>Edit Snippet<a href="<?php echo $this->edit_snippets_url; ?>" class="add-new-h2">Add New</a></h2><?php
|
6 |
else:
|
7 |
?>Add New Snippet</h2>
|
8 |
<?php endif; ?>
|
9 |
+
<?php if ( strlen($msg) ) : ?>
|
10 |
<div id="message" class="updated fade"><p><?php echo $msg; ?></p></div>
|
11 |
<?php else: ?>
|
12 |
<br />
|
13 |
<?php endif; ?>
|
14 |
<form method="post" action="">
|
15 |
+
<?php if( $_GET['action'] == 'edit' ) : ?>
|
16 |
<?php $record = $wpdb->get_row( "SELECT * FROM `$this->table_name` WHERE `id` = '$id';" ); ?>
|
17 |
<input type="hidden" name="edit_id" value="<?php echo $id;?>" />
|
18 |
<?php else: ?>
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: bungeshea
|
|
3 |
Donate link: http://bungeshea.wordpress.com/donate/
|
4 |
Tags: snippets, code, php
|
5 |
Requires at least: 3.3
|
6 |
-
Tested up to: 3.4
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/copyleft/gpl.html
|
10 |
|
@@ -20,19 +20,17 @@ Snippets are stored in the `wp_snippets` table in the WordPress database (the ta
|
|
20 |
|
21 |
Code Snippets includes an option to clean up its data when deactivated. Each screen includes a help tab just in case you get stuck.
|
22 |
|
23 |
-
Further information and screenshots are available on the
|
24 |
|
25 |
-
|
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 rating at [WordPress.org](http://wordpress.org/extend/plugins/code-snippets) :-)
|
28 |
|
29 |
== Installation ==
|
30 |
|
31 |
1. Download the `code-snippets.zip` file to your local machine.
|
32 |
-
2. Either use the automatic plugin installer *(Plugins
|
33 |
3. Activate the plugin through the Plugins menu
|
34 |
-
4. Visit the Add New Snippet menu page
|
35 |
-
5. Activate your snippets through the Manage Snippets page
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
@@ -64,14 +62,7 @@ The import/export feature is currently in development. You can however, use the
|
|
64 |
|
65 |
== Changelog ==
|
66 |
|
67 |
-
= 1.1 =
|
68 |
-
* Fixed a permissions bug with `DISALLOW_FILE_EDIT` being set to true
|
69 |
-
* Fixed a bug with the page title reading 'Add New Snippet' on the 'Edit Snippets' page
|
70 |
-
|
71 |
= 1.0 =
|
72 |
* Stable version released.
|
73 |
|
74 |
== Upgrade Notice ==
|
75 |
-
|
76 |
-
= 1.1 =
|
77 |
-
* Minor bug fixes and improvments on the the 'Edit Snippet' page
|
3 |
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.0
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/copyleft/gpl.html
|
10 |
|
20 |
|
21 |
Code Snippets includes an option to clean up its data when deactivated. Each screen includes a help tab just in case you get stuck.
|
22 |
|
23 |
+
Further information and screenshots are available on the plugin homepage at http://bungeshea.wordpress.com/plugins/code-snippets.
|
24 |
|
25 |
+
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 rating at http://wordpress.org/extend/plugins/code-snippets :-)
|
|
|
|
|
26 |
|
27 |
== Installation ==
|
28 |
|
29 |
1. Download the `code-snippets.zip` file to your local machine.
|
30 |
+
2. Either use the automatic plugin installer *(Plugins - Add New)* or Unzip the file and upload the **code-snippets** folder to your `/wp-content/plugins/` directory.
|
31 |
3. Activate the plugin through the Plugins menu
|
32 |
+
4. Visit the Add New Snippet menu page **(Snippets > Add New)** to add or edit Snippets.
|
33 |
+
5. Activate your snippets through the Manage Snippets page **(Snippets > Manage Snippets)**
|
34 |
|
35 |
== Frequently Asked Questions ==
|
36 |
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
|
|
65 |
= 1.0 =
|
66 |
* Stable version released.
|
67 |
|
68 |
== Upgrade Notice ==
|
|
|
|
|
|