Ticket #8215: 8215.patch
File 8215.patch, 10.4 KB (added by , 4 years ago) |
---|
-
src/bp-xprofile/admin/js/admin.js
59 59 newDiv.appendChild( toDeleteWrap ); 60 60 holder.appendChild( newDiv ); 61 61 62 // re-initialize the sortable ui62 // Re-initialize the sortable ui. 63 63 enableSortableFieldOptions( forWhat ); 64 64 65 // set focus on newly created element65 // Set focus on newly created element. 66 66 document.getElementById(forWhat + '_option' + theId).focus(); 67 67 68 68 theId++; … … 104 104 } 105 105 106 106 document.getElementById( id ).style.display = 'none'; 107 // the field id is [fieldtype]option[iterator] and not [fieldtype]div[iterator]107 // The field id is [fieldtype]option[iterator] and not [fieldtype]div[iterator]. 108 108 var field_id = id.replace( 'div', 'option' ); 109 109 document.getElementById( field_id ).value = ''; 110 110 } … … 190 190 191 191 jQuery( document ).ready( function() { 192 192 193 // Set focus in Field Title, if we're on the right page 193 // Set focus in Field Title, if we're on the right page. 194 194 jQuery( '#bp-xprofile-add-field #title' ).focus(); 195 195 196 196 // Set up the notice that shows when no member types are selected for a field. … … 199 199 toggle_no_member_type_notice(); 200 200 } ); 201 201 202 // Set up deleting options ajax 202 // Set up deleting options ajax. 203 203 jQuery( 'a.ajax-option-delete' ).on( 'click', function() { 204 204 var theId = this.id.split( '-' ); 205 205 theId = theId[1]; … … 213 213 function() {} ); 214 214 } ); 215 215 216 // Set up the sort order change actions 216 // Set up the sort order change actions. 217 217 jQuery( '[id^="sort_order_"]' ).change(function() { 218 218 if ( jQuery( this ).val() !== 'custom' ) { 219 219 destroySortableFieldOptions(); … … 222 222 } 223 223 }); 224 224 225 // Show object if JS is enabled 225 // Show object if JS is enabled. 226 226 jQuery( 'ul#field-group-tabs' ).show(); 227 227 228 // Allow reordering of field group tabs 228 // Allow reordering of field group tabs. 229 229 jQuery( 'ul#field-group-tabs' ).sortable( { 230 230 cursor: 'move', 231 231 axis: 'x', … … 244 244 } 245 245 }).disableSelection(); 246 246 247 // Allow reordering of fields within groups 247 // Allow reordering of fields within groups. 248 248 jQuery( 'fieldset.field-group' ).sortable({ 249 249 cursor: 'move', 250 250 opacity: 0.7, … … 263 263 } 264 264 }) 265 265 266 // Disallow text selection 266 // Disallow text selection. 267 267 .disableSelection(); 268 268 269 // Allow reordering of field options 269 // Allow reordering of field options. 270 270 enableSortableFieldOptions( jQuery('#fieldtype :selected').val() ); 271 271 272 // Handle title placeholder text the WordPress way 272 // Handle title placeholder text the WordPress way. 273 273 titleHint( 'title' ); 274 274 275 275 // On Date fields, selecting a date_format radio button should change the Custom value. … … 313 313 } ); 314 314 } ); 315 315 316 // tabs init with a custom tab template and an "add" callback filling in the content 316 // tabs init with a custom tab template and an "add" callback filling in the content. 317 317 var $tab_items, 318 318 $tabs = jQuery( '#tabs' ).tabs(); 319 319 … … 327 327 touch: 'pointer', 328 328 tolerance: 'pointer', 329 329 330 // When field is dropped on tab 330 // When field is dropped on tab. 331 331 drop: function( ev, ui ) { 332 332 var $item = jQuery(this), // The tab 333 333 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); // The tab body 334 334 335 // Remove helper class 335 // Remove helper class. 336 336 jQuery($item).removeClass( 'drop-candidate' ); 337 337 338 // Hide field, change selected tab, and show new placement 338 // Hide field, change selected tab, and show new placement. 339 339 ui.draggable.hide( 'slow', function() { 340 340 341 // Select new tab as current 341 // Select new tab as current. 342 342 $tabs.tabs( 'option', 'active', $tab_items.index( $item ) ); 343 343 344 // Show new placement 344 // Show new placement. 345 345 jQuery(this).appendTo($list).show( 'slow' ).animate( {opacity: '1'}, 500 ); 346 346 347 // Refresh $list variable 347 // Refresh $list variable. 348 348 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); 349 349 jQuery($list).find( 'p.nofields' ).hide( 'slow' ); 350 350 351 // Ajax update field locations and orders 351 // Ajax update field locations and orders. 352 352 jQuery.post( ajaxurl, { 353 353 action: 'xprofile_reorder_fields', 354 354 'cookie': encodeURIComponent(document.cookie), -
src/bp-xprofile/bp-xprofile-admin.php
45 45 ? sanitize_key( $_GET['mode'] ) 46 46 : false; 47 47 48 // Group ID 48 // Group ID. 49 49 $group_id = ! empty( $_GET['group_id'] ) 50 50 ? intval( $_GET['group_id'] ) 51 51 : false; 52 52 53 // Field ID 53 // Field ID. 54 54 $field_id = ! empty( $_GET['field_id'] ) 55 55 ? intval( $_GET['field_id'] ) 56 56 : false; 57 57 58 // Option ID 58 // Option ID. 59 59 $option_id = ! empty( $_GET['option_id'] ) 60 60 ? intval( $_GET['option_id'] ) 61 61 : false; 62 62 63 // Allowed modes 63 // Allowed modes. 64 64 $allowed_modes = array( 65 65 'add_group', 66 66 'edit_group', … … 71 71 'delete_option' 72 72 ); 73 73 74 // Is an allowed mode 74 // Is an allowed mode. 75 75 if ( in_array( $mode, $allowed_modes, true ) ) { 76 76 77 // All group actions 77 // All group actions. 78 78 if ( false !== $group_id ) { 79 79 80 // Add field to group 80 // Add field to group. 81 81 if ( 'add_field' == $mode ) { 82 82 xprofile_admin_manage_field( $group_id ); 83 83 84 // Edit field of group 84 // Edit field of group. 85 85 } elseif ( ! empty( $field_id ) && 'edit_field' === $mode ) { 86 86 xprofile_admin_manage_field( $group_id, $field_id ); 87 87 88 // Delete group 88 // Delete group. 89 89 } elseif ( 'delete_group' === $mode ) { 90 90 xprofile_admin_delete_group( $group_id ); 91 91 92 // Edit group 92 // Edit group. 93 93 } elseif ( 'edit_group' === $mode ) { 94 94 xprofile_admin_manage_group( $group_id ); 95 95 } 96 96 97 // Delete field 97 // Delete field. 98 98 } elseif ( ( false !== $field_id ) && ( 'delete_field' === $mode ) ) { 99 99 xprofile_admin_delete_field( $field_id, 'field'); 100 100 101 // Delete option 101 // Delete option. 102 102 } elseif ( ! empty( $option_id ) && 'delete_option' === $mode ) { 103 103 xprofile_admin_delete_field( $option_id, 'option' ); 104 104 105 // Add group 105 // Add group. 106 106 } elseif ( 'add_group' == $mode ) { 107 107 xprofile_admin_manage_group(); 108 108 } … … 124 124 */ 125 125 function xprofile_admin_screen( $message = '', $type = 'error' ) { 126 126 127 // Users admin URL 127 // Users admin URL. 128 128 $url = bp_get_admin_url( 'users.php' ); 129 129 130 // Add Group 130 // Add Group. 131 131 $add_group_url = add_query_arg( array( 132 132 'page' => 'bp-profile-setup', 133 133 'mode' => 'add_group' … … 200 200 201 201 <?php if ( !empty( $groups ) ) : foreach ( $groups as $group ) : 202 202 203 // Add Field to Group URL 203 // Add Field to Group URL. 204 204 $add_field_url = add_query_arg( array( 205 205 'page' => 'bp-profile-setup', 206 206 'mode' => 'add_field', … … 207 207 'group_id' => (int) $group->id 208 208 ), $url ); 209 209 210 // Edit Group URL 210 // Edit Group URL. 211 211 $edit_group_url = add_query_arg( array( 212 212 'page' => 'bp-profile-setup', 213 213 'mode' => 'edit_group', … … 214 214 'group_id' => (int) $group->id 215 215 ), $url ); 216 216 217 // Delete Group URL 217 // Delete Group URL. 218 218 $delete_group_url = wp_nonce_url( add_query_arg( array( 219 219 'page' => 'bp-profile-setup', 220 220 'mode' => 'delete_group', … … 340 340 // Updating. 341 341 if ( isset( $_POST['save_group'] ) ) { 342 342 343 // Check nonce 343 // Check nonce. 344 344 check_admin_referer( 'bp_xprofile_admin_group', 'bp_xprofile_admin_group' ); 345 345 346 346 // Validate $_POSTed data. … … 366 366 $message = __( 'The group was saved successfully.', 'buddypress' ); 367 367 $type = 'success'; 368 368 369 // @todo remove these old options 369 // @todo remove these old options. 370 370 if ( 1 == $group_id ) { 371 371 bp_update_option( 'bp-xprofile-base-group-name', $group->name ); 372 372 } … … 448 448 449 449 if ( isset( $_POST['saveField'] ) ) { 450 450 451 // Check nonce 451 // Check nonce. 452 452 check_admin_referer( 'bp_xprofile_admin_field', 'bp_xprofile_admin_field' ); 453 453 454 454 if ( BP_XProfile_Field::admin_validate() ) { … … 483 483 $message = __( 'The field was saved successfully.', 'buddypress' ); 484 484 $type = 'success'; 485 485 486 // @todo remove these old options 486 // @todo remove these old options. 487 487 if ( 1 == $field_id ) { 488 488 bp_update_option( 'bp-xprofile-fullname-field-name', $field->name ); 489 489 } … … 649 649 650 650 $field = $admin_field; 651 651 652 // Users admin URL 652 // Users admin URL. 653 653 $url = bp_get_admin_url( 'users.php' ); 654 654 655 // Edit 655 // Edit. 656 656 $field_edit_url = add_query_arg( array( 657 657 'page' => 'bp-profile-setup', 658 658 'mode' => 'edit_field', … … 660 660 'field_id' => (int) $field->id 661 661 ), $url ); 662 662 663 // Delete 663 // Delete. 664 664 if ( $field->can_delete ) { 665 665 $field_delete_url = add_query_arg( array( 666 666 'page' => 'bp-profile-setup', -
src/bp-xprofile/bp-xprofile-cache.php
180 180 * 181 181 * @since 2.1.0 182 182 * 183 * @param object $group_obj Grou bobject to clear.183 * @param object $group_obj Group object to clear. 184 184 */ 185 185 function xprofile_clear_profile_groups_object_cache( $group_obj ) { 186 186 wp_cache_delete( 'all', 'bp_xprofile_groups' ); -
src/bp-xprofile/bp-xprofile-filters.php
193 193 * 194 194 * @since 1.2.6 195 195 * 196 * @param string $field_value Field value being san tized.196 * @param string $field_value Field value being sanitized. 197 197 * @param int $field_id Field ID being sanitized. 198 198 * @param bool $reserialize Whether to reserialize arrays before returning. Defaults to true. 199 199 * @param object|null $data_obj The BP_XProfile_ProfileData object. … … 408 408 * 409 409 * Before splitting on the ";" character, decode the HTML entities, and re-encode after. 410 410 * This prevents input like "O'Hara" rendering as "O' Hara" (with each of those parts 411 * having a sep erate HTML link).411 * having a separate HTML link). 412 412 */ 413 413 $list_type = 'semicolon'; 414 414 $field_value = wp_specialchars_decode( $field_value, ENT_QUOTES );