Better $pagenow determination. fixes #4748
git-svn-id: https://develop.svn.wordpress.org/trunk@6029 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a4924de5d5
commit
5a4c102696
|
@ -1,14 +1,23 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// On which page are we ?
|
// On which page are we ?
|
||||||
if ( preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches) ) {
|
if ( is_admin() ) {
|
||||||
|
// wp-admin pages are checked more carefully
|
||||||
|
preg_match('#/wp-admin/?(.*?)$#i', $PHP_SELF, $self_matches);
|
||||||
$pagenow = $self_matches[1];
|
$pagenow = $self_matches[1];
|
||||||
} elseif ( strpos($PHP_SELF, '?') !== false ) {
|
$pagenow = preg_replace('#\?.*?$#', '', $pagenow);
|
||||||
$pagenow = explode('/', $PHP_SELF);
|
if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
|
||||||
$pagenow = trim($pagenow[(sizeof($pagenow)-1)]);
|
$pagenow = 'index.php';
|
||||||
$pagenow = explode('?', $pagenow);
|
|
||||||
$pagenow = $pagenow[0];
|
|
||||||
} else {
|
} else {
|
||||||
|
preg_match('#(.*?)(/|$)#', $pagenow, $self_matches);
|
||||||
|
$pagenow = strtolower($self_matches[1]);
|
||||||
|
if ( '.php' !== substr($pagenow, -4, 4) )
|
||||||
|
$pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $PHP_SELF, $self_matches) )
|
||||||
|
$pagenow = strtolower($self_matches[1]);
|
||||||
|
else
|
||||||
$pagenow = 'index.php';
|
$pagenow = 'index.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue