X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=e2fdb65381aba41d1264c934cfe0079386fd1a23;hp=ba6ccc37101dcfc574e6145d1cc3728bbadb3811;hb=9197694ce183b69384a385a6c4a5e16988c7fb09;hpb=c6017cf76200e2a5e68bd1984fa2d31f0e3be9d8 diff --git a/inc/functions.php b/inc/functions.php index ba6ccc3710..e2fdb65381 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2300,7 +2300,7 @@ function detectMultiBytePrefix ($str) { } // Searches the given array for a sub-string match and returns all found keys in an array -function getArrayKeysFromSubStrArray ($heystack, array $needles, $offset = 0) { +function getArrayKeysFromSubStrArray ($heystack, $needles, $offset = 0) { // Init array for all found keys $keys = array(); @@ -2391,6 +2391,21 @@ function translateTaskType ($taskType) { return $message; } +// "Translates" 'true' to true and 'false' to false +function convertStringToBoolean ($str) { + // Trim it lower-case for validation + $str = trim(strtolower($str)); + + // Is it valid? + if (!in_array($str, array('true', 'false'))) { + // Not valid! + debug_report_bug(__FUNCTION__, __LINE__, 'str=' . $str . ' is not true/false'); + } // END - if + + // Return it + return (($str == 'true') ? true : false); +} + //----------------------------------------------------------------------------- // Automatically re-created functions, all taken from user comments on www.php.net //-----------------------------------------------------------------------------