Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 5fe846b

Browse files
authored
Merge pull request #245 from edent/patch-2
Prevent Facepile error
2 parents 88bc8f9 + 0d052d9 commit 5fe846b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

includes/class-linkbacks-walker-comment.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ class Semantic_Linkbacks_Walker_Comment extends Walker_Comment {
1010

1111
protected static function should_facepile( $comment ) {
1212
$facepiles = get_option( 'semantic_linkbacks_facepiles', array_keys( Linkbacks_Handler::get_comment_type_strings() ) );
13-
13+
// If getting the facepiles hasn't worked, create an empty array to avoid generating errors
14+
if ( ! is_array( $facepiles ) ) {
15+
$facepiles = array();
16+
}
17+
1418
if ( self::is_reaction( $comment ) && in_array( 'reaction', $facepiles, true ) ) {
1519
return true;
1620
}

templates/linkbacks.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
<?php $facepiles = get_option( 'semantic_linkbacks_facepiles', array_keys( Linkbacks_Handler::get_comment_type_strings() ) ); ?>
1+
<?php $facepiles = get_option( 'semantic_linkbacks_facepiles', array_keys( Linkbacks_Handler::get_comment_type_strings() ) );
2+
3+
// If getting the facepiles hasn't worked, create an empty array to avoid generating errors
4+
if ( ! is_array( $facepiles ) ) {
5+
$facepiles = array();
6+
}
7+
8+
?>
29
<?php if ( in_array( 'reacji', $facepiles, true ) && Semantic_Linkbacks_Walker_Comment::$reactions ) : ?>
310
<div class="reactions">
411
<h3><?php echo __( 'Reacjis', 'semantic-linkbacks' ); ?></h3>

0 commit comments

Comments
 (0)