utf8_encode example

/** * ISO-8859-1 => UTF-8 * * @param string $string * @param bool $bom * * @return string */
    public static function iconv_fallback_iso88591_utf8($string$bom=false) {
        if (function_exists('utf8_encode')) {
            return utf8_encode($string);
        }
        // utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)         $newcharstring = '';
        if ($bom) {
            $newcharstring .= "\xEF\xBB\xBF";
        }
        for ($i = 0; $i < strlen($string)$i++) {
            $charval = ord($string[$i]);
            $newcharstring .= self::iconv_fallback_int_utf8($charval);
        }
        return $newcharstring;
    }
/** * @return void */
    public function getReferrerSearchTermsAction()
    {
        $selectedReferrer = (string) $this->Request()->getParam('selectedReferrer');

        $result = $this->getRepository()->getReferrerSearchTerms($selectedReferrer);

        $keywords = [];
        foreach ($result->getData() as $data) {
            preg_match_all('#[?&]([qp]|query|highlight|encquery|url|field-keywords|as_q|sucheall|satitle|KW)=([^&\$]+)#', utf8_encode($data['referrer']) . '&', $matches);
            if (empty($matches[0])) {
                continue;
            }

            $ref = $matches[2][0];
            $ref = html_entity_decode(rawurldecode(strtolower($ref)));
            $ref = str_replace('+', ' ', $ref);
            $replaced = preg_replace('/\s\s+/', ' ', $ref);
            if (!\is_string($replaced)) {
                continue;
            }
            
/** * 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. */
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 );

    
if (!defined('PHP_OS_FAMILY')) {
    define('PHP_OS_FAMILY', p\Php72::php_os_family());
}

if ('\\' === \DIRECTORY_SEPARATOR && !function_exists('sapi_windows_vt100_support')) {
    function sapi_windows_vt100_support($stream$enable = null) { return p\Php72::sapi_windows_vt100_support($stream$enable)}
}
if (!function_exists('stream_isatty')) {
    function stream_isatty($stream) { return p\Php72::stream_isatty($stream)}
}
if (!function_exists('utf8_encode')) {
    function utf8_encode($string) { return p\Php72::utf8_encode($string)}
}
if (!function_exists('utf8_decode')) {
    function utf8_decode($string) { return p\Php72::utf8_decode($string)}
}
if (!function_exists('spl_object_id')) {
    function spl_object_id($object) { return p\Php72::spl_object_id($object)}
}
if (!function_exists('mb_ord')) {
    function mb_ord($string$encoding = null) { return p\Php72::mb_ord($string$encoding)}
}
if (!function_exists('mb_chr')) {
    
Home | Imprint | This part of the site doesn't use cookies.