Make WordPress Core

Changeset 48320


Ignore:
Timestamp:
07/05/2020 02:44:37 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve documentation for various option functions.

Props andfinally, david.binda, SergeyBiryukov.
Fixes #49566.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-blogs.php

    r48200 r48320  
    399399 * @param string $option Name of option to add. Expected to not be SQL-escaped.
    400400 * @param mixed  $value  Optional. Option value, can be anything. Expected to not be SQL-escaped.
    401  * @return bool False if option was not added and true if option was added.
     401 * @return bool True if the option was added, false otherwise.
    402402 */
    403403function add_blog_option( $id, $option, $value ) {
     
    426426 * @param int    $id     A blog ID. Can be null to refer to the current blog.
    427427 * @param string $option Name of option to remove. Expected to not be SQL-escaped.
    428  * @return bool True, if option is successfully deleted. False on failure.
     428 * @return bool True if the option was deleted, false otherwise.
    429429 */
    430430function delete_blog_option( $id, $option ) {
     
    455455 * @param mixed  $value      The option value.
    456456 * @param mixed  $deprecated Not used.
    457  * @return bool True on success, false on failure.
     457 * @return bool True if the value was updated, false otherwise.
    458458 */
    459459function update_blog_option( $id, $option, $value, $deprecated = null ) {
  • trunk/src/wp-includes/option.php

    r48193 r48320  
    2424 * @global wpdb $wpdb WordPress database abstraction object.
    2525 *
    26  * @param string $option  Name of option to retrieve. Expected to not be SQL-escaped.
     26 * @param string $option  Name of the option to retrieve. Expected to not be SQL-escaped.
    2727 * @param mixed  $default Optional. Default value to return if the option does not exist.
    2828 * @return mixed Value set for the option.
     
    298298 * @global wpdb $wpdb WordPress database abstraction object.
    299299 *
    300  * @param string      $option   Option name. Expected to not be SQL-escaped.
     300 * @param string      $option   Name of the option to update. Expected to not be SQL-escaped.
    301301 * @param mixed       $value    Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
    302302 * @param string|bool $autoload Optional. Whether to load the option when WordPress starts up. For existing options,
     
    304304 *                              Accepts 'yes'|true to enable or 'no'|false to disable. For non-existent options,
    305305 *                              the default value is 'yes'. Default null.
    306  * @return bool False if value was not updated and true if value was updated.
     306 * @return bool True if the value was updated, false otherwise.
    307307 */
    308308function update_option( $option, $value, $autoload = null ) {
     
    458458 * @global wpdb $wpdb WordPress database abstraction object.
    459459 *
    460  * @param string         $option      Name of option to add. Expected to not be SQL-escaped.
     460 * @param string         $option      Name of the option to add. Expected to not be SQL-escaped.
    461461 * @param mixed          $value       Optional. Option value. Must be serializable if non-scalar.
    462462 *                                    Expected to not be SQL-escaped.
     
    464464 * @param string|bool    $autoload    Optional. Whether to load the option when WordPress starts up.
    465465 *                                    Default is enabled. Accepts 'no' to disable for legacy reasons.
    466  * @return bool False if option was not added and true if option was added.
     466 * @return bool True if the option was added, false otherwise.
    467467 */
    468468function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
     
    566566 * @global wpdb $wpdb WordPress database abstraction object.
    567567 *
    568  * @param string $option Name of option to remove. Expected to not be SQL-escaped.
    569  * @return bool True, if option is successfully deleted. False on failure.
     568 * @param string $option Name of the option to delete. Expected to not be SQL-escaped.
     569 * @return bool True if the option was deleted, false otherwise.
    570570 */
    571571function delete_option( $option ) {
     
    642642 *
    643643 * @param string $transient Transient name. Expected to not be SQL-escaped.
    644  * @return bool true if successful, false otherwise
     644 * @return bool True if the transient was deleted, false otherwise.
    645645 */
    646646function delete_transient( $transient ) {
     
    769769 *                           Expected to not be SQL-escaped.
    770770 * @param int    $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
    771  * @return bool False if value was not set and true if value was set.
     771 * @return bool True if the value was set, false otherwise.
    772772 */
    773773function set_transient( $transient, $value, $expiration = 0 ) {
     
    991991 * @param string $name    The name of the setting.
    992992 * @param string $default Optional default value to return when $name is not set.
    993  * @return mixed the last saved user setting or the default value/false if it doesn't exist.
     993 * @return mixed The last saved user setting or the default value/false if it doesn't exist.
    994994 */
    995995function get_user_setting( $name, $default = false ) {
     
    10101010 * @param string $name  The name of the setting.
    10111011 * @param string $value The value for the setting.
    1012  * @return bool|null True if set successfully, false if not. Null if the current user can't be established.
     1012 * @return bool|null True if set successfully, false otherwise.
     1013 *                   Null if the current user is not a member of the site.
    10131014 */
    10141015function set_user_setting( $name, $value ) {
     
    10331034 *
    10341035 * @param string $names The name or array of names of the setting to be deleted.
    1035  * @return bool|null True if deleted successfully, false if not. Null if the current user can't be established.
     1036 * @return bool|null True if deleted successfully, false otherwise.
     1037 *                   Null if the current user is not a member of the site.
    10361038 */
    10371039function delete_user_setting( $names ) {
     
    10651067 * @global array $_updated_user_settings
    10661068 *
    1067  * @return array the last saved user settings or empty array.
     1069 * @return array The last saved user settings or empty array.
    10681070 */
    10691071function get_all_user_settings() {
     
    11081110 *
    11091111 * @param array $user_settings User settings.
    1110  * @return bool|null False if the current user can't be found, null if the current
    1111  *                   user is not a super admin or a member of the site, otherwise true.
     1112 * @return bool|null True if set successfully, false if the current user could not be found.
     1113 *                   Null if the current user is not a member of the site.
    11121114 */
    11131115function wp_set_all_user_settings( $user_settings ) {
     
    11661168 * @see get_network_option()
    11671169 *
    1168  * @param string $option     Name of option to retrieve. Expected to not be SQL-escaped.
    1169  * @param mixed  $default    Optional value to return if option doesn't exist. Default false.
     1170 * @param string $option     Name of the option to retrieve. Expected to not be SQL-escaped.
     1171 * @param mixed  $default    Optional. Value to return if the option doesn't exist. Default false.
    11701172 * @param bool   $deprecated Whether to use cache. Multisite only. Always set to true.
    11711173 * @return mixed Value set for the option.
     
    11851187 * @see add_network_option()
    11861188 *
    1187  * @param string $option Name of option to add. Expected to not be SQL-escaped.
     1189 * @param string $option Name of the option to add. Expected to not be SQL-escaped.
    11881190 * @param mixed  $value  Option value, can be anything. Expected to not be SQL-escaped.
    1189  * @return bool False if the option was not added. True if the option was added.
     1191 * @return bool True if the option was added, false otherwise.
    11901192 */
    11911193function add_site_option( $option, $value ) {
     
    12011203 * @see delete_network_option()
    12021204 *
    1203  * @param string $option Name of option to remove. Expected to not be SQL-escaped.
    1204  * @return bool True, if succeed. False, if failure.
     1205 * @param string $option Name of the option to delete. Expected to not be SQL-escaped.
     1206 * @return bool True if the option was deleted, false otherwise.
    12051207 */
    12061208function delete_site_option( $option ) {
     
    12161218 * @see update_network_option()
    12171219 *
    1218  * @param string $option Name of option. Expected to not be SQL-escaped.
     1220 * @param string $option Name of the option. Expected to not be SQL-escaped.
    12191221 * @param mixed  $value  Option value. Expected to not be SQL-escaped.
    1220  * @return bool False if value was not updated. True if value was updated.
     1222 * @return bool True if the value was updated, false otherwise.
    12211223 */
    12221224function update_site_option( $option, $value ) {
     
    12341236 *
    12351237 * @param int      $network_id ID of the network. Can be null to default to the current network ID.
    1236  * @param string   $option     Name of option to retrieve. Expected to not be SQL-escaped.
     1238 * @param string   $option     Name of the option to retrieve. Expected to not be SQL-escaped.
    12371239 * @param mixed    $default    Optional. Value to return if the option doesn't exist. Default false.
    12381240 * @return mixed Value set for the option.
     
    13681370 *
    13691371 * @param int    $network_id ID of the network. Can be null to default to the current network ID.
    1370  * @param string $option     Name of option to add. Expected to not be SQL-escaped.
     1372 * @param string $option     Name of the option to add. Expected to not be SQL-escaped.
    13711373 * @param mixed  $value      Option value, can be anything. Expected to not be SQL-escaped.
    1372  * @return bool False if option was not added and true if option was added.
     1374 * @return bool True if the option was added, false otherwise.
    13731375 */
    13741376function add_network_option( $network_id, $option, $value ) {
     
    14931495 *
    14941496 * @param int    $network_id ID of the network. Can be null to default to the current network ID.
    1495  * @param string $option     Name of option to remove. Expected to not be SQL-escaped.
    1496  * @return bool True, if succeed. False, if failure.
     1497 * @param string $option     Name of the option to delete. Expected to not be SQL-escaped.
     1498 * @return bool True if the option was deleted, false otherwise.
    14971499 */
    14981500function delete_network_option( $network_id, $option ) {
     
    15861588 *
    15871589 * @param int      $network_id ID of the network. Can be null to default to the current network ID.
    1588  * @param string   $option     Name of option. Expected to not be SQL-escaped.
     1590 * @param string   $option     Name of the option. Expected to not be SQL-escaped.
    15891591 * @param mixed    $value      Option value. Expected to not be SQL-escaped.
    1590  * @return bool False if value was not updated and true if value was updated.
     1592 * @return bool True if the value was updated, false otherwise.
    15911593 */
    15921594function update_network_option( $network_id, $option, $value ) {
     
    17141716 *
    17151717 * @param string $transient Transient name. Expected to not be SQL-escaped.
    1716  * @return bool True if successful, false otherwise
     1718 * @return bool True if the transient was deleted, false otherwise.
    17171719 */
    17181720function delete_site_transient( $transient ) {
     
    18421844 * @param mixed  $value      Transient value. Expected to not be SQL-escaped.
    18431845 * @param int    $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
    1844  * @return bool False if value was not set and true if value was set.
     1846 * @return bool True if the value was set, false otherwise.
    18451847 */
    18461848function set_site_transient( $transient, $value, $expiration = 0 ) {
Note: See TracChangeset for help on using the changeset viewer.