From b8eaf34b285216023094578ca06690feb4e05ed9 Mon Sep 17 00:00:00 2001 From: Shea Bunge Date: Mon, 17 Jun 2013 17:30:06 +1000 Subject: [PATCH] Updated to version 1.1 --- code-snippets.php | 77 ++++++++++++++++++++++++++++--------------- inc/edit-snippets.php | 12 ++++--- readme.txt | 23 +++++++++---- 3 files changed, 74 insertions(+), 38 deletions(-) diff --git a/code-snippets.php b/code-snippets.php index 9fa5bf95..b195bc74 100644 --- a/code-snippets.php +++ b/code-snippets.php @@ -1,30 +1,30 @@ . - */ +/* + Plugin Name: Code Snippets + Plugin URI: http://wordpress.org/extend/plugins/code-snippets + Description: Provides an easy-to-manage GUI interface for adding code snippets to your blog. + Author: Shea Bunge + Version: 1.1 + Author URI: http://bungeshea.wordpress.com/plugins/code-snippets/ + License: GPLv3 or later + + Code Snippets - WordPress Plugin + Copyright (C) 2012 Shea Bunge + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ // Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit; @@ -109,9 +109,9 @@ function uninstall() { } function add_admin_menus() { - $this->manage_snippets_page = add_menu_page( 'Snippets', 'Snippets', 'activate_plugins', 'snippets', array( &$this, 'manage_snippets' ), $this->plugin_url . 'img/icon16.png', 67 ); + $this->manage_snippets_page = add_menu_page( 'Snippets', 'Snippets', 'install_plugins', 'snippets', array( &$this, 'manage_snippets' ), $this->plugin_url . 'img/icon16.png', 67 ); add_submenu_page('snippets', 'Snippets', 'Manage Snippets' , 'install_plugins', 'snippets', array( &$this, 'manage_snippets') ); - $this->edit_snippets_page = add_submenu_page( 'snippets', 'Add New Snippet', 'Add New', 'edit_plugins', 'snippet-new', array( &$this, 'edit_snippets' ) ); + $this->edit_snippets_page = add_submenu_page( 'snippets', 'Add New Snippet', 'Add New', 'install_plugins', 'snippet-new', array( &$this, 'edit_snippets' ) ); $this->uninstall_plugin_page = add_submenu_page( 'snippets', 'Uninstall Code Snippets', 'Uninstall', 'install_plugins', 'uninstall-cs', array( &$this, 'uninstall_plugin' ) ); add_action( 'admin_print_styles-' . $this->manage_snippets_page, array( $this, 'load_stylesheet' ), 5 ); @@ -156,6 +156,10 @@ function manage_snippets_help() { } function edit_snippets_help() { + + if( isset( $_GET['action'] ) && @$_GET['action'] == 'edit' ) + add_filter('admin_title', array( &$this, 'edit_snippets_title' ), 10, 2); + $screen = get_current_screen(); $screen->add_help_tab( array( 'id' => 'overview', @@ -320,6 +324,25 @@ function edit_snippets() { require_once( $this->dirname . '/inc/edit-snippets.php'); } + function edit_snippets_title( $admin_title, $title ) { + + $title = 'Edit Snippet'; + + if ( is_network_admin() ) + $admin_title = __( 'Network Admin' ); + elseif ( is_user_admin() ) + $admin_title = __( 'Global Dashboard' ); + else + $admin_title = get_bloginfo( 'name' ); + + if ( $admin_title == $title ) + $admin_title = sprintf( __( '%1$s — WordPress' ), $title ); + else + $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title ); + + return $admin_title; + } + function uninstall_plugin(){ $msg = ''; if( isset( $_POST['uninstall'] ) ) { diff --git a/inc/edit-snippets.php b/inc/edit-snippets.php index e2d99634..9c80ffc7 100644 --- a/inc/edit-snippets.php +++ b/inc/edit-snippets.php @@ -1,18 +1,22 @@ - +

Edit SnippetAdd New

Add New Snippet - +


- + get_row( "SELECT * FROM `$this->table_name` WHERE `id` = '$id';" ); ?> diff --git a/readme.txt b/readme.txt index 555cfed9..7525ddf8 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: bungeshea Donate link: http://bungeshea.wordpress.com/donate/ Tags: snippets, code, php Requires at least: 3.3 -Tested up to: 3.4.1 -Stable tag: 1.0 +Tested up to: 3.4 +Stable tag: 1.1 License: GPLv3 or later License URI: http://www.gnu.org/copyleft/gpl.html @@ -20,17 +20,19 @@ Snippets are stored in the `wp_snippets` table in the WordPress database (the ta Code Snippets includes an option to clean up its data when deactivated. Each screen includes a help tab just in case you get stuck. -Further information and screenshots are available on the plugin homepage at http://bungeshea.wordpress.com/plugins/code-snippets. +Further information and screenshots are available on the [plugin homepage]( http://bungeshea.wordpress.com/plugins/code-snippets). -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 :-) +Code Snippets was featured on WPMU.org - [WordPress Code Snippets: Keep them Organized with this Plugin!](http://wpmu.org/wordpress-code-snippets/) + +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) :-) == Installation == 1. Download the `code-snippets.zip` file to your local machine. -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. +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. 3. Activate the plugin through the Plugins menu -4. Visit the Add New Snippet menu page **(Snippets > Add New)** to add or edit Snippets. -5. Activate your snippets through the Manage Snippets page **(Snippets > Manage Snippets)** +4. Visit the Add New Snippet menu page *(Snippets > Add New)* to add or edit Snippets. +5. Activate your snippets through the Manage Snippets page *(Snippets > Manage Snippets)* == Frequently Asked Questions == @@ -62,7 +64,14 @@ The import/export feature is currently in development. You can however, use the == Changelog == += 1.1 = +* Fixed a permissions bug with `DISALLOW_FILE_EDIT` being set to true +* Fixed a bug with the page title reading 'Add New Snippet' on the 'Edit Snippets' page + = 1.0 = * Stable version released. == Upgrade Notice == + += 1.1 = +* Minor bug fixes and improvments on the the 'Edit Snippet' page \ No newline at end of file