Ticket #5639: functions.phpdoc.r8211.diff
| File functions.phpdoc.r8211.diff, 12.0 KB (added by , 18 years ago) |
|---|
-
functions.php
99 99 } 100 100 } 101 101 102 102 /** 103 * Retrieve the date in localized format, based on timestamp. 104 * 105 * If the locale specifies the locale month and weekday, then the locale will 106 * take over the format for the date. If it isn't, then the date format string 107 * will be used instead. 108 * 109 * @since 0.71 110 * 111 * @param string $dateformatstring Format to display the date 112 * @param int $unixtimestamp Unix timestamp 113 * @return string The date, translated if locale specifies it. 114 */ 103 115 function date_i18n( $dateformatstring, $unixtimestamp ) { 104 116 global $wp_locale; 105 117 $i = $unixtimestamp; … … 280 292 return false; 281 293 } 282 294 283 /* Options functions */284 285 295 /** 286 296 * Retrieve option value based on setting name. 287 297 * 288 * {@internal Missing Long Description}} 298 * If the option does not exist or does not have a value, then the return value 299 * will be false. This is useful to check whether you need to install an option 300 * and is commonly used during installation of plugin options and to test 301 * whether upgrading is required. 289 302 * 303 * You can "short-circuit" the retrieval of the option from the database for 304 * your plugin or core options that aren't protected. You can do so by hooking 305 * into the 'pre_option_$option' with the $option being replaced by the option 306 * name. You should not try to override special options, but you will not be 307 * prevented from doing so. 308 * 309 * There is a second filter called 'option_$option' with the $option being 310 * replaced with the option name. This gives the value as the only parameter. 311 * 290 312 * @since 1.5.0 291 313 * @package WordPress 292 314 * @subpackage Option 315 * @uses apply_filters() Calls 'pre_option_$optionname' false to allow 316 * overwriting the option value in a plugin. 317 * @uses apply_filters() Calls 'option_$optionname' with the option name value. 293 318 * 294 319 * @param string $setting Name of option to retrieve. Should already be SQL-escaped 295 320 * @return mixed Value set for the option. … … 374 399 echo attribute_escape (get_option( $option ) ); 375 400 } 376 401 402 /** 403 * Retrieve all autoload options or all options, if no autoloaded ones exist. 404 * 405 * This is different from wp_load_alloptions(), in this that function does not 406 * cache all options and will retrieve all options from the database every time 407 * it is called. 408 * 409 * @since 1.0.0 410 * @package WordPress 411 * @subpackage Option 412 * @uses apply_filters() Calls 'pre_option_$optionname' hook with option value as parameter. 413 * @uses apply_filters() Calls 'all_options' on options list. 414 * 415 * @return array List of all options. 416 */ 377 417 function get_alloptions() { 378 418 global $wpdb, $wp_queries; 379 419 $show = $wpdb->hide_errors(); … … 392 432 return apply_filters( 'all_options', $all_options ); 393 433 } 394 434 395 435 /** 436 * Loads and caches all autoloaded options, if available or all options. 437 * 438 * This is different from get_alloptions(), in that this function will cache the 439 * options and will return the cached options when called again. 440 * 441 * @since 2.2.0 442 * @package WordPress 443 * @subpackage Option 444 * 445 * @return array List all options. 446 */ 396 447 function wp_load_alloptions() { 397 448 global $wpdb; 398 449 … … 411 462 return $alloptions; 412 463 } 413 464 414 415 // expects $option_name to NOT be SQL-escaped 465 /** 466 * Update the value of an option that was already added. 467 * 468 * If the option does not exist, then the option will be added with the option 469 * value, but you will not be able to set whether it is autoloaded. If you want 470 * to set whether an option autoloaded, then you need to use the add_option(). 471 * 472 * When the option is updated, then the filter named 473 * 'update_option_$option_name', with the $option_name as the $option_name 474 * parameter value, will be called. The hook should accept two parameters, the 475 * first is the old parameter and the second is the new parameter. 476 * 477 * @since 1.0.0 478 * @package WordPress 479 * @subpackage Option 480 * 481 * @param string $option_name Option name. Expected to not be SQL-escaped 482 * @param mixed $newvalue Option value. 483 * @return bool False if value was not updated and true if value was updated. 484 */ 416 485 function update_option( $option_name, $newvalue ) { 417 486 global $wpdb; 418 487 … … 456 525 return false; 457 526 } 458 527 459 460 // thx Alex Stapleton, http://alex.vort-x.net/blog/ 461 // expects $name to NOT be SQL-escaped 528 /** 529 * Add a new option. 530 * 531 * You can create options without values and then add values later. Does not 532 * check whether the option has already been added, but does check that you 533 * aren't adding a protected WordPress option. Care should be taken to not name 534 * options, the same as the ones which are protected and to not add options 535 * that were already added. 536 * 537 * The filter named 'add_option_$optionname', with the $optionname being 538 * replaced with the option's name, will be called. The hook should accept two 539 * parameters, the first is the option name, and the second is the value. 540 * 541 * @package WordPress 542 * @subpackage Option 543 * @since 1.0.0 544 * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton 545 * 546 * @param string $name Option name to add. Expects to NOT be SQL escaped. 547 * @param mixed $value Optional. Option value, can be anything. 548 * @param mixed $deprecated Optional. Description. Not used anymore. 549 * @param bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up. 550 * @return null returns when finished. 551 */ 462 552 function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) { 463 553 global $wpdb; 464 554 … … 492 582 493 583 $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ) ); 494 584 495 do_action( "add_option_{$name}", $name, $value ); 585 do_action( "add_option_{$name}", $name, $value ); 496 586 return; 497 587 } 498 588 499 589 /** 590 * Removes option by name and prevents removal of protected WordPress options. 591 * 592 * @package WordPress 593 * @subpackage Option 594 * @since unknown 595 * 596 * @param string $name Option name to remove. 597 * @return bool True, if succeed. False, if failure. 598 */ 500 599 function delete_option( $name ) { 501 600 global $wpdb; 502 601 … … 521 620 return true; 522 621 } 523 622 524 623 /** 624 * Serialize data, if needed. 625 * 626 * @param mixed $data Data that might be serialized. 627 * @return mixed A scalar data 628 */ 525 629 function maybe_serialize( $data ) { 526 630 if ( is_string( $data ) ) 527 631 return $data; … … 585 689 return $content; 586 690 } 587 691 588 692 /** 693 * Open the file handle for debugging. 694 * 695 * This function is used for XMLRPC feature, but it is general purpose enough 696 * to be used in anywhere. 697 * 698 * @see fopen() for mode options. 699 * @package WordPress 700 * @subpackage Debug 701 * @since unknown 702 * @uses $debug Used for whether debugging is enabled. 703 * 704 * @param string $filename File path to debug file. 705 * @param string $mode Same as fopen() mode parameter. 706 * @return bool|resource File handle. False on failure. 707 */ 589 708 function debug_fopen( $filename, $mode ) { 590 709 global $debug; 591 710 if ( 1 == $debug ) { … … 596 715 } 597 716 } 598 717 599 718 /** 719 * Write contents to the file used for debugging. 720 * 721 * Technically, this can be used to write to any file handle when the global 722 * $debug is set to 1 or true. 723 * 724 * @package WordPress 725 * @subpackage Debug 726 * @since unknown 727 * @uses $debug Used for whether debugging is enabled. 728 * 729 * @param resource $fp File handle for debugging file. 730 * @param string $string Content to write to debug file. 731 */ 600 732 function debug_fwrite( $fp, $string ) { 601 733 global $debug; 602 734 if ( 1 == $debug ) 603 735 fwrite( $fp, $string ); 604 736 } 605 737 606 738 /** 739 * Close the debugging file handle. 740 * 741 * Technically, this can be used to close any file handle when the global $debug 742 * is set to 1 or true. 743 * 744 * @package WordPress 745 * @subpackage Debug 746 * @since unknown 747 * @uses $debug Used for whether debugging is enabled. 748 * 749 * @param resource $fp Debug File handle. 750 */ 607 751 function debug_fclose( $fp ) { 608 752 global $debug; 609 753 if ( 1 == $debug ) … … 772 916 return 0; 773 917 } 774 918 775 919 /** 920 * Build URL query based on an associative and, or indexed array. 921 * 922 * This is a convenient function for easily building url queries. It sets the 923 * separator to '&' and uses _http_build_query() function. 924 * 925 * @see _http_build_query() Used to build the query 926 * @link http://us2.php.net/manual/en/function.http-build-query.php more on what 927 * http_build_query() does. 928 * 929 * @since unknown 930 * 931 * @param array $data URL-encode key/value pairs. 932 * @return string URL encoded string 933 */ 776 934 function build_query( $data ) { 777 935 return _http_build_query( $data, NULL, '&', '', false ); 778 936 } 779 937 780 938 /** 781 * Retrieve a modified query string.939 * Retrieve a modified URL query string. 782 940 * 783 * {@internal Missing Long Description}} 941 * You can rebuild the URL and append a new query variable to the URL query by 942 * using this function. You can also retrieve the full URL with query data. 784 943 * 785 * Adding a single key & value or an associative array. 786 * Setting a key value to emptystring removes the key.787 * Omitting oldquery_or_uri uses the $_SERVERvalue.944 * Adding a single key & value or an associative array. Setting a key value to 945 * emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER 946 * value. 788 947 * 789 948 * @since 1.5.0 790 949 * … … 897 1056 return $array; 898 1057 } 899 1058 1059 /** 1060 * HTTP request for URI to retrieve content. 1061 * 1062 * Tries to retrieve the HTTP content with fopen first and then using cURL, if 1063 * fopen can't be used. 1064 * 1065 * @since unknown 1066 * 1067 * @param string $uri URI/URL of web page to retrieve. 1068 * @return string HTTP content. 1069 */ 900 1070 function wp_remote_fopen( $uri ) { 901 1071 $timeout = 10; 902 1072 $parsed_url = @parse_url( $uri ); … … 1008 1178 return ''; 1009 1179 } 1010 1180 1011 1181 /** 1182 * Set HTTP status header. 1183 * 1184 * @since unknown 1185 * @uses apply_filters() Calls 'status_header' on status header string, HTTP 1186 * HTTP code, HTTP code description, and protocol string as separate 1187 * parameters. 1188 * 1189 * @param int $header HTTP status code 1190 * @return null Does not return anything. 1191 */ 1012 1192 function status_header( $header ) { 1013 1193 $text = get_status_header_desc( $header ); 1014 1194 … … 1794 1974 while ( @ob_end_flush() ); 1795 1975 } 1796 1976 1797 1798 1977 /** 1799 1978 * Load the correct database class file. 1800 1979 * … … 1813 1992 require_once( ABSPATH . WPINC . '/wp-db.php' ); 1814 1993 } 1815 1994 1816 1817 1995 /** 1818 1996 * Load custom DB error or display WordPress DB error. 1819 1997 * … … 1861 2039 die(); 1862 2040 } 1863 2041 1864 1865 2042 /** 1866 2043 * Converts value to positive integer. 1867 2044 * … … 1874 2051 return abs( intval( $maybeint ) ); 1875 2052 } 1876 2053 1877 1878 2054 /** 1879 2055 * Determines if the blog can be accessed over SSL. 1880 2056 * … … 1908 2084 return false; 1909 2085 } 1910 2086 1911 1912 2087 /** 1913 2088 * Secure URL, if available or the given URL. 1914 2089 * … … 1925 2100 return $url; 1926 2101 } 1927 2102 1928 1929 2103 /** 1930 2104 * Marks a function as deprecated and informs when it has been used. 1931 2105 * … … 1963 2137 } 1964 2138 } 1965 2139 1966 1967 2140 /** 1968 2141 * Marks a file as deprecated and informs when it has been used. 1969 2142 * … … 2001 2174 } 2002 2175 } 2003 2176 2004 2005 2177 /** 2006 2178 * Is the server running earlier than 1.5.0 version of lighttpd 2007 2179 * … … 2015 2187 return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ); 2016 2188 } 2017 2189 2018 2019 2190 /** 2020 2191 * Does the specified module exist in the apache config? 2021 2192 * … … 2045 2216 return $default; 2046 2217 } 2047 2218 2048 2049 2219 /** 2050 2220 * File validates against allowed set of defined rules. 2051 2221 * … … 2076 2246 return 0; 2077 2247 } 2078 2248 2079 2080 2249 /** 2081 2250 * Determine if SSL is used. 2082 2251 * … … 2088 2257 return ( 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false; 2089 2258 } 2090 2259 2091 2092 2260 /** 2093 2261 * Whether SSL login should be forced. 2094 2262 * … … 2109 2277 return $forced; 2110 2278 } 2111 2279 2112 2113 2280 /** 2114 2281 * Whether to force SSL used for the Administration Panels. 2115 2282 * … … 2130 2297 return $forced; 2131 2298 } 2132 2299 2300 /** 2301 * Guess the URL for the site. 2302 * 2303 * Will remove wp-admin links to retrieve only return URLs not in the wp-admin 2304 * directory. 2305 * 2306 * @since 2.6 2307 * 2308 * @return string 2309 */ 2133 2310 function wp_guess_url() { 2134 2311 if ( defined('WP_SITEURL') && '' != WP_SITEURL ) { 2135 2312 $url = WP_SITEURL; … … 2140 2317 return $url; 2141 2318 } 2142 2319 2143 ?> 2320 ?> 2321 No newline at end of file
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)