Ticket #8776: 8776.diff
| File 8776.diff, 19.3 KB (added by , 17 years ago) |
|---|
-
wp-includes/author-template.php
80 80 } 81 81 82 82 /** 83 * Retrieve the description of the author of the current post.84 * 85 * @since 1.586 * @ uses $authordata The current author's DB object.87 * @return string The author's description.83 * Retrieve the requested data of the author of the current post. 84 * @link http://codex.wordpress.org/Template_Tags/the_author_meta 85 * @since 2.8.0 86 * @param string $field selects the field of the users record. 87 * @return string The author's field from the current author's DB object. 88 88 */ 89 function get_the_author_description() { 90 global $authordata; 91 return $authordata->description; 92 } 89 function get_the_author_meta($field = '', $user_id = false) { 90 if ( ! $user_id ) 91 global $authordata; 92 else 93 $authordata = get_userdata( $auth_id ); 94 var_dump($authordata); 95 $field = strtolower($field); 96 if ( 'id' == $field ) 97 $value = isset($authordata->ID) ? (int)$authordata->ID : 0; 98 else 99 $value = isset($authordata->$field) ? $authordata->$field : ''; 93 100 94 /** 95 * Display the description of the author of the current post. 96 * 97 * @link http://codex.wordpress.org/Template_Tags/the_author_description 98 * @since 1.0.0 99 * @see get_the_author_description() 100 */ 101 function the_author_description() { 102 echo get_the_author_description(); 101 return apply_filters('get_the_author_' . $field, $value); 103 102 } 104 103 105 104 /** 106 * Retrieve the login name of the author of the current post.107 * 108 * @since 1.5109 * @ uses $authordata The current author's DB object.110 * @ return string The author's login name (username).105 * Retrieve the requested data of the author of the current post. 106 * @link http://codex.wordpress.org/Template_Tags/the_author_meta 107 * @since 2.8.0 108 * @param string $field selects the field of the users record. 109 * @echo string The author's field from the current author's DB object. 111 110 */ 112 function get_the_author_login() { 113 global $authordata; 114 return $authordata->user_login; 111 function the_author_meta($field = '', $user_id = false) { 112 echo apply_filters('the_author_' . $field, get_the_author_meta($field, $user_id)); 115 113 } 116 114 117 115 /** 118 * Display the login name of the author of the current post.119 *120 * @link http://codex.wordpress.org/Template_Tags/the_author_login121 * @since 0.71122 * @see get_the_author_login()123 */124 function the_author_login() {125 echo get_the_author_login();126 }127 128 /**129 * Retrieve the first name of the author of the current post.130 *131 * @since 1.5132 * @uses $authordata The current author's DB object.133 * @return string The author's first name.134 */135 function get_the_author_firstname() {136 global $authordata;137 return $authordata->first_name;138 }139 140 /**141 * Display the first name of the author of the current post.142 *143 * @link http://codex.wordpress.org/Template_Tags/the_author_firstname144 * @since 0.71145 * @uses get_the_author_firstname()146 */147 function the_author_firstname() {148 echo get_the_author_firstname();149 }150 151 /**152 * Retrieve the last name of the author of the current post.153 *154 * @since 1.5155 * @uses $authordata The current author's DB object.156 * @return string The author's last name.157 */158 function get_the_author_lastname() {159 global $authordata;160 return $authordata->last_name;161 }162 163 /**164 * Display the last name of the author of the current post.165 *166 * @link http://codex.wordpress.org/Template_Tags/the_author_lastname167 * @since 0.71168 * @uses get_the_author_lastname()169 */170 function the_author_lastname() {171 echo get_the_author_lastname();172 }173 174 /**175 * Retrieve the nickname of the author of the current post.176 *177 * @since 1.5178 * @uses $authordata The current author's DB object.179 * @return string The author's nickname.180 */181 function get_the_author_nickname() {182 global $authordata;183 return $authordata->nickname;184 }185 186 /**187 * Display the nickname of the author of the current post.188 *189 * @link http://codex.wordpress.org/Template_Tags/the_author_nickname190 * @since 0.71191 * @uses get_the_author_nickname()192 */193 function the_author_nickname() {194 echo get_the_author_nickname();195 }196 197 /**198 * Retrieve the ID of the author of the current post.199 *200 * @since 1.5201 * @uses $authordata The current author's DB object.202 * @return int The author's ID.203 */204 function get_the_author_ID() {205 global $authordata;206 return (int) $authordata->ID;207 }208 209 /**210 * Display the ID of the author of the current post.211 *212 * @link http://codex.wordpress.org/Template_Tags/the_author_ID213 * @since 0.71214 * @uses get_the_author_ID()215 */216 function the_author_ID() {217 echo get_the_author_id();218 }219 220 /**221 * Retrieve the email of the author of the current post.222 *223 * @since 1.5224 * @uses $authordata The current author's DB object.225 * @return string The author's username.226 */227 function get_the_author_email() {228 global $authordata;229 return $authordata->user_email;230 }231 232 /**233 * Display the email of the author of the current post.234 *235 * @link http://codex.wordpress.org/Template_Tags/the_author_email236 * @since 0.71237 * @uses get_the_author_email()238 */239 function the_author_email() {240 echo apply_filters('the_author_email', get_the_author_email() );241 }242 243 /**244 * Retrieve the URL to the home page of the author of the current post.245 *246 * @since 1.5247 * @uses $authordata The current author's DB object.248 * @return string The URL to the author's page.249 */250 function get_the_author_url() {251 global $authordata;252 253 if ( 'http://' == $authordata->user_url )254 return '';255 256 return $authordata->user_url;257 }258 259 /**260 * Display the URL to the home page of the author of the current post.261 *262 * @link http://codex.wordpress.org/Template_Tags/the_author_url263 * @since 0.71264 * @uses get_the_author_url()265 */266 function the_author_url() {267 echo get_the_author_url();268 }269 270 /**271 116 * Display either author's link or author's name. 272 117 * 273 118 * If the author has a home page set, echo an HTML link, otherwise just echo the … … 287 132 } 288 133 289 134 /** 290 * Retrieve the ICQ number of the author of the current post.291 *292 * @since 1.5293 * @uses $authordata The current author's DB object.294 * @return string The author's ICQ number.295 */296 function get_the_author_icq() {297 global $authordata;298 return $authordata->icq;299 }300 301 /**302 * Display the ICQ number of the author of the current post.303 *304 * @link http://codex.wordpress.org/Template_Tags/the_author_icq305 * @since 0.71306 * @see get_the_author_icq()307 */308 function the_author_icq() {309 echo get_the_author_icq();310 }311 312 /**313 * Retrieve the AIM name of the author of the current post.314 *315 * @since 1.5316 * @uses $authordata The current author's DB object.317 * @return string The author's AIM name.318 */319 function get_the_author_aim() {320 global $authordata;321 return str_replace(' ', '+', $authordata->aim);322 }323 324 /**325 * Display the AIM name of the author of the current post.326 *327 * @link http://codex.wordpress.org/Template_Tags/the_author_aim328 * @since 0.71329 * @see get_the_author_aim()330 */331 function the_author_aim() {332 echo get_the_author_aim();333 }334 335 /**336 * Retrieve the Yahoo! IM name of the author of the current post.337 *338 * @since 1.5339 * @uses $authordata The current author's DB object.340 * @return string The author's Yahoo! IM name.341 */342 function get_the_author_yim() {343 global $authordata;344 return $authordata->yim;345 }346 347 /**348 * Display the Yahoo! IM name of the author of the current post.349 *350 * @link http://codex.wordpress.org/Template_Tags/the_author_yim351 * @since 0.71352 * @see get_the_author_yim()353 */354 function the_author_yim() {355 echo get_the_author_yim();356 }357 358 /**359 * Retrieve the MSN address of the author of the current post.360 *361 * @since 1.5362 * @uses $authordata The current author's DB object.363 * @return string The author's MSN address.364 */365 function get_the_author_msn() {366 global $authordata;367 return $authordata->msn;368 }369 370 /**371 * Display the MSN address of the author of the current post.372 *373 * @link http://codex.wordpress.org/Template_Tags/the_author_msn374 * @since 0.71375 * @see get_the_author_msn()376 */377 function the_author_msn() {378 echo get_the_author_msn();379 }380 381 /**382 135 * Retrieve the number of posts by the author of the current post. 383 136 * 384 137 * @since 1.5 … … 457 210 } 458 211 459 212 /** 460 * Retrieve the specified author's preferred display name.461 *462 * @since 1.0.0463 * @param int $auth_id The ID of the author.464 * @return string The author's display name.465 */466 function get_author_name( $auth_id ) {467 $authordata = get_userdata( $auth_id );468 return $authordata->display_name;469 }470 471 /**472 213 * List all the authors of the blog, with several options available. 473 214 * 474 215 * <ul> -
wp-includes/default-filters.php
97 97 add_filter($filter, 'convert_chars'); 98 98 } 99 99 100 //Author Data Filters 101 add_filter('get_the_author_user_url', '_filter_empty_url'); 102 add_filter('get_the_author_aim', 'urlencode'); 103 100 104 // Display filters 101 105 add_filter('the_title', 'wptexturize'); 102 106 add_filter('the_title', 'convert_chars'); -
wp-includes/deprecated.php
1353 1353 return $chain; 1354 1354 } 1355 1355 1356 /** 1357 * Retrieve the description of the author of the current post. 1358 * 1359 * @since 1.5 1360 * @deprecated 2.8 1361 * @uses $authordata The current author's DB object. 1362 * @return string The author's description. 1363 * @deprecated Use the_author_meta('description') 1364 */ 1365 function get_the_author_description() { 1366 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' ); 1367 return get_the_author_meta('description'); 1368 } 1369 1370 /** 1371 * Display the description of the author of the current post. 1372 * 1373 * @link http://codex.wordpress.org/Template_Tags/the_author_description 1374 * @since 1.0.0 1375 * @deprecated 2.8 1376 * @deprecated Use the_author_meta('description') 1377 */ 1378 function the_author_description() { 1379 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'description\')' ); 1380 the_author_meta('description'); 1381 } 1382 1383 /** 1384 * Retrieve the login name of the author of the current post. 1385 * 1386 * @since 1.5 1387 * @deprecated 2.8 1388 * @uses $authordata The current author's DB object. 1389 * @return string The author's login name (username). 1390 * @deprecated Use the_author_meta('user_login') 1391 */ 1392 function get_the_author_login() { 1393 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'user_login\')' ); 1394 return get_the_author_meta('user_login'); 1395 } 1396 1397 /** 1398 * Display the login name of the author of the current post. 1399 * 1400 * @link http://codex.wordpress.org/Template_Tags/the_author_login 1401 * @since 0.71 1402 * @deprecated 2.8 1403 * @deprecated Use the_author_meta('user_login') 1404 */ 1405 function the_author_login() { 1406 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'user_login\')' ); 1407 the_author_meta('user_login'); 1408 } 1409 1410 /** 1411 * Retrieve the first name of the author of the current post. 1412 * 1413 * @since 1.5 1414 * @deprecated 2.8 1415 * @uses $authordata The current author's DB object. 1416 * @return string The author's first name. 1417 * @deprecated Use the_author_meta('first_name') 1418 */ 1419 function get_the_author_firstname() { 1420 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' ); 1421 return get_the_author_meta('first_name'); 1422 } 1423 1424 /** 1425 * Display the first name of the author of the current post. 1426 * 1427 * @link http://codex.wordpress.org/Template_Tags/the_author_firstname 1428 * @since 0.71 1429 * @deprecated 2.8 1430 * @deprecated Use the_author_meta('first_name') 1431 */ 1432 function the_author_firstname() { 1433 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' ); 1434 the_author_meta('first_name'); 1435 } 1436 1437 /** 1438 * Retrieve the last name of the author of the current post. 1439 * 1440 * @since 1.5 1441 * @deprecated 2.8 1442 * @uses $authordata The current author's DB object. 1443 * @return string The author's last name. 1444 * @deprecated Use the_author_meta('last_name') 1445 */ 1446 function get_the_author_lastname() { 1447 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' ); 1448 return get_the_author_meta('last_name'); 1449 } 1450 1451 /** 1452 * Display the last name of the author of the current post. 1453 * 1454 * @link http://codex.wordpress.org/Template_Tags/the_author_lastname 1455 * @since 0.71 1456 * @deprecated 2.8 1457 * @deprecated Use the_author_meta('last_name') 1458 */ 1459 function the_author_lastname() { 1460 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' ); 1461 the_author_meta('last_name'); 1462 } 1463 1464 /** 1465 * Retrieve the nickname of the author of the current post. 1466 * 1467 * @since 1.5 1468 * @deprecated 2.8 1469 * @uses $authordata The current author's DB object. 1470 * @return string The author's nickname. 1471 * @deprecated Use the_author_meta('nickname') 1472 */ 1473 function get_the_author_nickname() { 1474 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' ); 1475 return get_the_author_meta('nickname'); 1476 } 1477 1478 /** 1479 * Display the nickname of the author of the current post. 1480 * 1481 * @link http://codex.wordpress.org/Template_Tags/the_author_nickname 1482 * @since 0.71 1483 * @deprecated 2.8 1484 * @deprecated Use the_author_meta('nickname') 1485 */ 1486 function the_author_nickname() { 1487 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' ); 1488 the_author_meta('nickname'); 1489 } 1490 1491 /** 1492 * Retrieve the email of the author of the current post. 1493 * 1494 * @since 1.5 1495 * @deprecated 2.8 1496 * @uses $authordata The current author's DB object. 1497 * @return string The author's username. 1498 * @deprecated Use the_author_meta('user_email') 1499 */ 1500 function get_the_author_email() { 1501 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'user_email\')' ); 1502 return get_the_author_meta('user_email'); 1503 } 1504 1505 /** 1506 * Display the email of the author of the current post. 1507 * 1508 * @link http://codex.wordpress.org/Template_Tags/the_author_email 1509 * @since 0.71 1510 * @deprecated 2.8 1511 * @deprecated Use the_author_meta('user_email') 1512 */ 1513 function the_author_email() { 1514 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'user_email\')' ); 1515 the_author_meta('user_email'); 1516 } 1517 1518 /** 1519 * Retrieve the ICQ number of the author of the current post. 1520 * 1521 * @since 1.5 1522 * @deprecated 2.8 1523 * @uses $authordata The current author's DB object. 1524 * @return string The author's ICQ number. 1525 * @deprecated Use the_author_meta('icq') 1526 */ 1527 function get_the_author_icq() { 1528 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' ); 1529 return get_the_author_meta('icq'); 1530 } 1531 1532 /** 1533 * Display the ICQ number of the author of the current post. 1534 * 1535 * @link http://codex.wordpress.org/Template_Tags/the_author_icq 1536 * @since 0.71 1537 * @deprecated 2.8 1538 * @see get_the_author_icq() 1539 * @deprecated Use the_author_meta('icq') 1540 */ 1541 function the_author_icq() { 1542 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'icq\')' ); 1543 the_author_meta('icq'); 1544 } 1545 1546 /** 1547 * Retrieve the Yahoo! IM name of the author of the current post. 1548 * 1549 * @since 1.5 1550 * @deprecated 2.8 1551 * @uses $authordata The current author's DB object. 1552 * @return string The author's Yahoo! IM name. 1553 * @deprecated Use the_author_meta('yim') 1554 */ 1555 function get_the_author_yim() { 1556 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' ); 1557 return get_the_author_meta('yim'); 1558 } 1559 1560 /** 1561 * Display the Yahoo! IM name of the author of the current post. 1562 * 1563 * @link http://codex.wordpress.org/Template_Tags/the_author_yim 1564 * @since 0.71 1565 * @deprecated 2.8 1566 * @deprecated Use the_author_meta('yim') 1567 */ 1568 function the_author_yim() { 1569 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'yim\')' ); 1570 the_author_meta('yim'); 1571 } 1572 1573 /** 1574 * Retrieve the MSN address of the author of the current post. 1575 * 1576 * @since 1.5 1577 * @deprecated 2.8 1578 * @uses $authordata The current author's DB object. 1579 * @return string The author's MSN address. 1580 * @deprecated Use the_author_meta('msn') 1581 */ 1582 function get_the_author_msn() { 1583 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' ); 1584 return get_the_author_meta('msn'); 1585 } 1586 1587 /** 1588 * Display the MSN address of the author of the current post. 1589 * 1590 * @link http://codex.wordpress.org/Template_Tags/the_author_msn 1591 * @since 0.71 1592 * @deprecated 2.8 1593 * @see get_the_author_msn() 1594 * @deprecated Use the_author_meta('msn') 1595 */ 1596 function the_author_msn() { 1597 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'msn\')' ); 1598 the_author_meta('msn'); 1599 } 1600 1601 /** 1602 * Retrieve the specified author's preferred display name. 1603 * 1604 * @since 1.0.0 1605 * @deprecated 2.8 1606 * @param int $auth_id The ID of the author. 1607 * @return string The author's display name. 1608 * @deprecated Use the_author_meta('display_name') 1609 */ 1610 function get_author_name( $auth_id = false ) { 1611 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' ); 1612 return get_the_author_meta('display_name', $auth_id); 1613 } 1614 1615 /** 1616 * Retrieve the URL to the home page of the author of the current post. 1617 * 1618 * @since 1.5 1619 * @deprecated 2.8 1620 * @uses $authordata The current author's DB object. 1621 * @return string The URL to the author's page. 1622 */ 1623 function get_the_author_url() { 1624 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'user_url\')' ); 1625 return get_the_author_meta('user_url'); 1626 } 1627 1628 /** 1629 * Display the URL to the home page of the author of the current post. 1630 * 1631 * @link http://codex.wordpress.org/Template_Tags/the_author_url 1632 * @since 0.71 1633 * @deprecated 2.8 1634 */ 1635 function the_author_url() { 1636 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'user_url\')' ); 1637 the_author_meta('user_url'); 1638 } 1639 1640 /** 1641 * Retrieve the ID of the author of the current post. 1642 * 1643 * @since 1.5 1644 * @deprecated 2.8 1645 * @return int The author's ID. 1646 */ 1647 function get_the_author_ID() { 1648 _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' ); 1649 return get_the_author_meta('ID'); 1650 } 1651 1652 /** 1653 * Display the ID of the author of the current post. 1654 * 1655 * @link http://codex.wordpress.org/Template_Tags/the_author_ID 1656 * @since 0.71 1657 * @deprecated 2.8 1658 * @uses get_the_author_ID() 1659 */ 1660 function the_author_ID() { 1661 _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'user_url\')' ); 1662 the_author_meta('ID'); 1663 } 1664 1356 1665 ?> 1666 No newline at end of file -
wp-includes/functions.php
3144 3145 return $structure; 3145 3146 } 3146 3147 3148 /** 3149 * Filters links to return an empty string if only http:// is present. 3150 * 3151 * @since 2.8.0 3152 * @param string $link The input link 3153 * @return string empty string, or link depending on input. 3154 */ 3155 function _filter_empty_url($link) { 3156 return 'http://' == $link ? '' : $link; 3157 } 3147 3158 3148 3159 ?>