Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/themify-.../themify
File: themify-status.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Generate reports of various system variables and configs, useful for debugging.
[2] Fix | Delete
* This only available to administrators.
[3] Fix | Delete
*
[4] Fix | Delete
* @package Themify
[5] Fix | Delete
*/
[6] Fix | Delete
class Themify_System_Status {
[7] Fix | Delete
[8] Fix | Delete
public static function init() {
[9] Fix | Delete
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
public static function admin_menu() {
[13] Fix | Delete
$parent = is_plugin_active( 'themify-builder/themify-builder.php' ) ? 'themify-builder' : 'themify';
[14] Fix | Delete
add_submenu_page ( $parent, __( 'System Status', 'themify' ), __( 'System Status', 'themify' ), 'manage_options', 'tf-status', array( __CLASS__, 'admin' ) );
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
public static function admin() {
[18] Fix | Delete
global $wpdb;
[19] Fix | Delete
$server_info = isset( $_SERVER['SERVER_SOFTWARE'] ) ? self::sanitize_deep( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '';
[20] Fix | Delete
$r=false;
[21] Fix | Delete
foreach(array('/etc/lsb-release','/etc/os-release','/etc/redhat-release') as $dist){
[22] Fix | Delete
if(@is_readable($dist)){
[23] Fix | Delete
$r=@parse_ini_file($dist);
[24] Fix | Delete
break;
[25] Fix | Delete
}
[26] Fix | Delete
}
[27] Fix | Delete
$tables=array(
[28] Fix | Delete
$wpdb->posts,
[29] Fix | Delete
$wpdb->postmeta,
[30] Fix | Delete
$wpdb->options,
[31] Fix | Delete
$wpdb->terms,
[32] Fix | Delete
$wpdb->term_taxonomy,
[33] Fix | Delete
$wpdb->term_relationships
[34] Fix | Delete
);
[35] Fix | Delete
[36] Fix | Delete
?>
[37] Fix | Delete
<div class="wrap">
[38] Fix | Delete
<h1><?php _e( 'System Status', 'themify' ); ?></h1>
[39] Fix | Delete
<table class="tf_status_table widefat" cellspacing="0">
[40] Fix | Delete
<thead>
[41] Fix | Delete
<tr>
[42] Fix | Delete
<td colspan="3"><h2><?php esc_html_e( 'Server environment', 'themify' ); ?></h2></td>
[43] Fix | Delete
</tr>
[44] Fix | Delete
</thead>
[45] Fix | Delete
<tbody>
[46] Fix | Delete
<tr>
[47] Fix | Delete
<th scope="row"><?php esc_html_e( 'OS', 'themify' ); ?>:</th>
[48] Fix | Delete
<td>
[49] Fix | Delete
<?php
[50] Fix | Delete
if ( is_array( $r ) && ( isset( $r['PRETTY_NAME'] ) || isset( $r['NAME'] ) ) ) {
[51] Fix | Delete
if ( isset( $r['PRETTY_NAME'] ) ) {
[52] Fix | Delete
echo $r['PRETTY_NAME'];
[53] Fix | Delete
} else {
[54] Fix | Delete
echo $r['NAME'];
[55] Fix | Delete
}
[56] Fix | Delete
} elseif ( function_exists( 'php_uname' ) ) {
[57] Fix | Delete
echo php_uname('s');
[58] Fix | Delete
} else {
[59] Fix | Delete
echo '<span class="dashicons dashicons-warning"></span>', __( 'Cannot be determined.', 'themify' );
[60] Fix | Delete
}
[61] Fix | Delete
?>
[62] Fix | Delete
</td>
[63] Fix | Delete
</tr>
[64] Fix | Delete
<tr>
[65] Fix | Delete
<th scope="row"><?php esc_html_e( 'Server info', 'themify' ); ?>:</th>
[66] Fix | Delete
<td>
[67] Fix | Delete
<?php echo esc_html( $server_info ); ?>
[68] Fix | Delete
<br>
[69] Fix | Delete
<strong><?php esc_html_e( 'Server IP', 'themify' ); ?></strong>: <?php echo $_SERVER['SERVER_ADDR']; ?>
[70] Fix | Delete
</td>
[71] Fix | Delete
</tr>
[72] Fix | Delete
<tr>
[73] Fix | Delete
<th scope="row"><?php esc_html_e( 'PHP version', 'themify' ); ?>:</th>
[74] Fix | Delete
<td>
[75] Fix | Delete
<?php
[76] Fix | Delete
echo phpversion();
[77] Fix | Delete
if ( version_compare( phpversion(), '7.2', '<' ) ) {
[78] Fix | Delete
echo '<span class="dashicons dashicons-warning"></span> ' . __( 'We recommend using PHP version 7.2 or above for greater performance and security. Please contact your web hosting provider.', 'themify' );
[79] Fix | Delete
}
[80] Fix | Delete
?>
[81] Fix | Delete
</td>
[82] Fix | Delete
</tr>
[83] Fix | Delete
<tr>
[84] Fix | Delete
<th scope="row"><?php esc_html_e( 'WordPress Version', 'themify' ); ?>:</th>
[85] Fix | Delete
<td>
[86] Fix | Delete
<?php
[87] Fix | Delete
global $wp_version;
[88] Fix | Delete
echo $wp_version;
[89] Fix | Delete
?>
[90] Fix | Delete
</td>
[91] Fix | Delete
</tr>
[92] Fix | Delete
<tr>
[93] Fix | Delete
<th scope="row"><?php esc_html_e( 'Database', 'themify' ); ?>:</th>
[94] Fix | Delete
<td><?php echo $wpdb->db_server_info(); ?></td>
[95] Fix | Delete
</tr>
[96] Fix | Delete
<tr>
[97] Fix | Delete
<th scope="row"><?php esc_html_e( 'Debug Mode', 'themify' ); ?>:</th>
[98] Fix | Delete
<td><?php echo ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? __( 'Enabled', 'themify' ) : __( 'Disabled', 'themify' ); ?></td>
[99] Fix | Delete
</tr>
[100] Fix | Delete
<?php if ( function_exists( 'ini_get' ) ) : ?>
[101] Fix | Delete
<tr>
[102] Fix | Delete
<th scope="row"><?php esc_html_e( 'PHP post max size', 'themify' ); ?>:</th>
[103] Fix | Delete
<td><?php echo esc_html( size_format( wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ) ) ); ?></td>
[104] Fix | Delete
</tr>
[105] Fix | Delete
<tr>
[106] Fix | Delete
<th scope="row"><?php esc_html_e( 'PHP time limit', 'themify' ); ?>:</th>
[107] Fix | Delete
<td><?php echo esc_html( (int) ini_get( 'max_execution_time' ) ); ?></td>
[108] Fix | Delete
</tr>
[109] Fix | Delete
<tr>
[110] Fix | Delete
<th scope="row"><?php esc_html_e( 'PHP memory limit', 'themify' ); ?>:</th>
[111] Fix | Delete
<td>
[112] Fix | Delete
<strong>WP_MEMORY_LIMIT</strong>: <?php echo esc_html( size_format( wp_convert_hr_to_bytes( WP_MEMORY_LIMIT ) ) ); ?><br>
[113] Fix | Delete
<strong><?php _e( 'PHP Memory Limit', 'themify' ); ?></strong>: <?php echo esc_html( size_format( wp_convert_hr_to_bytes( ini_get( 'memory_limit' ) ) ) ); ?>
[114] Fix | Delete
</td>
[115] Fix | Delete
</tr>
[116] Fix | Delete
<tr>
[117] Fix | Delete
<th scope="row"><?php esc_html_e( 'PHP max input vars', 'themify' ); ?>:</th>
[118] Fix | Delete
<td><?php echo esc_html( (int) ini_get( 'max_input_vars' ) ); ?></td>
[119] Fix | Delete
</tr>
[120] Fix | Delete
<tr>
[121] Fix | Delete
<th scope="row"><?php esc_html_e( 'cURL version', 'themify' ); ?>:</th>
[122] Fix | Delete
<td><?php echo esc_html( self::get_curl_version() ); ?></td>
[123] Fix | Delete
</tr>
[124] Fix | Delete
<tr>
[125] Fix | Delete
<th scope="row"><?php esc_html_e( 'SUHOSIN installed', 'themify' ); ?>:</th>
[126] Fix | Delete
<td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '&ndash;'; ?></td>
[127] Fix | Delete
</tr>
[128] Fix | Delete
<?php endif; ?>
[129] Fix | Delete
<tr>
[130] Fix | Delete
<th scope="row"><?php esc_html_e( 'Max upload size', 'themify' ); ?>:</th>
[131] Fix | Delete
<td><?php echo esc_html( size_format( wp_max_upload_size() ) ); ?></td>
[132] Fix | Delete
</tr>
[133] Fix | Delete
<tr>
[134] Fix | Delete
<th scope="row"><?php esc_html_e( 'fsockopen/cURL', 'themify' ); ?>:</th>
[135] Fix | Delete
<td>
[136] Fix | Delete
<?php
[137] Fix | Delete
if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) {
[138] Fix | Delete
echo '<span class="dashicons dashicons-yes"></span>';
[139] Fix | Delete
} else {
[140] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Your server does not have fsockopen or cURL enabled - some features that require connecting to external web services may not work. Contact your hosting provider.', 'themify' ) . '</mark>';
[141] Fix | Delete
}
[142] Fix | Delete
?>
[143] Fix | Delete
</td>
[144] Fix | Delete
</tr>
[145] Fix | Delete
<tr>
[146] Fix | Delete
<th scope="row"><?php esc_html_e( 'Custom Tables Allowed', 'themify' ); ?>:</th>
[147] Fix | Delete
<td>
[148] Fix | Delete
<?php
[149] Fix | Delete
if ( Themify_Storage::init()!==false ) {
[150] Fix | Delete
echo '<span class="dashicons dashicons-yes"></span>';
[151] Fix | Delete
} else {
[152] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Your server does not have have permissions to create custom tables in DB', 'themify' ) . '</mark>';
[153] Fix | Delete
}
[154] Fix | Delete
?>
[155] Fix | Delete
</td>
[156] Fix | Delete
</tr>
[157] Fix | Delete
<tr>
[158] Fix | Delete
<th scope="row"><?php esc_html_e( 'GZip', 'themify' ); ?>:</th>
[159] Fix | Delete
<td>
[160] Fix | Delete
<?php
[161] Fix | Delete
$gzip = TFCache::get_available_gzip();
[162] Fix | Delete
if ( false !== $gzip ) {
[163] Fix | Delete
$gzip = current( $gzip );
[164] Fix | Delete
echo '<span class="dashicons dashicons-yes"></span> ' . $gzip['f'];
[165] Fix | Delete
} else {
[166] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '<a href="%s">GZIP</a> is recommended for better performance.', 'themify' ), 'https://php.net/manual/en/zlib.installation.php' ) . '</mark>';
[167] Fix | Delete
}
[168] Fix | Delete
?>
[169] Fix | Delete
</td>
[170] Fix | Delete
</tr>
[171] Fix | Delete
<tr>
[172] Fix | Delete
<th scope="row"><?php esc_html_e( 'Multibyte string', 'themify' ); ?>:</th>
[173] Fix | Delete
<td>
[174] Fix | Delete
<?php
[175] Fix | Delete
if ( extension_loaded( 'mbstring' ) ) {
[176] Fix | Delete
echo '<span class="dashicons dashicons-yes"></span>';
[177] Fix | Delete
} else {
[178] Fix | Delete
/* Translators: %s: classname and link. */
[179] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'themify' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ) . '</mark>';
[180] Fix | Delete
}
[181] Fix | Delete
?>
[182] Fix | Delete
</td>
[183] Fix | Delete
</tr>
[184] Fix | Delete
<tr>
[185] Fix | Delete
<th scope="row"><?php esc_html_e( 'Uploads folder', 'themify' ); ?>:</th>
[186] Fix | Delete
<td>
[187] Fix | Delete
<?php
[188] Fix | Delete
$dir = themify_upload_dir();
[189] Fix | Delete
echo '<p><strong>' . __( 'Base Dir ', 'themify' ) . '</strong>: ' . $dir['basedir'] . '<br>' . '<strong>' . __( 'Base URL ', 'themify' ) . '</strong>: ' . $dir['baseurl'] . '</p>';
[190] Fix | Delete
if ( strpos( $dir['baseurl'], 'http' ) === false ) {
[191] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Protocol missing from URL, this can cause missing assets on frontend.', 'themify' ) . '</mark>';
[192] Fix | Delete
}
[193] Fix | Delete
?>
[194] Fix | Delete
</td>
[195] Fix | Delete
</tr>
[196] Fix | Delete
<tr>
[197] Fix | Delete
<th scope="row"><?php esc_html_e( 'Concate CSS folder', 'themify' ); ?>:</th>
[198] Fix | Delete
<td>
[199] Fix | Delete
<?php
[200] Fix | Delete
$dir = Themify_Enqueue_Assets::getCurrentVersionFolder();
[201] Fix | Delete
echo $dir . ' - ';
[202] Fix | Delete
if ( Themify_Filesystem::is_writable( $dir ) ) {
[203] Fix | Delete
echo '<span class="dashicons dashicons-yes"></span>';
[204] Fix | Delete
} else {
[205] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Uploads folder is not writeable, your CSS may not display correctly.', 'themify' ) . '</mark>';
[206] Fix | Delete
}
[207] Fix | Delete
?>
[208] Fix | Delete
</td>
[209] Fix | Delete
</tr>
[210] Fix | Delete
<tr>
[211] Fix | Delete
<th scope="row"><?php esc_html_e( 'Image Processing Library', 'themify' ); ?>:</th>
[212] Fix | Delete
<td>
[213] Fix | Delete
<?php
[214] Fix | Delete
$image_editor = _wp_image_editor_choose();
[215] Fix | Delete
if ( empty( $image_editor ) ) {
[216] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'No image processing library found. Please contact your web hosting to enable this.', 'themify' ) . '</mark>';
[217] Fix | Delete
} else {
[218] Fix | Delete
echo '<span class="dashicons dashicons-yes"></span>' . $image_editor;
[219] Fix | Delete
}
[220] Fix | Delete
?>
[221] Fix | Delete
</td>
[222] Fix | Delete
</tr>
[223] Fix | Delete
<tr>
[224] Fix | Delete
<th scope="row"><?php esc_html_e( 'Mysql version', 'themify' ); ?>:</th>
[225] Fix | Delete
<td>
[226] Fix | Delete
<?php echo $wpdb->db_version();?>
[227] Fix | Delete
</td>
[228] Fix | Delete
</tr>
[229] Fix | Delete
<tr>
[230] Fix | Delete
<th scope="row"><?php esc_html_e( 'Storage engine', 'themify' ); ?>:</th>
[231] Fix | Delete
<td>
[232] Fix | Delete
<table>
[233] Fix | Delete
<?php foreach($tables as $t):?>
[234] Fix | Delete
<tr>
[235] Fix | Delete
<th scope="row"><?php echo $t?></th>
[236] Fix | Delete
<td>
[237] Fix | Delete
<?php $engine=$wpdb->get_row( $wpdb->prepare( "SHOW TABLE STATUS WHERE Name = '%s'", $t ));
[238] Fix | Delete
echo $engine->Engine;
[239] Fix | Delete
if($engine->Engine==='InnoDB'){
[240] Fix | Delete
echo '<span class="dashicons dashicons-yes"></span>';
[241] Fix | Delete
}
[242] Fix | Delete
else{
[243] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Please consider using <a href="%s" target="_blank">InnoDB engine</a> which offers a lot of advantages and keeps your data safe. You can contact your web hosting to upgrade this for you.', 'themify' ), 'https://core.trac.wordpress.org/ticket/9422' ) . '</mark>';
[244] Fix | Delete
}
[245] Fix | Delete
?></td>
[246] Fix | Delete
</tr>
[247] Fix | Delete
<?php endforeach;?>
[248] Fix | Delete
</table>
[249] Fix | Delete
</td>
[250] Fix | Delete
</tr>
[251] Fix | Delete
</tbody>
[252] Fix | Delete
</table>
[253] Fix | Delete
</div>
[254] Fix | Delete
<?php
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
public static function get_curl_version() {
[258] Fix | Delete
$curl_version = '';
[259] Fix | Delete
if ( function_exists( 'curl_version' ) ) {
[260] Fix | Delete
$curl_version = curl_version();
[261] Fix | Delete
$curl_version = $curl_version['version'] . ', ' . $curl_version['ssl_version'];
[262] Fix | Delete
} elseif ( extension_loaded( 'curl' ) ) {
[263] Fix | Delete
$curl_version = __( 'cURL installed but unable to retrieve version.', 'themify' );
[264] Fix | Delete
}
[265] Fix | Delete
return $curl_version;
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
/**
[269] Fix | Delete
* Applies sanitize_ function on multidimensional array
[270] Fix | Delete
*
[271] Fix | Delete
* @return mixed
[272] Fix | Delete
*/
[273] Fix | Delete
public static function sanitize_deep( $value ) {
[274] Fix | Delete
if ( is_array( $value ) ) {
[275] Fix | Delete
return array_map( 'wc_clean', $value );
[276] Fix | Delete
} else {
[277] Fix | Delete
return is_scalar( $value ) ? sanitize_text_field( $value ) : $value;
[278] Fix | Delete
}
[279] Fix | Delete
}
[280] Fix | Delete
}
[281] Fix | Delete
Themify_System_Status::init();
[282] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function