|
1 | 1 | <?php
|
2 | 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 |
| - */ |
| 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.1 |
| 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 | 28 |
|
29 | 29 | // Exit if accessed directly
|
30 | 30 | if ( !defined( 'ABSPATH' ) ) exit;
|
@@ -109,9 +109,9 @@ function uninstall() {
|
109 | 109 | }
|
110 | 110 |
|
111 | 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 ); |
| 112 | + $this->manage_snippets_page = add_menu_page( 'Snippets', 'Snippets', 'install_plugins', 'snippets', array( &$this, 'manage_snippets' ), $this->plugin_url . 'img/icon16.png', 67 ); |
113 | 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' ) ); |
| 114 | + $this->edit_snippets_page = add_submenu_page( 'snippets', 'Add New Snippet', 'Add New', 'install_plugins', 'snippet-new', array( &$this, 'edit_snippets' ) ); |
115 | 115 | $this->uninstall_plugin_page = add_submenu_page( 'snippets', 'Uninstall Code Snippets', 'Uninstall', 'install_plugins', 'uninstall-cs', array( &$this, 'uninstall_plugin' ) );
|
116 | 116 |
|
117 | 117 | add_action( 'admin_print_styles-' . $this->manage_snippets_page, array( $this, 'load_stylesheet' ), 5 );
|
@@ -156,6 +156,10 @@ function manage_snippets_help() {
|
156 | 156 | }
|
157 | 157 |
|
158 | 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 | + |
159 | 163 | $screen = get_current_screen();
|
160 | 164 | $screen->add_help_tab( array(
|
161 | 165 | 'id' => 'overview',
|
@@ -320,6 +324,25 @@ function edit_snippets() {
|
320 | 324 | require_once( $this->dirname . '/inc/edit-snippets.php');
|
321 | 325 | }
|
322 | 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 | + |
323 | 346 | function uninstall_plugin(){
|
324 | 347 | $msg = '';
|
325 | 348 | if( isset( $_POST['uninstall'] ) ) {
|
|
0 commit comments