Skip to content

Commit df9faa4

Browse files
authored
php8.0 兼容性修复
1 parent 661b88c commit df9faa4

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

shortcode.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
<?php
2-
/**
3-
*
4-
* 注册短代码
5-
*
6-
* @author MaiCong <i@maicong.me>
7-
* @link https://github.com/maicong/stay
8-
* @since 1.5.7
9-
*
10-
*/
2+
/* 注册短代码 */
113

124
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
135

@@ -134,7 +126,7 @@ function shortcode_shrinks( $atts, $content = '' ) {
134126
foreach ( $args as $k => $v ) {
135127
$attr_strings[] = $k . '="' . htmlspecialchars( $v, ENT_QUOTES, 'UTF-8' ) . '"';
136128
}
137-
return '<div class="panel panel-'.$args['style'].' shrinkBox '.$args['checked'].'" >
129+
return '<div class="panel panel-'.$args['style'].' shrinkBox '.(isset($args['checked']) ? $args['checked'] : '').'" >
138130
<div class="panel-heading shrinkBox-title" onclick="$(this).parent().toggleClass(\'active\');">'.$args['title'].'</div><div class="panel-body shrinkBox-content">'.$content.'</div></div>';
139131
}
140132
add_shortcode( 'shrinks' , 'shortcode_shrinks' );
@@ -155,6 +147,6 @@ function shortcode_alert( $atts, $content = '' ) {
155147
foreach ( $args as $k => $v ) {
156148
$attr_strings[] = $k . '="' . htmlspecialchars( $v, ENT_QUOTES, 'UTF-8' ) . '"';
157149
}
158-
return '<div class="alert alert-'.$args['style'].' '.$args['close'].'" role="alert">'.$closebutton.$content.'</div>';
150+
return '<div class="alert alert-'.$args['style'].' '.(isset($args['close']) ? $args['close'] : '').'" role="alert">'.$closebutton.$content.'</div>';
159151
}
160152
add_shortcode( 'alert' , 'shortcode_alert' );

0 commit comments

Comments
 (0)