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.../inc
File: functions-troubleshooting.php
<?php
[0] Fix | Delete
[1] Fix | Delete
function icl_reset_wpml( $blog_id = false ) {
[2] Fix | Delete
global $wpdb, $sitepress_settings;
[3] Fix | Delete
[4] Fix | Delete
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'resetwpml' ) {
[5] Fix | Delete
check_admin_referer( 'resetwpml' );
[6] Fix | Delete
}
[7] Fix | Delete
[8] Fix | Delete
if ( empty( $blog_id ) ) {
[9] Fix | Delete
$filtered_id = filter_input( INPUT_POST, 'id', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE );
[10] Fix | Delete
$filtered_id = $filtered_id ? $filtered_id : filter_input( INPUT_GET, 'id', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE );
[11] Fix | Delete
$blog_id = $filtered_id !== false ? $filtered_id : $wpdb->blogid;
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
if ( $blog_id || ! function_exists( 'is_multisite' ) || ! is_multisite() ) {
[15] Fix | Delete
[16] Fix | Delete
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
[17] Fix | Delete
switch_to_blog( $blog_id );
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
do_action( 'wpml_reset_plugins_before' );
[21] Fix | Delete
[22] Fix | Delete
wp_clear_scheduled_hook( 'update_wpml_config_index' );
[23] Fix | Delete
[24] Fix | Delete
$icl_tables = array(
[25] Fix | Delete
$wpdb->prefix . 'icl_languages',
[26] Fix | Delete
$wpdb->prefix . 'icl_languages_translations',
[27] Fix | Delete
$wpdb->prefix . 'icl_translations',
[28] Fix | Delete
$wpdb->prefix . 'icl_translation_status',
[29] Fix | Delete
$wpdb->prefix . 'icl_translate_job',
[30] Fix | Delete
$wpdb->prefix . 'icl_translate',
[31] Fix | Delete
$wpdb->prefix . 'icl_locale_map',
[32] Fix | Delete
$wpdb->prefix . 'icl_flags',
[33] Fix | Delete
$wpdb->prefix . 'icl_content_status',
[34] Fix | Delete
$wpdb->prefix . 'icl_core_status',
[35] Fix | Delete
$wpdb->prefix . 'icl_node',
[36] Fix | Delete
$wpdb->prefix . 'icl_strings',
[37] Fix | Delete
$wpdb->prefix . 'icl_string_packages',
[38] Fix | Delete
$wpdb->prefix . 'icl_translation_batches',
[39] Fix | Delete
$wpdb->prefix . 'icl_string_translations',
[40] Fix | Delete
$wpdb->prefix . 'icl_string_status',
[41] Fix | Delete
$wpdb->prefix . 'icl_string_positions',
[42] Fix | Delete
$wpdb->prefix . 'icl_message_status',
[43] Fix | Delete
$wpdb->prefix . 'icl_reminders',
[44] Fix | Delete
$wpdb->prefix . 'icl_mo_files_domains',
[45] Fix | Delete
$wpdb->prefix . 'icl_string_pages',
[46] Fix | Delete
$wpdb->prefix . 'icl_string_urls',
[47] Fix | Delete
$wpdb->prefix . 'icl_cms_nav_cache',
[48] Fix | Delete
);
[49] Fix | Delete
$icl_tables = apply_filters( 'wpml_reset_tables', $icl_tables, $blog_id );
[50] Fix | Delete
[51] Fix | Delete
foreach ( $icl_tables as $icl_table ) {
[52] Fix | Delete
$wpdb->query( "DROP TABLE IF EXISTS " . $icl_table );
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
$wpml_options = array(
[56] Fix | Delete
'icl_sitepress_settings',
[57] Fix | Delete
'icl_sitepress_version',
[58] Fix | Delete
'_icl_cache',
[59] Fix | Delete
'_icl_admin_option_names',
[60] Fix | Delete
'wp_icl_translators_cached',
[61] Fix | Delete
'wpml32_icl_non_translators_cached',
[62] Fix | Delete
'wpml-package-translation-db-updates-run',
[63] Fix | Delete
'wpml-package-translation-refresh-required',
[64] Fix | Delete
'wpml-package-translation-string-packages-table-updated',
[65] Fix | Delete
'wpml-package-translation-string-table-updated',
[66] Fix | Delete
'icl_translation_jobs_basket',
[67] Fix | Delete
'widget_icl_lang_sel_widget',
[68] Fix | Delete
'icl_admin_messages',
[69] Fix | Delete
'icl_adl_settings',
[70] Fix | Delete
'wpml_tp_com_log',
[71] Fix | Delete
'wpml_config_index',
[72] Fix | Delete
'wpml_config_index_updated',
[73] Fix | Delete
'wpml_config_files_arr',
[74] Fix | Delete
'wpml_language_switcher',
[75] Fix | Delete
'wpml_notices',
[76] Fix | Delete
'wpml_start_version',
[77] Fix | Delete
'wpml_dependencies:installed_plugins',
[78] Fix | Delete
'wpml_translation_services',
[79] Fix | Delete
'wpml_update_statuses',
[80] Fix | Delete
'_wpml_dismissed_notices',
[81] Fix | Delete
'wpml_translation_services_timestamp',
[82] Fix | Delete
'wpml_string_table_ok_for_mo_import',
[83] Fix | Delete
'wpml-charset-validation',
[84] Fix | Delete
'_wpml_media',
[85] Fix | Delete
'wpml_st_display_strings_scan_notices',
[86] Fix | Delete
'wpml-st-all-strings-are-in-english',
[87] Fix | Delete
'wpml_strings_need_links_fixed',
[88] Fix | Delete
'_wpml_batch_report',
[89] Fix | Delete
'wpml_cms_nav_settings',
[90] Fix | Delete
'WPML_CMS_NAV_VERSION',
[91] Fix | Delete
'icl_st_settings',
[92] Fix | Delete
'wpml-tm-custom-xml',
[93] Fix | Delete
'wpml-st-persist-errors',
[94] Fix | Delete
'wpml_base_slug_translation',
[95] Fix | Delete
);
[96] Fix | Delete
$wpml_options = apply_filters( 'wpml_reset_options', $wpml_options, $blog_id );
[97] Fix | Delete
[98] Fix | Delete
foreach ( $wpml_options as $wpml_option ) {
[99] Fix | Delete
delete_option( $wpml_option );
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
$wpml_user_options = array(
[103] Fix | Delete
'language_pairs'
[104] Fix | Delete
);
[105] Fix | Delete
$wpml_user_options = apply_filters( 'wpml_reset_user_options', $wpml_user_options, $blog_id );
[106] Fix | Delete
if ( $wpml_user_options ) {
[107] Fix | Delete
foreach ( $wpml_user_options as $wpml_user_option ) {
[108] Fix | Delete
[109] Fix | Delete
$meta_key = $wpdb->get_blog_prefix( $blog_id ) . $wpml_user_option;
[110] Fix | Delete
$users = get_users( array(
[111] Fix | Delete
'blog_id' => $blog_id,
[112] Fix | Delete
'meta_key' => $meta_key,
[113] Fix | Delete
'fields' => array( 'ID' ),
[114] Fix | Delete
) );
[115] Fix | Delete
[116] Fix | Delete
/** @var WP_User $user */
[117] Fix | Delete
foreach ( $users as $user ) {
[118] Fix | Delete
delete_user_option( $user->ID, $wpml_user_option );
[119] Fix | Delete
}
[120] Fix | Delete
}
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
$capabilities = array(
[124] Fix | Delete
'wpml_manage_translation_management',
[125] Fix | Delete
'wpml_manage_languages',
[126] Fix | Delete
'wpml_manage_theme_and_plugin_localization',
[127] Fix | Delete
'wpml_manage_support',
[128] Fix | Delete
'wpml_manage_woocommerce_multilingual',
[129] Fix | Delete
'wpml_operate_woocommerce_multilingual',
[130] Fix | Delete
'wpml_manage_media_translation',
[131] Fix | Delete
'wpml_manage_navigation',
[132] Fix | Delete
'wpml_manage_sticky_links',
[133] Fix | Delete
'wpml_manage_string_translation',
[134] Fix | Delete
'wpml_manage_translation_analytics',
[135] Fix | Delete
'wpml_manage_wp_menus_sync',
[136] Fix | Delete
'wpml_manage_taxonomy_translation',
[137] Fix | Delete
'wpml_manage_troubleshooting',
[138] Fix | Delete
'wpml_manage_translation_options',
[139] Fix | Delete
'manage_translations',
[140] Fix | Delete
'translate',
[141] Fix | Delete
);
[142] Fix | Delete
[143] Fix | Delete
$capabilities = apply_filters( 'wpml_reset_user_capabilities', $capabilities, $blog_id );
[144] Fix | Delete
if ( $capabilities ) {
[145] Fix | Delete
$users = get_users( array(
[146] Fix | Delete
'blog_id' => $blog_id,
[147] Fix | Delete
) );
[148] Fix | Delete
[149] Fix | Delete
/** @var WP_User $user */
[150] Fix | Delete
foreach ( $users as $user ) {
[151] Fix | Delete
foreach ( $capabilities as $capability ) {
[152] Fix | Delete
$user->remove_cap( $capability );
[153] Fix | Delete
}
[154] Fix | Delete
}
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
$sitepress_settings = null;
[158] Fix | Delete
wp_cache_init();
[159] Fix | Delete
[160] Fix | Delete
$wpml_cache_directory = new WPML_Cache_Directory( new WPML_WP_API() );
[161] Fix | Delete
$wpml_cache_directory->remove();
[162] Fix | Delete
[163] Fix | Delete
do_action( 'wpml_reset_plugins_after' );
[164] Fix | Delete
[165] Fix | Delete
$wpmu_sitewide_plugins = (array) maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );
[166] Fix | Delete
if ( ! isset( $wpmu_sitewide_plugins[ WPML_PLUGIN_BASENAME ] ) ) {
[167] Fix | Delete
remove_action( 'deactivate_' . WPML_PLUGIN_BASENAME, 'icl_sitepress_deactivate' );
[168] Fix | Delete
deactivate_plugins( WPML_PLUGIN_BASENAME );
[169] Fix | Delete
$ra = get_option( 'recently_activated' );
[170] Fix | Delete
$ra[ WPML_PLUGIN_BASENAME ] = time();
[171] Fix | Delete
update_option( 'recently_activated', $ra );
[172] Fix | Delete
} else {
[173] Fix | Delete
update_option( '_wpml_inactive', true );
[174] Fix | Delete
}
[175] Fix | Delete
[176] Fix | Delete
$options_to_delete_after_deactivation = array(
[177] Fix | Delete
'wpml_dependencies:needs_validation',
[178] Fix | Delete
'wpml_dependencies:valid_plugins',
[179] Fix | Delete
'wpml_dependencies:invalid_plugins',
[180] Fix | Delete
);
[181] Fix | Delete
$options_to_delete_after_deactivation = apply_filters( 'wpml_reset_options_after_deactivation', $options_to_delete_after_deactivation, $blog_id );
[182] Fix | Delete
[183] Fix | Delete
foreach ( $options_to_delete_after_deactivation as $option ) {
[184] Fix | Delete
delete_option( $option );
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
[188] Fix | Delete
restore_current_blog();
[189] Fix | Delete
}
[190] Fix | Delete
}
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
/**
[194] Fix | Delete
* Ajax handler for type assignment fix troubleshoot action
[195] Fix | Delete
*/
[196] Fix | Delete
function icl_repair_broken_type_and_language_assignments() {
[197] Fix | Delete
global $sitepress;
[198] Fix | Delete
[199] Fix | Delete
$lang_setter = new WPML_Fix_Type_Assignments( $sitepress );
[200] Fix | Delete
$rows_fixed = $lang_setter->run();
[201] Fix | Delete
[202] Fix | Delete
wp_send_json_success( $rows_fixed );
[203] Fix | Delete
}
[204] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function