Ticket #5639: 5639.r8605.diff
File 5639.r8605.diff, 19.1 KB (added by , 16 years ago) |
---|
-
functions.php
86 86 * 87 87 * @param string $type Either 'mysql' or 'timestamp'. 88 88 * @param int|bool $gmt Optional. Whether to use $gmt offset. Default is false. 89 * @return unknown89 * @return int|string String if $type is 'gmt', int if $type is 'timestamp'. 90 90 */ 91 91 function current_time( $type, $gmt = 0 ) { 92 92 switch ( $type ) { … … 176 176 * 177 177 * @param int|string $bytes Number of bytes. Note max integer size for integers. 178 178 * @param int $decimals Precision of number of decimal places. 179 * @return unknown179 * @return bool|string False on failure. Number string on success. 180 180 */ 181 181 function size_format( $bytes, $decimals = null ) { 182 182 $quant = array( … … 317 317 * There is a second filter called 'option_$option' with the $option being 318 318 * replaced with the option name. This gives the value as the only parameter. 319 319 * 320 * If the option was serialized, when the option was added and, or updated, then 321 * it will be unserialized, when it is returned. 322 * 320 323 * @since 1.5.0 321 324 * @package WordPress 322 325 * @subpackage Option … … 379 382 /** 380 383 * Protect WordPress special option from being modified. 381 384 * 382 * Will die if $option is in protected list. 385 * Will die if $option is in protected list. Protected options are 'alloptions' 386 * and 'notoptions' options. 383 387 * 384 388 * @since 2.2.0 385 389 * @package WordPress … … 473 477 /** 474 478 * Update the value of an option that was already added. 475 479 * 480 * You do not need to serialize values, if the value needs to be serialize, then 481 * it will be serialized before it is inserted into the database. Remember, 482 * resources can not be serialized or added as an option. 483 * 476 484 * If the option does not exist, then the option will be added with the option 477 485 * value, but you will not be able to set whether it is autoloaded. If you want 478 486 * to set whether an option autoloaded, then you need to use the add_option(). … … 539 547 /** 540 548 * Add a new option. 541 549 * 550 * You do not need to serialize values, if the value needs to be serialize, then 551 * it will be serialized before it is inserted into the database. Remember, 552 * resources can not be serialized or added as an option. 553 * 542 554 * You can create options without values and then add values later. Does not 543 555 * check whether the option has already been added, but does check that you 544 556 * aren't adding a protected WordPress option. Care should be taken to not name … … 602 614 * 603 615 * @package WordPress 604 616 * @subpackage Option 605 * @since unknown617 * @since 1.2.0 606 618 * 607 619 * @param string $name Option name to remove. 608 620 * @return bool True, if succeed. False, if failure. … … 634 646 /** 635 647 * Serialize data, if needed. 636 648 * 649 * @since 2.0.5 650 * 637 651 * @param mixed $data Data that might be serialized. 638 652 * @return mixed A scalar data 639 653 */ … … 653 667 * Searches for all of the links, strips them out of the content, and places 654 668 * them at the bottom of the content with numbers. 655 669 * 656 * @since unknown670 * @since 0.71 657 671 * 658 672 * @param string $content Content to get links 659 673 * @return string HTML stripped out of content with links at the bottom. … … 685 699 * 686 700 * @package WordPress 687 701 * @subpackage XMLRPC 688 * @since unknown702 * @since 0.71 689 703 * 690 704 * @global string $post_default_title Default XMLRPC post title. 691 705 * … … 713 727 * 714 728 * @package WordPress 715 729 * @subpackage XMLRPC 716 * @since unknown730 * @since 0.71 717 731 * 718 732 * @global string $post_default_category Default XMLRPC post category. 719 733 * … … 736 750 * 737 751 * @package WordPress 738 752 * @subpackage XMLRPC 739 * @since unknown753 * @since 0.71 740 754 * 741 755 * @param string $content XMLRPC XML Request content 742 756 * @return string XMLRPC XML Request content without title and category elements. … … 757 771 * @see fopen() for mode options. 758 772 * @package WordPress 759 773 * @subpackage Debug 760 * @since unknown774 * @since 0.71 761 775 * @uses $debug Used for whether debugging is enabled. 762 776 * 763 777 * @param string $filename File path to debug file. … … 782 796 * 783 797 * @package WordPress 784 798 * @subpackage Debug 785 * @since unknown799 * @since 0.71 786 800 * @uses $debug Used for whether debugging is enabled. 787 801 * 788 802 * @param resource $fp File handle for debugging file. … … 802 816 * 803 817 * @package WordPress 804 818 * @subpackage Debug 805 * @since unknown819 * @since 0.71 806 820 * @uses $debug Used for whether debugging is enabled. 807 821 * 808 822 * @param resource $fp Debug File handle. … … 813 827 fclose( $fp ); 814 828 } 815 829 830 /** 831 * {@internal Missing Short Description}} 832 * 833 * {@internal Missing Long Description}} 834 * 835 * @package WordPress 836 * @since 1.5.0 837 * 838 * @uses $wpdb 839 * 840 * @param string $content 841 * @param int $post_ID Post ID 842 */ 816 843 function do_enclose( $content, $post_ID ) { 817 844 global $wpdb; 818 845 include_once( ABSPATH . WPINC . '/class-IXR.php' ); … … 865 892 * If $file_path is a writable filename, this will do a GET request and write 866 893 * the file to that path. 867 894 * 868 * @since unknown895 * @since 2.5.0 869 896 * 870 897 * @param string $url 871 898 * @param string|bool $file_path Optional. File path to write request to. … … 983 1010 * @link http://us2.php.net/manual/en/function.http-build-query.php more on what 984 1011 * http_build_query() does. 985 1012 * 986 * @since unknown1013 * @since 2.3.0 987 1014 * 988 1015 * @param array $data URL-encode key/value pairs. 989 1016 * @return string URL encoded string … … 1096 1123 * Walks the array while sanitizing the contents. 1097 1124 * 1098 1125 * @uses $wpdb Used to sanitize values 1126 * @since 0.71 1099 1127 * 1100 1128 * @param array $array Array to used to walk while sanitizing contents. 1101 1129 * @return array Sanitized $array. … … 1119 1147 * Tries to retrieve the HTTP content with fopen first and then using cURL, if 1120 1148 * fopen can't be used. 1121 1149 * 1122 * @since unknown1150 * @since 1.5.1 1123 1151 * 1124 1152 * @param string $uri URI/URL of web page to retrieve. 1125 1153 * @return string HTTP content. … … 1244 1272 /** 1245 1273 * Set HTTP status header. 1246 1274 * 1247 * @since unknown1275 * @since 2.0.0 1248 1276 * @uses apply_filters() Calls 'status_header' on status header string, HTTP 1249 1277 * HTTP code, HTTP code description, and protocol string as separate 1250 1278 * parameters. … … 1458 1486 /** 1459 1487 * Retrieve URL with nonce added to URL query. 1460 1488 * 1489 * @package WordPress 1490 * @subpackage Security 1461 1491 * @since 2.0.4 1462 1492 * 1463 1493 * @param string $actionurl URL to add nonce action … … 1469 1499 return wp_specialchars( add_query_arg( '_wpnonce', wp_create_nonce( $action ), $actionurl ) ); 1470 1500 } 1471 1501 1502 /** 1503 * Retrieve or display nonce hidden field for forms. 1504 * 1505 * The nonce field is used to validate that the contents of the form came from 1506 * the location on the current site and not somewhere else. The nonce does not 1507 * offer absolute protection, but should protect against most cases. It is very 1508 * important to use nonce field in forms. 1509 * 1510 * If you set $echo to true and set $referer to true, then you will need to 1511 * retrieve the {@link wp_referer_field() wp referer field}. If you have the 1512 * $referer set to true and are echoing the nonce field, it will also echo the 1513 * referer field. 1514 * 1515 * The $action and $name are optional, but if you want to have better security, 1516 * it is strongly suggested to set those two parameters. It is easier to just 1517 * call the function without any parameters, because validation of the nonce 1518 * doesn't require any parameters, but since crackers know what the default is 1519 * it won't be difficult for them to find a way around your nonce and cause 1520 * damage. 1521 * 1522 * The input name will be whatever $name value you gave. The input value will be 1523 * the nonce creation value. 1524 * 1525 * @package WordPress 1526 * @subpackage Security 1527 * @since 2.0.4 1528 * 1529 * @param string $action Optional. Action name. 1530 * @param string $name Optional. Nonce name. 1531 * @param bool $referer Optional, default true. Whether to set the referer field for validation. 1532 * @param bool $echo Optional, default true. Whether to display or return hidden form field. 1533 * @return string Nonce field. 1534 */ 1472 1535 function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) { 1473 1536 $name = attribute_escape( $name ); 1474 1537 $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />'; … … 1481 1544 return $nonce_field; 1482 1545 } 1483 1546 1547 /** 1548 * Retrieve or display referer hidden field for forms. 1549 * 1550 * The referer link is the current Request URI from the server super global. The 1551 * input name is '_wp_http_referer', in case you wanted to check manually. 1552 * 1553 * @package WordPress 1554 * @subpackage Security 1555 * @since 2.0.4 1556 * 1557 * @param bool $echo Whether to echo or return the referer field. 1558 * @return string Referer field. 1559 */ 1484 1560 function wp_referer_field( $echo = true) { 1485 1561 $ref = attribute_escape( $_SERVER['REQUEST_URI'] ); 1486 1562 $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />'; … … 1490 1566 return $referer_field; 1491 1567 } 1492 1568 1569 /** 1570 * Retrieve or display original referer hidden field for forms. 1571 * 1572 * The input name is '_wp_original_http_referer' and will be either the same 1573 * value of {@link wp_referer_field()}, if that was posted already or it will 1574 * be the current page, if it doesn't exist. 1575 * 1576 * @package WordPress 1577 * @subpackage Security 1578 * @since 2.0.4 1579 * 1580 * @param bool $echo Whether to echo the original http referer 1581 * @param string $jump_back_to Optional, default is 'current'. Can be 'previous' or page you want to jump back to. 1582 * @return string Original referer field. 1583 */ 1493 1584 function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) { 1494 1585 $jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : $_SERVER['REQUEST_URI']; 1495 1586 $ref = ( wp_get_original_referer() ) ? wp_get_original_referer() : $jump_back_to; … … 1499 1590 return $orig_referer_field; 1500 1591 } 1501 1592 1593 /** 1594 * Retrieve referer from '_wp_http_referer', HTTP referer, or current page respectively. 1595 * 1596 * @package WordPress 1597 * @subpackage Security 1598 * @since 2.0.4 1599 * 1600 * @return string|bool False on failure. Referer URL on success. 1601 */ 1502 1602 function wp_get_referer() { 1503 1603 $ref = ''; 1504 1604 if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) … … 1511 1611 return false; 1512 1612 } 1513 1613 1514 1614 /** 1615 * Retrieve original referer that was posted, if it exists. 1616 * 1617 * @package WordPress 1618 * @subpackage Security 1619 * @since 2.0.4 1620 * 1621 * @return string|bool False if no original referer or original referer if set. 1622 */ 1515 1623 function wp_get_original_referer() { 1516 1624 if ( !empty( $_REQUEST['_wp_original_http_referer'] ) ) 1517 1625 return $_REQUEST['_wp_original_http_referer']; 1518 1626 return false; 1519 1627 } 1520 1628 1629 /** 1630 * Recursive directory creation based on full path. 1631 * 1632 * Will attempt to set permissions on folders. 1633 * 1634 * @since 2.0.1 1635 * 1636 * @param string $target Full path to attempt to create. 1637 * @return bool Whether the path was created or not. True if path already exists. 1638 */ 1521 1639 function wp_mkdir_p( $target ) { 1522 1640 // from php.net/mkdir user contributed notes 1523 1641 $target = str_replace( '//', '/', $target ); … … 1544 1662 /** 1545 1663 * Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows'). 1546 1664 * 1547 * @since unknown1665 * @since 2.5.0 1548 1666 * 1549 1667 * @param string $path File path 1550 1668 * @return bool True if path is absolute, false is not absolute. … … 1570 1688 * 1571 1689 * If the $path is absolute, then it the full path is returned. 1572 1690 * 1573 * @since unknown1691 * @since 2.5.0 1574 1692 * 1575 1693 * @param string $base 1576 1694 * @param string $path … … 1584 1702 } 1585 1703 1586 1704 /** 1587 * Get an array containing the current upload directory's path and url , or an error message.1705 * Get an array containing the current upload directory's path and url. 1588 1706 * 1589 * {@internal Missing Long Description}} 1707 * Checks the 'upload_path' option, which should be from the web root folder, 1708 * and if it isn't empty it will be used. If it is empty, then the path will be 1709 * 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will 1710 * override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path. 1590 1711 * 1712 * The upload URL path is set either by the 'upload_url_path' option or by using 1713 * the 'WP_CONTENT_URL' constant and appending '/uploads' to the path. 1714 * 1715 * If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in 1716 * the administration settings panel), then the time will be used. The format 1717 * will be year first and then month. 1718 * 1719 * If the path couldn't be created, then an error will be returned with the key 1720 * 'error' containing the error message. The error suggests that the parent 1721 * directory is not writable by the server. 1722 * 1723 * On success, the returned array will have many indices: 1724 * 'path' - base directory and sub directory or full path to upload directory. 1725 * 'url' - base url and sub directory or absolute URL to upload directory. 1726 * 'subdir' - sub directory if uploads use year/month folders option is on. 1727 * 'basedir' - path without subdir. 1728 * 'baseurl' - URL path without subdir. 1729 * 'error' - set to false. 1730 * 1591 1731 * @since 2.0.0 1732 * @uses apply_filters() Calls 'upload_dir' on returned array. 1592 1733 * 1593 * @param unknown_type $time1594 * @return unknown1734 * @param string $time Optional. Time formatted in 'yyyy/mm'. 1735 * @return array See above for description. 1595 1736 */ 1596 1737 function wp_upload_dir( $time = null ) { 1597 1738 $siteurl = get_option( 'siteurl' ); … … 1647 1788 /** 1648 1789 * Get a filename that is sanitized and unique for the given directory. 1649 1790 * 1650 * {@internal Missing Long Description}} 1791 * If the filename is not unique, then a number will be added to the filename 1792 * before the extension, and will continue adding numbers until the filename is 1793 * unique. 1651 1794 * 1795 * The callback must accept two parameters, the first one is the directory and 1796 * the second is the filename. The callback must be a function. 1797 * 1652 1798 * @since 2.5 1653 1799 * 1654 1800 * @param string $dir 1655 1801 * @param string $filename 1656 * @param string $unique_filename_callback Function name 1657 * @return unknown1802 * @param string $unique_filename_callback Function name, must be a function. 1803 * @return string New filename, if given wasn't unique. 1658 1804 */ 1659 1805 function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) { 1660 1806 $filename = strtolower( $filename ); … … 1693 1839 return $filename; 1694 1840 } 1695 1841 1842 /** 1843 * Create a file in the upload folder with given content. 1844 * 1845 * If there is an error, then the key 'error' will exist with the error message. 1846 * If success, then the key 'file' will have the unique file path, the 'url' key 1847 * will have the link to the new file. and the 'error' key will be set to false. 1848 * 1849 * This function will not move an uploaded file to the upload folder. It will 1850 * create a new file with the content in $bits parameter. If you move the upload 1851 * file, read the content of the uploaded file, and then you can give the 1852 * filename and content to this function, which will add it to the upload 1853 * folder. 1854 * 1855 * The permissions will be set on the new file automatically by this function. 1856 * 1857 * @since 2.0.0 1858 * 1859 * @param string $name 1860 * @param null $deprecated Not used. Set to null. 1861 * @param mixed $bits File content 1862 * @param string $time Optional. Time formatted in 'yyyy/mm'. 1863 * @return array 1864 */ 1696 1865 function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { 1697 1866 if ( empty( $name ) ) 1698 1867 return array( 'error' => __( "Empty filename" ) ); … … 1736 1905 * Retrieve the file type based on the extension name. 1737 1906 * 1738 1907 * @package WordPress 1739 * @since unknown1908 * @since 2.5.0 1740 1909 * @uses apply_filters() Calls 'ext2type' hook on default supported types. 1741 1910 * 1742 1911 * @param string $ext The extension to search. … … 1849 2018 * hook are the localized "Are you sure you want to do this?" message with the 1850 2019 * extra text (the text after the underscore). 1851 2020 * 2021 * @package WordPress 2022 * @subpackage Security 1852 2023 * @since 2.0.4 1853 2024 * 1854 2025 * @param string $action Nonce action. … … 1925 2096 * If the action has the nonce explain message, then it will be displayed along 1926 2097 * with the "Are you sure?" message. 1927 2098 * 2099 * @package WordPress 2100 * @subpackage Security 1928 2101 * @since 2.0.4 1929 2102 * 1930 2103 * @param string $action The nonce action. … … 2251 2424 * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is 2252 2425 * defined globally by the inline code in wp-db.php. 2253 2426 * 2254 * @since 2.5 2427 * @since 2.5.0 2255 2428 * @global $wpdb WordPress Database Object 2256 2429 */ 2257 2430 function require_wp_db() { … … 2273 2446 * search engines from caching the message. Custom DB messages should do the 2274 2447 * same. 2275 2448 * 2276 * @since 2.5 2449 * This function was backported to the the WordPress 2.3.2, but originally was 2450 * added in WordPress 2.5.0. 2451 * 2452 * @since 2.3.2 2277 2453 * @uses $wpdb 2278 2454 */ 2279 2455 function dead_db() { … … 2312 2488 /** 2313 2489 * Converts value to positive integer. 2314 2490 * 2315 * @since 2.5 2491 * @since 2.5.0 2316 2492 * 2317 2493 * @param mixed $maybeint Data you wish to have convered to an absolute integer 2318 2494 * @return int An absolute integer … … 2327 2503 * Determines if blog can be accessed over SSL by using cURL to access the site 2328 2504 * using the https in the siteurl. Requires cURL extension to work correctly. 2329 2505 * 2330 * @since 2.5 2506 * @since 2.5.0 2331 2507 * 2332 2508 * @return bool Whether or not SSL access is available 2333 2509 */ … … 2357 2533 /** 2358 2534 * Secure URL, if available or the given URL. 2359 2535 * 2360 * @since 2.5 2536 * @since 2.5.0 2361 2537 * 2362 2538 * @param string $url Complete URL path with transport. 2363 2539 * @return string Secure or regular URL path. … … 2384 2560 * 2385 2561 * @package WordPress 2386 2562 * @package Debug 2387 * @since 2.5 2563 * @since 2.5.0 2388 2564 * @access private 2389 2565 * 2390 2566 * @uses do_action() Calls 'deprecated_function_run' and passes the function name and what to use instead. … … 2421 2597 * 2422 2598 * @package WordPress 2423 2599 * @package Debug 2424 * @since 2.5 2600 * @since 2.5.0 2425 2601 * @access private 2426 2602 * 2427 2603 * @uses do_action() Calls 'deprecated_file_included' and passes the file name and what to use instead. … … 2447 2623 /** 2448 2624 * Is the server running earlier than 1.5.0 version of lighttpd 2449 2625 * 2450 * @since unknown2626 * @since 2.5.0 2451 2627 * 2452 2628 * @return bool Whether the server is running lighttpd < 1.5.0 2453 2629 */ … … 2460 2636 /** 2461 2637 * Does the specified module exist in the apache config? 2462 2638 * 2463 * @since unknown2639 * @since 2.5.0 2464 2640 * 2465 2641 * @param string $mod e.g. mod_rewrite 2466 2642 * @param bool $default The default return value if the module is not found … … 2494 2670 * character. A return value of '3' means that the file is not in the allowed 2495 2671 * files list. 2496 2672 * 2497 * @since 2.62673 * @since 1.2.0 2498 2674 * 2499 2675 * @param string $file File path. 2500 2676 * @param array $allowed_files List of allowed files. … … 2519 2695 /** 2520 2696 * Determine if SSL is used. 2521 2697 * 2522 * @since 2.6 2698 * @since 2.6.0 2523 2699 * 2524 2700 * @return bool True if SSL, false if not used. 2525 2701 */ … … 2530 2706 /** 2531 2707 * Whether SSL login should be forced. 2532 2708 * 2533 * @since 2.6 2709 * @since 2.6.0 2534 2710 * 2535 2711 * @param string|bool $force Optional. 2536 2712 * @return bool True if forced, false if not forced. … … 2550 2726 /** 2551 2727 * Whether to force SSL used for the Administration Panels. 2552 2728 * 2553 * @since 2.6 2729 * @since 2.6.0 2554 2730 * 2555 2731 * @param string|bool $force 2556 2732 * @return bool True if forced, false if not forced. … … 2573 2749 * Will remove wp-admin links to retrieve only return URLs not in the wp-admin 2574 2750 * directory. 2575 2751 * 2576 * @since 2.6 2752 * @since 2.6.0 2577 2753 * 2578 2754 * @return string 2579 2755 */ … … 2587 2763 return $url; 2588 2764 } 2589 2765 2590 ?> 2766 ?> 2767 No newline at end of file