PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 All 123 releases
← All changes | Inc/Framework/Inc/Helpers/StringHelper.php +58 -8 1.0.7 → 3.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FirePlugins Framework
4 - * @version 1.0.16
4 + * @version 1.2.6
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2026 FirePlugins All Rights Reserved
9 9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 10 */
11 11
12 12 namespace FPFramework\Helpers;
@@ -51,13 +51,16 @@
51 51 * @return mixed integer position or FALSE on failure
52 52 */
53 53 public static function utf8_strpos($str, $search, $offset = FALSE)
54 54 {
55 - if ( $offset === FALSE ) {
56 - return mb_strpos($str, $search);
57 - } else {
58 - return mb_strpos($str, $search, $offset);
55 + if ($offset === FALSE)
56 + {
57 + return \mb_strpos($str, $search);
59 58 }
59 + else
60 + {
61 + return \mb_strpos($str, $search, $offset);
62 + }
60 63 }
61 64
62 65 /**
63 66 * Checks whether $haystack starts with $needle.
@@ -68,9 +71,9 @@
68 71 * @return int
69 72 */
70 73 public static function startsWith($haystack, $needle)
71 74 {
72 - return substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
75 + return \substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
73 76 }
74 77
75 78 /**
76 79 * Checks whether $haystack ends with $needle.
@@ -81,7 +84,54 @@
81 84 * @return int
82 85 */
83 86 public static function endsWith($haystack, $needle)
84 87 {
85 - return substr_compare($haystack, $needle, -strlen($needle)) === 0;
88 + return \substr_compare($haystack, $needle, -strlen($needle)) === 0;
89 + }
90 +
91 + /**
92 + * UTF-8 aware alternative to substr()
93 + *
94 + * Return part of a string given character offset (and optionally length).
95 + *
96 + * @param string $str String being processed
97 + * @param integer $offset Number of UTF-8 characters offset (from left)
98 + * @param integer|null|boolean $length Optional length in UTF-8 characters from offset
99 + *
100 + * @return string|boolean
101 + */
102 + public static function substr($str, $offset, $length = false)
103 + {
104 + if ($length === false)
105 + {
106 + return self::utf8_substr($str, $offset);
107 + }
108 +
109 + return self::utf8_substr($str, $offset, $length);
110 + }
111 +
112 + public static function utf8_substr($str, $offset, $length = FALSE)
113 + {
114 + if ($length === FALSE)
115 + {
116 + return \mb_substr($str, $offset);
117 + }
118 + else
119 + {
120 + return \mb_substr($str, $offset, $length);
121 + }
122 + }
123 +
124 + /**
125 + * UTF-8 aware alternative to strlen()
126 + *
127 + * Returns the number of characters in the string (NOT THE NUMBER OF BYTES).
128 + *
129 + * @param string $str UTF-8 string.
130 + *
131 + * @return integer Number of UTF-8 characters in string.
132 + */
133 + public static function strlen($str)
134 + {
135 + return \mb_strlen($str);
86 136 }
87 137 }