seems_utf8 example



    /** * Wraps given string in XML CDATA tag. * * @since 2.1.0 * * @param string $str String to wrap in XML CDATA tag. * @return string */
    function wxr_cdata( $str ) {
        if ( ! seems_utf8( $str ) ) {
            $str = utf8_encode( $str );
        }
        // $str = ent2ncr(esc_html($str));         $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';

        return $str;
    }

    /** * Returns the URL of the site. * * @since 2.5.0 * * @return string Site URL. */

function remove_accents( $text$locale = '' ) {
    if ( ! preg_match( '/[\x80-\xff]/', $text ) ) {
        return $text;
    }

    if ( seems_utf8( $text ) ) {

        /* * Unicode sequence normalization from NFD (Normalization Form Decomposed) * to NFC (Normalization Form [Pre]Composed), the encoding used in this function. */
        if ( function_exists( 'normalizer_is_normalized' )
            && function_exists( 'normalizer_normalize' )
        ) {
            if ( ! normalizer_is_normalized( $text ) ) {
                $text = normalizer_normalize( $text );
            }
        }
$meta['shutter_speed'] = (string) $exif['ExposureTime'];
            if ( is_scalar( $exif['ExposureTime'] ) ) {
                $meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] );
            }
        }
        if ( ! empty( $exif['Orientation'] ) ) {
            $meta['orientation'] = $exif['Orientation'];
        }
    }

    foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) {
        if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) {
            $meta[ $key ] = utf8_encode( $meta[ $key ] );
        }
    }

    foreach ( $meta['keywords'] as $key => $keyword ) {
        if ( ! seems_utf8( $keyword ) ) {
            $meta['keywords'][ $key ] = utf8_encode( $keyword );
        }
    }

    $meta = wp_kses_post_deep( $meta );

    
Home | Imprint | This part of the site doesn't use cookies.