Skip to content

Commit 6bf259c

Browse files
authored
Update 000-common.txt
1 parent 8f90eae commit 6bf259c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

modules/wordpress/mu-plugins/000-common.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,17 @@ License URI: http://www.gnu.org/licenses/gpl-3.0.html
3737
/** A. 000 Common: Safe Constant ************************************************************ */
3838
/** ********************************************************************************************* */
3939

40-
// Function to check if a constant is defined before using it
40+
// check if constant is defined before using it
4141
function ss_safe_constant( $constant, $default = '' ) {
42-
return defined( $constant ) ? (string) constant( $constant ) : $default;
42+
if ( defined( $constant ) ) {
43+
$value = constant( $constant );
44+
45+
if ( is_scalar( $value ) ) {
46+
return (string) $value;
47+
}
48+
}
49+
50+
return $default;
4351
}
4452

4553
/** ********************************************************************************************* */

0 commit comments

Comments
 (0)