Jump to content

FormAbstract


CodingJungle

Recommended Posts

	/**
	 * 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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...