Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Commit 18a9d30

Browse files
committed
Fix issue undefined index, bump to v2.1.1
Fixes #112 An issue with $tag['code'] is not set when viewed on an archive page created by Beaver Builder. This adds an isset() check to avoid the error.
1 parent aee25bf commit 18a9d30

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Code Syntax Block
44
* Plugin URI: https://github.com/mkaz/code-syntax-block
55
* Description: A plugin to extend Gutenberg code block with syntax highlighting
6-
* Version: 2.1.0
6+
* Version: 2.1.1
77
* Author: Marcus Kazmierczak
88
* Author URI: https://mkaz.blog/
99
* License: GPL2
@@ -14,7 +14,7 @@
1414
*/
1515

1616
// version added, used in URL
17-
const MKAZ_CODE_SYNTAX_BLOCK_VERSION = '2.1.0';
17+
const MKAZ_CODE_SYNTAX_BLOCK_VERSION = '2.1.1';
1818
const MKAZ_CODE_SYNTAX_DEFAULT_SCHEME = 'prism-a11y-dark';
1919
const MKAZ_CODE_SYNTAX_COLOR_SCHEMES = ['prism-a11y-dark', 'prism-ghcolors', 'prism-nord', 'prism-onedark'];
2020
require dirname( __FILE__ ) . '/prism-languages.php';
@@ -214,7 +214,7 @@ function mkaz_prism_theme_css_ver() {
214214
// extend code tag to allow lang attribute
215215
add_filter( 'wp_kses_allowed_html', function( $tags ) {
216216

217-
if ( is_array( $tags['code'] ) ) {
217+
if ( isset( $tags['code'] ) && is_array( $tags['code'] ) ) {
218218
$tags['code']['lang'] = array();
219219
} else {
220220
$tags['code'] = array(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mkaz-code-syntax-block",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"license": "GPL-2.0-or-later",
55
"repository": {
66
"type": "git",

readme.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: code, code syntax, syntax highlight, code highlighting
55
Requires at least: 5.0
66
Tested up to: 5.8
77
Requires PHP: 5.6
8-
Stable tag: 2.1.0
8+
Stable tag: 2.1.1
99
License: GPLv2 or later
1010
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -108,6 +108,12 @@ Example:
108108

109109
== Changelog ==
110110

111+
= 2.1.1 =
112+
113+
- Fix undefined index error with $tag['code'] not defined
114+
on archive page triggered by Beaver Builder
115+
116+
111117
= 2.1.0 =
112118

113119
- Fix background color not being applied unless language specified.

0 commit comments

Comments
 (0)