Changeset 2389 for branches/0.9/bb-includes/template-functions.php
- Timestamp:
- 01/12/2010 10:54:40 PM (16 years ago)
- File:
-
- 1 edited
-
branches/0.9/bb-includes/template-functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9/bb-includes/template-functions.php
r1889 r2389 1488 1488 ) { 1489 1489 echo "\t<dt>{$label[1]}</dt>\n"; 1490 echo "\t<dd>" . make_clickable( $val ) . "</dd>\n"; 1490 1491 $val = make_clickable( $val ); 1492 if (isset($label[2]) && !empty($label[2])) 1493 if (preg_match("#^<a#i", $val)) 1494 $val = preg_replace("#^<a#i", '<a class="' . attribute_escape($label[2]) . '"', $val); 1495 else 1496 $val = '<span class="' . attribute_escape($label[2]) . '">' . $val . '</span>'; 1497 1498 echo "\t<dd>" . $val . "</dd>\n"; 1491 1499 } 1492 1500 } … … 1531 1539 $name = attribute_escape( $key ); 1532 1540 $type = isset($label[2]) ? attribute_escape( $label[2] ) : 'text'; 1541 $checked = false; 1533 1542 1534 1543 if ( in_array( $key, $error_codes ) ) { 1535 1544 $class .= ' form-invalid'; 1536 1545 $data = $errors->get_error_data( $key ); 1537 if ( isset($data['data']) ) 1538 $value = $data['data']; 1539 else 1540 $value = $_POST[$key]; 1546 1547 if ( 'checkbox' == $type ) { 1548 if ( isset($data['data']) ) 1549 $checked = $data['data']; 1550 else 1551 $checked = $_POST[$key]; 1552 $value = $label[3]; 1553 $checked = $checked == $value; 1554 } else { 1555 if ( isset($data['data']) ) 1556 $value = $data['data']; 1557 else 1558 $value = $_POST[$key]; 1559 } 1541 1560 1542 1561 $message = wp_specialchars( $errors->get_error_message( $key ) ); 1543 1562 $message = "<p class='error'>$message</p>"; 1544 1563 } else { 1545 $value = $user->$key; 1564 if ( 'checkbox' == $type ) { 1565 $checked = $user->$key == $label[3] || $label[4] == $label[3]; 1566 $value = $label[3]; 1567 } else { 1568 $value = isset($user->$key) ? $user->$key : ''; 1569 } 1546 1570 $message = ''; 1547 1571 } 1572 1573 $checked = $checked ? ' checked="checked"' : ''; 1548 1574 $value = attribute_escape( $value ); 1549 1575 … … 1553 1579 <th scope="row"><label for="<?php echo $name; ?>"><?php echo $title; ?></label></th> 1554 1580 <td> 1555 <input name="<?php echo $name; ?>" type="<?php echo $type; ?>" id="<?php echo $name; ?>" value="<?php echo $value; ?>" />1581 <input name="<?php echo $name; ?>" type="<?php echo $type; ?>" id="<?php echo $name; ?>" value="<?php echo $value; ?>"<?php echo $checked; ?> /> 1556 1582 <?php echo $message; ?> 1557 1583 </td>
Note: See TracChangeset
for help on using the changeset viewer.