Server IP : 192.64.118.117 / Your IP : 18.191.125.73 Web Server : LiteSpeed System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : thecgapy ( 1160) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/thecgapy/mcprintingandpromotions.com/wp-content/plugins/fluentform/app/Helpers/ |
Upload File : |
<?php namespace FluentForm\App\Helpers; class Str { /** * Determine if a given string starts with a given substring. * * @param string $haystack * @param string|array $needles * * @return bool */ public static function startsWith($haystack, $needles) { if (is_array($haystack)) { $haystack = implode(' ', $haystack); } foreach ((array) $needles as $needle) { if ('' != $needle && substr($haystack, 0, strlen($needle)) === (string) $needle) { return true; } } return false; } /** * Determine if a given string ends with a given substring. * * @param string $haystack * @param string|array $needles * * @return bool */ public static function endsWith($haystack, $needles) { if (is_array($haystack)) { $haystack = implode(' ', $haystack); } foreach ((array) $needles as $needle) { if (substr($haystack, -strlen($needle)) === (string) $needle) { return true; } } return false; } /** * Determine if a given string contains a given substring. * * @param string $haystack * @param string|array $needles * * @return bool */ public static function contains($haystack, $needles) { if (is_array($haystack)) { $haystack = implode(' ', $haystack); } foreach ((array) $needles as $needle) { if ('' != $needle && false !== fluentform_mb_strpos(strtolower($haystack), strtolower($needle))) { return true; } } return false; } /** * Determine if a given string does not contain a given substring. * * @param string $haystack * @param string|array $needles * * @return bool */ public static function doNotContains($haystack, $needles) { return !self::contains($haystack, $needles); } /** * Split string as array of string on given substring. * * @param string $haystack * @param string|array $needles * * @return array */ public static function separateString($haystack, $needles) { $separateArray = []; if (self::contains($haystack, $needles)) { if (is_array($needles)) { foreach ($needles as $needle) { $separateArray[] = array_map('trim', explode($needle, $haystack)); } } else { $separateArray = array_map('trim', explode($needles, $haystack)); } } return $separateArray; } }