Version Description
Add capability check to snippets importer
Download this release
Release Info
Developer | bungeshea |
Plugin | Code Snippets |
Version | 1.9.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.9.1 to 1.9.1.1
- assets/font/code-snippets.svg +10 -10
- code-snippets.php +3 -3
- includes/class-admin.php +30 -2
- readme.txt +8 -2
assets/font/code-snippets.svg
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
<?xml version="1.0" standalone="no"?>
|
2 |
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
-
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
-
<metadata>Generated by IcoMoon</metadata>
|
5 |
-
<defs>
|
6 |
-
<font id="code-snippets" horiz-adv-x="1024">
|
7 |
-
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
8 |
-
<missing-glyph horiz-adv-x="1024" />
|
9 |
-
<glyph unicode=" " d="" horiz-adv-x="512" />
|
10 |
-
<glyph unicode="" d="M191.968 495.776h158.912c23.68 0 42.656-19.2 42.656-42.656 0-11.488-4.48-21.984-11.968-29.632l0.192-0.448-108.768-108.736c-75.104-75.136-75.104-196.512 0-271.584 74.88-74.848 196.448-74.848 271.552 0 74.88 75.104 74.88 196.48 0 271.584-21.76 21.504-47.36 37.12-74.464 46.272l28.608 28.576h365.248c87.040 0 157.856 74.016 159.968 166.4 0 1.472 0.224 2.752 0 4.256-2.112 23.904-22.368 42.656-46.912 42.656h-264.96l191.328 191.328c17.504 17.504 18.56 45.024 3.2 63.36-1.024 1.28-2.080 2.144-3.2 3.2-66.528 63.552-169.152 65.92-230.56 4.48l-262.368-262.368h-46.528c12.8 25.6 20.032 54.624 20.032 85.344 0 106.016-85.952 192-192 192-106.016 0-191.968-85.984-191.968-192 0.032-106.080 85.984-192.032 192-192.032zM277.312 687.744c0-47.136-38.176-85.344-85.344-85.344-47.136 0-85.312 38.176-85.312 85.344s38.176 85.344 85.312 85.344c47.168 0 85.344-38.208 85.344-85.344zM469.088 238.688c33.28-33.248 33.28-87.264 0-120.512-33.28-33.472-87.264-33.472-120.736 0-33.28 33.248-33.28 87.264 0 120.512 33.472 33.504 87.456 33.504 120.736 0z" />
|
11 |
</font></defs></svg>
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Generated by IcoMoon</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="code-snippets" horiz-adv-x="1024">
|
7 |
+
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
8 |
+
<missing-glyph horiz-adv-x="1024" />
|
9 |
+
<glyph unicode=" " d="" horiz-adv-x="512" />
|
10 |
+
<glyph unicode="" d="M191.968 495.776h158.912c23.68 0 42.656-19.2 42.656-42.656 0-11.488-4.48-21.984-11.968-29.632l0.192-0.448-108.768-108.736c-75.104-75.136-75.104-196.512 0-271.584 74.88-74.848 196.448-74.848 271.552 0 74.88 75.104 74.88 196.48 0 271.584-21.76 21.504-47.36 37.12-74.464 46.272l28.608 28.576h365.248c87.040 0 157.856 74.016 159.968 166.4 0 1.472 0.224 2.752 0 4.256-2.112 23.904-22.368 42.656-46.912 42.656h-264.96l191.328 191.328c17.504 17.504 18.56 45.024 3.2 63.36-1.024 1.28-2.080 2.144-3.2 3.2-66.528 63.552-169.152 65.92-230.56 4.48l-262.368-262.368h-46.528c12.8 25.6 20.032 54.624 20.032 85.344 0 106.016-85.952 192-192 192-106.016 0-191.968-85.984-191.968-192 0.032-106.080 85.984-192.032 192-192.032zM277.312 687.744c0-47.136-38.176-85.344-85.344-85.344-47.136 0-85.312 38.176-85.312 85.344s38.176 85.344 85.312 85.344c47.168 0 85.344-38.208 85.344-85.344zM469.088 238.688c33.28-33.248 33.28-87.264 0-120.512-33.28-33.472-87.264-33.472-120.736 0-33.28 33.248-33.28 87.264 0 120.512 33.472 33.504 87.456 33.504 120.736 0z" />
|
11 |
</font></defs></svg>
|
code-snippets.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* contribute to the localization, please see http://code-snippets.bungeshea.com
|
8 |
*
|
9 |
* @package Code_Snippets
|
10 |
-
* @version 1.9.1
|
11 |
* @author Shea Bunge <http://bungeshea.com/>
|
12 |
* @copyright Copyright (c) 2012-2014, Shea Bunge
|
13 |
* @link http://code-snippets.bungeshea.com
|
@@ -20,7 +20,7 @@ Plugin URI: http://code-snippets.bungeshea.com
|
|
20 |
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!
|
21 |
Author: Shea Bunge
|
22 |
Author URI: http://bungeshea.com
|
23 |
-
Version: 1.9.1
|
24 |
License: MIT
|
25 |
License URI: license.txt
|
26 |
Text Domain: code-snippets
|
@@ -58,7 +58,7 @@ final class Code_Snippets {
|
|
58 |
* @access public
|
59 |
* @var string A PHP-standardized version number string
|
60 |
*/
|
61 |
-
public $version = '1.9.1';
|
62 |
|
63 |
/**
|
64 |
* Variables to hold plugin paths
|
7 |
* contribute to the localization, please see http://code-snippets.bungeshea.com
|
8 |
*
|
9 |
* @package Code_Snippets
|
10 |
+
* @version 1.9.1.1
|
11 |
* @author Shea Bunge <http://bungeshea.com/>
|
12 |
* @copyright Copyright (c) 2012-2014, Shea Bunge
|
13 |
* @link http://code-snippets.bungeshea.com
|
20 |
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!
|
21 |
Author: Shea Bunge
|
22 |
Author URI: http://bungeshea.com
|
23 |
+
Version: 1.9.1.1
|
24 |
License: MIT
|
25 |
License URI: license.txt
|
26 |
Text Domain: code-snippets
|
58 |
* @access public
|
59 |
* @var string A PHP-standardized version number string
|
60 |
*/
|
61 |
+
public $version = '1.9.1.1';
|
62 |
|
63 |
/**
|
64 |
* Variables to hold plugin paths
|
includes/class-admin.php
CHANGED
@@ -164,16 +164,19 @@ class Code_Snippets_Admin {
|
|
164 |
* @return void
|
165 |
*/
|
166 |
function load_importer() {
|
|
|
167 |
|
168 |
-
if
|
|
|
169 |
|
170 |
/* Load Importer API */
|
171 |
require_once ABSPATH . 'wp-admin/includes/import.php';
|
172 |
|
173 |
if ( ! class_exists( 'WP_Importer' ) ) {
|
174 |
$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
|
175 |
-
if ( file_exists( $class_wp_importer ) )
|
176 |
require_once $class_wp_importer;
|
|
|
177 |
}
|
178 |
|
179 |
/* Register the Code Snippets importer with WordPress */
|
@@ -228,6 +231,22 @@ class Code_Snippets_Admin {
|
|
228 |
require $code_snippets->plugin_dir . "admin/messages/{$slug}.php";
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
/**
|
232 |
* Add the dashboard admin menu and subpages
|
233 |
*
|
@@ -350,6 +369,9 @@ class Code_Snippets_Admin {
|
|
350 |
function load_manage_menu() {
|
351 |
global $code_snippets;
|
352 |
|
|
|
|
|
|
|
353 |
/* Create the snippet tables if they don't exist */
|
354 |
$code_snippets->maybe_create_tables( true, true );
|
355 |
|
@@ -376,6 +398,9 @@ class Code_Snippets_Admin {
|
|
376 |
global $code_snippets;
|
377 |
$screen = get_current_screen();
|
378 |
|
|
|
|
|
|
|
379 |
/* Create the snippet tables if they don't exist */
|
380 |
$code_snippets->maybe_create_tables( true, true );
|
381 |
|
@@ -561,6 +586,9 @@ class Code_Snippets_Admin {
|
|
561 |
function load_import_menu() {
|
562 |
global $code_snippets;
|
563 |
|
|
|
|
|
|
|
564 |
/* Create the snippet tables if they don't exist */
|
565 |
$code_snippets->maybe_create_tables( true, true );
|
566 |
|
164 |
* @return void
|
165 |
*/
|
166 |
function load_importer() {
|
167 |
+
global $code_snippets;
|
168 |
|
169 |
+
/* Only register the importer if the current user can manage snippets */
|
170 |
+
if ( defined( 'WP_LOAD_IMPORTERS' ) && current_user_can( $code_snippets->get_cap() ) ) {
|
171 |
|
172 |
/* Load Importer API */
|
173 |
require_once ABSPATH . 'wp-admin/includes/import.php';
|
174 |
|
175 |
if ( ! class_exists( 'WP_Importer' ) ) {
|
176 |
$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
|
177 |
+
if ( file_exists( $class_wp_importer ) ) {
|
178 |
require_once $class_wp_importer;
|
179 |
+
}
|
180 |
}
|
181 |
|
182 |
/* Register the Code Snippets importer with WordPress */
|
231 |
require $code_snippets->plugin_dir . "admin/messages/{$slug}.php";
|
232 |
}
|
233 |
|
234 |
+
/**
|
235 |
+
* Check if the current user can manage snippets.
|
236 |
+
* If not, display an error message
|
237 |
+
*
|
238 |
+
* @since 1.9.1.1
|
239 |
+
* @access public
|
240 |
+
* @return void
|
241 |
+
*/
|
242 |
+
public function check_perms() {
|
243 |
+
global $code_snippets;
|
244 |
+
|
245 |
+
if ( ! current_user_can( $code_snippets->get_cap() ) ) {
|
246 |
+
wp_die( __( 'You are not access this page.', 'code-snippets' ) );
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
/**
|
251 |
* Add the dashboard admin menu and subpages
|
252 |
*
|
369 |
function load_manage_menu() {
|
370 |
global $code_snippets;
|
371 |
|
372 |
+
/* Make sure the user has permission to be here */
|
373 |
+
$this->check_perms();
|
374 |
+
|
375 |
/* Create the snippet tables if they don't exist */
|
376 |
$code_snippets->maybe_create_tables( true, true );
|
377 |
|
398 |
global $code_snippets;
|
399 |
$screen = get_current_screen();
|
400 |
|
401 |
+
/* Make sure the user has permission to be here */
|
402 |
+
$this->check_perms();
|
403 |
+
|
404 |
/* Create the snippet tables if they don't exist */
|
405 |
$code_snippets->maybe_create_tables( true, true );
|
406 |
|
586 |
function load_import_menu() {
|
587 |
global $code_snippets;
|
588 |
|
589 |
+
/* Make sure the user has permission to be here */
|
590 |
+
$this->check_perms();
|
591 |
+
|
592 |
/* Create the snippet tables if they don't exist */
|
593 |
$code_snippets->maybe_create_tables( true, true );
|
594 |
|
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:
|
7 |
-
Stable tag: 1.9.1
|
8 |
License: MIT
|
9 |
License URI: license.txt
|
10 |
|
@@ -120,6 +120,9 @@ That's fantastic! Join me on [GitHub](https://github.com/bungeshea/code-snippets
|
|
120 |
|
121 |
== Changelog ==
|
122 |
|
|
|
|
|
|
|
123 |
= 1.9.1 =
|
124 |
* Use an icon font for menu icon instead of embedded SVG
|
125 |
* Use Sass (libsass) instead of Compass
|
@@ -268,6 +271,9 @@ Plugin updates will be posted on the [plugin's homepage](http://code-snippets.bu
|
|
268 |
|
269 |
== Upgrade Notice ==
|
270 |
|
|
|
|
|
|
|
271 |
= 1.9.1 =
|
272 |
UI improvements for WordPress 3.8
|
273 |
|
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: 4.1
|
7 |
+
Stable tag: 1.9.1.1
|
8 |
License: MIT
|
9 |
License URI: license.txt
|
10 |
|
120 |
|
121 |
== Changelog ==
|
122 |
|
123 |
+
= 1.9.1.1
|
124 |
+
* Add capability check to site snippets importer
|
125 |
+
|
126 |
= 1.9.1 =
|
127 |
* Use an icon font for menu icon instead of embedded SVG
|
128 |
* Use Sass (libsass) instead of Compass
|
271 |
|
272 |
== Upgrade Notice ==
|
273 |
|
274 |
+
= 1.9.1.1 =
|
275 |
+
Add capability check to snippets importer
|
276 |
+
|
277 |
= 1.9.1 =
|
278 |
UI improvements for WordPress 3.8
|
279 |
|