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/upgrade-...
File: upgrade-3.2.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* @package wpml-core
[2] Fix | Delete
*/
[3] Fix | Delete
[4] Fix | Delete
global $wpdb;
[5] Fix | Delete
[6] Fix | Delete
global $sitepress_settings;
[7] Fix | Delete
[8] Fix | Delete
if ( ! isset( $sitepress_settings ) ) {
[9] Fix | Delete
$sitepress_settings = get_option( 'icl_sitepress_settings' );
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
// change icl_translate.field_type size to 160
[13] Fix | Delete
$sql = "ALTER TABLE {$wpdb->prefix}icl_translate MODIFY COLUMN field_type VARCHAR( 160 ) NOT NULL";
[14] Fix | Delete
$wpdb->query( $sql );
[15] Fix | Delete
[16] Fix | Delete
// Add 'batch_id' column to icl_translation_status
[17] Fix | Delete
$sql = $wpdb->prepare( "SELECT count(*) FROM information_schema.COLUMNS
[18] Fix | Delete
WHERE COLUMN_NAME = 'batch_id'
[19] Fix | Delete
and TABLE_NAME = '{$wpdb->prefix}icl_translation_status'AND TABLE_SCHEMA = %s",
[20] Fix | Delete
DB_NAME );
[21] Fix | Delete
$batch_id_exists = $wpdb->get_var( $sql );
[22] Fix | Delete
if ( ! $batch_id_exists || ! (int) $batch_id_exists ) {
[23] Fix | Delete
$sql = "ALTER TABLE `{$wpdb->prefix}icl_translation_status` ADD batch_id int DEFAULT 0 NOT NULL;";
[24] Fix | Delete
$wpdb->query( $sql );
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
// Add 'batch_id' column to icl_string_translations
[28] Fix | Delete
$sql = $wpdb->prepare( "SELECT count(*) FROM information_schema.COLUMNS
[29] Fix | Delete
WHERE COLUMN_NAME = 'batch_id'
[30] Fix | Delete
and TABLE_NAME = '{$wpdb->prefix}icl_string_translations' AND TABLE_SCHEMA = %s",
[31] Fix | Delete
DB_NAME );
[32] Fix | Delete
$batch_id_exists = $wpdb->get_var( $sql );
[33] Fix | Delete
if ( ! $batch_id_exists || ! (int) $batch_id_exists ) {
[34] Fix | Delete
$sql = "ALTER TABLE `{$wpdb->prefix}icl_string_translations` ADD batch_id int DEFAULT -1 NOT NULL;";
[35] Fix | Delete
$wpdb->query( $sql );
[36] Fix | Delete
require dirname( __FILE__ ) . '/3.2/wpml-upgrade-string-statuses.php';
[37] Fix | Delete
update_string_statuses();
[38] Fix | Delete
fix_icl_string_status();
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
// Add 'translation_service' column to icl_string_translations
[42] Fix | Delete
$sql = $wpdb->prepare( "SELECT count(*) FROM information_schema.COLUMNS
[43] Fix | Delete
WHERE COLUMN_NAME = 'translation_service'
[44] Fix | Delete
and TABLE_NAME = '{$wpdb->prefix}icl_string_translations' AND TABLE_SCHEMA = %s",
[45] Fix | Delete
DB_NAME );
[46] Fix | Delete
$batch_id_exists = $wpdb->get_var( $sql );
[47] Fix | Delete
if ( ! $batch_id_exists || ! (int) $batch_id_exists ) {
[48] Fix | Delete
$sql = "ALTER TABLE `{$wpdb->prefix}icl_string_translations` ADD translation_service varchar(16) DEFAULT '' NOT NULL;";
[49] Fix | Delete
$wpdb->query( $sql );
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
// Add 'icl_translation_batches' table
[53] Fix | Delete
$sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}icl_translation_batches (
[54] Fix | Delete
`id` int(11) NOT NULL AUTO_INCREMENT,
[55] Fix | Delete
`batch_name` text NOT NULL,
[56] Fix | Delete
`tp_id` int NULL,
[57] Fix | Delete
`ts_url` text NULL,
[58] Fix | Delete
`last_update` DATETIME NULL,
[59] Fix | Delete
PRIMARY KEY (`id`)
[60] Fix | Delete
);";
[61] Fix | Delete
$wpdb->query( $sql );
[62] Fix | Delete
[63] Fix | Delete
[64] Fix | Delete
$res = $wpdb->get_results( "SHOW COLUMNS FROM {$wpdb->prefix}icl_strings" );
[65] Fix | Delete
$icl_strings_columns = array();
[66] Fix | Delete
foreach ( $res as $row ) {
[67] Fix | Delete
$icl_strings_columns[ ] = $row->Field;
[68] Fix | Delete
}
[69] Fix | Delete
if ( ! in_array( 'string_package_id', $icl_strings_columns ) ) {
[70] Fix | Delete
$wpdb->query( "ALTER TABLE {$wpdb->prefix}icl_strings
[71] Fix | Delete
ADD `string_package_id` BIGINT unsigned NULL AFTER value,
[72] Fix | Delete
ADD `type` VARCHAR(40) NOT NULL DEFAULT 'LINE' AFTER string_package_id,
[73] Fix | Delete
ADD `title` VARCHAR(160) NULL AFTER type,
[74] Fix | Delete
ADD INDEX (`string_package_id`)
[75] Fix | Delete
" );
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
$wpdb->update( $wpdb->prefix . 'postmeta', array( 'meta_key' => '_wpml_original_post_id' ), array( 'meta_key' => 'original_post_id' ) );
[79] Fix | Delete
[80] Fix | Delete
$sitepress_settings = get_option( 'icl_sitepress_settings' );
[81] Fix | Delete
[82] Fix | Delete
if ( isset( $sitepress_settings[ 'translation-management' ] ) ) {
[83] Fix | Delete
$updated_tm_settings = false;
[84] Fix | Delete
$tm_settings = $sitepress_settings[ 'translation-management' ];
[85] Fix | Delete
$tm_setting_keys = array(
[86] Fix | Delete
'custom_fields_translation',
[87] Fix | Delete
'custom_fields_readonly_config',
[88] Fix | Delete
'custom_fields_translation_custom_readonly',
[89] Fix | Delete
);
[90] Fix | Delete
foreach ( $tm_setting_keys as $tm_setting_key ) {
[91] Fix | Delete
$updated_tm_settings_key = false;
[92] Fix | Delete
if ( isset( $tm_settings[ $tm_setting_key ] ) ) {
[93] Fix | Delete
$tm_custom_fields_settings = $tm_settings[ $tm_setting_key ];
[94] Fix | Delete
if ( array_key_exists( 'original_post_id', $tm_custom_fields_settings ) ) {
[95] Fix | Delete
$tm_custom_fields_settings[ '_wpml_original_post_id' ] = $tm_custom_fields_settings[ 'original_post_id' ];
[96] Fix | Delete
unset( $tm_custom_fields_settings[ 'original_post_id' ] );
[97] Fix | Delete
$updated_tm_settings_key = true;
[98] Fix | Delete
}
[99] Fix | Delete
$index = array_search( 'original_post_id', $tm_custom_fields_settings, true );
[100] Fix | Delete
if ( $index ) {
[101] Fix | Delete
$tm_custom_fields_settings[ $index ] = '_wpml_original_post_id';
[102] Fix | Delete
$updated_tm_settings_key = true;
[103] Fix | Delete
}
[104] Fix | Delete
if($updated_tm_settings_key) {
[105] Fix | Delete
$tm_settings[ $tm_setting_key ] = $tm_custom_fields_settings;
[106] Fix | Delete
$updated_tm_settings = true;
[107] Fix | Delete
}
[108] Fix | Delete
}
[109] Fix | Delete
}
[110] Fix | Delete
if($updated_tm_settings) {
[111] Fix | Delete
$sitepress_settings[ 'translation-management' ] = $tm_settings;
[112] Fix | Delete
update_option( 'icl_sitepress_settings', $sitepress_settings );
[113] Fix | Delete
}
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function