Changeset 6379
- Timestamp:
- 12/14/2007 12:28:34 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r6377 r6379 1 1 <?php 2 3 // 4 // Post functions 5 // 6 2 /** 3 * Post functions and post utility function 4 * 5 * @package WordPress 6 * @subpackage Post 7 * @since 1.5 8 */ 9 10 /** 11 * get_attached_file() - Get metadata for an attached file 12 * 13 * {@internal Missing Long Description}} 14 * 15 * @package WordPress 16 * @subpackage Post 17 * @since 2.0 18 * 19 * @param int $attachment_id Attachment ID 20 * @param bool $unfiltered Whether to apply filters or not 21 * @return array {@internal Missing Description}} 22 */ 7 23 function get_attached_file( $attachment_id, $unfiltered = false ) { 8 24 $file = get_post_meta( $attachment_id, '_wp_attached_file', true ); … … 12 28 } 13 29 30 /** 31 * update_attached_file() - Update attached file metadata 32 * 33 * {@internal Missing Long Description}} 34 * 35 * @package WordPress 36 * @subpackage Post 37 * @since 2.1 38 * 39 * @param int $attachment_id Attachment ID 40 * @param string $file {@internal Missing Description}} 41 * @return bool|mixed {@internal Missing Description}} 42 */ 14 43 function update_attached_file( $attachment_id, $file ) { 15 44 if ( !get_post( $attachment_id ) ) … … 26 55 } 27 56 57 /** 58 * get_children() - Get post children 59 * 60 * {@internal Missing Long Description}} 61 * 62 * @package WordPress 63 * @subpackage Post 64 * @since 2.0 65 * 66 * @param mixed $args {@internal Missing Description}} 67 * @param string $output {@internal Missing Description}} 68 * @return mixed {@internal Missing Description}} 69 */ 28 70 function &get_children($args = '', $output = OBJECT) { 29 71 if ( empty( $args ) ) { … … 71 113 } 72 114 73 // get extended entry info (<!--more-->) 115 /** 116 * get_extended() - get extended entry info (<!--more-->) 117 * 118 * {@internal Missing Long Description}} 119 * 120 * @package WordPress 121 * @subpackage Post 122 * @since 1.0.1 123 * 124 * @param string $post {@internal Missing Description}} 125 * @return array {@internal Missing Description}} 126 */ 74 127 function get_extended($post) { 75 128 //Match the new style more links … … 88 141 } 89 142 90 // Retrieves post data given a post ID or post object. 91 // Handles post caching. 143 /** 144 * get_post() - Retrieves post data given a post ID or post object. 145 * 146 * {@internal Missing Long Description}} 147 * 148 * @package WordPress 149 * @subpackage Post 150 * @since 1.5.1 151 * @uses $wpdb 152 * 153 * @param int|object &$post post ID or post object 154 * @param string $output {@internal Missing Description}} 155 * @param string $filter {@internal Missing Description}} 156 * @return mixed {@internal Missing Description}} 157 */ 92 158 function &get_post(&$post, $output = OBJECT, $filter = 'raw') { 93 159 global $wpdb; … … 122 188 } 123 189 190 /** 191 * get_post_field() - Retrieve a field based on a post ID. 192 * 193 * @package WordPress 194 * @subpackage Post 195 * @since 2.3 196 * 197 * @param string $field {@internal Missing Description}} 198 * @param id $post Post ID 199 * @param string $context Optional. How to filter the field 200 * @return WP_Error|string Value in post field or WP_Error on failure 201 */ 124 202 function get_post_field( $field, $post, $context = 'display' ) { 125 203 $post = (int) $post; … … 138 216 } 139 217 140 // Takes a post ID, returns its mime type. 218 /** 219 * get_post_mime_type() - Takes a post ID, returns its mime type. 220 * 221 * @package WordPress 222 * @subpackage Post 223 * @since 2.0 224 * 225 * @param int $ID Post ID 226 * @return bool|string False on failure or returns the mime type 227 */ 141 228 function get_post_mime_type($ID = '') { 142 229 $post = & get_post($ID); … … 148 235 } 149 236 237 /** 238 * get_post_status() - Takes a post ID and returns its status 239 * 240 * {@internal Missing Long Description}} 241 * 242 * @package WordPress 243 * @subpackage Post 244 * @since 2.0 245 * 246 * @param int $ID {@internal Missing Description}} 247 * @return string|bool post status or false 248 */ 150 249 function get_post_status($ID = '') { 151 250 $post = get_post($ID); … … 161 260 } 162 261 262 /** 263 * get_post_type() - Returns post type 264 * 265 * {@internal Missing Long Description}} 266 * 267 * @package WordPress 268 * @subpackage Post 269 * @since 2.1 270 * 271 * @uses $wpdb 272 * @uses $posts {@internal Missing Description}} 273 * 274 * @param mixed $post post object or post ID 275 * @return mixed post type or false 276 */ 163 277 function get_post_type($post = false) { 164 278 global $posts; … … 175 289 } 176 290 291 /** 292 * get_posts() - Returns a number of posts 293 * 294 * {@internal Missing Long Description}} 295 * 296 * @package WordPress 297 * @subpackage Post 298 * @since 1.2 299 * @uses $wpdb 300 * 301 * @param array $args {@internal Missing Description}} 302 * @return array {@internal Missing Description}} 303 */ 177 304 function get_posts($args) { 178 305 global $wpdb; … … 258 385 // 259 386 387 /** 388 * add_post_meta() - adds metadata for post 389 * 390 * {@internal Missing Long Description}} 391 * 392 * @package WordPress 393 * @subpackage Post 394 * @since 1.5 395 * @uses $wpdb 396 * 397 * @param int $post_id post ID 398 * @param string $key {@internal Missing Description}} 399 * @param mixed $value {@internal Missing Description}} 400 * @param bool $unique whether to check for a value with the same key 401 * @return bool {@internal Missing Description}} 402 */ 260 403 function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) { 261 404 global $wpdb; … … 281 424 } 282 425 426 /** 427 * delete_post_meta() - delete post metadata 428 * 429 * {@internal Missing Long Description}} 430 * 431 * @package WordPress 432 * @subpackage Post 433 * @since 1.5 434 * @uses $wpdb 435 * 436 * @param int $post_id post ID 437 * @param string $key {@internal Missing Description}} 438 * @param mixed $value {@internal Missing Description}} 439 * @return bool {@internal Missing Description}} 440 */ 283 441 function delete_post_meta($post_id, $key, $value = '') { 284 442 global $wpdb; … … 308 466 } 309 467 468 /** 469 * get_post_meta() - Get a post meta field 470 * 471 * {@internal Missing Long Description}} 472 * 473 * @package WordPress 474 * @subpackage Post 475 * @since 1.5 476 * @uses $wpdb 477 * 478 * @param int $post_id post ID 479 * @param string $key The meta key to retrieve 480 * @param bool $single Whether to return a single value 481 * @return mixed {@internal Missing Description}} 482 */ 310 483 function get_post_meta($post_id, $key, $single = false) { 311 484 $post_id = (int) $post_id; … … 336 509 } 337 510 511 /** 512 * update_post_meta() - Update a post meta field 513 * 514 * {@internal Missing Long Description}} 515 * 516 * @package WordPress 517 * @subpackage Post 518 * @since 1.5 519 * @uses $wpdb 520 * 521 * @param int $post_id post ID 522 * @param string $key {@internal Missing Description}} 523 * @param mixed $value {@internal Missing Description}} 524 * @param mixed $prev_value previous value (for differentiating between meta fields with the same key and post ID) 525 * @return bool {@internal Missing Description}} 526 */ 338 527 function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') { 339 528 global $wpdb; … … 359 548 } 360 549 361 550 /** 551 * delete_post_meta_by_key() - Delete everything from post meta matching $post_meta_key 552 * 553 * @package WordPress 554 * @subpackage Post 555 * @since 2.3 556 * @uses $wpdb 557 * 558 * @param string $post_meta_key What to search for when deleting 559 * @return bool Whether the post meta key was deleted from the database 560 */ 362 561 function delete_post_meta_by_key($post_meta_key) { 363 562 global $wpdb; 364 563 if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) { 365 / / TODO Get post_ids and delete cache564 /** @todo Get post_ids and delete cache */ 366 565 // wp_cache_delete($post_id, 'post_meta'); 367 566 return true; … … 370 569 } 371 570 372 571 /** 572 * get_post_custom() - Retrieve post custom fields 573 * 574 * {@internal Missing Long Description}} 575 * 576 * @package WordPress 577 * @subpackage Post 578 * @since 1.2 579 * 580 * @uses $id 581 * @uses $wpdb 582 * 583 * @param int $post_id post ID 584 * @return array {@internal Missing Description}} 585 */ 373 586 function get_post_custom($post_id = 0) { 374 587 global $id; … … 385 598 } 386 599 600 /** 601 * get_post_custom_keys() - Retrieve post custom field names 602 * 603 * @package WordPress 604 * @subpackage Post 605 * @since 1.2 606 * 607 * @param int $post_id post ID 608 * @return array|null Either array of the keys, or null if keys would not be retrieved 609 */ 387 610 function get_post_custom_keys( $post_id = 0 ) { 388 611 $custom = get_post_custom( $post_id ); … … 424 647 } 425 648 649 /** 650 * sanitize_post_field() - Sanitize post field based on context 651 * 652 * {@internal Missing Long Description}} 653 * 654 * @package WordPress 655 * @subpackage Post 656 * @since 2.3 657 * 658 * @param string $field The Post Object field name 659 * @param string $value The Post Object value 660 * @param int $postid Post ID 661 * @param string $context How to sanitize post fields 662 * @return string Sanitized value 663 */ 426 664 function sanitize_post_field($field, $value, $post_id, $context) { 427 665 $int_fields = array('ID', 'post_parent', 'menu_order'); … … 481 719 } 482 720 721 /** 722 * wp_delete_post() - Deletes a Post 723 * 724 * {@internal Missing Long Description}} 725 * 726 * @package WordPress 727 * @subpackage Post 728 * @since 1.0.1 729 * 730 * @param int $postid post ID 731 * @return mixed {@internal Missing Description}} 732 */ 483 733 function wp_delete_post($postid = 0) { 484 734 global $wpdb, $wp_rewrite; … … 492 742 do_action('delete_post', $postid); 493 743 494 / / TODO delete for pluggable post taxonomies too744 /** @todo delete for pluggable post taxonomies too */ 495 745 wp_delete_object_term_relationships($postid, array('category', 'post_tag')); 496 746 … … 534 784 } 535 785 786 /** 787 * wp_get_post_categories() - Retrieve the list of categories for a post 788 * 789 * Compatibility layer for themes and plugins. Also an easy layer of abstraction 790 * away from the complexity of the taxonomy layer. 791 * 792 * @package WordPress 793 * @subpackage Post 794 * @since 2.1 795 * 796 * @uses wp_get_object_terms() Retrieves the categories. Args details can be found here 797 * 798 * @param int $post_id Optional. The Post ID 799 * @param array $args Optional. Overwrite the defaults 800 * @return array {@internal Missing Description}} 801 */ 536 802 function wp_get_post_categories( $post_id = 0, $args = array() ) { 537 803 $post_id = (int) $post_id; … … 544 810 } 545 811 812 /** 813 * wp_get_post_tags() - Retrieve the post tags 814 * 815 * @package WordPress 816 * @subpackage Post 817 * @since 2.3 818 * 819 * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here 820 * 821 * @param int $post_id Optional. The Post ID 822 * @param array $args Optional. Overwrite the defaults 823 * @return mixed The tags the post has currently 824 */ 546 825 function wp_get_post_tags( $post_id = 0, $args = array() ) { 547 826 $post_id = (int) $post_id; … … 555 834 } 556 835 836 /** 837 * wp_get_recent_posts() - Get the $num most recent posts 838 * 839 * {@internal Missing Long Description}} 840 * 841 * @package WordPress 842 * @subpackage Post 843 * @since 1.0.1 844 * 845 * @param int $num number of posts to get 846 * @return array {@internal Missing Description}} 847 */ 557 848 function wp_get_recent_posts($num = 10) { 558 849 global $wpdb; … … 570 861 } 571 862 863 /** 864 * wp_get_single_post() - Get one post 865 * 866 * {@internal Missing Long Description}} 867 * 868 * @package WordPress 869 * @subpackage Post 870 * @since 1.0.1 871 * @uses $wpdb 872 * 873 * @param int $postid post ID 874 * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A 875 * @return object|array Post object or array holding post contents and information 876 */ 572 877 function wp_get_single_post($postid = 0, $mode = OBJECT) { 573 878 $postid = (int) $postid; … … 588 893 } 589 894 895 /** 896 * wp_insert_post() - Insert a post 897 * 898 * {@internal Missing Long Description}} 899 * 900 * @package WordPress 901 * @subpackage Post 902 * @since 1.0.1 903 * 904 * @uses $wpdb 905 * @uses $wp_rewrite 906 * @uses $user_ID 907 * @uses $allowedtags 908 * 909 * @param array $postarr post contents 910 * @return int post ID or 0 on error 911 */ 590 912 function wp_insert_post($postarr = array()) { 591 913 global $wpdb, $wp_rewrite, $user_ID; … … 759 1081 } 760 1082 1083 /** 1084 * wp_update_post() - Update a post 1085 * 1086 * {@internal Missing Long Description}} 1087 * 1088 * @package WordPress 1089 * @subpackage Post 1090 * @since 1.0.1 1091 * @uses $wpdb 1092 * 1093 * @param array $postarr post data 1094 * @return int {@internal Missing Description}} 1095 */ 761 1096 function wp_update_post($postarr = array()) { 762 1097 if ( is_object($postarr) ) … … 797 1132 } 798 1133 1134 /** 1135 * wp_publish_post() - Mark a post as "published" 1136 * 1137 * {@internal Missing Long Description}} 1138 * 1139 * @package WordPress 1140 * @subpackage Post 1141 * @since 2.1 1142 * @uses $wpdb 1143 * 1144 * @param int $post_id Post ID 1145 * @return int|null {@internal Missing Description}} 1146 */ 799 1147 function wp_publish_post($post_id) { 800 1148 global $wpdb; … … 837 1185 } 838 1186 1187 /** 1188 * wp_set_post_categories() - Set categories for a post 1189 * 1190 * {@internal Missing Long Description}} 1191 * 1192 * @package WordPress 1193 * @subpackage Post 1194 * @since 2.1 1195 * @uses $wpdb 1196 * 1197 * @param int $post_ID post ID 1198 * @param array $post_categories 1199 * @return bool|mixed {@internal Missing Description}} 1200 */ 839 1201 function wp_set_post_categories($post_ID = 0, $post_categories = array()) { 840 1202 $post_ID = (int) $post_ID; … … 851 1213 } // wp_set_post_categories() 852 1214 1215 /** 1216 * wp_transition_post_status() - Change the post transition status 1217 * 1218 * {@internal Missing Long Description}} 1219 * 1220 * @package WordPress 1221 * @subpackage Post 1222 * @since 2.3 1223 * 1224 * @param string $new_status {@internal Missing Description}} 1225 * @param string $old_status {@internal Missing Description}} 1226 * @param int $post {@internal Missing Description}} 1227 */ 853 1228 function wp_transition_post_status($new_status, $old_status, $post) { 854 1229 if ( $new_status != $old_status ) { … … 863 1238 // 864 1239 865 function add_ping($post_id, $uri) { // Add a URL to those already pung 1240 /** 1241 * add_ping() - Add a URL to those already pung 1242 * 1243 * {@internal Missing Long Description}} 1244 * 1245 * @package WordPress 1246 * @subpackage Post 1247 * @since 1.5 1248 * @uses $wpdb 1249 * 1250 * @param int $post_id post ID 1251 * @param string $uri {@internal Missing Description}} 1252 * @return mixed {@internal Missing Description}} 1253 */ 1254 function add_ping($post_id, $uri) { 866 1255 global $wpdb; 867 1256 $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); … … 894 1283 } 895 1284 896 function get_pung($post_id) { // Get URLs already pung for a post 1285 /** 1286 * get_pung() - Get URLs already pinged for a post 1287 * 1288 * {@internal Missing Long Description}} 1289 * 1290 * @package WordPress 1291 * @subpackage Post 1292 * @since 1.5 1293 * @uses $wpdb 1294 * 1295 * @param int $post_id post ID 1296 * @return array {@internal Missing Description}} 1297 */ 1298 function get_pung($post_id) { 897 1299 global $wpdb; 898 1300 $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); … … 903 1305 } 904 1306 905 function get_to_ping($post_id) { // Get any URLs in the todo list 1307 /** 1308 * get_to_ping() - Get any URLs in the todo list 1309 * 1310 * {@internal Missing Long Description}} 1311 * 1312 * @package WordPress 1313 * @subpackage Post 1314 * @since 1.5 1315 * @uses $wpdb 1316 * 1317 * @param int $post_id post ID 1318 * @return array {@internal Missing Description}} 1319 */ 1320 function get_to_ping($post_id) { 906 1321 global $wpdb; 907 1322 $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id )); … … 912 1327 } 913 1328 914 // do trackbacks for a list of urls 915 // accepts a comma-separated list of trackback urls and a post id 1329 /** 1330 * trackback_url_list() - Do trackbacks for a list of urls 1331 * 1332 * {@internal Missing Long Description}} 1333 * 1334 * @package WordPress 1335 * @subpackage Post 1336 * @since 1.0.1 1337 * 1338 * @param string $tb_list comma separated list of URLs 1339 * @param int $post_id post ID 1340 */ 916 1341 function trackback_url_list($tb_list, $post_id) { 917 1342 if (!empty($tb_list)) { … … 941 1366 // 942 1367 1368 /** 1369 * get_all_page_ids() - Get a list of page IDs 1370 * 1371 * {@internal Missing Long Description}} 1372 * 1373 * @package WordPress 1374 * @subpackage Post 1375 * @since 2.0 1376 * @uses $wpdb 1377 * 1378 * @return array {@internal Missing Description}} 1379 */ 943 1380 function get_all_page_ids() { 944 1381 global $wpdb; … … 952 1389 } 953 1390 954 955 // Retrieves page data given a page ID or page object. 956 // Handles page caching. 1391 /** 1392 * get_page() - Retrieves page data given a page ID or page object 1393 * 1394 * {@internal Missing Long Description}} 1395 * 1396 * @package WordPress 1397 * @subpackage Post 1398 * @since 1.5.1 1399 * 1400 * @param mixed &$page page object or page ID 1401 * @param string $output what to output 1402 * @param string $filter How the return value should be filtered. 1403 * @return mixed {@internal Missing Description}} 1404 */ 957 1405 function &get_page(&$page, $output = OBJECT, $filter = 'raw') { 958 1406 if ( empty($page) ) { … … 966 1414 } 967 1415 1416 /** 1417 * get_page_by_path() - Retrieves a page given its path 1418 * 1419 * {@internal Missing Long Description}} 1420 * 1421 * @package WordPress 1422 * @subpackage Post 1423 * @since 2.1 1424 * @uses $wpdb 1425 * 1426 * @param string $page_path page path 1427 * @param string $output output type 1428 * @return mixed {@internal Missing Description}} 1429 */ 968 1430 function get_page_by_path($page_path, $output = OBJECT) { 969 1431 global $wpdb; … … 997 1459 } 998 1460 1461 /** 1462 * get_page_by_title() - Retrieve a page given its title 1463 * 1464 * {@internal Missing Long Description}} 1465 * 1466 * @package WordPress 1467 * @subpackage Post 1468 * @since 2.1 1469 * @uses $wpdb 1470 * 1471 * @param string $page_title page title 1472 * @param string $output output type 1473 * @return mixed {@internal Missing Description}} 1474 */ 999 1475 function get_page_by_title($page_title, $output = OBJECT) { 1000 1476 global $wpdb; … … 1006 1482 } 1007 1483 1484 /** 1485 * get_page_children() - Retrieve child pages 1486 * 1487 * {@internal Missing Long Description}} 1488 * 1489 * @package WordPress 1490 * @subpackage Post 1491 * @since 1.5.1 1492 * 1493 * @param int $page_id page ID 1494 * @param array $pages list of pages 1495 * @return array {@internal Missing Description}} 1496 */ 1008 1497 function &get_page_children($page_id, $pages) { 1009 1498 $page_list = array(); … … 1018 1507 } 1019 1508 1020 //fetches the pages returned as a FLAT list, but arranged in order of their hierarchy, i.e., child parents 1021 //immediately follow their parents 1509 /** 1510 * get_page_hierarchy() - {@internal Missing Short Description}} 1511 * 1512 * Fetches the pages returned as a FLAT list, but arranged in order of their hierarchy, 1513 * i.e., child parents immediately follow their parents. 1514 * 1515 * @package WordPress 1516 * @subpackage Post 1517 * @since 2.0 1518 * 1519 * @param array $posts posts array 1520 * @param int $parent parent page ID 1521 * @return array {@internal Missing Description}} 1522 */ 1022 1523 function get_page_hierarchy($posts, $parent = 0) { 1023 1524 $result = array ( ); … … 1032 1533 } 1033 1534 1535 /** 1536 * get_page_uri() - Builds a page URI 1537 * 1538 * {@internal Missing Long Description}} 1539 * 1540 * @package WordPress 1541 * @subpackage Post 1542 * @since 1.5 1543 * 1544 * @param int $page_id page ID 1545 * @return string {@internal Missing Description}} 1546 */ 1034 1547 function get_page_uri($page_id) { 1035 1548 $page = get_page($page_id); … … 1048 1561 } 1049 1562 1563 /** 1564 * get_pages() - Retrieve a list of pages 1565 * 1566 * {@internal Missing Long Description}} 1567 * 1568 * @package WordPress 1569 * @subpackage Post 1570 * @since 1.5 1571 * @uses $wpdb 1572 * 1573 * @param mixed $args Optional. Array or string of options 1574 * @return array List of pages matching defaults or $args 1575 */ 1050 1576 function &get_pages($args = '') { 1051 1577 global $wpdb; … … 1158 1684 // 1159 1685 1686 /** 1687 * is_local_attachment() - Check if the attachment URI is local one and is really an attachment. 1688 * 1689 * {@internal Missing Long Description}} 1690 * 1691 * @package WordPress 1692 * @subpackage Post 1693 * @since 2.0 1694 * 1695 * @param string $url URL to check 1696 * @return bool {@internal Missing Description}} 1697 */ 1160 1698 function is_local_attachment($url) { 1161 1699 if (strpos($url, get_bloginfo('url')) === false) … … 1171 1709 } 1172 1710 1711 /** 1712 * wp_insert_attachment() - Insert an attachment 1713 * 1714 * {@internal Missing Long Description}} 1715 * 1716 * @package WordPress 1717 * @subpackage Post 1718 * @since 2.0 1719 * 1720 * @uses $wpdb 1721 * @uses $user_ID 1722 * 1723 * @param object $object attachment object 1724 * @param string $file filename 1725 * @param int $post_parent parent post ID 1726 * @return int {@internal Missing Description}} 1727 */ 1173 1728 function wp_insert_attachment($object, $file = false, $parent = 0) { 1174 1729 global $wpdb, $user_ID; … … 1292 1847 } 1293 1848 1849 /** 1850 * wp_delete_attachment() - Delete an attachment 1851 * 1852 * {@internal Missing Long Description}} 1853 * 1854 * @package WordPress 1855 * @subpackage Post 1856 * @since 2.0 1857 * @uses $wpdb 1858 * 1859 * @param int $postid attachment Id 1860 * @return mixed {@internal Missing Description}} 1861 */ 1294 1862 function wp_delete_attachment($postid) { 1295 1863 global $wpdb; … … 1304 1872 $file = get_attached_file( $postid ); 1305 1873 1306 / / TODO delete for pluggable post taxonomies too1874 /** @todo Delete for pluggable post taxonomies too */ 1307 1875 wp_delete_object_term_relationships($postid, array('category', 'post_tag')); 1308 1876 … … 1334 1902 } 1335 1903 1904 /** 1905 * wp_get_attachment_metadata() - Retrieve metadata for an attachment 1906 * 1907 * {@internal Missing Long Description}} 1908 * 1909 * @package WordPress 1910 * @subpackage Post 1911 * @since 2.1 1912 * 1913 * @param int $post_id attachment ID 1914 * @param bool $unfiltered Optional, default is false. If true, filters are not run 1915 * @return array {@internal Missing Description}} 1916 */ 1336 1917 function wp_get_attachment_metadata( $post_id, $unfiltered = false ) { 1337 1918 $post_id = (int) $post_id; … … 1345 1926 } 1346 1927 1928 /** 1929 * wp_update_attachment_metadata() - Update metadata for an attachment 1930 * 1931 * {@internal Missing Long Description}} 1932 * 1933 * @package WordPress 1934 * @subpackage Post 1935 * @since 2.1 1936 * 1937 * @param int $post_id attachment ID 1938 * @param array $data attachment data 1939 * @return int {@internal Missing Description}} 1940 */ 1347 1941 function wp_update_attachment_metadata( $post_id, $data ) { 1348 1942 $post_id = (int) $post_id; … … 1360 1954 } 1361 1955 1956 /** 1957 * wp_get_attachment_url() - Retrieve the URL for an attachment 1958 * 1959 * {@internal Missing Long Description}} 1960 * 1961 * @package WordPress 1962 * @subpackage Post 1963 * @since 2.1 1964 * 1965 * @param int $post_id attachment ID 1966 * @return string {@internal Missing Description}} 1967 */ 1362 1968 function wp_get_attachment_url( $post_id = 0 ) { 1363 1969 $post_id = (int) $post_id; … … 1373 1979 } 1374 1980 1981 /** 1982 * wp_get_attachment_thumb_file() - Retrieve thumbnail for an attachment 1983 * 1984 * {@internal Missing Long Description}} 1985 * 1986 * @package WordPress 1987 * @subpackage Post 1988 * @since 2.1 1989 * 1990 * @param int $post_id attachment ID 1991 * @return mixed {@internal Missing Description}} 1992 */ 1375 1993 function wp_get_attachment_thumb_file( $post_id = 0 ) { 1376 1994 $post_id = (int) $post_id; … … 1387 2005 } 1388 2006 2007 /** 2008 * wp_get_attachment_thumb_url() - Retrieve URL for an attachment thumbnail 2009 * 2010 * {@internal Missing Long Description}} 2011 * 2012 * @package WordPress 2013 * @subpackage Post 2014 * @since 2.1 2015 * 2016 * @param int $post_id attachment ID 2017 * @return string {@internal Missing Description}} 2018 */ 1389 2019 function wp_get_attachment_thumb_url( $post_id = 0 ) { 1390 2020 $post_id = (int) $post_id; … … 1402 2032 } 1403 2033 2034 /** 2035 * wp_attachment_is_image() - Check if the attachment is an image 2036 * 2037 * {@internal Missing Long Description}} 2038 * 2039 * @package WordPress 2040 * @subpackage Post 2041 * @since 2.1 2042 * 2043 * @param int $post_id attachment ID 2044 * @return bool {@internal Missing Description}} 2045 */ 1404 2046 function wp_attachment_is_image( $post_id = 0 ) { 1405 2047 $post_id = (int) $post_id; … … 1419 2061 } 1420 2062 2063 /** 2064 * wp_mime_type_icon() - Retrieve the icon for a MIME type 2065 * 2066 * {@internal Missing Long Description}} 2067 * 2068 * @package WordPress 2069 * @subpackage Post 2070 * @since 2.1 2071 * 2072 * @param string $mime MIME type 2073 * @return string|bool {@internal Missing Description}} 2074 */ 1421 2075 function wp_mime_type_icon( $mime = 0 ) { 1422 2076 $post_id = 0; … … 1458 2112 } 1459 2113 2114 /** 2115 * wp_check_for_changed_slugs() - {@internal Missing Short Description}} 2116 * 2117 * {@internal Missing Long Description}} 2118 * 2119 * @package WordPress 2120 * @subpackage Post 2121 * @since 2.1 2122 * 2123 * @param int $post_id The Post ID 2124 * @return int Same as $post_id 2125 */ 1460 2126 function wp_check_for_changed_slugs($post_id) { 1461 2127 if ( !strlen($_POST['wp-old-slug']) ) … … 1486 2152 1487 2153 /** 2154 * get_private_posts_cap_sql() - {@internal Missing Short Description}} 2155 * 1488 2156 * This function provides a standardized way to appropriately select on 1489 2157 * the post_status of posts/pages. The function will return a piece of … … 1491 2159 * to allow all published posts, and all private posts to which the user 1492 2160 * has access. 2161 * 2162 * @package WordPress 2163 * @subpackage Post 2164 * @since 2.2 2165 * 2166 * @uses $user_ID 2167 * @uses apply_filters() Call 'pub_priv_sql_capability' filter for plugins with different post types 1493 2168 * 1494 2169 * @param string $post_type currently only supports 'post' or 'page'. … … 1531 2206 } 1532 2207 2208 /** 2209 * get_lastpostdate() - {@internal Missing Short Description}} 2210 * 2211 * {@internal Missing Long Description}} 2212 * 2213 * @package WordPress 2214 * @subpackage Post 2215 * @since 0.71 2216 * 2217 * @uses $wpdb 2218 * @uses $blog_id 2219 * @uses apply_filters() Calls 'get_lastpostdate' filter 2220 * 2221 * @global mixed $cache_lastpostdate Stores the last post date 2222 * @global mixed $pagenow The current page being viewed 2223 * 2224 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. 2225 * @return string The date of the last post. 2226 */ 1533 2227 function get_lastpostdate($timezone = 'server') { 1534 2228 global $cache_lastpostdate, $wpdb, $blog_id; … … 1553 2247 } 1554 2248 2249 /** 2250 * get_lastpostmodified() - {@internal Missing Short Description}} 2251 * 2252 * {@internal Missing Long Description}} 2253 * 2254 * @package WordPress 2255 * @subpackage Post 2256 * @since 1.2 2257 * 2258 * @uses $wpdb 2259 * @uses $blog_id 2260 * @uses apply_filters() Calls 'get_lastpostmodified' filter 2261 * 2262 * @global mixed $cache_lastpostmodified Stores the date the last post was modified 2263 * @global mixed $pagenow The current page being viewed 2264 * 2265 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. 2266 * @return string The date the post was last modified. 2267 */ 1555 2268 function get_lastpostmodified($timezone = 'server') { 1556 2269 global $cache_lastpostmodified, $wpdb, $blog_id; … … 1579 2292 } 1580 2293 1581 // 1582 // Cache 1583 // 1584 2294 /** 2295 * update_post_cache() - Updates posts in cache 2296 * 2297 * @usedby update_page_cache() update_page_cache() aliased by this function. 2298 * 2299 * @package WordPress 2300 * @subpackage Cache 2301 * @since 1.5.1 2302 * 2303 * @param array $posts Array of post objects 2304 */ 1585 2305 function update_post_cache(&$posts) { 1586 2306 if ( !$posts ) … … 1591 2311 } 1592 2312 2313 /** 2314 * clean_post_cache() - Will clean the post in the cache 2315 * 2316 * Cleaning means delete from the cache of the post. Will call to clean 2317 * the term object cache associated with the post ID. 2318 * 2319 * @package WordPress 2320 * @subpackage Cache 2321 * @since 2.0 2322 * 2323 * @uses do_action() Will call the 'clean_post_cache' hook action. 2324 * 2325 * @param int $id The Post ID in the cache to clean 2326 */ 1593 2327 function clean_post_cache($id) { 1594 2328 wp_cache_delete($id, 'posts'); … … 1602 2336 } 1603 2337 2338 /** 2339 * update_page_cache() - Alias of update_post_cache() 2340 * 2341 * @see update_post_cache() Posts and pages are the same, alias is intentional 2342 * 2343 * @package WordPress 2344 * @subpackage Cache 2345 * @since 1.5.1 2346 * 2347 * @param array $pages list of page objects 2348 */ 1604 2349 function update_page_cache(&$pages) { 1605 2350 update_post_cache($pages); 1606 2351 } 1607 2352 2353 /** 2354 * clean_page_cache() - Will clean the page in the cache 2355 * 2356 * Clean (read: delete) page from cache that matches $id. Will also clean 2357 * cache associated with 'all_page_ids' and 'get_pages'. 2358 * 2359 * @package WordPress 2360 * @subpackage Cache 2361 * @since 2.0 2362 * 2363 * @uses do_action() Will call the 'clean_page_cache' hook action. 2364 * 2365 * @param int $id Page ID to clean 2366 */ 1608 2367 function clean_page_cache($id) { 1609 2368 clean_post_cache($id); … … 1615 2374 } 1616 2375 2376 /** 2377 * update_post_caches() - Call major cache updating functions for list of Post objects. 2378 * 2379 * @package WordPress 2380 * @subpackage Cache 2381 * @since 1.5 2382 * 2383 * @uses $wpdb 2384 * @uses update_post_cache() 2385 * @uses update_object_term_cache() 2386 * @uses update_postmeta_cache() 2387 * 2388 * @param array $posts Array of Post objects 2389 */ 1617 2390 function update_post_caches(&$posts) { 1618 2391 // No point in doing all this work if we didn't match any posts. … … 1632 2405 } 1633 2406 2407 /** 2408 * update_postmeta_cache() - {@internal Missing Short Description}} 2409 * 2410 * {@internal Missing Long Description}} 2411 * 2412 * @package WordPress 2413 * @subpackage Cache 2414 * @since 2.1 2415 * 2416 * @uses $wpdb 2417 * 2418 * @param array $post_ids {@internal Missing Description}} 2419 * @return bool|array Returns false if there is nothing to update or an array of metadata 2420 */ 1634 2421 function update_postmeta_cache($post_ids) { 1635 2422 global $wpdb; … … 1689 2476 // 1690 2477 2478 /** 2479 * _transition_post_status() - Hook {@internal Missing Short Description}} 2480 * 2481 * {@internal Missing Long Description}} 2482 * 2483 * @package WordPress 2484 * @subpackage Post 2485 * @since 2.3 2486 * 2487 * @uses $wpdb 2488 * 2489 * @param string $new_status {@internal Missing Description}} 2490 * @param string $old_status {@internal Missing Description}} 2491 * @param object $post Object type containing the post information 2492 */ 1691 2493 function _transition_post_status($new_status, $old_status, $post) { 1692 2494 global $wpdb; … … 1702 2504 } 1703 2505 2506 /** 2507 * _future_post_hook() - Hook used to schedule publication for a post marked for the future. 2508 * 2509 * The $post properties used and must exist are 'ID' and 'post_date_gmt'. 2510 * 2511 * @package WordPress 2512 * @subpackage Post 2513 * @since 2.3 2514 * 2515 * @param int $post_id Not Used. Can be set to null. 2516 * @param object $post Object type containing the post information 2517 */ 1704 2518 function _future_post_hook($post_id, $post) { 1705 // Schedule publication.1706 2519 wp_clear_scheduled_hook( 'publish_future_post', $post->ID ); 1707 2520 wp_schedule_single_event(strtotime($post->post_date_gmt. ' GMT'), 'publish_future_post', array($post->ID)); 1708 2521 } 1709 2522 2523 /** 2524 * _publish_post_hook() - Hook {@internal Missing Short Description}} 2525 * 2526 * {@internal Missing Long Description}} 2527 * 2528 * @package WordPress 2529 * @subpackage Post 2530 * @since 2.3 2531 * 2532 * @uses $wpdb 2533 * @uses XMLRPC_REQUEST 2534 * @uses APP_REQUEST 2535 * @uses do_action Calls 'xmlprc_publish_post' action if XMLRPC_REQUEST is defined. Calls 'app_publish_post' 2536 * action if APP_REQUEST is defined. 2537 * 2538 * @param int $post_id The ID in the database table of the post being published 2539 */ 1710 2540 function _publish_post_hook($post_id) { 1711 2541 global $wpdb; … … 1726 2556 } 1727 2557 2558 /** 2559 * _save_post_hook() - Hook used to prevent page/post cache and rewrite rules from staying dirty 2560 * 2561 * Does two things. If the post is a page and has a template then it will update/add that 2562 * template to the meta. For both pages and posts, it will clean the post cache to make sure 2563 * that the cache updates to the changes done recently. For pages, the rewrite rules of 2564 * WordPress are flushed to allow for any changes. 2565 * 2566 * The $post parameter, only uses 'post_type' property and 'page_template' property. 2567 * 2568 * @package WordPress 2569 * @subpackage Post 2570 * @since 2.3 2571 * 2572 * @uses $wp_rewrite Flushes Rewrite Rules. 2573 * 2574 * @param int $post_id The ID in the database table for the $post 2575 * @param object $post Object type containing the post information 2576 */ 1728 2577 function _save_post_hook($post_id, $post) { 1729 2578 if ( $post->post_type == 'page' ) {
Note: See TracChangeset
for help on using the changeset viewer.