Skip to content

Commit 0e79313

Browse files
committed
Add: check for mbstring extension
1 parent 5a32f57 commit 0e79313

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

class.jetpack-admin.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,14 @@ function get_modules() {
6666
foreach ( $available_modules as $module ) {
6767
if ( $module_array = $this->jetpack->get_module( $module ) ) {
6868
$short_desc = apply_filters( 'jetpack_short_module_description', $module_array['description'], $module );
69-
// Fix: correct multibyte strings truncate
70-
$short_desc_trunc = ( mb_strlen( $short_desc ) > 143 )
71-
? mb_substr( $short_desc, 0, 140 ) . '...'
72-
: $short_desc;
69+
// Fix: correct multibyte strings truncate with checking for mbstring extension
70+
$short_desc_trunc = ( function_exists( 'mb_strlen' ) )
71+
? ( ( mb_strlen( $short_desc ) > 143 )
72+
? mb_substr( $short_desc, 0, 140 ) . '...'
73+
: $short_desc )
74+
: ( ( strlen( $short_desc ) > 143 )
75+
? substr( $short_desc, 0, 140 ) . '...'
76+
: $short_desc );
7377

7478
$module_array['module'] = $module;
7579
$module_array['activated'] = ( $jetpack_active ? in_array( $module, $active_modules ) : false );

0 commit comments

Comments
 (0)