[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

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

(no description)

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

Defines 8 functions

  yourls_get_option()
  yourls_get_all_options()
  yourls_update_option()
  yourls_add_option()
  yourls_delete_option()
  yourls_maybe_serialize()
  yourls_maybe_unserialize()
  yourls_is_serialized()

Functions
Functions that are not part of a class:

yourls_get_option( $option_name, $default = false )   X-Ref
Read an option from DB (or from cache if available). Return value or $default if not found

Pretty much stolen from WordPress

since: 1.4
return: mixed Value set for the option.
param: string $option_name Option name. Expected to not be SQL-escaped.
param: mixed $default Optional value to return if option doesn't exist. Default false.

yourls_get_all_options()   X-Ref
Read all options from DB at once

The goal is to read all options at once and then populate array $ydb->option, to prevent further
SQL queries if we need to read an option value later.
It's also a simple check whether YOURLS is installed or not (no option = assuming not installed) after
a check for DB server reachability has been performed

since: 1.4
return: void

yourls_update_option( $option_name, $newvalue )   X-Ref
Update (add if doesn't exist) an option to DB

Pretty much stolen from WordPress

since: 1.4
return: bool False if value was not updated, true otherwise.
param: string $option_name Option name. Expected to not be SQL-escaped.
param: mixed $newvalue Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.

yourls_add_option( $name, $value = '' )   X-Ref
Add an option to the DB

Pretty much stolen from WordPress

since: 1.4
return: bool False if option was not added and true otherwise.
param: string $name Name of option to add. Expected to not be SQL-escaped.
param: mixed $value Optional option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.

yourls_delete_option( $name )   X-Ref
Delete an option from the DB

Pretty much stolen from WordPress

since: 1.4
return: bool True, if option is successfully deleted. False on failure.
param: string $name Option name to delete. Expected to not be SQL-escaped.

yourls_maybe_serialize( $data )   X-Ref
Serialize data if needed. Stolen from WordPress

since: 1.4
return: mixed A scalar data
param: mixed $data Data that might be serialized.

yourls_maybe_unserialize( $original )   X-Ref
Unserialize value only if it was serialized. Stolen from WP

since: 1.4
return: mixed Unserialized data can be any type.
param: string $original Maybe unserialized original, if is needed.

yourls_is_serialized( $data, $strict = true )   X-Ref
Check value to find if it was serialized. Stolen from WordPress

since: 1.4
return: bool False if not serialized and true if it was.
param: mixed $data Value to check to see if was serialized.
param: bool $strict Optional. Whether to be strict about the end of the string. Defaults true.



Generated: Tue Jan 21 05:10:11 2025 Cross-referenced by PHPXref 0.7.1