[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-includes/ -> wp-formatting.php (summary)

(no description)

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

Defines 14 functions

  clean_pre()
  js_escape()
  attribute_escape()
  build_query()
  add_query_arg()
  remove_query_arg()
  ent2ncr()
  urlencode_deep()
  zeroise()
  backslashit()
  _make_url_clickable_cb()
  _make_web_ftp_clickable_cb()
  _make_email_clickable_cb()
  make_clickable()

Functions
Functions that are not part of a class:

clean_pre($matches)   X-Ref
Accepts matches array from preg_replace_callback in wpautop() or a string.

Ensures that the contents of a <<pre>>...<</pre>> HTML block are not
converted into paragraphs or line-breaks.

param: array|string $matches The array or string
return: string The pre block without paragraph/line-break conversion.

js_escape($text)   X-Ref
Escape single quotes, specialchar double quotes, and fix line endings.

The filter 'js_escape' is also applied here.

param: string $text The text to be escaped.
return: string Escaped text.

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

param: string $text
return: string

build_query( $data )   X-Ref
Build URL query based on an associative and, or indexed array.

This is a convenient function for easily building url queries. It sets the
separator to '&' and uses _http_build_query() function.

param: array $data URL-encode key/value pairs.
return: string URL encoded string

add_query_arg()   X-Ref
Retrieve a modified URL query string.

You can rebuild the URL and append a new query variable to the URL query by
using this function. You can also retrieve the full URL with query data.

Adding a single key & value or an associative array. Setting a key value to
emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER
value.

param: mixed $param1 Either newkey or an associative_array
param: mixed $param2 Either newvalue or oldquery or uri
param: mixed $param3 Optional. Old query or uri
return: string New URL query string.

remove_query_arg( $key, $query=false )   X-Ref
Removes an item or list from the query string.

param: string|array $key Query key or keys to remove.
param: bool $query When false uses the $_SERVER value.
return: string New URL query string.

ent2ncr($text)   X-Ref
Converts named entities into numbered entities.

param: string $text The text within which entities will be converted.
return: string Text with converted entities.

urlencode_deep($value)   X-Ref
Navigates through an array and encodes the values to be used in a URL.

Uses a callback to pass the value of the array back to the function as a
string.

param: array|string $value The array or string to be encoded.
return: array|string $value The encoded array (or string from the callback).

zeroise($number, $threshold)   X-Ref
Add leading zeros when necessary.

If you set the threshold to '4' and the number is '10', then you will get
back '0010'. If you set the number to '4' and the number is '5000', then you
will get back '5000'.

Uses sprintf to append the amount of zeros based on the $threshold parameter
and the size of the number. If the number is large enough, then no zeros will
be appended.

param: mixed $number Number to append zeros to if not greater than threshold.
param: int $threshold Digit places number needs to be to not have zeros added.
return: string Adds leading zeros to number if needed.

backslashit($string)   X-Ref
Adds backslashes before letters and before a number at the start of a string.

param: string $string Value to which backslashes will be added.
return: string String with backslashes inserted.

_make_url_clickable_cb($matches)   X-Ref
Callback to convert URI match to HTML A element.

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
make_clickable()}.

param: array $matches Single Regex Match.
return: string HTML A element with URI address.

_make_web_ftp_clickable_cb($matches)   X-Ref
Callback to convert URL match to HTML A element.

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
make_clickable()}.

param: array $matches Single Regex Match.
return: string HTML A element with URL address.

_make_email_clickable_cb($matches)   X-Ref
Callback to convert email address match to HTML A element.

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
make_clickable()}.

param: array $matches Single Regex Match.
return: string HTML A element with email address.

make_clickable($ret)   X-Ref
Convert plaintext URI to HTML links.

Converts URI, www and ftp, and email addresses. Finishes by fixing links
within links.

param: string $ret Content to convert URIs.
return: string Content with converted URIs.



Generated: Thu May 24 03:59:35 2012 Hosted by follow the white rabbit.