Edit File by line
/home/barbar84/public_h.../wp-inclu...
File: vars.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Creates common globals for the rest of WordPress
[2] Fix | Delete
*
[3] Fix | Delete
* Sets $pagenow global which is the current page. Checks
[4] Fix | Delete
* for the browser to set which one is currently being used.
[5] Fix | Delete
*
[6] Fix | Delete
* Detects which user environment WordPress is being used on.
[7] Fix | Delete
* Only attempts to check for Apache, Nginx and IIS -- three web
[8] Fix | Delete
* servers with known pretty permalink capability.
[9] Fix | Delete
*
[10] Fix | Delete
* Note: Though Nginx is detected, WordPress does not currently
[11] Fix | Delete
* generate rewrite rules for it. See https://wordpress.org/support/article/nginx/
[12] Fix | Delete
*
[13] Fix | Delete
* @package WordPress
[14] Fix | Delete
*/
[15] Fix | Delete
[16] Fix | Delete
global $pagenow,
[17] Fix | Delete
$is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE, $is_edge,
[18] Fix | Delete
$is_apache, $is_IIS, $is_iis7, $is_nginx;
[19] Fix | Delete
[20] Fix | Delete
// On which page are we?
[21] Fix | Delete
if ( is_admin() ) {
[22] Fix | Delete
// wp-admin pages are checked more carefully.
[23] Fix | Delete
if ( is_network_admin() ) {
[24] Fix | Delete
preg_match( '#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
[25] Fix | Delete
} elseif ( is_user_admin() ) {
[26] Fix | Delete
preg_match( '#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
[27] Fix | Delete
} else {
[28] Fix | Delete
preg_match( '#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
[29] Fix | Delete
}
[30] Fix | Delete
$pagenow = $self_matches[1];
[31] Fix | Delete
$pagenow = trim( $pagenow, '/' );
[32] Fix | Delete
$pagenow = preg_replace( '#\?.*?$#', '', $pagenow );
[33] Fix | Delete
if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
[34] Fix | Delete
$pagenow = 'index.php';
[35] Fix | Delete
} else {
[36] Fix | Delete
preg_match( '#(.*?)(/|$)#', $pagenow, $self_matches );
[37] Fix | Delete
$pagenow = strtolower( $self_matches[1] );
[38] Fix | Delete
if ( '.php' !== substr( $pagenow, -4, 4 ) ) {
[39] Fix | Delete
$pagenow .= '.php'; // For `Options +Multiviews`: /wp-admin/themes/index.php (themes.php is queried).
[40] Fix | Delete
}
[41] Fix | Delete
}
[42] Fix | Delete
} else {
[43] Fix | Delete
if ( preg_match( '#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches ) ) {
[44] Fix | Delete
$pagenow = strtolower( $self_matches[1] );
[45] Fix | Delete
} else {
[46] Fix | Delete
$pagenow = 'index.php';
[47] Fix | Delete
}
[48] Fix | Delete
}
[49] Fix | Delete
unset( $self_matches );
[50] Fix | Delete
[51] Fix | Delete
// Simple browser detection.
[52] Fix | Delete
$is_lynx = false;
[53] Fix | Delete
$is_gecko = false;
[54] Fix | Delete
$is_winIE = false;
[55] Fix | Delete
$is_macIE = false;
[56] Fix | Delete
$is_opera = false;
[57] Fix | Delete
$is_NS4 = false;
[58] Fix | Delete
$is_safari = false;
[59] Fix | Delete
$is_chrome = false;
[60] Fix | Delete
$is_iphone = false;
[61] Fix | Delete
$is_edge = false;
[62] Fix | Delete
[63] Fix | Delete
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
[64] Fix | Delete
if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Lynx' ) !== false ) {
[65] Fix | Delete
$is_lynx = true;
[66] Fix | Delete
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Edge' ) !== false ) {
[67] Fix | Delete
$is_edge = true;
[68] Fix | Delete
} elseif ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chrome' ) !== false ) {
[69] Fix | Delete
if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) {
[70] Fix | Delete
$is_admin = is_admin();
[71] Fix | Delete
/**
[72] Fix | Delete
* Filters whether Google Chrome Frame should be used, if available.
[73] Fix | Delete
*
[74] Fix | Delete
* @since 3.2.0
[75] Fix | Delete
*
[76] Fix | Delete
* @param bool $is_admin Whether to use the Google Chrome Frame. Default is the value of is_admin().
[77] Fix | Delete
*/
[78] Fix | Delete
$is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin );
[79] Fix | Delete
if ( $is_chrome ) {
[80] Fix | Delete
header( 'X-UA-Compatible: chrome=1' );
[81] Fix | Delete
}
[82] Fix | Delete
$is_winIE = ! $is_chrome;
[83] Fix | Delete
} else {
[84] Fix | Delete
$is_chrome = true;
[85] Fix | Delete
}
[86] Fix | Delete
} elseif ( stripos( $_SERVER['HTTP_USER_AGENT'], 'safari' ) !== false ) {
[87] Fix | Delete
$is_safari = true;
[88] Fix | Delete
} elseif ( ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident' ) !== false ) && strpos( $_SERVER['HTTP_USER_AGENT'], 'Win' ) !== false ) {
[89] Fix | Delete
$is_winIE = true;
[90] Fix | Delete
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false && strpos( $_SERVER['HTTP_USER_AGENT'], 'Mac' ) !== false ) {
[91] Fix | Delete
$is_macIE = true;
[92] Fix | Delete
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Gecko' ) !== false ) {
[93] Fix | Delete
$is_gecko = true;
[94] Fix | Delete
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera' ) !== false ) {
[95] Fix | Delete
$is_opera = true;
[96] Fix | Delete
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Nav' ) !== false && strpos( $_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.' ) !== false ) {
[97] Fix | Delete
$is_NS4 = true;
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
if ( $is_safari && stripos( $_SERVER['HTTP_USER_AGENT'], 'mobile' ) !== false ) {
[102] Fix | Delete
$is_iphone = true;
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
$is_IE = ( $is_macIE || $is_winIE );
[106] Fix | Delete
[107] Fix | Delete
// Server detection.
[108] Fix | Delete
[109] Fix | Delete
/**
[110] Fix | Delete
* Whether the server software is Apache or something else
[111] Fix | Delete
*
[112] Fix | Delete
* @global bool $is_apache
[113] Fix | Delete
*/
[114] Fix | Delete
$is_apache = ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== false );
[115] Fix | Delete
[116] Fix | Delete
/**
[117] Fix | Delete
* Whether the server software is Nginx or something else
[118] Fix | Delete
*
[119] Fix | Delete
* @global bool $is_nginx
[120] Fix | Delete
*/
[121] Fix | Delete
$is_nginx = ( strpos( $_SERVER['SERVER_SOFTWARE'], 'nginx' ) !== false );
[122] Fix | Delete
[123] Fix | Delete
/**
[124] Fix | Delete
* Whether the server software is IIS or something else
[125] Fix | Delete
*
[126] Fix | Delete
* @global bool $is_IIS
[127] Fix | Delete
*/
[128] Fix | Delete
$is_IIS = ! $is_apache && ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer' ) !== false );
[129] Fix | Delete
[130] Fix | Delete
/**
[131] Fix | Delete
* Whether the server software is IIS 7.X or greater
[132] Fix | Delete
*
[133] Fix | Delete
* @global bool $is_iis7
[134] Fix | Delete
*/
[135] Fix | Delete
$is_iis7 = $is_IIS && (int) substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) >= 7;
[136] Fix | Delete
[137] Fix | Delete
/**
[138] Fix | Delete
* Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
[139] Fix | Delete
*
[140] Fix | Delete
* @since 3.4.0
[141] Fix | Delete
*
[142] Fix | Delete
* @return bool
[143] Fix | Delete
*/
[144] Fix | Delete
function wp_is_mobile() {
[145] Fix | Delete
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
[146] Fix | Delete
$is_mobile = false;
[147] Fix | Delete
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Mobile' ) !== false // Many mobile devices (all iPhone, iPad, etc.)
[148] Fix | Delete
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Android' ) !== false
[149] Fix | Delete
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Silk/' ) !== false
[150] Fix | Delete
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Kindle' ) !== false
[151] Fix | Delete
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'BlackBerry' ) !== false
[152] Fix | Delete
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mini' ) !== false
[153] Fix | Delete
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mobi' ) !== false ) {
[154] Fix | Delete
$is_mobile = true;
[155] Fix | Delete
} else {
[156] Fix | Delete
$is_mobile = false;
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* Filters whether the request should be treated as coming from a mobile device or not.
[161] Fix | Delete
*
[162] Fix | Delete
* @since 4.9.0
[163] Fix | Delete
*
[164] Fix | Delete
* @param bool $is_mobile Whether the request is from a mobile device or not.
[165] Fix | Delete
*/
[166] Fix | Delete
return apply_filters( 'wp_is_mobile', $is_mobile );
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function