[ 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
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.
return: mixed Value set for the option.

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
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.
return: bool False if value was not updated, true otherwise.

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

Pretty much stolen from WordPress

since: 1.4
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.
return: bool False if option was not added and true otherwise.

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

Pretty much stolen from WordPress

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

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

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

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

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

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

since: 1.4
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.
return: bool False if not serialized and true if it was.



Generated: Sat Oct 1 05:10:01 2022 Cross-referenced by PHPXref 0.7.1