PluginProbe
Polylang / 1.5
Polylang v1.5
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | js/user.js +18 -31 3.0.21.5 View file →
@@ -1,33 +1,20 @@
1 -/**
2 - * Adds one biography input field per language in the user profile.
3 - *
4 - * @package Polylang
5 - */
1 +jQuery(document).ready(function($) {
2 + // biography
3 + // FIXME there is probably a more efficient way to do this
4 + var td = $('#description').parent();
5 + var d = $('#description').clone();
6 + var span = td.children('.description').clone();
7 + td.children().remove();
6 8
7 -jQuery(
8 - function( $ ) {
9 - // biography
10 - // FIXME there is probably a more efficient way to do this
11 - var td = $( '#description' ).parent();
12 - var d = $( '#description' ).clone();
13 - var span = td.children( '.description' ).clone();
14 - td.children().remove();
9 + $('.biography').each( function(){
10 + lang = $(this).attr('name').split('-');
11 + desc = d.clone();
12 + desc.attr('name', 'description_'+lang[0]);
13 + desc.html($(this).val());
14 + td.append('<div>'+lang[1]+'</div');
15 + td.append(desc);
16 + });
15 17
16 - $( '.biography' ).each(
17 - function(){
18 - lang = $( this ).attr( 'name' ).split( '___' );
19 - desc = d.clone();
20 - desc.attr( 'name', 'description_' + lang[0] );
21 - desc.attr( 'id', 'description_' + lang[0] );
22 - // Whitelist because description and lang value is already escaped by the side of PHP
23 - desc.html( $( this ).val() ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
24 - td.append( $( '<div></div>' ).text( lang[1] ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
25 - td.append( desc ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
26 - }
27 - );
28 -
29 - td.append( '<br />' );
30 - // Whitelist because description come from html code generated by WordPress
31 - td.append( span ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
32 - }
33 -);
18 + td.append('<br />');
19 + td.append(span);
20 +});