Better determination. fixes #4748 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@6061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5528dd0af1
commit
8093fb3e91
|
@ -1,14 +1,23 @@
|
|||
<?php
|
||||
|
||||
// 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];
|
||||
} elseif ( strpos($PHP_SELF, '?') !== false ) {
|
||||
$pagenow = explode('/', $PHP_SELF);
|
||||
$pagenow = trim($pagenow[(sizeof($pagenow)-1)]);
|
||||
$pagenow = explode('?', $pagenow);
|
||||
$pagenow = $pagenow[0];
|
||||
$pagenow = preg_replace('#\?.*?$#', '', $pagenow);
|
||||
if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
|
||||
$pagenow = 'index.php';
|
||||
} 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';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue