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/sitepres.../classes/troubles...
File: class-wpml-debug-information.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class WPML_Debug_Information {
[2] Fix | Delete
[3] Fix | Delete
/** @var WPDB $wpdb */
[4] Fix | Delete
public $wpdb;
[5] Fix | Delete
[6] Fix | Delete
/** @var SitePress $sitepress */
[7] Fix | Delete
protected $sitepress;
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* @param wpdb $wpdb
[11] Fix | Delete
* @param SitePress $sitepress
[12] Fix | Delete
*/
[13] Fix | Delete
public function __construct( $wpdb, $sitepress ) {
[14] Fix | Delete
$this->wpdb = $wpdb;
[15] Fix | Delete
$this->sitepress = $sitepress;
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
public function run() {
[19] Fix | Delete
$info = array( 'core', 'plugins', 'theme', 'extra-debug' );
[20] Fix | Delete
[21] Fix | Delete
$output = array();
[22] Fix | Delete
foreach ( $info as $type ) {
[23] Fix | Delete
switch ( $type ) {
[24] Fix | Delete
case 'core':
[25] Fix | Delete
$output['core'] = $this->get_core_info();
[26] Fix | Delete
break;
[27] Fix | Delete
case 'plugins':
[28] Fix | Delete
$output['plugins'] = $this->get_plugins_info();
[29] Fix | Delete
break;
[30] Fix | Delete
case 'theme':
[31] Fix | Delete
$output['theme'] = $this->get_theme_info();
[32] Fix | Delete
break;
[33] Fix | Delete
case 'extra-debug':
[34] Fix | Delete
$output['extra-debug'] = apply_filters( 'icl_get_extra_debug_info', array() );
[35] Fix | Delete
break;
[36] Fix | Delete
}
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
return $output;
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
function get_core_info() {
[43] Fix | Delete
[44] Fix | Delete
$core = array(
[45] Fix | Delete
'Wordpress' => array(
[46] Fix | Delete
'Multisite' => is_multisite() ? 'Yes' : 'No',
[47] Fix | Delete
'SiteURL' => site_url(),
[48] Fix | Delete
'HomeURL' => home_url(),
[49] Fix | Delete
'Version' => get_bloginfo( 'version' ),
[50] Fix | Delete
'PermalinkStructure' => get_option( 'permalink_structure' ),
[51] Fix | Delete
'PostTypes' => implode( ', ', get_post_types( '', 'names' ) ),
[52] Fix | Delete
'PostStatus' => implode( ', ', get_post_stati() ),
[53] Fix | Delete
'RestEnabled' => wpml_is_rest_enabled() ? 'Yes' : 'No',
[54] Fix | Delete
),
[55] Fix | Delete
'Server' => array(
[56] Fix | Delete
'jQueryVersion' => wp_script_is( 'jquery', 'registered' ) ? $GLOBALS['wp_scripts']->registered['jquery']->ver : __( 'n/a', 'bbpress' ),
[57] Fix | Delete
'PHPVersion' => $this->sitepress->get_wp_api()->phpversion(),
[58] Fix | Delete
'MySQLVersion' => $this->wpdb->db_version(),
[59] Fix | Delete
'ServerSoftware' => $_SERVER['SERVER_SOFTWARE']
[60] Fix | Delete
),
[61] Fix | Delete
'PHP' => array(
[62] Fix | Delete
'MemoryLimit' => ini_get( 'memory_limit' ),
[63] Fix | Delete
'WP Memory Limit' => WP_MEMORY_LIMIT,
[64] Fix | Delete
'UploadMax' => ini_get( 'upload_max_filesize' ),
[65] Fix | Delete
'PostMax' => ini_get( 'post_max_size' ),
[66] Fix | Delete
'TimeLimit' => ini_get( 'max_execution_time' ),
[67] Fix | Delete
'MaxInputVars' => ini_get( 'max_input_vars' ),
[68] Fix | Delete
'MBString' => $this->sitepress->get_wp_api()->extension_loaded( 'mbstring' ),
[69] Fix | Delete
'libxml' => $this->sitepress->get_wp_api()->extension_loaded( 'libxml' ),
[70] Fix | Delete
),
[71] Fix | Delete
);
[72] Fix | Delete
[73] Fix | Delete
return $core;
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
function get_plugins_info() {
[77] Fix | Delete
[78] Fix | Delete
$plugins = $this->sitepress->get_wp_api()->get_plugins();
[79] Fix | Delete
$active_plugins = $this->sitepress->get_wp_api()->get_option( 'active_plugins' );
[80] Fix | Delete
$active_plugins_info = array();
[81] Fix | Delete
[82] Fix | Delete
foreach ( $active_plugins as $plugin ) {
[83] Fix | Delete
if ( isset( $plugins[ $plugin ] ) ) {
[84] Fix | Delete
unset( $plugins[ $plugin ]['Description'] );
[85] Fix | Delete
$active_plugins_info[ $plugin ] = $plugins[ $plugin ];
[86] Fix | Delete
}
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
$mu_plugins = get_mu_plugins();
[90] Fix | Delete
[91] Fix | Delete
$dropins = get_dropins();
[92] Fix | Delete
[93] Fix | Delete
$output = array(
[94] Fix | Delete
'active_plugins' => $active_plugins_info,
[95] Fix | Delete
'mu_plugins' => $mu_plugins,
[96] Fix | Delete
'dropins' => $dropins,
[97] Fix | Delete
);
[98] Fix | Delete
[99] Fix | Delete
return $output;
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
function get_theme_info() {
[103] Fix | Delete
[104] Fix | Delete
/** @var WP_Theme $current_theme */
[105] Fix | Delete
if ( $this->sitepress->get_wp_api()->get_bloginfo( 'version' ) < '3.4' ) {
[106] Fix | Delete
$current_theme = get_theme_data( get_stylesheet_directory() . '/style.css' );
[107] Fix | Delete
$theme = $current_theme;
[108] Fix | Delete
unset( $theme['Description'] );
[109] Fix | Delete
unset( $theme['Status'] );
[110] Fix | Delete
unset( $theme['Tags'] );
[111] Fix | Delete
} else {
[112] Fix | Delete
$theme = array(
[113] Fix | Delete
'Name' => $this->sitepress->get_wp_api()->get_theme_name(),
[114] Fix | Delete
'ThemeURI' => $this->sitepress->get_wp_api()->get_theme_URI(),
[115] Fix | Delete
'Author' => $this->sitepress->get_wp_api()->get_theme_author(),
[116] Fix | Delete
'AuthorURI' => $this->sitepress->get_wp_api()->get_theme_authorURI(),
[117] Fix | Delete
'Template' => $this->sitepress->get_wp_api()->get_theme_template(),
[118] Fix | Delete
'Version' => $this->sitepress->get_wp_api()->get_theme_version(),
[119] Fix | Delete
'TextDomain' => $this->sitepress->get_wp_api()->get_theme_textdomain(),
[120] Fix | Delete
'DomainPath' => $this->sitepress->get_wp_api()->get_theme_domainpath(),
[121] Fix | Delete
'ParentName' => $this->sitepress->get_wp_api()->get_theme_parent_name(),
[122] Fix | Delete
);
[123] Fix | Delete
}
[124] Fix | Delete
[125] Fix | Delete
return $theme;
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
function do_json_encode( $data ) {
[129] Fix | Delete
$json_options = 0;
[130] Fix | Delete
if ( defined( 'JSON_HEX_TAG' ) ) {
[131] Fix | Delete
$json_options += JSON_HEX_TAG;
[132] Fix | Delete
}
[133] Fix | Delete
if ( defined( 'JSON_HEX_APOS' ) ) {
[134] Fix | Delete
$json_options += JSON_HEX_APOS;
[135] Fix | Delete
}
[136] Fix | Delete
if ( defined( 'JSON_HEX_QUOT' ) ) {
[137] Fix | Delete
$json_options += JSON_HEX_QUOT;
[138] Fix | Delete
}
[139] Fix | Delete
if ( defined( 'JSON_HEX_AMP' ) ) {
[140] Fix | Delete
$json_options += JSON_HEX_AMP;
[141] Fix | Delete
}
[142] Fix | Delete
if ( defined( 'JSON_UNESCAPED_UNICODE' ) ) {
[143] Fix | Delete
$json_options += JSON_UNESCAPED_UNICODE;
[144] Fix | Delete
}
[145] Fix | Delete
[146] Fix | Delete
if ( version_compare( $this->sitepress->get_wp_api()->phpversion(), '5.3.0', '<' ) ) {
[147] Fix | Delete
$json_data = wp_json_encode( $data );
[148] Fix | Delete
} else {
[149] Fix | Delete
$json_data = wp_json_encode( $data, $json_options );
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
return $json_data;
[153] Fix | Delete
}
[154] Fix | Delete
}
[155] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function