Make WordPress Core


Ignore:
Timestamp:
07/01/2014 01:43:48 AM (10 years ago)
Author:
DrewAPicture
Message:

General inline documentation improvements in wp-includes/functions.php.

Second run. See #26185.

File:
1 edited

Legend:

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

    r28933 r28936  
    639639 * @since 0.71
    640640 *
    641  * @global string $currentday The day of the current post in the loop.
     641 * @global string $currentday  The day of the current post in the loop.
    642642 * @global string $previousday The day of the previous post in the loop.
    643643 *
    644  * @return int 1 when new day, 0 if not a new day.
     644 * @return int|bool 1|true when new day, 0|false if not a new day.
    645645 */
    646646function is_new_day() {
     
    658658 * separator to '&' and uses _http_build_query() function.
    659659 *
     660 * @since 2.3.0
     661 *
    660662 * @see _http_build_query() Used to build the query
    661  * @link http://us2.php.net/manual/en/function.http-build-query.php more on what
     663 * @see http://us2.php.net/manual/en/function.http-build-query.php for more on what
    662664 *      http_build_query() does.
    663665 *
    664  * @since 2.3.0
    665  *
    666666 * @param array $data URL-encode key/value pairs.
    667  * @return string URL encoded string
     667 * @return string URL-encoded string.
    668668 */
    669669function build_query( $data ) {
     
    730730 * @since 1.5.0
    731731 *
    732  * @param mixed $param1 Either newkey or an associative_array
    733  * @param mixed $param2 Either newvalue or oldquery or uri
    734  * @param mixed $param3 Optional. Old query or uri
     732 * @param string|array $param1 Either newkey or an associative_array.
     733 * @param string       $param2 Either newvalue or oldquery or URI.
     734 * @param string       $param3 Optional. Old query or URI.
    735735 * @return string New URL query string.
    736736 */
     
    802802 * @since 1.5.0
    803803 *
    804  * @param string|array $key Query key or keys to remove.
    805  * @param bool $query When false uses the $_SERVER value.
     804 * @param string|array $key   Query key or keys to remove.
     805 * @param bool         $query Optional. When false uses the $_SERVER value. Default false.
    806806 * @return string New URL query string.
    807807 */
    808 function remove_query_arg( $key, $query=false ) {
     808function remove_query_arg( $key, $query = false ) {
    809809    if ( is_array( $key ) ) { // removing multiple keys
    810810        foreach ( $key as $k )
     
    838838 *
    839839 * @since 1.5.1
    840  * @uses wp_remote_get()
     840 *
     841 * @see wp_safe_remote_get()
    841842 *
    842843 * @param string $uri URI/URL of web page to retrieve.
     
    963964 *
    964965 * @since 2.0.0
     966 *
    965967 * @see get_status_header_desc()
    966968 *
     
    995997
    996998/**
    997  * Gets the header information to prevent caching.
    998  *
    999  * The several different headers cover the different ways cache prevention is handled
    1000  * by different browsers
     999 * Get the header information to prevent caching.
     1000 *
     1001 * The several different headers cover the different ways cache prevention
     1002 * is handled by different browsers
    10011003 *
    10021004 * @since 2.8.0
     
    10161018         *
    10171019         * @since 2.8.0
     1020         *
     1021         * @see wp_get_nocache_headers()
    10181022         *
    10191023         * @param array $headers {
     
    10321036
    10331037/**
    1034  * Sets the headers to prevent caching for the different browsers.
    1035  *
    1036  * Different browsers support different nocache headers, so several headers must
    1037  * be sent so that all of them get the point that no caching should occur.
     1038 * Set the headers to prevent caching for the different browsers.
     1039 *
     1040 * Different browsers support different nocache headers, so several
     1041 * headers must be sent so that all of them get the point that no
     1042 * caching should occur.
    10381043 *
    10391044 * @since 2.0.0
     1045 *
    10401046 * @see wp_get_nocache_headers()
    10411047 */
     
    10701076function cache_javascript_headers() {
    10711077    $expiresOffset = 10 * DAY_IN_SECONDS;
     1078
    10721079    header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );
    10731080    header( "Vary: Accept-Encoding" ); // Handle proxies
     
    10801087 * @since 2.0.0
    10811088 *
    1082  * @return int Number of database queries
     1089 * @global wpdb $wpdb WordPress database access abstraction object.
     1090 *
     1091 * @return int Number of database queries.
    10831092 */
    10841093function get_num_queries() {
     
    10881097
    10891098/**
    1090  * Whether input is yes or no. Must be 'y' to be true.
     1099 * Whether input is yes or no.
     1100 *
     1101 * Must be 'y' to be true.
    10911102 *
    10921103 * @since 1.0.0
    10931104 *
    1094  * @param string $yn Character string containing either 'y' or 'n'
    1095  * @return bool True if yes, false on anything else
     1105 * @param string $yn Character string containing either 'y' (yes) or 'n' (no).
     1106 * @return bool True if yes, false on anything else.
    10961107 */
    10971108function bool_from_yn( $yn ) {
     
    11001111
    11011112/**
    1102  * Loads the feed template from the use of an action hook.
     1113 * Load the feed template from the use of an action hook.
    11031114 *
    11041115 * If the feed action does not have a hook, then the function will die with a
     
    11421153 *
    11431154 * @since 2.1.0
     1155 *
     1156 * @see load_template()
    11441157 */
    11451158function do_feed_rdf() {
     
    11511164 *
    11521165 * @since 2.1.0
     1166 *
     1167 * @see load_template()
    11531168 */
    11541169function do_feed_rss() {
     
    11601175 *
    11611176 * @since 2.1.0
     1177 *
     1178 * @see load_template()
    11621179 *
    11631180 * @param bool $for_comments True for the comment feed, false for normal feed.
     
    11741191 *
    11751192 * @since 2.1.0
     1193 *
     1194 * @see load_template()
    11761195 *
    11771196 * @param bool $for_comments True for the comment feed, false for normal feed.
     
    12261245 * Test whether blog is already installed.
    12271246 *
    1228  * The cache will be checked first. If you have a cache plugin, which saves the
    1229  * cache values, then this will work. If you use the default WordPress cache,
    1230  * and the database goes away, then you might have problems.
    1231  *
    1232  * Checks for the option siteurl for whether WordPress is installed.
     1247 * The cache will be checked first. If you have a cache plugin, which saves
     1248 * the cache values, then this will work. If you use the default WordPress
     1249 * cache, and the database goes away, then you might have problems.
     1250 *
     1251 * Checks for the 'siteurl' option for whether WordPress is installed.
    12331252 *
    12341253 * @since 2.1.0
    1235  * @uses $wpdb
    1236  *
    1237  * @return bool Whether blog is already installed.
     1254 *
     1255 * @global wpdb $wpdb WordPress database access abstraction object.
     1256 *
     1257 * @return bool Whether the blog is already installed.
    12381258 */
    12391259function is_blog_installed() {
    12401260    global $wpdb;
    12411261
    1242     // Check cache first. If options table goes away and we have true cached, oh well.
     1262    /*
     1263     * Check cache first. If options table goes away and we have true
     1264     * cached, oh well.
     1265     */
    12431266    if ( wp_cache_get( 'is_blog_installed' ) )
    12441267        return true;
     
    12671290    $suppress = $wpdb->suppress_errors();
    12681291
    1269     // Loop over the WP tables. If none exist, then scratch install is allowed.
    1270     // If one or more exist, suggest table repair since we got here because the options
    1271     // table could not be accessed.
     1292    /*
     1293     * Loop over the WP tables. If none exist, then scratch install is allowed.
     1294     * If one or more exist, suggest table repair since we got here because the
     1295     * options table could not be accessed.
     1296     */
    12721297    $wp_tables = $wpdb->tables();
    12731298    foreach ( $wp_tables as $table ) {
     
    13031328 *
    13041329 * @param string $actionurl URL to add nonce action.
    1305  * @param string $action Optional. Nonce action name.
    1306  * @param string $name Optional. Nonce name.
     1330 * @param string $action    Optional. Nonce action name. Default -1.
     1331 * @param string $name      Optional. Nonce name. Default '_wpnonce'.
    13071332 * @return string Escaped URL with nonce action added.
    13081333 */
     
    13321357 * @since 2.0.4
    13331358 *
    1334  * @param string $action Optional. Action name.
    1335  * @param string $name Optional. Nonce name.
    1336  * @param bool $referer Optional, default true. Whether to set the referer field for validation.
    1337  * @param bool $echo Optional, default true. Whether to display or return hidden form field.
    1338  * @return string Nonce field.
     1359 * @param string $action  Optional. Action name. Default -1.
     1360 * @param string $name    Optional. Nonce name. Default '_wpnonce'.
     1361 * @param bool   $referer Optional. Whether to set the referer field for validation. Default true.
     1362 * @param bool   $echo    Optional. Whether to display or return hidden form field. Default true.
     1363 * @return string Nonce field HTML markup.
    13391364 */
    13401365function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
     
    13591384 * @since 2.0.4
    13601385 *
    1361  * @param bool $echo Whether to echo or return the referer field.
    1362  * @return string Referer field.
     1386 * @param bool $echo Optional. Whether to echo or return the referer field. Default true.
     1387 * @return string Referer field HTML markup.
    13631388 */
    13641389function wp_referer_field( $echo = true ) {
     
    13741399 *
    13751400 * The input name is '_wp_original_http_referer' and will be either the same
    1376  * value of {@link wp_referer_field()}, if that was posted already or it will
    1377  * be the current page, if it doesn't exist.
     1401 * value of wp_referer_field(), if that was posted already or it will be the
     1402 * current page, if it doesn't exist.
    13781403 *
    13791404 * @since 2.0.4
    13801405 *
    1381  * @param bool $echo Whether to echo the original http referer
    1382  * @param string $jump_back_to Optional, default is 'current'. Can be 'previous' or page you want to jump back to.
     1406 * @param bool   $echo         Optional. Whether to echo the original http referer. Default true.
     1407 * @param string $jump_back_to Optional. Can be 'previous' or page you want to jump back to.
     1408 *                             Default 'current'.
    13831409 * @return string Original referer field.
    13841410 */
     
    13941420
    13951421/**
    1396  * Retrieve referer from '_wp_http_referer' or HTTP referer. If it's the same
    1397  * as the current request URL, will return false.
     1422 * Retrieve referer from '_wp_http_referer' or HTTP referer.
     1423 *
     1424 * If it's the same as the current request URL, will return false.
    13981425 *
    13991426 * @since 2.0.4
     
    14411468    $wrapper = null;
    14421469
    1443     // strip the protocol
     1470    // Strip the protocol.
    14441471    if( wp_is_stream( $target ) ) {
    14451472        list( $wrapper, $target ) = explode( '://', $target, 2 );
    14461473    }
    14471474
    1448     // from php.net/mkdir user contributed notes
     1475    // From php.net/mkdir user contributed notes.
    14491476    $target = str_replace( '//', '/', $target );
    14501477
    1451     // put the wrapper back on the target
     1478    // Put the wrapper back on the target.
    14521479    if( $wrapper !== null ) {
    14531480        $target = $wrapper . '://' . $target;
    14541481    }
    14551482
    1456     // safe mode fails with a trailing slash under certain PHP versions.
    1457     $target = rtrim($target, '/'); // Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
     1483    /*
     1484     * Safe mode fails with a trailing slash under certain PHP versions.
     1485     * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
     1486     */
     1487    $target = rtrim($target, '/');
    14581488    if ( empty($target) )
    14591489        $target = '/';
     
    14771507    if ( @mkdir( $target, $dir_perms, true ) ) {
    14781508
    1479         // If a umask is set that modifies $dir_perms, we'll have to re-set the $dir_perms correctly with chmod()
     1509        /*
     1510         * If a umask is set that modifies $dir_perms, we'll have to re-set
     1511         * the $dir_perms correctly with chmod()
     1512         */
    14801513        if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
    14811514            $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
     
    14921525
    14931526/**
    1494  * Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows').
     1527 * Test if a give filesystem path is absolute.
     1528 *
     1529 * For example, '/foo/bar', or 'c:\windows'.
    14951530 *
    14961531 * @since 2.5.0
    14971532 *
    1498  * @param string $path File path
     1533 * @param string $path File path.
    14991534 * @return bool True if path is absolute, false is not absolute.
    15001535 */
    15011536function path_is_absolute( $path ) {
    1502     // this is definitive if true but fails if $path does not exist or contains a symbolic link
     1537    /*
     1538     * This is definitive if true but fails if $path does not exist or contains
     1539     * a symbolic link.
     1540     */
    15031541    if ( realpath($path) == $path )
    15041542        return true;
     
    15071545        return false;
    15081546
    1509     // windows allows absolute paths like this
     1547    // Windows allows absolute paths like this.
    15101548    if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
    15111549        return true;
    15121550
    1513     // a path starting with / or \ is absolute; anything else is relative
     1551    // A path starting with / or \ is absolute; anything else is relative.
    15141552    return ( $path[0] == '/' || $path[0] == '\\' );
    15151553}
    15161554
    15171555/**
    1518  * Join two filesystem paths together (e.g. 'give me $path relative to $base').
    1519  *
    1520  * If the $path is absolute, then it the full path is returned.
     1556 * Join two filesystem paths together.
     1557 *
     1558 * For example, 'give me $path relative to $base'. If the $path is absolute,
     1559 * then it the full path is returned.
    15211560 *
    15221561 * @since 2.5.0
    15231562 *
    1524  * @param string $base
    1525  * @param string $path
     1563 * @param string $base Base path.
     1564 * @param string $path Path relative to $base.
    15261565 * @return string The path with the base or absolute path.
    15271566 */
     
    15361575 * Normalize a filesystem path.
    15371576 *
    1538  * Replaces backslashes with forward slashes for Windows systems,
    1539  * and ensures no duplicate slashes exist.
     1577 * Replaces backslashes with forward slashes for Windows systems, and ensures
     1578 * no duplicate slashes exist.
    15401579 *
    15411580 * @since 3.9.0
     
    15511590
    15521591/**
    1553  * Determines a writable directory for temporary files.
    1554  * Function's preference is the return value of <code>sys_get_temp_dir()</code>,
     1592 * Determine a writable directory for temporary files.
     1593 *
     1594 * Function's preference is the return value of sys_get_temp_dir(),
    15551595 * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR,
    15561596 * before finally defaulting to /tmp/
    15571597 *
    15581598 * In the event that this function does not find a writable location,
    1559  * It may be overridden by the <code>WP_TEMP_DIR</code> constant in
    1560  * your <code>wp-config.php</code> file.
     1599 * It may be overridden by the WP_TEMP_DIR constant in your wp-config.php file.
    15611600 *
    15621601 * @since 2.5.0
    15631602 *
    1564  * @return string Writable temporary directory
     1603 * @return string Writable temporary directory.
    15651604 */
    15661605function get_temp_dir() {
     
    15931632 * Determine if a directory is writable.
    15941633 *
    1595  * This function is used to work around certain ACL issues
    1596  * in PHP primarily affecting Windows Servers.
     1634 * This function is used to work around certain ACL issues in PHP primarily
     1635 * affecting Windows Servers.
     1636 *
     1637 * @since 3.6.0
    15971638 *
    15981639 * @see win_is_writable()
    15991640 *
    1600  * @since 3.6.0
    1601  *
    1602  * @param string $path
    1603  * @return bool
     1641 * @param string $path Path to check for write-ability.
     1642 * @return bool Whether the path is writable.
    16041643 */
    16051644function wp_is_writable( $path ) {
     
    16181657 * upon PHP to interprate the OS ACL.
    16191658 *
    1620  * @link http://bugs.php.net/bug.php?id=27609
    1621  * @link http://bugs.php.net/bug.php?id=30931
    1622  *
    16231659 * @since 2.8.0
    16241660 *
    1625  * @param string $path
    1626  * @return bool
     1661 * @see http://bugs.php.net/bug.php?id=27609
     1662 * @see http://bugs.php.net/bug.php?id=30931
     1663 *
     1664 * @param string $path Windows path to check for write-ability.
     1665 * @return bool Whether the path is writable.
    16271666 */
    16281667function win_is_writable( $path ) {
     
    16731712 * @since 2.0.0
    16741713 *
    1675  * @param string $time Optional. Time formatted in 'yyyy/mm'.
     1714 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
    16761715 * @return array See above for description.
    16771716 */
     
    16961735    }
    16971736
    1698     // Obey the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
    1699     // We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
     1737    /*
     1738     * Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
     1739     * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
     1740     */
    17001741    if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
    17011742        $dir = ABSPATH . UPLOADS;
     
    17071748
    17081749        if ( ! get_site_option( 'ms_files_rewriting' ) ) {
    1709             // If ms-files rewriting is disabled (networks created post-3.5), it is fairly straightforward:
    1710             // Append sites/%d if we're not on the main site (for post-MU networks). (The extra directory
    1711             // prevents a four-digit ID from conflicting with a year-based directory for the main site.
    1712             // But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra
    1713             // directory, as they never had wp-content/uploads for the main site.)
     1750            /*
     1751             * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
     1752             * straightforward: Append sites/%d if we're not on the main site (for post-MU
     1753             * networks). (The extra directory prevents a four-digit ID from conflicting with
     1754             * a year-based directory for the main site. But if a MU-era network has disabled
     1755             * ms-files rewriting manually, they don't need the extra directory, as they never
     1756             * had wp-content/uploads for the main site.)
     1757             */
    17141758
    17151759            if ( defined( 'MULTISITE' ) )
     
    17221766
    17231767        } elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
    1724             // Handle the old-form ms-files.php rewriting if the network still has that enabled.
    1725             // When ms-files rewriting is enabled, then we only listen to UPLOADS when:
    1726             //   1) we are not on the main site in a post-MU network,
    1727             //      as wp-content/uploads is used there, and
    1728             //   2) we are not switched, as ms_upload_constants() hardcodes
    1729             //      these constants to reflect the original blog ID.
    1730             //
    1731             // Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
    1732             // (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
    1733             // as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
    1734             // rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
     1768            /*
     1769             * Handle the old-form ms-files.php rewriting if the network still has that enabled.
     1770             * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
     1771             * 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
     1772             *    there, and
     1773             * 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
     1774             *    the original blog ID.
     1775             *
     1776             * Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
     1777             * (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
     1778             * as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
     1779             * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
     1780             */
    17351781
    17361782            if ( defined( 'BLOGUPLOADDIR' ) )
     
    17761822        ) );
    17771823
    1778     // Make sure we have an uploads dir
     1824    // Make sure we have an uploads directory.
    17791825    if ( ! wp_mkdir_p( $uploads['path'] ) ) {
    17801826        if ( 0 === strpos( $uploads['basedir'], ABSPATH ) )
     
    18021848 * @since 2.5.0
    18031849 *
    1804  * @param string $dir
    1805  * @param string $filename
    1806  * @param mixed $unique_filename_callback Callback.
     1850 * @param string   $dir                      Directory.
     1851 * @param string   $filename                 File name.
     1852 * @param callback $unique_filename_callback Callback. Default null.
    18071853 * @return string New filename, if given wasn't unique.
    18081854 */
    18091855function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
    1810     // sanitize the file name before we begin processing
     1856    // Sanitize the file name before we begin processing.
    18111857    $filename = sanitize_file_name($filename);
    18121858
    1813     // separate the filename into a name and extension
     1859    // Separate the filename into a name and extension.
    18141860    $info = pathinfo($filename);
    18151861    $ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
    18161862    $name = basename($filename, $ext);
    18171863
    1818     // edge case: if file is named '.ext', treat as an empty name
     1864    // Edge case: if file is named '.ext', treat as an empty name.
    18191865    if ( $name === $ext )
    18201866        $name = '';
    18211867
    1822     // Increment the file number until we have a unique file to save in $dir. Use callback if supplied.
     1868    /*
     1869     * Increment the file number until we have a unique file to save in $dir.
     1870     * Use callback if supplied.
     1871     */
    18231872    if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
    18241873        $filename = call_user_func( $unique_filename_callback, $dir, $name, $ext );
     
    18261875        $number = '';
    18271876
    1828         // change '.ext' to lower case
     1877        // Change '.ext' to lower case.
    18291878        if ( $ext && strtolower($ext) != $ext ) {
    18301879            $ext2 = strtolower($ext);
    18311880            $filename2 = preg_replace( '|' . preg_quote($ext) . '$|', $ext2, $filename );
    18321881
    1833             // check for both lower and upper case extension or image sub-sizes may be overwritten
     1882            // Check for both lower and upper case extension or image sub-sizes may be overwritten.
    18341883            while ( file_exists($dir . "/$filename") || file_exists($dir . "/$filename2") ) {
    18351884                $new_number = $number + 1;
     
    18691918 * @since 2.0.0
    18701919 *
    1871  * @param string $name
    1872  * @param null $deprecated Never used. Set to null.
    1873  * @param mixed $bits File content
    1874  * @param string $time Optional. Time formatted in 'yyyy/mm'.
     1920 * @param string $name       Filename.
     1921 * @param null   $deprecated Never used. Set to null.
     1922 * @param mixed  $bits      File content
     1923 * @param string $time       Optional. Time formatted in 'yyyy/mm'. Default null.
    18751924 * @return array
    18761925 */
     
    19902039 *
    19912040 * @param string $filename File name or path.
    1992  * @param array $mimes Optional. Key is the file extension with value as the mime type.
     2041 * @param array  $mimes    Optional. Key is the file extension with value as the mime type.
    19932042 * @return array Values with extension first and mime type.
    19942043 */
     
    20132062/**
    20142063 * Attempt to determine the real file type of a file.
     2064 *
    20152065 * If unable to, the file name extension will be used to determine type.
    20162066 *
     
    20222072 * @since 3.0.0
    20232073 *
    2024  * @param string $file Full path to the file.
    2025  * @param string $filename The name of the file (may differ from $file due to $file being in a tmp directory)
    2026  * @param array $mimes Optional. Key is the file extension with value as the mime type.
    2027  * @return array Values for the extension, MIME, and either a corrected filename or false if original $filename is valid
     2074 * @param string $file     Full path to the file.
     2075 * @param string $filename The name of the file (may differ from $file due to $file being
     2076 *                         in a tmp directory).
     2077 * @param array   $mimes   Optional. Key is the file extension with value as the mime type.
     2078 * @return array Values for the extension, MIME, and either a corrected filename or false
     2079 *               if original $filename is valid.
    20282080 */
    20292081function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
     
    21172169     */
    21182170    return apply_filters( 'mime_types', array(
    2119     // Image formats
     2171    // Image formats.
    21202172    'jpg|jpeg|jpe' => 'image/jpeg',
    21212173    'gif' => 'image/gif',
     
    21242176    'tif|tiff' => 'image/tiff',
    21252177    'ico' => 'image/x-icon',
    2126     // Video formats
     2178    // Video formats.
    21272179    'asf|asx' => 'video/x-ms-asf',
    21282180    'wmv' => 'video/x-ms-wmv',
     
    21402192    '3gp|3gpp' => 'video/3gpp', // Can also be audio
    21412193    '3g2|3gp2' => 'video/3gpp2', // Can also be audio
    2142     // Text formats
     2194    // Text formats.
    21432195    'txt|asc|c|cc|h|srt' => 'text/plain',
    21442196    'csv' => 'text/csv',
     
    21502202    'vtt' => 'text/vtt',
    21512203    'dfxp' => 'application/ttaf+xml',
    2152     // Audio formats
     2204    // Audio formats.
    21532205    'mp3|m4a|m4b' => 'audio/mpeg',
    21542206    'ra|ram' => 'audio/x-realaudio',
     
    21592211    'wax' => 'audio/x-ms-wax',
    21602212    'mka' => 'audio/x-matroska',
    2161     // Misc application formats
     2213    // Misc application formats.
    21622214    'rtf' => 'application/rtf',
    21632215    'js' => 'application/javascript',
     
    21712223    '7z' => 'application/x-7z-compressed',
    21722224    'exe' => 'application/x-msdownload',
    2173     // MS Office formats
     2225    // MS Office formats.
    21742226    'doc' => 'application/msword',
    21752227    'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
     
    22002252    'oxps' => 'application/oxps',
    22012253    'xps' => 'application/vnd.ms-xpsdocument',
    2202     // OpenOffice formats
     2254    // OpenOffice formats.
    22032255    'odt' => 'application/vnd.oasis.opendocument.text',
    22042256    'odp' => 'application/vnd.oasis.opendocument.presentation',
     
    22082260    'odb' => 'application/vnd.oasis.opendocument.database',
    22092261    'odf' => 'application/vnd.oasis.opendocument.formula',
    2210     // WordPerfect formats
     2262    // WordPerfect formats.
    22112263    'wp|wpd' => 'application/wordperfect',
    2212     // iWork formats
     2264    // iWork formats.
    22132265    'key' => 'application/vnd.apple.keynote',
    22142266    'numbers' => 'application/vnd.apple.numbers',
     
    22242276 *
    22252277 * @param int|WP_User $user Optional. User to check. Defaults to current user.
    2226  * @return array Array of mime types keyed by the file extension regex corresponding to those types.
     2278 * @return array Array of mime types keyed by the file extension regex corresponding
     2279 *               to those types.
    22272280 */
    22282281function get_allowed_mime_types( $user = null ) {
     
    22522305 * Display "Are You Sure" message to confirm the action being taken.
    22532306 *
    2254  * If the action has the nonce explain message, then it will be displayed along
    2255  * with the "Are you sure?" message.
     2307 * If the action has the nonce explain message, then it will be displayed
     2308 * along with the "Are you sure?" message.
    22562309 *
    22572310 * @since 2.0.4
     
    22852338 * @since 2.0.4
    22862339 *
    2287  * @param string $message Error message.
    2288  * @param string $title Error title.
    2289  * @param string|array $args Optional arguments to control behavior.
     2340 * @param string       $message Optional. Error message. Default empty.
     2341 * @param string       $title   Optional. Error title. Default empty.
     2342 * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
    22902343 */
    22912344function wp_die( $message = '', $title = '', $args = array() ) {
     
    23312384 * @access private
    23322385 *
    2333  * @param string $message Error message.
    2334  * @param string $title Error title.
    2335  * @param string|array $args Optional arguments to control behavior.
     2386 * @param string       $message Error message.
     2387 * @param string       $title   Optional. Error title. Default empty.
     2388 * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
    23362389 */
    23372390function _default_wp_die_handler( $message, $title = '', $args = array() ) {
     
    25092562 * @access private
    25102563 *
    2511  * @param string $message Error message.
    2512  * @param string $title Error title.
    2513  * @param string|array $args Optional arguments to control behavior.
     2564 * @param string       $message Error message.
     2565 * @param string       $title   Optional. Error title. Default empty.
     2566 * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
    25142567 */
    25152568function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
     
    25342587 * @access private
    25352588 *
    2536  * @param string $message Optional. Response to print.
     2589 * @param string $message Optional. Response to print. Default empty.
    25372590 */
    25382591function _ajax_wp_die_handler( $message = '' ) {
     
    25502603 * @access private
    25512604 *
    2552  * @param string $message Optional. Response to print.
     2605 * @param string $message Optional. Response to print. Default empty.
    25532606 */
    25542607function _scalar_wp_die_handler( $message = '' ) {
     
    25632616 * @since 3.5.0
    25642617 *
    2565  * @param mixed $response Variable (usually an array or object) to encode as JSON, then print and die.
     2618 * @param mixed $response Variable (usually an array or object) to encode as JSON,
     2619 *                        then print and die.
    25662620 */
    25672621function wp_send_json( $response ) {
     
    26092663 * Retrieve the WordPress home page URL.
    26102664 *
    2611  * If the constant named 'WP_HOME' exists, then it will be used and returned by
    2612  * the function. This can be used to counter the redirection on your local
     2665 * If the constant named 'WP_HOME' exists, then it will be used and returned
     2666 * by the function. This can be used to counter the redirection on your local
    26132667 * development environment.
    26142668 *
     2669 * @since 2.2.0
    26152670 * @access private
    2616  * @since 2.2.0
    2617  *
    2618  * @param string $url URL for the home location
     2671 *
     2672 * @see WP_HOME
     2673 *
     2674 * @param string $url URL for the home location.
    26192675 * @return string Homepage location.
    26202676 */
     
    26292685 *
    26302686 * If the constant named 'WP_SITEURL' is defined, then the value in that
    2631  * constant will always be returned. This can be used for debugging a site on
    2632  * your localhost while not having to change the database to your URL.
    2633  *
     2687 * constant will always be returned. This can be used for debugging a site
     2688 * on your localhost while not having to change the database to your URL.
     2689 *
     2690 * @since 2.2.0
    26342691 * @access private
    2635  * @since 2.2.0
     2692 *
     2693 * @see WP_SITEURL
    26362694 *
    26372695 * @param string $url URL to set the WordPress site location.
    2638  * @return string The WordPress Site URL
     2696 * @return string The WordPress Site URL.
    26392697 */
    26402698function _config_wp_siteurl( $url = '' ) {
     
    26472705 * Set the localized direction for MCE plugin.
    26482706 *
    2649  * Will only set the direction to 'rtl', if the WordPress locale has the text
    2650  * direction set to 'rtl'.
    2651  *
    2652  * Fills in the 'directionality' setting, enables the 'directionality' plugin,
    2653  * and adds the 'ltr' button to 'toolbar1', formerly 'theme_advanced_buttons1' array
    2654  * keys. These keys are then returned in the $input (TinyMCE settings) array.
    2655  *
     2707 * Will only set the direction to 'rtl', if the WordPress locale has
     2708 * the text direction set to 'rtl'.
     2709 *
     2710 * Fills in the 'directionality' setting, enables the 'directionality'
     2711 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
     2712 * 'theme_advanced_buttons1' array keys. These keys are then returned
     2713 * in the $input (TinyMCE settings) array.
     2714 *
     2715 * @since 2.1.0
    26562716 * @access private
    2657  * @since 2.1.0
    26582717 *
    26592718 * @param array $input MCE settings array.
     
    26902749 * @global array $wpsmiliestrans
    26912750 * @global array $wp_smiliessearch
     2751 *
    26922752 * @since 2.2.0
    26932753 */
     
    27962856 * @since 2.2.0
    27972857 *
    2798  * @param string|array $args Value to merge with $defaults
    2799  * @param array $defaults Array that serves as the defaults.
     2858 * @param string|array $args     Value to merge with $defaults
     2859 * @param array        $defaults Optional. Array that serves as the defaults. Default empty.
    28002860 * @return array Merged user defined values with defaults.
    28012861 */
     
    28182878 * @since 3.0.0
    28192879 *
    2820  * @param array|string $list
    2821  * @return array Sanitized array of IDs
     2880 * @param array|string $list List of ids.
     2881 * @return array Sanitized array of IDs.
    28222882 */
    28232883function wp_parse_id_list( $list ) {
     
    28332893 * @since 3.1.0
    28342894 *
    2835  * @param array $array The original array
    2836  * @param array $keys The list of keys
    2837  * @return array The array slice
     2895 * @param array $array The original array.
     2896 * @param array $keys  The list of keys.
     2897 * @return array The array slice.
    28382898 */
    28392899function wp_array_slice_assoc( $array, $keys ) {
     
    28512911 * @since 3.0.0
    28522912 *
    2853  * @param array $list An array of objects to filter
    2854  * @param array $args An array of key => value arguments to match against each object
    2855  * @param string $operator The logical operation to perform. 'or' means only one element
    2856  *  from the array needs to match; 'and' means all elements must match. The default is 'and'.
    2857  * @param bool|string $field A field from the object to place instead of the entire object
    2858  * @return array A list of objects or object fields
     2913 * @param array       $list     An array of objects to filter
     2914 * @param array       $args     Optional. An array of key => value arguments to match
     2915 *                              against each object. Default empty array.
     2916 * @param string      $operator Optional. The logical operation to perform. 'or' means
     2917 *                              only one element from the array needs to match; 'and'
     2918 *                              means all elements must match. Default 'and'.
     2919 * @param bool|string $field    A field from the object to place instead of the entire object.
     2920 *                              Default false.
     2921 * @return array A list of objects or object fields.
    28592922 */
    28602923function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
     
    28752938 * @since 3.1.0
    28762939 *
    2877  * @param array $list An array of objects to filter
    2878  * @param array $args An array of key => value arguments to match against each object
    2879  * @param string $operator The logical operation to perform:
    2880  *    'AND' means all elements from the array must match;
    2881  *    'OR' means only one element needs to match;
    2882  *    'NOT' means no elements may match.
    2883  *   The default is 'AND'.
    2884  * @return array
     2940 * @param array  $list     An array of objects to filter.
     2941 * @param array  $args     Optional. An array of key => value arguments to match
     2942 *                         against each object. Default empty array.
     2943 * @param string $operator Optional. The logical operation to perform. 'AND' means
     2944 *                         all elements from the array must match. 'OR' means only
     2945 *                         one element needs to match. 'NOT' means no elements may
     2946 *                         match. Default 'AND'.
     2947 * @return array Array of found values.
    28852948 */
    28862949function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
     
    29212984 *
    29222985 * @since 3.1.0
    2923  *
    2924  * @param array $list A list of objects or arrays
    2925  * @param int|string $field A field from the object to place instead of the entire object
    2926  * @param int|string $index_key A field from the object to use as keys for the new array
    2927  * @return array
     2986 * @since 4.0.0 $index_key parameter added.
     2987 *
     2988 * @param array      $list      List of objects or arrays
     2989 * @param int|string $field     Field from the object to place instead of the entire object
     2990 * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
     2991 *                              Default null.
     2992 * @return array Array of found values. If $index_key is set, an array of found values with keys
     2993 *               corresponding to $index_key.
    29282994 */
    29292995function wp_list_pluck( $list, $field, $index_key = null ) {
    29302996    if ( ! $index_key ) {
    2931         // This is simple. Could at some point wrap array_column()
    2932         // if we knew we had an array of arrays.
     2997        /*
     2998         * This is simple. Could at some point wrap array_column()
     2999         * if we knew we had an array of arrays.
     3000         */
    29333001        foreach ( $list as $key => $value ) {
    29343002            if ( is_object( $value ) ) {
     
    29413009    }
    29423010
    2943     // When index_key is not set for a particular item,
    2944     // push the value to the end of the stack.
    2945     // This is how array_column() behaves.
     3011    /*
     3012     * When index_key is not set for a particular item, push the value
     3013     * to the end of the stack. This is how array_column() behaves.
     3014     */
    29463015    $newlist = array();
    29473016    foreach ( $list as $value ) {
     
    29673036 * Determines if Widgets library should be loaded.
    29683037 *
    2969  * Checks to make sure that the widgets library hasn't already been loaded. If
    2970  * it hasn't, then it will load the widgets library and run an action hook.
     3038 * Checks to make sure that the widgets library hasn't already been loaded.
     3039 * If it hasn't, then it will load the widgets library and run an action hook.
    29713040 *
    29723041 * @since 2.2.0
    2973  * @uses add_action() Calls '_admin_menu' hook with 'wp_widgets_add_menu' value.
    29743042 */
    29753043function wp_maybe_load_widgets() {
    29763044    /**
    29773045     * Filter whether to load the Widgets library.
     3046     *
     3047     * Passing a falsey value to the filter will effectively short-circuit
     3048     * the Widgets library from loading.
    29783049     *
    29793050     * @since 2.8.0
     
    29853056        return;
    29863057    }
     3058
    29873059    require_once( ABSPATH . WPINC . '/default-widgets.php' );
     3060
    29883061    add_action( '_admin_menu', 'wp_widgets_add_menu' );
    29893062}
     
    29933066 *
    29943067 * @since 2.2.0
     3068 *
    29953069 * @uses $submenu The administration submenu list.
    29963070 */
     
    30083082 * Flush all output buffers for PHP 5.2.
    30093083 *
    3010  * Make sure all output buffers are flushed before our singletons our destroyed.
     3084 * Make sure all output buffers are flushed before our singletons are destroyed.
    30113085 *
    30123086 * @since 2.2.0
     
    30333107 *
    30343108 * @since 2.3.2
    3035  * @uses $wpdb
     3109 *
     3110 * @global wpdb $wpdb WordPress database access abstraction object.
    30363111 */
    30373112function dead_db() {
Note: See TracChangeset for help on using the changeset viewer.