[wp-trac] [WordPress Trac] #38071: Add status links to network/sites.php
WordPress Trac
noreply at wordpress.org
Fri May 5 00:53:58 UTC 2017
#38071: Add status links to network/sites.php
-------------------------------------------------+-------------------------
Reporter: johnjamesjacoby | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future
Component: Networks and Sites | Release
Severity: normal | Version: 3.0
Keywords: has-patch has-screenshots needs- | Resolution:
unit-tests | Focuses: multisite
-------------------------------------------------+-------------------------
Comment (by pbiron):
Replying to [comment:7 rheinardkorf]:
> Definitely needs unit tests.
>
> The following is not a reliable method.
>
> {{{
> protected function is_base_request() {
> $vars = $_GET;
> unset( $vars['paged'] );
>
> if ( empty( $vars ) ) {
> return true;
> }
>
> return 1 === count( $vars ) && ! empty( $vars['mode'] );
> }
> }}}
>
> Plugins may add additional functionality via URI, so simply unsetting
'paged' or checking for only 'mode' is does not give the intended result.
It is better to check for the presence/absence of 'site_status'.
>
> The rest is looking pretty good.
This is what I came up with for `is_base_request()` which I think is more
reliable:
{{{
protected function is_base_request() {
$vars = $_GET;
unset( $vars['paged'] );
if ( empty( $vars ) ) {
return true;
} elseif ( 1 === count( $vars ) && ! empty(
$vars['site_status'] ) ) {
return false;
}
return 1 === count( $vars ) && ! empty( $vars['mode'] );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38071#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list