[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-includes/ -> strings.php (summary)

(no description)

File Size: 307 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 12 functions

  gp_startswith()
  gp_endswith()
  gp_in()
  gp_strtolower()
  gp_strlen()
  gp_stripos()
  gp_substr()
  gp_esc_attr_with_entities()
  esc_translation()
  gp_string_similarity()
  gp_levenshtein()
  gp_sanitize_slug()

Functions
Functions that are not part of a class:

gp_startswith( $haystack, $needle )   X-Ref
Functions, which make work with strings easier


gp_endswith( $haystack, $needle )   X-Ref
No description

gp_in( $needle, $haystack )   X-Ref
No description

gp_strtolower( $str, $encoding = null )   X-Ref
Compat function to mimic mb_strtolower().

Falls back to `strtolower()` if `mb_strtolower()` doesn't exists.

since: 1.0.0
return: int String length of `$str`.
param: string      $str      The string being lowercased.
param: string|null $encoding Optional. Character encoding to use. Default null.

gp_strlen( $str, $encoding = null )   X-Ref
Compat function to mimic mb_strlen().

Without a `function_exists()` check because WordPress includes
a compat function for `mb_strlen()`.

since: 1.0.0
return: int String length of `$str`.
param: string      $str      The string to retrieve the character length from.
param: string|null $encoding Optional. Character encoding to use. Default null.

gp_stripos( $haystack, $needle, $offset = 0, $encoding = null )   X-Ref
Compat function to mimic mb_stripos().

Falls back to `stripos()` if `mb_stripos()` doesn't exists.

since: 1.0.0
return: int|false The numeric position of the first occurrence of needle in the haystack string,
param: string      $haystack The string from which to get the position of the first occurrence of needle.
param: string      $needle   The string to find in haystack.
param: int         $offset   The position in haystack to start searching.
param: string|null $encoding Optional. Character encoding to use. Default null.

gp_substr( $str, $start, $length, $encoding = null )   X-Ref
Compat function to mimic mb_substr().

Without a `function_exists()` check because WordPress includes
a compat function for `mb_substr()`.

since: 1.0.0
return: string Extracted substring.
param: string      $str      The string to extract the substring from.
param: int         $start    Position to being extraction from in `$str`.
param: int|null    $length   Optional. Maximum number of characters to extract from `$str`.
param: string|null $encoding Optional. Character encoding to use. Default null.

gp_esc_attr_with_entities( $text )   X-Ref
Escaping for HTML attributes.

Similar to esc_attr(), but double encode entities.

since: 1.0.0
return: string The text after it has been escaped.
param: string $text The text prior to being escaped.

esc_translation( $text )   X-Ref
Escapes translations for HTML blocks.

Similar to esc_html(), but double encode entities.

since: 1.0.0
return: string The text after it has been escaped.
param: string $text The text prior to being escaped.

gp_string_similarity( $str1, $str2 )   X-Ref
No description

gp_levenshtein( $str1, $str2, $length1, $length2 )   X-Ref
No description

gp_sanitize_slug( $slug )   X-Ref
Sanitizes a string for use as a slug, replacing whitespace and a few other characters with dashes.

Limits the output to alphanumeric characters, underscore (_), periods (.) and dash (-).
Whitespace becomes a dash.

since: 2.1.0
return: string The sanitized title.
param: string $slug The string to be sanitized for use as a slug.



Generated: Tue Jan 22 01:02:31 2019 Cross-referenced by PHPXref 0.7.1