You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -143,15 +142,22 @@ static public function colorize($string, $colored = null) {
143
142
* Remove color information from a string.
144
143
*
145
144
* @param string $string A string with color information.
145
+
* @param int $keep Optional. If the 1 bit is set, color tokens (eg "%n") won't be stripped. If the 2 bit is set, color encodings (ANSI escapes) won't be stripped. Default 0.
146
146
* @return string A string with color information removed.
if (!isset($this->_width[$column]) || $width > $this->_width[$column]) {
107
107
$this->_width[$column] = $width;
108
108
}
@@ -228,4 +228,30 @@ public function setRows(array $rows) {
228
228
publicfunctioncountRows() {
229
229
returncount($this->_rows);
230
230
}
231
+
232
+
/**
233
+
* Set whether items in an Ascii table are pre-colorized.
234
+
*
235
+
* @param bool|array $precolorized A boolean to set all columns in the table as pre-colorized, or an array of booleans keyed by column index (number) to set individual columns as pre-colorized.
@@ -213,16 +243,13 @@ function safe_str_pad( $string, $length ) {
213
243
/**
214
244
* Get width of string, ie length in characters, taking into account multi-byte and mark characters for UTF-8, and multi-byte for non-UTF-8.
215
245
*
216
-
* @param string The string to check
217
-
* @return int The string's width.
246
+
* @param string $string The string to check.
247
+
* @param string|bool $encoding Optional. The encoding of the string. Default false.
248
+
* @return int The string's width.
218
249
*/
219
-
functionstrwidth( $string ) {
220
-
static$eaw_regex; // East Asian Width regex. Characters that count as 2 characters as they're "wide" or "fullwidth". See http://www.unicode.org/reports/tr11/tr11-19.html
221
-
static$m_regex; // Mark characters regex (Unicode property "M") - mark combining "Mc", mark enclosing "Me" and mark non-spacing "Mn" chars that should be ignored for spacing purposes.
@@ -252,3 +281,29 @@ function strwidth( $string ) {
252
281
}
253
282
returnsafe_strlen( $string );
254
283
}
284
+
285
+
/**
286
+
* Get the regexs generated from Unicode data.
287
+
*
288
+
* @param string $idx Optional. Return a specific regex only. Default null.
289
+
* @return array|string Returns keyed array if not given $idx or $idx doesn't exist, otherwise the specific regex string.
290
+
*/
291
+
functionget_unicode_regexs( $idx = null ) {
292
+
static$eaw_regex; // East Asian Width regex. Characters that count as 2 characters as they're "wide" or "fullwidth". See http://www.unicode.org/reports/tr11/tr11-19.html
293
+
static$m_regex; // Mark characters regex (Unicode property "M") - mark combining "Mc", mark enclosing "Me" and mark non-spacing "Mn" chars that should be ignored for spacing purposes.
0 commit comments