Version Description
(19 Sep 2017) = * Fixed: Prevented PHP error from occurring when saving a snippet * Minor improvements to database creation function
Download this release
Release Info
Developer | bungeshea |
Plugin | Code Snippets |
Version | 2.9.4 |
Comparing to | |
See all releases |
Code changes from version 2.9.3 to 2.9.4
- code-snippets.php +3 -3
- languages/code-snippets.pot +2 -2
- php/class-db.php +12 -14
- readme.txt +5 -1
code-snippets.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
* @author Shea Bunge <shea@bungeshea.com>
|
11 |
* @copyright 2012-2017 Shea Bunge
|
12 |
* @license MIT http://opensource.org/licenses/MIT
|
13 |
-
* @version 2.9.
|
14 |
* @link https://github.com/sheabunge/code-snippets
|
15 |
*/
|
16 |
|
@@ -20,7 +20,7 @@ Plugin URI: https://github.com/sheabunge/code-snippets
|
|
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: https://bungeshea.com
|
23 |
-
Version: 2.9.
|
24 |
License: MIT
|
25 |
License URI: license.txt
|
26 |
Text Domain: code-snippets
|
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
42 |
* @since 2.0
|
43 |
* @var string A PHP-standardized version number string
|
44 |
*/
|
45 |
-
define( 'CODE_SNIPPETS_VERSION', '2.9.
|
46 |
|
47 |
/**
|
48 |
* The full path to the main file of this plugin
|
10 |
* @author Shea Bunge <shea@bungeshea.com>
|
11 |
* @copyright 2012-2017 Shea Bunge
|
12 |
* @license MIT http://opensource.org/licenses/MIT
|
13 |
+
* @version 2.9.4
|
14 |
* @link https://github.com/sheabunge/code-snippets
|
15 |
*/
|
16 |
|
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: https://bungeshea.com
|
23 |
+
Version: 2.9.4
|
24 |
License: MIT
|
25 |
License URI: license.txt
|
26 |
Text Domain: code-snippets
|
42 |
* @since 2.0
|
43 |
* @var string A PHP-standardized version number string
|
44 |
*/
|
45 |
+
define( 'CODE_SNIPPETS_VERSION', '2.9.4' );
|
46 |
|
47 |
/**
|
48 |
* The full path to the main file of this plugin
|
languages/code-snippets.pot
CHANGED
@@ -6,9 +6,9 @@
|
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
-
"Project-Id-Version: code-snippets 2.9.
|
10 |
"Report-Msgid-Bugs-To: \n"
|
11 |
-
"POT-Creation-Date: 2017-09-11
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
+
"Project-Id-Version: code-snippets 2.9.4\n"
|
10 |
"Report-Msgid-Bugs-To: \n"
|
11 |
+
"POT-Creation-Date: 2017-09-19 11:19+1000\n"
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
php/class-db.php
CHANGED
@@ -47,7 +47,7 @@ class Code_Snippets_DB {
|
|
47 |
}
|
48 |
|
49 |
/* If $multisite is null, try to base it on the current admin page */
|
50 |
-
if ( is_null( $network ) &&
|
51 |
$network = get_current_screen()->in_admin( 'network' );
|
52 |
}
|
53 |
|
@@ -115,21 +115,11 @@ class Code_Snippets_DB {
|
|
115 |
* @uses dbDelta() to apply the SQL code
|
116 |
*
|
117 |
* @param string $table_name The name of the table to create
|
|
|
118 |
*/
|
119 |
function create_table( $table_name ) {
|
120 |
global $wpdb;
|
121 |
-
|
122 |
-
|
123 |
-
/* Set the database charset */
|
124 |
-
$charset_collate = '';
|
125 |
-
|
126 |
-
if ( ! empty( $wpdb->charset ) ) {
|
127 |
-
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
128 |
-
}
|
129 |
-
|
130 |
-
if ( ! empty( $wpdb->collate ) ) {
|
131 |
-
$charset_collate .= " COLLATE $wpdb->collate";
|
132 |
-
}
|
133 |
|
134 |
/* Create the database table */
|
135 |
$sql = "CREATE TABLE $table_name (
|
@@ -143,7 +133,15 @@ class Code_Snippets_DB {
|
|
143 |
PRIMARY KEY (id)
|
144 |
) $charset_collate;";
|
145 |
|
|
|
146 |
dbDelta( $sql );
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
}
|
47 |
}
|
48 |
|
49 |
/* If $multisite is null, try to base it on the current admin page */
|
50 |
+
if ( is_null( $network ) && get_current_screen() ) {
|
51 |
$network = get_current_screen()->in_admin( 'network' );
|
52 |
}
|
53 |
|
115 |
* @uses dbDelta() to apply the SQL code
|
116 |
*
|
117 |
* @param string $table_name The name of the table to create
|
118 |
+
* @return bool whether the table creation was successful
|
119 |
*/
|
120 |
function create_table( $table_name ) {
|
121 |
global $wpdb;
|
122 |
+
$charset_collate = $wpdb->get_charset_collate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
/* Create the database table */
|
125 |
$sql = "CREATE TABLE $table_name (
|
133 |
PRIMARY KEY (id)
|
134 |
) $charset_collate;";
|
135 |
|
136 |
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
137 |
dbDelta( $sql );
|
138 |
+
|
139 |
+
$success = empty( $wpdb->last_error );
|
140 |
+
|
141 |
+
if ( $success ) {
|
142 |
+
do_action( 'code_snippets/create_table', $table_name );
|
143 |
+
}
|
144 |
+
|
145 |
+
return $success;
|
146 |
}
|
147 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://bungeshea.com/donate/
|
|
4 |
Tags: code-snippets, snippets, code, php, network, multisite
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.8.1
|
7 |
-
Stable tag: 2.9.
|
8 |
License: MIT
|
9 |
License URI: license.txt
|
10 |
|
@@ -110,6 +110,10 @@ That's fantastic! Fork the [repository on GitHub](http://github.com/sheabunge/co
|
|
110 |
|
111 |
== Changelog ==
|
112 |
|
|
|
|
|
|
|
|
|
113 |
= 2.9.3 (11 Sep 2017) =
|
114 |
* Fixed: Prevent snippets from being executed twice when saving due to invalid ID being passed to allow_execute_snippet filter
|
115 |
* Fixed: Re-enabled output suppression when executing snippets
|
4 |
Tags: code-snippets, snippets, code, php, network, multisite
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.8.1
|
7 |
+
Stable tag: 2.9.4
|
8 |
License: MIT
|
9 |
License URI: license.txt
|
10 |
|
110 |
|
111 |
== Changelog ==
|
112 |
|
113 |
+
= 2.9.4 (19 Sep 2017) =
|
114 |
+
* Fixed: Prevented PHP error from occurring when saving a snippet
|
115 |
+
* Minor improvements to database creation function
|
116 |
+
|
117 |
= 2.9.3 (11 Sep 2017) =
|
118 |
* Fixed: Prevent snippets from being executed twice when saving due to invalid ID being passed to allow_execute_snippet filter
|
119 |
* Fixed: Re-enabled output suppression when executing snippets
|