[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/includes/ -> functions-deprecated.php (summary)

Deprecated functions from past YOURLS versions. Don't use them, as they may be removed in a later version. Use the newer alternatives instead. Note to devs: when deprecating a function, move it here. Then check all the places in core that might be using it, including core plugins.

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

Defines 22 functions

  yourls_activate_plugin_sandbox()
  yourls_current_admin_page()
  yourls_encodeURI()
  yourls_validate_plugin_file()
  yourls_string2htmlid()
  yourls_get_search_text()
  yourls_current_time()
  yourls_lowercase_scheme_domain()
  yourls_sanitize_string()
  yourls_favicon()
  yourls_get_link_stats()
  yourls_url_exists()
  yourls_plural()
  yourls_get_duplicate_keywords()
  yourls_intval()
  yourls_get_remote_content()
  yourls_apply_filters()
  yourls_has_interface()
  yourls_http_proxy_is_defined()
  yourls_ex()
  yourls_escape()
  yourls_escape_real()

Functions
Functions that are not part of a class:

yourls_activate_plugin_sandbox( $pluginfile )   X-Ref
Plugin activation sandbox

return: string|true  string if error or true if success
param: string $pluginfile Plugin filename (full path)
since: 1.8.3

yourls_current_admin_page()   X-Ref
Return current admin page, or null if not an admin page. Was not used anywhere.

return: mixed string if admin page, null if not an admin page
since: 1.6

yourls_encodeURI($url)   X-Ref
PHP emulation of JS's encodeURI

return: string
param: string $url

yourls_validate_plugin_file( $file )   X-Ref
Check if a file is a plugin file


yourls_string2htmlid( $string )   X-Ref
Return a unique(ish) hash for a string to be used as a valid HTML id


yourls_get_search_text()   X-Ref
Get search text from query string variables search_protocol, search_slashes and search

Some servers don't like query strings containing "(ht|f)tp(s)://". A javascript bit
explodes the search text into protocol, slashes and the rest (see JS function
split_search_text_before_search()) and this function glues pieces back together
See issue https://github.com/YOURLS/YOURLS/issues/1576

return: string Search string
since: 1.7

yourls_current_time( $type, $gmt = 0 )   X-Ref
Retrieve the current time based on specified type. Stolen from WP.

The 'mysql' type will return the time in the format for MySQL DATETIME field.
The 'timestamp' type will return the current timestamp.

If $gmt is set to either '1' or 'true', then both types will use GMT time.
if $gmt is false, the output is adjusted with the GMT offset in the WordPress option.

return: int|string String if $type is 'gmt', int if $type is 'timestamp'.
param: string $type Either 'mysql' or 'timestamp'.
param: int|bool $gmt Optional. Whether to use GMT timezone. Default is false.
since: 1.6

yourls_lowercase_scheme_domain( $url )   X-Ref
Lowercase scheme and domain of an URI - see issues 591, 1630, 1889

Renamed to yourls_normalize_uri() in 1.7.10 because the function now does more than just
lowercasing the scheme and domain.


yourls_sanitize_string( $string, $restrict_to_shorturl_charset = false )   X-Ref
The original string sanitize function


yourls_favicon( $echo = true )   X-Ref
Return favicon URL (either default or custom)


yourls_get_link_stats( $url )   X-Ref
Return array of stats for a given keyword


yourls_url_exists( $url )   X-Ref
Check if a long URL already exists in the DB. Return NULL (doesn't exist) or an object with URL informations.

since: 1.5.1

yourls_plural( $word, $count=1 )   X-Ref
Return word or words if more than one


yourls_get_duplicate_keywords( $longurl )   X-Ref
Return list of all shorturls associated to the same long URL. Returns NULL or array of keywords.


yourls_intval( $int )   X-Ref
Make sure a integer is safe

Note: this function is dumb and dumbly named since it does not intval(). DO NOT USE.


yourls_get_remote_content( $url, $maxlen = 4096, $timeout = 5 )   X-Ref
Get remote content via a GET request using best transport available


yourls_apply_filters( $hook, $value = '' )   X-Ref
Alias for yourls_apply_filter because I never remember if it's _filter or _filters

At first I thought it made semantically more sense but thinking about it, I was wrong. It's one filter.
There may be several function hooked into it, but it still the same one filter.

return: mixed
param: string $hook the name of the YOURLS element or action
param: mixed $value the value of the element before filtering
since: 1.6

yourls_has_interface()   X-Ref
Check if we'll need interface display function (ie not API or redirection)


yourls_http_proxy_is_defined()   X-Ref
Check if a proxy is defined for HTTP requests

return: bool true if a proxy is defined, false otherwise
since: 1.7

yourls_ex( $text, $context, $domain = 'default' )   X-Ref
Displays translated string with gettext context

This function has been renamed yourls_xe() for consistency with other *e() functions

return: string Translated context string without pipe
param: string $text Text to translate
param: string $context Context information for the translators
param: string $domain Optional. Domain to retrieve the translated text
since: 1.6

yourls_escape( $data )   X-Ref
Escape a string or an array of strings before DB usage. ALWAYS escape before using in a SQL query. Thanks.

Deprecated in 1.7.3 because we moved onto using PDO and using built-in escaping functions, instead of
rolling our own.

return: string|array escaped data
param: string|array $data string or array of strings to be escaped

yourls_escape_real( $string )   X-Ref
"Real" escape. This function should NOT be called directly. Use yourls_escape() instead.

This function uses a "real" escape if possible, using PDO, MySQL or MySQLi functions,
with a fallback to a "simple" addslashes
If you're implementing a custom DB engine or a custom cache system, you can define an
escape function using filter 'custom_escape_real'

return: string escaped string
param: string $a string to be escaped
since: 1.7



Generated: Sat Feb 22 05:10:06 2025 Cross-referenced by PHPXref 0.7.1