Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted September 26, 20177 yr /** * Check if a value is okay to be stored in a non-utf8mb4 database * * @param mixed $value The value * @return bool */ protected static function utf8mb4Check( $value ) { if ( is_array( $value ) ) { foreach ( $value as $_value ) { if ( !static::utf8mb4Check( $_value ) ) { return FALSE; } } } elseif ( is_string( $value ) ) { return (bool) !preg_match( '/[\x{10000}-\x{10FFFF}]/u', $value ); } return TRUE; } could we get this method mad public or moved to another class where it has public access? i've been meaning to ask this for quite awhile now, but keeps slipping my mind it would be useful if it was like in Lang or Text class instead
September 28, 20177 yr Author thanks. while you are at it, could you possible abstract this out into a method as well in almost all my apps i have a "junk" method that does something like this for non lang strings. if ( isset( $values[ 'options' ][ 'ucfirst' ] ) ) { $replacement = mb_strtoupper( mb_substr( $replacement, 0, 1 ) ) . mb_substr( $replacement, 1 ); } maybe make it a public static method like breakword was (i know thats been deprecated) in the Lang class . I really hate duplication of code and this could have a lot of uses outside of lang strings as well.
Archived
This topic is now archived and is closed to further replies.