From a4f4744a3b23d0a92b808108df838e3a8095c06d Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Mon, 7 Apr 2014 20:59:15 +0000 Subject: [PATCH] Inline documentation improvements in wp-includes/ms-load.php for 3.9 functionality. Clarifies some mixed type parameters, spacing and comment style, and language fixes. See #27700. Built from https://develop.svn.wordpress.org/trunk@28006 git-svn-id: http://core.svn.wordpress.org/trunk@27836 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-load.php | 76 ++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/wp-includes/ms-load.php b/wp-includes/ms-load.php index 2f2f7d49c7..84e9118b6e 100644 --- a/wp-includes/ms-load.php +++ b/wp-includes/ms-load.php @@ -117,9 +117,9 @@ function ms_site_check() { * * @since 3.9.0 * - * @param string $domain Domain to check. - * @param string $path Path to check. - * @param int $segments Path segments to use. Defaults to null, or the full path. + * @param string $domain Domain to check. + * @param string $path Path to check. + * @param int|null $segments Path segments to use. Defaults to null, or the full path. * @return object|bool Network object if successful. False when no network is found. */ function get_network_by_path( $domain, $path, $segments = null ) { @@ -128,8 +128,10 @@ function get_network_by_path( $domain, $path, $segments = null ) { $domains = $exact_domains = array( $domain ); $pieces = explode( '.', $domain ); - // It's possible one domain to search is 'com', but it might as well - // be 'localhost' or some other locally mapped domain. + /* + * It's possible one domain to search is 'com', but it might as well + * be 'localhost' or some other locally mapped domain. + */ while ( array_shift( $pieces ) ) { if ( $pieces ) { $domains[] = implode( '.', $pieces ); @@ -163,11 +165,11 @@ function get_network_by_path( $domain, $path, $segments = null ) { * * @since 3.9.0 * - * @param mixed $segments The number of path segments to consider. WordPress by default looks at - * one path segment. The function default of null only makes sense when you - * know the requested path should match a network. - * @param string $domain The requested domain. - * @param string $path The requested path, in full. + * @param int|null $segments The number of path segments to consider. WordPress by default looks at + * one path segment. The function default of null only makes sense when you + * know the requested path should match a network. + * @param string $domain The requested domain. + * @param string $path The requested path, in full. */ $segments = apply_filters( 'network_by_path_segments_count', $segments, $domain, $path ); @@ -195,11 +197,12 @@ function get_network_by_path( $domain, $path, $segments = null ) { * * @since 3.9.0 * - * @param string $domain The requested domain. - * @param string $path The requested path, in full. - * @param mixed $segments The suggested number of paths to consult. - * Default null, meaning the entire path was to be consulted. - * @param array $paths The paths to search for, based on $path and $segments. + * @param null|bool|object $network Network value to return by path. + * @param string $domain The requested domain. + * @param string $path The requested path, in full. + * @param int|null $segments The suggested number of paths to consult. + * Default null, meaning the entire path was to be consulted. + * @param array $paths The paths to search for, based on $path and $segments. */ $pre = apply_filters( 'pre_get_network_by_path', null, $domain, $path, $segments, $paths ); if ( null !== $pre ) { @@ -257,7 +260,7 @@ function get_network_by_path( $domain, $path, $segments = null ) { * * @since 3.9.0 * - * @param object|int $network The network's DB row or ID. + * @param object|int $network The network's database row or ID. * @return object|bool Object containing network information if found, false if not. */ function wp_get_network( $network ) { @@ -284,9 +287,9 @@ function wpmu_current_site() { * * @since 3.9.0 * - * @param string $domain Domain to check. - * @param string $path Path to check. - * @param int $segments Path segments to use. Defaults to null, or the full path. + * @param string $domain Domain to check. + * @param string $path Path to check. + * @param int|null $segments Path segments to use. Defaults to null, or the full path. * @return object|bool Site object if successful. False when no site is found. */ function get_site_by_path( $domain, $path, $segments = null ) { @@ -299,11 +302,11 @@ function get_site_by_path( $domain, $path, $segments = null ) { * * @since 3.9.0 * - * @param mixed $segments The number of path segments to consider. WordPress by default looks at - * one path segment following the network path. The function default of - * null only makes sense when you know the requested path should match a site. - * @param string $domain The requested domain. - * @param string $path The requested path, in full. + * @param int|null $segments The number of path segments to consider. WordPress by default looks at + * one path segment following the network path. The function default of + * null only makes sense when you know the requested path should match a site. + * @param string $domain The requested domain. + * @param string $path The requested path, in full. */ $segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path ); @@ -330,23 +333,26 @@ function get_site_by_path( $domain, $path, $segments = null ) { * * @since 3.9.0 * - * @param string $domain The requested domain. - * @param string $path The requested path, in full. - * @param mixed $segments The suggested number of paths to consult. - * Default null, meaning the entire path was to be consulted. - * @param array $paths The paths to search for, based on $path and $segments. + * @param null|bool|object $site Site value to return by path. + * @param string $domain The requested domain. + * @param string $path The requested path, in full. + * @param int|null $segments The suggested number of paths to consult. + * Default null, meaning the entire path was to be consulted. + * @param array $paths The paths to search for, based on $path and $segments. */ $pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths ); if ( null !== $pre ) { return $pre; } - // @todo - // get_blog_details(), caching, etc. Consider alternative optimization routes, - // perhaps as an opt-in for plugins, rather than using the pre_* filter. - // For example: The segments filter can expand or ignore paths. - // If persistent caching is enabled, we could query the DB for a path <> '/' - // then cache whether we can just always ignore paths. + /* + * @todo + * get_blog_details(), caching, etc. Consider alternative optimization routes, + * perhaps as an opt-in for plugins, rather than using the pre_* filter. + * For example: The segments filter can expand or ignore paths. + * If persistent caching is enabled, we could query the DB for a path <> '/' + * then cache whether we can just always ignore paths. + */ if ( count( $paths ) > 1 ) { $paths = "'" . implode( "', '", $wpdb->_escape( $paths ) ) . "'";