: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Generate reports of various system variables and configs, useful for debugging.
* This only available to administrators.
class Themify_System_Status {
public static function init() {
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
public static function admin_menu() {
$parent = is_plugin_active( 'themify-builder/themify-builder.php' ) ? 'themify-builder' : 'themify';
add_submenu_page ( $parent, __( 'System Status', 'themify' ), __( 'System Status', 'themify' ), 'manage_options', 'tf-status', array( __CLASS__, 'admin' ) );
public static function admin() {
$server_info = isset( $_SERVER['SERVER_SOFTWARE'] ) ? self::sanitize_deep( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '';
foreach(array('/etc/lsb-release','/etc/os-release','/etc/redhat-release') as $dist){
$r=@parse_ini_file($dist);
$wpdb->term_relationships
<h1><?php _e( 'System Status', 'themify' ); ?></h1>
<table class="tf_status_table widefat" cellspacing="0">
<td colspan="3"><h2><?php esc_html_e( 'Server environment', 'themify' ); ?></h2></td>
<th scope="row"><?php esc_html_e( 'OS', 'themify' ); ?>:</th>
if ( is_array( $r ) && ( isset( $r['PRETTY_NAME'] ) || isset( $r['NAME'] ) ) ) {
if ( isset( $r['PRETTY_NAME'] ) ) {
} elseif ( function_exists( 'php_uname' ) ) {
echo '<span class="dashicons dashicons-warning"></span>', __( 'Cannot be determined.', 'themify' );
<th scope="row"><?php esc_html_e( 'Server info', 'themify' ); ?>:</th>
<?php echo esc_html( $server_info ); ?>
<strong><?php esc_html_e( 'Server IP', 'themify' ); ?></strong>: <?php echo $_SERVER['SERVER_ADDR']; ?>
<th scope="row"><?php esc_html_e( 'PHP version', 'themify' ); ?>:</th>
if ( version_compare( phpversion(), '7.2', '<' ) ) {
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' );
<th scope="row"><?php esc_html_e( 'WordPress Version', 'themify' ); ?>:</th>
<th scope="row"><?php esc_html_e( 'Database', 'themify' ); ?>:</th>
<td><?php echo $wpdb->db_server_info(); ?></td>
<th scope="row"><?php esc_html_e( 'Debug Mode', 'themify' ); ?>:</th>
<td><?php echo ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? __( 'Enabled', 'themify' ) : __( 'Disabled', 'themify' ); ?></td>
<?php if ( function_exists( 'ini_get' ) ) : ?>
<th scope="row"><?php esc_html_e( 'PHP post max size', 'themify' ); ?>:</th>
<td><?php echo esc_html( size_format( wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ) ) ); ?></td>
<th scope="row"><?php esc_html_e( 'PHP time limit', 'themify' ); ?>:</th>
<td><?php echo esc_html( (int) ini_get( 'max_execution_time' ) ); ?></td>
<th scope="row"><?php esc_html_e( 'PHP memory limit', 'themify' ); ?>:</th>
<strong>WP_MEMORY_LIMIT</strong>: <?php echo esc_html( size_format( wp_convert_hr_to_bytes( WP_MEMORY_LIMIT ) ) ); ?><br>
<strong><?php _e( 'PHP Memory Limit', 'themify' ); ?></strong>: <?php echo esc_html( size_format( wp_convert_hr_to_bytes( ini_get( 'memory_limit' ) ) ) ); ?>
<th scope="row"><?php esc_html_e( 'PHP max input vars', 'themify' ); ?>:</th>
<td><?php echo esc_html( (int) ini_get( 'max_input_vars' ) ); ?></td>
<th scope="row"><?php esc_html_e( 'cURL version', 'themify' ); ?>:</th>
<td><?php echo esc_html( self::get_curl_version() ); ?></td>
<th scope="row"><?php esc_html_e( 'SUHOSIN installed', 'themify' ); ?>:</th>
<td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td>
<th scope="row"><?php esc_html_e( 'Max upload size', 'themify' ); ?>:</th>
<td><?php echo esc_html( size_format( wp_max_upload_size() ) ); ?></td>
<th scope="row"><?php esc_html_e( 'fsockopen/cURL', 'themify' ); ?>:</th>
if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) {
echo '<span class="dashicons dashicons-yes"></span>';
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>';
<th scope="row"><?php esc_html_e( 'Custom Tables Allowed', 'themify' ); ?>:</th>
if ( Themify_Storage::init()!==false ) {
echo '<span class="dashicons dashicons-yes"></span>';
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>';
<th scope="row"><?php esc_html_e( 'GZip', 'themify' ); ?>:</th>
$gzip = TFCache::get_available_gzip();
$gzip = current( $gzip );
echo '<span class="dashicons dashicons-yes"></span> ' . $gzip['f'];
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>';
<th scope="row"><?php esc_html_e( 'Multibyte string', 'themify' ); ?>:</th>
if ( extension_loaded( 'mbstring' ) ) {
echo '<span class="dashicons dashicons-yes"></span>';
/* Translators: %s: classname and link. */
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>';
<th scope="row"><?php esc_html_e( 'Uploads folder', 'themify' ); ?>:</th>
$dir = themify_upload_dir();
echo '<p><strong>' . __( 'Base Dir ', 'themify' ) . '</strong>: ' . $dir['basedir'] . '<br>' . '<strong>' . __( 'Base URL ', 'themify' ) . '</strong>: ' . $dir['baseurl'] . '</p>';
if ( strpos( $dir['baseurl'], 'http' ) === false ) {
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>';
<th scope="row"><?php esc_html_e( 'Concate CSS folder', 'themify' ); ?>:</th>
$dir = Themify_Enqueue_Assets::getCurrentVersionFolder();
if ( Themify_Filesystem::is_writable( $dir ) ) {
echo '<span class="dashicons dashicons-yes"></span>';
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>';
<th scope="row"><?php esc_html_e( 'Image Processing Library', 'themify' ); ?>:</th>
$image_editor = _wp_image_editor_choose();
if ( empty( $image_editor ) ) {
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>';
echo '<span class="dashicons dashicons-yes"></span>' . $image_editor;
<th scope="row"><?php esc_html_e( 'Mysql version', 'themify' ); ?>:</th>
<?php echo $wpdb->db_version();?>
<th scope="row"><?php esc_html_e( 'Storage engine', 'themify' ); ?>:</th>
<?php foreach($tables as $t):?>
<th scope="row"><?php echo $t?></th>
<?php $engine=$wpdb->get_row( $wpdb->prepare( "SHOW TABLE STATUS WHERE Name = '%s'", $t ));
if($engine->Engine==='InnoDB'){
echo '<span class="dashicons dashicons-yes"></span>';
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>';
public static function get_curl_version() {
if ( function_exists( 'curl_version' ) ) {
$curl_version = curl_version();
$curl_version = $curl_version['version'] . ', ' . $curl_version['ssl_version'];
} elseif ( extension_loaded( 'curl' ) ) {
$curl_version = __( 'cURL installed but unable to retrieve version.', 'themify' );
* Applies sanitize_ function on multidimensional array
public static function sanitize_deep( $value ) {
if ( is_array( $value ) ) {
return array_map( 'wc_clean', $value );
return is_scalar( $value ) ? sanitize_text_field( $value ) : $value;
Themify_System_Status::init();