[ Index ]

PHP Cross Reference of phpBB-3.3.0-deutsch

title

Body

[close]

/includes/utf/ -> utf_tools.php (summary)

This file is part of the phpBB Forum Software package.

Copyright: (c) phpBB Limited
License: GNU General Public License, version 2 (GPL-2.0)
File Size: 1469 lines (41 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 26 functions

  utf8_strrpos()
  utf8_strpos()
  utf8_strtolower()
  utf8_strtoupper()
  utf8_substr()
  utf8_strlen()
  utf8_str_split()
  utf8_strspn()
  utf8_ucfirst()
  utf8_recode()
  utf8_encode_ucr()
  utf8_encode_ncr()
  utf8_encode_ncr_callback()
  utf8_ord()
  utf8_chr()
  utf8_decode_ncr()
  utf8_decode_ncr_callback()
  utf8_case_fold()
  utf8_case_fold_nfkc()
  utf8_case_fold_nfc()
  utf8_normalize_nfc()
  utf8_clean_string()
  utf8_htmlspecialchars()
  utf8_convert_message()
  utf8_wordwrap()
  utf8_basename()

Functions
Functions that are not part of a class:

utf8_strrpos($str, $needle, $offset = null)   X-Ref
UTF-8 aware alternative to strrpos


utf8_strpos($str, $needle, $offset = null)   X-Ref
UTF-8 aware alternative to strpos


utf8_strtolower($str)   X-Ref
UTF-8 aware alternative to strtolower


utf8_strtoupper($str)   X-Ref
UTF-8 aware alternative to strtoupper


utf8_substr($str, $offset, $length = null)   X-Ref
UTF-8 aware alternative to substr


utf8_strlen($text)   X-Ref
Return the length (in characters) of a UTF-8 string


utf8_str_split($str, $split_len = 1)   X-Ref
UTF-8 aware alternative to str_split
Convert a string to an array

return: array characters in string reverses
author: Harry Fuecks
param: string $str UTF-8 encoded
param: int $split_len number to characters to split string by

utf8_strspn($str, $mask, $start = null, $length = null)   X-Ref
UTF-8 aware alternative to strspn
Find length of initial segment matching the mask

author: Harry Fuecks

utf8_ucfirst($str)   X-Ref
UTF-8 aware alternative to ucfirst
Make a string's first character uppercase

return: string with first character as upper case (if applicable)
author: Harry Fuecks
param: string

utf8_recode($string, $encoding)   X-Ref
Recode a string to UTF-8

If the encoding is not supported, the string is returned as-is

return: string                The string, encoded in UTF-8
param: string    $string        Original string
param: string    $encoding    Original encoding (lowered)

utf8_encode_ucr($text)   X-Ref
Replace some special UTF-8 chars that are not in ASCII with their UCR.
using their Numeric Character Reference's Hexadecimal notation.

Doesn't interfere with Japanese or Cyrillic etc.
Unicode character visualization will depend on the character support
of your web browser and the fonts installed on your system.

return: string                ASCII string using NCR for non-ASCII chars
param: string    $text        UTF-8 string in NFC

utf8_encode_ncr($text)   X-Ref
Replace all UTF-8 chars that are not in ASCII with their NCR
using their Numeric Character Reference's Hexadecimal notation.

return: string                ASCII string using NCRs for non-ASCII chars
param: string    $text        UTF-8 string in NFC

utf8_encode_ncr_callback($m)   X-Ref
Callback used in utf8_encode_ncr() and utf8_encode_ucr()

Takes a UTF-8 char and replaces it with its NCR. Attention, $m is an array

return: string                A HTML NCR if the character is valid, or the original string otherwise
param: array    $m            0-based numerically indexed array passed by preg_replace_callback()

utf8_ord($chr)   X-Ref
Converts a UTF-8 char to an NCR

return: integer UNICODE code point
param: string $chr UTF-8 char

utf8_chr($cp)   X-Ref
Converts an NCR to a UTF-8 char

return: string        UTF-8 char
param: int        $cp    UNICODE code point

utf8_decode_ncr($text)   X-Ref
Convert Numeric Character References to UTF-8 chars

Notes:
- we do not convert NCRs recursively, if you pass & it will return &
- we DO NOT check for the existence of the Unicode characters, therefore an entity may be converted to an inexistent codepoint

return: string                UTF-8 string where NCRs have been replaced with the actual chars
param: string    $text        String to convert, encoded in UTF-8 (no normal form required)

utf8_decode_ncr_callback($m)   X-Ref
Callback used in decode_ncr()

Takes a NCR (in decimal or hexadecimal) and returns a UTF-8 char. Attention, $m is an array.
It will ignore most of invalid NCRs, but not all!

return: string                UTF-8 char
param: array    $m            0-based numerically indexed array passed by preg_replace_callback()

utf8_case_fold($text, $option = 'full')   X-Ref
Case folds a unicode string as per Unicode 5.0, section 3.13

return: string            case folded text
param: string    $text    text to be case folded
param: string    $option    determines how we will fold the cases

utf8_case_fold_nfkc($text, $option = 'full')   X-Ref
Takes the input and does a "special" case fold. It does minor normalization
and returns NFKC compatable text

return: string            case folded text
param: string    $text    text to be case folded
param: string    $option    determines how we will fold the cases

utf8_case_fold_nfc($text, $option = 'full')   X-Ref
Assume the input is NFC:
Takes the input and does a "special" case fold. It does minor normalization as well.

return: string            case folded text
param: string    $text    text to be case folded
param: string    $option    determines how we will fold the cases

utf8_normalize_nfc($strings)   X-Ref
wrapper around PHP's native normalizer from intl
previously a PECL extension, included in the core since PHP 5.3.0
http://php.net/manual/en/normalizer.normalize.php

return: mixed                the normalized content, preserving array keys if array given.
param: mixed    $strings    a string or an array of strings to normalize

utf8_clean_string($text)   X-Ref
This function is used to generate a "clean" version of a string.
Clean means that it is a case insensitive form (case folding) and that it is normalized (NFC).
Additionally a homographs of one character are transformed into one specific character (preferably ASCII
if it is an ASCII character).

Please be aware that if you change something within this function or within
functions used here you need to rebuild/update the username_clean column in the users table. And all other
columns that store a clean string otherwise you will break this functionality.

return: string            Cleaned up version of the input string
param: string    $text    An unclean string, mabye user input (has to be valid UTF-8!)

utf8_htmlspecialchars($value)   X-Ref
A wrapper for htmlspecialchars($value, ENT_COMPAT, 'UTF-8')


utf8_convert_message($message)   X-Ref
Trying to convert returned system message to utf8

PHP assumes such messages are ISO-8859-1 so we'll do that too
and if it breaks messages we'll blame it on them ;-)

utf8_wordwrap($string, $width = 75, $break = "\n", $cut = false)   X-Ref
UTF8-compatible wordwrap replacement

return: string            the given string wrapped at the specified column.
param: string    $string    The input string
param: int        $width    The column width. Defaults to 75.
param: string    $break    The line is broken using the optional break parameter. Defaults to '\n'.
param: bool    $cut    If the cut is set to TRUE, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken apart.

utf8_basename($filename)   X-Ref
UTF8-safe basename() function

basename() has some limitations and is dependent on the locale setting
according to the PHP manual. Therefore we provide our own locale independent
basename function.

return: string The basenamed filename
param: string $filename The filename basename() should be applied to



Generated: Tue Apr 7 19:44:41 2020 Cross-referenced by PHPXref 0.7.1