CI_Typography::format_characters PHP Метод

format_characters() публичный Метод

This function mainly converts double and single quotes to curly entities, but it also converts em-dashes, double spaces, and ampersands
public format_characters ( $str ) : string
Результат string
    public function format_characters($str)
    {
        static $table;
        if (!isset($table)) {
            $table = array('/\'"(\\s|$)/' => '&#8217;&#8221;$1', '/(^|\\s|<p>)\'"/' => '$1&#8216;&#8220;', '/\'"(\\W)/' => '&#8217;&#8221;$1', '/(\\W)\'"/' => '$1&#8216;&#8220;', '/"\'(\\s|$)/' => '&#8221;&#8217;$1', '/(^|\\s|<p>)"\'/' => '$1&#8220;&#8216;', '/"\'(\\W)/' => '&#8221;&#8217;$1', '/(\\W)"\'/' => '$1&#8220;&#8216;', '/\'(\\s|$)/' => '&#8217;$1', '/(^|\\s|<p>)\'/' => '$1&#8216;', '/\'(\\W)/' => '&#8217;$1', '/(\\W)\'/' => '$1&#8216;', '/"(\\s|$)/' => '&#8221;$1', '/(^|\\s|<p>)"/' => '$1&#8220;', '/"(\\W)/' => '&#8221;$1', '/(\\W)"/' => '$1&#8220;', "/(\\w)'(\\w)/" => '$1&#8217;$2', '/\\s?\\-\\-\\s?/' => '&#8212;', '/(\\w)\\.{3}/' => '$1&#8230;', '/(\\W)  /' => '$1&nbsp; ', '/&(?!#?[a-zA-Z0-9]{2,};)/' => '&amp;');
        }
        return preg_replace(array_keys($table), $table, $str);
    }