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.../menu/menu-syn...
File: menus-sync.php
<?php
[0] Fix | Delete
require dirname( __FILE__ ) . '/wpml-menu-sync-display.class.php';
[1] Fix | Delete
[2] Fix | Delete
/** @var $sitepress SitePress */
[3] Fix | Delete
/** @var $icl_menus_sync ICLMenusSync */
[4] Fix | Delete
$active_languages = $sitepress->get_active_languages();
[5] Fix | Delete
$def_lang_code = $sitepress->get_default_language();
[6] Fix | Delete
$def_lang = $sitepress->get_language_details( $def_lang_code );
[7] Fix | Delete
$secondary_languages = array();
[8] Fix | Delete
[9] Fix | Delete
foreach ( $active_languages as $code => $lang ) {
[10] Fix | Delete
if ( $code !== $def_lang_code ) {
[11] Fix | Delete
$secondary_languages[] = $lang;
[12] Fix | Delete
}
[13] Fix | Delete
}
[14] Fix | Delete
?>
[15] Fix | Delete
<!--suppress HtmlFormInputWithoutLabel --><!--suppress HtmlUnknownAttribute -->
[16] Fix | Delete
<div class="wrap">
[17] Fix | Delete
<h2><?php esc_html_e( 'WP Menus Sync', 'sitepress' ) ?></h2>
[18] Fix | Delete
<p><?php printf( esc_html__( 'Menu synchronization will sync the menu structure from the default language of %s to the secondary languages.', 'sitepress' ), $def_lang['display_name'] ) ?></p>
[19] Fix | Delete
[20] Fix | Delete
<br/>
[21] Fix | Delete
<?php
[22] Fix | Delete
if ( $icl_menus_sync->is_preview ) {
[23] Fix | Delete
?>
[24] Fix | Delete
[25] Fix | Delete
<form id="icl_msync_confirm_form" method="post">
[26] Fix | Delete
<input type="hidden" name="action" value="icl_msync_confirm"/>
[27] Fix | Delete
[28] Fix | Delete
<table id="icl_msync_confirm" class="widefat icl_msync">
[29] Fix | Delete
<thead>
[30] Fix | Delete
<tr>
[31] Fix | Delete
<th scope="row" class="menu-check-all"><input type="checkbox"/></th>
[32] Fix | Delete
<th><?php esc_html_e( 'Language', 'sitepress' ) ?></th>
[33] Fix | Delete
<th><?php esc_html_e( 'Action', 'sitepress' ) ?></th>
[34] Fix | Delete
</tr>
[35] Fix | Delete
</thead>
[36] Fix | Delete
<tbody>
[37] Fix | Delete
[38] Fix | Delete
<?php
[39] Fix | Delete
if ( empty( $icl_menus_sync->sync_data ) ) {
[40] Fix | Delete
?>
[41] Fix | Delete
<tr>
[42] Fix | Delete
<td align="center" colspan="3"><?php esc_html_e( 'Nothing to sync.', 'sitepress' ) ?></td>
[43] Fix | Delete
</tr>
[44] Fix | Delete
<?php
[45] Fix | Delete
} else {
[46] Fix | Delete
//Menus
[47] Fix | Delete
foreach ( $icl_menus_sync->menus as $menu_id => $menu ) {
[48] Fix | Delete
$menu_sync_display = new WPML_Menu_Sync_Display( $menu_id, $icl_menus_sync );
[49] Fix | Delete
?>
[50] Fix | Delete
<tr class="icl_msync_menu_title">
[51] Fix | Delete
<td colspan="3"><?php echo esc_html( $menu['name'] ) ?></td>
[52] Fix | Delete
</tr>
[53] Fix | Delete
[54] Fix | Delete
<?php
[55] Fix | Delete
// Display actions per menu
[56] Fix | Delete
// menu translations
[57] Fix | Delete
if ( isset( $icl_menus_sync->sync_data['menu_translations'], $icl_menus_sync->sync_data['menu_translations'][ $menu_id ] ) ) {
[58] Fix | Delete
foreach ( $icl_menus_sync->sync_data['menu_translations'][ $menu_id ] as $language => $name ) {
[59] Fix | Delete
$lang_details = $sitepress->get_language_details( $language );
[60] Fix | Delete
?>
[61] Fix | Delete
<tr>
[62] Fix | Delete
<th scope="row" class="check-column">
[63] Fix | Delete
<input type="checkbox"
[64] Fix | Delete
name="sync[menu_translation][<?php echo esc_attr( $menu_id ) ?>][<?php echo esc_attr( $language ) ?>]"
[65] Fix | Delete
value="<?php echo esc_attr( $name ) ?>"/>
[66] Fix | Delete
</th>
[67] Fix | Delete
<td><?php echo esc_html( $lang_details['display_name'] ) ?></td>
[68] Fix | Delete
<td><?php printf( esc_html__( 'Add menu translation: %s', 'sitepress' ), '<strong>' . esc_html( $name ) . '</strong>' ) ?> </td>
[69] Fix | Delete
</tr>
[70] Fix | Delete
<?php
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
foreach (
[75] Fix | Delete
array(
[76] Fix | Delete
'add',
[77] Fix | Delete
'mov',
[78] Fix | Delete
'del',
[79] Fix | Delete
'label_changed',
[80] Fix | Delete
'url_changed',
[81] Fix | Delete
'label_missing',
[82] Fix | Delete
'url_missing',
[83] Fix | Delete
'options_changed',
[84] Fix | Delete
) as $sync_type
[85] Fix | Delete
) {
[86] Fix | Delete
$menu_sync_display->print_sync_field( $sync_type );
[87] Fix | Delete
}
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
?>
[91] Fix | Delete
</tbody>
[92] Fix | Delete
</table>
[93] Fix | Delete
<p class="submit">
[94] Fix | Delete
<?php
[95] Fix | Delete
$icl_menu_sync_submit_disabled = '';
[96] Fix | Delete
if ( empty( $icl_menus_sync->sync_data ) || ( empty( $icl_menus_sync->sync_data['mov'] ) && empty( $icl_menus_sync->sync_data['mov'][ $menu_id ] ) ) ) {
[97] Fix | Delete
$icl_menu_sync_submit_disabled = 'disabled="disabled"';
[98] Fix | Delete
}
[99] Fix | Delete
?>
[100] Fix | Delete
<input id="icl_msync_submit"
[101] Fix | Delete
class="button-primary"
[102] Fix | Delete
type="button"
[103] Fix | Delete
value="<?php esc_attr_e( 'Apply changes' ) ?>"
[104] Fix | Delete
data-message="<?php esc_attr_e( 'Syncing menus %1 of %2', 'sitepress' ) ?>"
[105] Fix | Delete
data-message-complete="<?php esc_attr_e( 'The selected menus have been synchonized.', 'sitepress' ) ?>"
[106] Fix | Delete
<?php echo $icl_menu_sync_submit_disabled; ?> />&nbsp;
[107] Fix | Delete
<input id="icl_msync_cancel" class="button-secondary" type="button" value="<?php _e( 'Cancel' ) ?>"/>
[108] Fix | Delete
<span id="icl_msync_message"></span>
[109] Fix | Delete
</p>
[110] Fix | Delete
<?php wp_nonce_field( '_icl_nonce_menu_sync', '_icl_nonce_menu_sync' ); ?>
[111] Fix | Delete
</form>
[112] Fix | Delete
<?php
[113] Fix | Delete
} else {
[114] Fix | Delete
$need_sync = 0;
[115] Fix | Delete
?>
[116] Fix | Delete
<form method="post" action="">
[117] Fix | Delete
<input type="hidden" name="action" value="icl_msync_preview"/>
[118] Fix | Delete
<table class="widefat icl_msync">
[119] Fix | Delete
<thead>
[120] Fix | Delete
<tr>
[121] Fix | Delete
<th><?php echo esc_html( $def_lang['display_name'] ) ?></th>
[122] Fix | Delete
<?php
[123] Fix | Delete
if ( ! empty( $secondary_languages ) ) {
[124] Fix | Delete
foreach ( $secondary_languages as $lang ) {
[125] Fix | Delete
?>
[126] Fix | Delete
<th><?php echo esc_html( $lang['display_name'] ) ?></th>
[127] Fix | Delete
<?php
[128] Fix | Delete
}
[129] Fix | Delete
}
[130] Fix | Delete
?>
[131] Fix | Delete
</tr>
[132] Fix | Delete
</thead>
[133] Fix | Delete
<tbody>
[134] Fix | Delete
<?php
[135] Fix | Delete
if ( empty( $icl_menus_sync->menus ) ) {
[136] Fix | Delete
?>
[137] Fix | Delete
<tr>
[138] Fix | Delete
<td align="center" colspan="<?php echo count( $active_languages ) ?>"><?php esc_html_e( 'No menus found', 'sitepress' ) ?></td>
[139] Fix | Delete
</tr>
[140] Fix | Delete
<?php
[141] Fix | Delete
} else {
[142] Fix | Delete
foreach ( $icl_menus_sync->menus as $menu_id => $menu ) {
[143] Fix | Delete
?>
[144] Fix | Delete
[145] Fix | Delete
<tr class="icl_msync_menu_title">
[146] Fix | Delete
<td><strong><?php echo esc_html( $menu['name'] ) ?></strong></td>
[147] Fix | Delete
<?php
[148] Fix | Delete
foreach ( $secondary_languages as $l ) {
[149] Fix | Delete
$input_name = sprintf( 'sync[menu_options][%s][%s][auto_add]', esc_attr( $menu_id ), esc_attr( $l['code'] ) );
[150] Fix | Delete
?>
[151] Fix | Delete
<td>
[152] Fix | Delete
<?php
[153] Fix | Delete
if ( isset( $menu['translations'][ $l['code'] ]['name'] ) ) {
[154] Fix | Delete
echo esc_html( $menu['translations'][ $l['code'] ]['name'] );
[155] Fix | Delete
} else { // menu is translated in $l[code]
[156] Fix | Delete
$need_sync++;
[157] Fix | Delete
?>
[158] Fix | Delete
<input type="text" class="icl_msync_add"
[159] Fix | Delete
name="sync[menu_translations][<?php echo esc_attr( $menu_id ) ?>][<?php echo esc_attr( $l['code'] ) ?>]"
[160] Fix | Delete
value="<?php echo esc_attr( $menu['name'] ) . ' - ' . esc_attr( $l['display_name'] ) ?>"
[161] Fix | Delete
/>
[162] Fix | Delete
<small><?php esc_html_e( 'Auto-generated title. Click to edit.', 'sitepress' ) ?></small>
[163] Fix | Delete
<input type="hidden" value=""
[164] Fix | Delete
name="<?php echo $input_name ?>"
[165] Fix | Delete
/>
[166] Fix | Delete
<?php
[167] Fix | Delete
}
[168] Fix | Delete
if ( isset( $menu['translations'][ $l['code'] ]['auto_add'] ) ) {
[169] Fix | Delete
?>
[170] Fix | Delete
<input type="hidden" name="<?php echo $input_name ?>" value="<?php echo esc_attr( $menu['translations'][ $l['code'] ]['auto_add'] ) ?>"/>
[171] Fix | Delete
<?php
[172] Fix | Delete
}
[173] Fix | Delete
?>
[174] Fix | Delete
</td>
[175] Fix | Delete
<?php
[176] Fix | Delete
} //foreach($secondary_languages as $l):
[177] Fix | Delete
?>
[178] Fix | Delete
</tr>
[179] Fix | Delete
<?php
[180] Fix | Delete
$need_sync += $icl_menus_sync->render_items_tree_default( $menu_id );
[181] Fix | Delete
[182] Fix | Delete
} //foreach( $icl_menus_sync->menus as $menu_id => $menu):
[183] Fix | Delete
}
[184] Fix | Delete
?>
[185] Fix | Delete
</tbody>
[186] Fix | Delete
</table>
[187] Fix | Delete
<p class="submit">
[188] Fix | Delete
<?php
[189] Fix | Delete
if ( $need_sync ) {
[190] Fix | Delete
?>
[191] Fix | Delete
<input id="icl_msync_sync" type="submit" class="button-primary"
[192] Fix | Delete
value="<?php esc_attr_e( 'Sync', 'sitepress' ) ?>"
[193] Fix | Delete
<?php disabled( ! $need_sync ) ?>
[194] Fix | Delete
/>
[195] Fix | Delete
&nbsp;&nbsp;
[196] Fix | Delete
<span id="icl_msync_max_input_vars"
[197] Fix | Delete
style="display:none"
[198] Fix | Delete
class="icl-admin-message-warning"
[199] Fix | Delete
data-max_input_vars="<?php
[200] Fix | Delete
[201] Fix | Delete
//phpcs:disable PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound -- It never caused issues, but we should probably fix that
[202] Fix | Delete
echo ini_get( 'max_input_vars' );
[203] Fix | Delete
//phpcs:enable PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
[204] Fix | Delete
[205] Fix | Delete
?>">
[206] Fix | Delete
<?php
[207] Fix | Delete
printf(
[208] Fix | Delete
esc_html__( 'The menus on this page may not sync because it requires more input variables. Please modify the %s setting in your php.ini or .htaccess files to %s or more.', 'sitepress' ),
[209] Fix | Delete
'<strong>max_input_vars</strong>',
[210] Fix | Delete
'<strong>!NUM!</strong>'
[211] Fix | Delete
)
[212] Fix | Delete
?>
[213] Fix | Delete
</span>
[214] Fix | Delete
<?php
[215] Fix | Delete
} else {
[216] Fix | Delete
?>
[217] Fix | Delete
<input id="icl_msync_sync" type="submit" class="button-primary"
[218] Fix | Delete
value="<?php esc_attr_e( 'Nothing Sync', 'sitepress' ) ?>"<?php disabled( ! $need_sync ) ?>
[219] Fix | Delete
/>
[220] Fix | Delete
<?php
[221] Fix | Delete
}
[222] Fix | Delete
?>
[223] Fix | Delete
</p>
[224] Fix | Delete
<?php wp_nonce_field( '_icl_nonce_menu_sync', '_icl_nonce_menu_sync' ); ?>
[225] Fix | Delete
</form>
[226] Fix | Delete
[227] Fix | Delete
<?php
[228] Fix | Delete
if ( ! empty( $icl_menus_sync->operations ) ) {
[229] Fix | Delete
$show_string_translation_link = false;
[230] Fix | Delete
foreach ( $icl_menus_sync->operations as $op => $c ) {
[231] Fix | Delete
if ( $op == 'add' ) {
[232] Fix | Delete
?>
[233] Fix | Delete
<span class="icl_msync_item icl_msync_add"><?php esc_html_e( 'Item will be added', 'sitepress' ) ?></span>
[234] Fix | Delete
<?php
[235] Fix | Delete
} elseif ( $op == 'del' ) {
[236] Fix | Delete
?>
[237] Fix | Delete
<span class="icl_msync_item icl_msync_del"><?php esc_html_e( 'Item will be removed', 'sitepress' ) ?></span>
[238] Fix | Delete
<?php
[239] Fix | Delete
} elseif ( $op == 'not' ) {
[240] Fix | Delete
?>
[241] Fix | Delete
<span class="icl_msync_item icl_msync_not"><?php esc_html_e( 'Item cannot be added (parent not translated)', 'sitepress' ) ?></span>
[242] Fix | Delete
<?php
[243] Fix | Delete
} elseif ( $op == 'mov' ) {
[244] Fix | Delete
?>
[245] Fix | Delete
<span class="icl_msync_item icl_msync_mov"><?php esc_html_e( 'Item changed position', 'sitepress' ) ?></span>
[246] Fix | Delete
<?php
[247] Fix | Delete
} elseif ( $op == 'copy' ) {
[248] Fix | Delete
?>
[249] Fix | Delete
<span class="icl_msync_item icl_msync_copy"><?php esc_html_e( 'Item will be copied', 'sitepress' ) ?></span>
[250] Fix | Delete
<?php
[251] Fix | Delete
} elseif ( $op == 'label_changed' ) {
[252] Fix | Delete
?>
[253] Fix | Delete
<span class="icl_msync_item icl_msync_label_changed"><?php esc_html_e( 'Strings for menus will be updated', 'sitepress' ) ?></span>
[254] Fix | Delete
<?php
[255] Fix | Delete
} elseif ( $op == 'url_changed' ) {
[256] Fix | Delete
?>
[257] Fix | Delete
<span class="icl_msync_item icl_msync_url_changed"><?php esc_html_e( 'URLs for menus will be updated', 'sitepress' ) ?></span>
[258] Fix | Delete
<?php
[259] Fix | Delete
} elseif ( $op == 'options_changed' ) {
[260] Fix | Delete
?>
[261] Fix | Delete
<span class="icl_msync_item icl_msync_options_changed"><?php esc_html_e( 'Menu Options will be updated', 'sitepress' ) ?></span>
[262] Fix | Delete
<?php
[263] Fix | Delete
} elseif ( $op == 'label_missing' ) {
[264] Fix | Delete
?>
[265] Fix | Delete
<span class="icl_msync_item icl_msync_label_missing">
[266] Fix | Delete
<?php esc_html_e( 'Untranslated strings for menus', 'sitepress' ) ?>
[267] Fix | Delete
</span>
[268] Fix | Delete
<?php
[269] Fix | Delete
} elseif ( $op == 'url_missing' ) {
[270] Fix | Delete
?>
[271] Fix | Delete
<span class="icl_msync_item icl_msync_url_missing">
[272] Fix | Delete
<?php esc_html_e( 'Untranslated URLs for menus', 'sitepress' ) ?>
[273] Fix | Delete
</span>
[274] Fix | Delete
<?php
[275] Fix | Delete
}
[276] Fix | Delete
}
[277] Fix | Delete
}
[278] Fix | Delete
[279] Fix | Delete
$icl_menus_sync->display_menu_links_to_string_translation();
[280] Fix | Delete
}
[281] Fix | Delete
do_action( 'icl_menu_footer' );
[282] Fix | Delete
?>
[283] Fix | Delete
</div>
[284] Fix | Delete
[285] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function