Changeset 32619
- Timestamp:
- 05/27/2015 05:04:45 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r32545 r32619 182 182 * @param int $attachment_id Attachment ID. 183 183 * @param bool $unfiltered Optional. Whether to apply filters. Default false. 184 * @return string| boolThe file path to where the attached file should be, false otherwise.184 * @return string|false The file path to where the attached file should be, false otherwise. 185 185 */ 186 186 function get_attached_file( $attachment_id, $unfiltered = false ) { … … 308 308 * @see get_posts() 309 309 * @todo Check validity of description. 310 * 311 * @global WP_Post $post 310 312 * 311 313 * @param mixed $args Optional. User defined arguments for replacing the defaults. Default empty. … … 411 413 * @since 1.5.1 412 414 * 413 * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post. 414 * @param string $output Optional, default is Object. Accepts OBJECT, ARRAY_A, or ARRAY_N. 415 * Default OBJECT. 416 * @param string $filter Optional. Type of filter to apply. Accepts 'raw', 'edit', 'db', 417 * or 'display'. Default 'raw'. 415 * @global WP_Post $post 416 * 417 * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 418 * @param string $output Optional, default is Object. Accepts OBJECT, ARRAY_A, or ARRAY_N. 419 * Default OBJECT. 420 * @param string $filter Optional. Type of filter to apply. Accepts 'raw', 'edit', 'db', 421 * or 'display'. Default 'raw'. 418 422 * @return WP_Post|array|null Type corresponding to $output on success or null on failure. 419 423 * When $output is OBJECT, a `WP_Post` instance is returned. … … 645 649 * @access public 646 650 * 651 * @global wpdb $wpdb 652 * 647 653 * @param int $post_id Post ID. 648 * @return WP_Post| boolPost object, false otherwise.654 * @return WP_Post|false Post object, false otherwise. 649 655 */ 650 656 public static function get_instance( $post_id ) { … … 708 714 * 709 715 * @param string $key Key to get. 710 * @return array|mixed716 * @return mixed 711 717 */ 712 718 public function __get( $key ) { … … 751 757 * 752 758 * @param string $filter Filter. 753 * @return $this|array|bool|object|WP_Post759 * @return self|array|bool|object|WP_Post 754 760 */ 755 761 public function filter( $filter ) { … … 951 957 * 952 958 * @since 3.0.0 953 * @ uses$wp_post_statuses Inserts new post status object into the list959 * @global array $wp_post_statuses Inserts new post status object into the list 954 960 * 955 961 * @param string $post_status Name of the post status. … … 982 988 * Default is value of $internal. 983 989 * } 990 * @return object 984 991 */ 985 992 function register_post_status( $post_status, $args = array() ) { … … 1058 1065 * 1059 1066 * @param string $post_status The name of a registered post status. 1060 * @return object A post status object.1067 * @return object|null A post status object. 1061 1068 */ 1062 1069 function get_post_status_object( $post_status ) { … … 1133 1140 * @since 2.1.0 1134 1141 * 1135 * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.1136 * @return string|false Post type on success, false on failure.1142 * @param int|WP_Post|null $post Optional. Post ID or post object. Default is global $post. 1143 * @return string|false Post type on success, false on failure. 1137 1144 */ 1138 1145 function get_post_type( $post = null ) { … … 1153 1160 * 1154 1161 * @param string $post_type The name of a registered post type. 1155 * @return object A post type object.1162 * @return object|null A post type object. 1156 1163 */ 1157 1164 function get_post_type_object( $post_type ) { … … 1582 1589 * @access private 1583 1590 * 1584 * @param null|array $capabilities Post type meta capabilities. 1591 * @staticvar array $meta_caps 1592 * 1593 * @param array|void $capabilities Post type meta capabilities. 1585 1594 */ 1586 1595 function _post_type_meta_capabilities( $capabilities = null ) { … … 1696 1705 } 1697 1706 $labels = array_merge( $defaults, $object->labels ); 1698 return (object) $labels;1707 return (object) $labels; 1699 1708 } 1700 1709 … … 1729 1738 * @since 3.0.0 1730 1739 * 1740 * @global array $_wp_post_type_features 1741 * 1731 1742 * @param string $post_type The post type for which to add the feature. 1732 1743 * @param string|array $feature The feature being added, accepts an array of … … 1750 1761 * @since 3.0.0 1751 1762 * 1763 * @global array $_wp_post_type_features 1764 * 1752 1765 * @param string $post_type The post type for which to remove the feature. 1753 1766 * @param string $feature The feature being removed. … … 1764 1777 * @since 3.4.0 1765 1778 * 1779 * @global array $_wp_post_type_features 1780 * 1766 1781 * @param string $post_type The post type. 1767 1782 * @return array Post type supports list. … … 1781 1796 * @since 3.0.0 1782 1797 * 1798 * @global array $_wp_post_type_features 1799 * 1783 1800 * @param string $post_type The post type being checked. 1784 * @param string $feature the feature being checked.1801 * @param string $feature The feature being checked. 1785 1802 * @return bool Whether the post type supports the given feature. 1786 1803 */ … … 1803 1820 * @param string $post_type Optional. Post type. Accepts 'post' or 'page' to 1804 1821 * name a few. Default 'post'. 1805 * @return int Amount of rows changed. Should be 1 for success and 0 for failure.1822 * @return int|false Amount of rows changed. Should be 1 for success and 0 for failure. 1806 1823 */ 1807 1824 function set_post_type( $post_id = 0, $post_type = 'post' ) { … … 1893 1910 * @param bool $unique Optional. Whether the same key should not be added. 1894 1911 * Default false. 1895 * @return int| boolMeta ID on success, false on failure.1912 * @return int|false Meta ID on success, false on failure. 1896 1913 */ 1897 1914 function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) { … … 2007 2024 * 2008 2025 * @param int $post_id Optional. Post ID. Default is ID of the global $post. 2009 * @return array|null Either array of the keys, or null if keys could not be 2010 * retrieved. 2026 * @return array|void Array of the keys, if retrieved. 2011 2027 */ 2012 2028 function get_post_custom_keys( $post_id = 0 ) { … … 2030 2046 * @param string $key Optional. Meta field key. Default empty. 2031 2047 * @param int $post_id Optional. Post ID. Default is ID of the global $post. 2032 * @return array Meta field values.2048 * @return array|null Meta field values. 2033 2049 */ 2034 2050 function get_post_custom_values( $key = '', $post_id = 0 ) { … … 2343 2359 * @since 2.5.0 2344 2360 * 2361 * @global wpdb $wpdb 2362 * 2345 2363 * @param string $type Optional. Post type to retrieve count. Default 'post'. 2346 2364 * @param string $perm Optional. 'readable' or empty. Default empty. … … 2405 2423 * 2406 2424 * @since 2.5.0 2425 * 2426 * @global wpdb $wpdb 2407 2427 * 2408 2428 * @param string|array $mime_type Optional. Array or comma-separated list of … … 2580 2600 * @param bool $force_delete Optional. Whether to bypass trash and force deletion. 2581 2601 * Default false. 2582 * @return array| bool|WP_Post False on failure.2602 * @return array|false|WP_Post False on failure. 2583 2603 */ 2584 2604 function wp_delete_post( $postid = 0, $force_delete = false ) { … … 2723 2743 * @param int $post_id Optional. Post ID. Default is ID of the global $post 2724 2744 * if EMPTY_TRASH_DAYS equals true. 2725 * @return bool|arrayPost data array, otherwise false.2745 * @return false|array|WP_Post|null Post data array, otherwise false. 2726 2746 */ 2727 2747 function wp_trash_post( $post_id = 0 ) { … … 2770 2790 * 2771 2791 * @param int $post_id Optional. Post ID. Default is ID of the global $post. 2772 * @return WP_Post| boolWP_Post object. False on failure.2792 * @return WP_Post|false WP_Post object. False on failure. 2773 2793 */ 2774 2794 function wp_untrash_post( $post_id = 0 ) { … … 2818 2838 * @global wpdb $wpdb WordPress database abstraction object. 2819 2839 * 2820 * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post.2821 * @return mixed False on failure.2840 * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 2841 * @return mixed|void False on failure. 2822 2842 */ 2823 2843 function wp_trash_post_comments( $post = null ) { … … 2872 2892 * @since 2.9.0 2873 2893 * 2874 * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post. 2875 * @return null|bool Null on failure. 2894 * @global wpdb $wpdb 2895 * 2896 * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 2897 * @return true|void 2876 2898 */ 2877 2899 function wp_untrash_post_comments( $post = null ) { … … 3003 3025 * @param array $args Optional. Arguments to retrieve posts. Default empty array. 3004 3026 * @param string $output Optional. Type of output. Accepts ARRAY_A or ''. Default ARRAY_A. 3005 * @return array| boolAssociative array if $output equals ARRAY_A, array or false if no results.3027 * @return array|false Associative array if $output equals ARRAY_A, array or false if no results. 3006 3028 */ 3007 3029 function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) { … … 3662 3684 * 3663 3685 * @param int|WP_Post $post_id Post ID or post object. 3664 * @return null Nothing is returned. Which can mean that no action is required3665 * or post was published.3666 3686 */ 3667 3687 function check_and_publish_future_post( $post_id ) { 3668 3669 3688 $post = get_post($post_id); 3670 3689 … … 3684 3703 } 3685 3704 3686 return wp_publish_post($post_id); 3705 // wp_publish_post(_ returns no meaninful value 3706 wp_publish_post( $post_id ); 3687 3707 } 3688 3708 … … 3692 3712 * @since 2.8.0 3693 3713 * 3694 * @global wpdb $wpdb WordPress database abstraction object.3714 * @global wpdb $wpdb WordPress database abstraction object. 3695 3715 * @global WP_Rewrite $wp_rewrite 3696 3716 * … … 3840 3860 * Default 0. 3841 3861 * @param string $tags Optional. The tags to set for the post, separated by commas. Default empty. 3842 * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise.3862 * @return array|false|WP_Error Will return false if $post_id is not an integer or is 0. 3843 3863 */ 3844 3864 function wp_add_post_tags( $post_id = 0, $tags = '' ) { … … 3858 3878 * @param bool $append Optional. If true, don't delete existing tags, just add on. If false, 3859 3879 * replace the tags with the new tags. Default false. 3860 * @return mixedArray of affected term IDs. WP_Error or false on failure.3880 * @return array|false|WP_Error Array of affected term IDs. WP_Error or false on failure. 3861 3881 */ 3862 3882 function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { … … 3876 3896 * @param bool $append Optional. If true, don't delete existing tags, just add on. If false, 3877 3897 * replace the tags with the new tags. Default false. 3878 * @return mixedArray of affected term IDs. WP_Error or false on failure.3898 * @return array|false|WP_Error Array of affected term IDs. WP_Error or false on failure. 3879 3899 */ 3880 3900 function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) { … … 3919 3939 * @param bool $append If true, don't delete existing categories, just add on. 3920 3940 * If false, replace the categories with the new categories. 3921 * @return bool|mixed3941 * @return array|bool|WP_Error 3922 3942 */ 3923 3943 function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) { … … 4018 4038 * @param int $post_id Post ID. 4019 4039 * @param string $uri Ping URI. 4020 * @return int How many rows were updated.4040 * @return int|false How many rows were updated. 4021 4041 */ 4022 4042 function add_ping( $post_id, $uri ) { … … 4073 4093 * @param int $post_id Post ID. 4074 4094 */ 4075 $pung = apply_filters( 'get_enclosed', $pung, $post_id ); 4076 return $pung; 4095 return apply_filters( 'get_enclosed', $pung, $post_id ); 4077 4096 } 4078 4097 … … 4100 4119 * @param array $pung Array of URLs already pinged for the given post. 4101 4120 */ 4102 $pung = apply_filters( 'get_pung', $pung ); 4103 return $pung; 4121 return apply_filters( 'get_pung', $pung ); 4104 4122 } 4105 4123 … … 4127 4145 * @param array $to_ping List of URLs yet to ping. 4128 4146 */ 4129 $to_ping = apply_filters( 'get_to_ping', $to_ping ); 4130 return $to_ping; 4147 return apply_filters( 'get_to_ping', $to_ping ); 4131 4148 } 4132 4149 … … 4197 4214 * @param string $filter Optional. How the return value should be filtered. Accepts 'raw', 4198 4215 * 'edit', 'db', 'display'. Default 'raw'. 4199 * @return WP_Post| null WP_Post on success or null on failure.4216 * @return WP_Post|array|null WP_Post on success or null on failure. 4200 4217 */ 4201 4218 function get_page( $page, $output = OBJECT, $filter = 'raw') { … … 4214 4231 * Default OBJECT. 4215 4232 * @param string|array $post_type Optional. Post type or array of post types. Default 'page'. 4216 * @return WP_Post| null WP_Post on success or null on failure.4233 * @return WP_Post|array|void WP_Post on success. 4217 4234 */ 4218 4235 function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) { … … 4268 4285 } 4269 4286 4270 if ( $foundid ) 4287 if ( $foundid ) { 4271 4288 return get_post( $foundid, $output ); 4272 4273 return null; 4289 } 4274 4290 } 4275 4291 … … 4285 4301 * Default OBJECT. 4286 4302 * @param string|array $post_type Optional. Post type or array of post types. Default 'page'. 4287 * @return WP_Post| nullWP_Post on success or null on failure4303 * @return WP_Post|array|void WP_Post on success or null on failure 4288 4304 */ 4289 4305 function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) { … … 4310 4326 $page = $wpdb->get_var( $sql ); 4311 4327 4312 if ( $page ) 4328 if ( $page ) { 4313 4329 return get_post( $page, $output ); 4314 4315 return null; 4330 } 4316 4331 } 4317 4332 … … 4370 4385 function get_page_hierarchy( &$pages, $page_id = 0 ) { 4371 4386 if ( empty( $pages ) ) { 4372 $result = array(); 4373 return $result; 4387 return array(); 4374 4388 } 4375 4389 … … 4471 4485 * Default 'publish'. 4472 4486 * } 4473 * @return array List of pages matching defaults or `$args`.4487 * @return array|false List of pages matching defaults or `$args`. 4474 4488 */ 4475 4489 function get_pages( $args = array() ) { … … 4723 4737 * @param array $r Array of get_pages() arguments. 4724 4738 */ 4725 $pages = apply_filters( 'get_pages', $pages, $r ); 4726 4727 return $pages; 4739 return apply_filters( 'get_pages', $pages, $r ); 4728 4740 } 4729 4741 … … 4911 4923 * @param int $post_id Attachment ID. Default 0. 4912 4924 * @param bool $unfiltered Optional. If true, filters are not run. Default false. 4913 * @return string|boolAttachment meta field. False on failure.4925 * @return mixed Attachment meta field. False on failure. 4914 4926 */ 4915 4927 function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) { … … 4968 4980 * @since 2.1.0 4969 4981 * 4982 * @global string $pagenow 4983 * 4970 4984 * @param int $post_id Optional. Attachment ID. Default 0. 4971 * @return string| boolAttachment URL, otherwise false.4985 * @return string|false Attachment URL, otherwise false. 4972 4986 */ 4973 4987 function wp_get_attachment_url( $post_id = 0 ) { … … 5032 5046 * 5033 5047 * @param int $post_id Optional. Attachment ID. Default 0. 5034 * @return mixedFalse on failure. Thumbnail file path on success.5048 * @return string|false False on failure. Thumbnail file path on success. 5035 5049 */ 5036 5050 function wp_get_attachment_thumb_file( $post_id = 0 ) { … … 5063 5077 * 5064 5078 * @param int $post_id Optional. Attachment ID. Default 0. 5065 * @return string| boolFalse on failure. Thumbnail URL on success.5079 * @return string|false False on failure. Thumbnail URL on success. 5066 5080 */ 5067 5081 function wp_get_attachment_thumb_url( $post_id = 0 ) { … … 5161 5175 * 5162 5176 * @param string|int $mime MIME type or attachment ID. 5163 * @return string| boolIcon, false otherwise.5177 * @return string|false Icon, false otherwise. 5164 5178 */ 5165 5179 function wp_mime_type_icon( $mime = 0 ) { … … 5295 5309 * @param WP_Post $post The Post Object 5296 5310 * @param WP_Post $post_before The Previous Post Object 5297 * @return int Same as $post_id5298 5311 */ 5299 5312 function wp_check_for_changed_slugs( $post_id, $post, $post_before ) { … … 5342 5355 * 5343 5356 * @see get_private_posts_cap_sql() 5357 * 5358 * @global wpdb $wpdb 5344 5359 * 5345 5360 * @param array|string $post_type Single post type or an array of post types. … … 5484 5499 * @access private 5485 5500 * 5501 * @global wpdb $wpdb 5502 * 5486 5503 * @param string $timezone The timezone for the timestamp. See {@see get_lastpostmodified()} 5487 5504 * for information on accepted values. 5488 5505 * @param string $field Post field to check. Accepts 'date' or 'modified'. 5489 * @return string The timestamp.5506 * @return string|false The timestamp. 5490 5507 */ 5491 5508 function _get_last_post_time( $timezone, $field ) { … … 5553 5570 * @since 2.0.0 5554 5571 * 5572 * @global bool $_wp_suspend_cache_invalidation 5555 5573 * @global wpdb $wpdb WordPress database abstraction object. 5556 5574 * … … 5656 5674 * 5657 5675 * @param array $post_ids List of post IDs. 5658 * @return bool|arrayReturns false if there is nothing to update or an array5659 * of metadata.5676 * @return array|false Returns false if there is nothing to update or an array 5677 * of metadata. 5660 5678 */ 5661 5679 function update_postmeta_cache( $post_ids ) { … … 5673 5691 * @since 3.0.0 5674 5692 * 5675 * @ see wp_suspend_cache_invalidation()5693 * @global bool $_wp_suspend_cache_invalidation 5676 5694 * 5677 5695 * @param int $id The attachment ID in the cache to clean. … … 5813 5831 * @param int $post_ID 5814 5832 * 5815 * @return int| boolPost parent ID, otherwise false.5833 * @return int|false Post parent ID, otherwise false. 5816 5834 */ 5817 5835 function wp_get_post_parent_id( $post_ID ) { … … 5871 5889 * @param int|WP_Post $post Post ID or post object where thumbnail should be attached. 5872 5890 * @param int $thumbnail_id Thumbnail to attach. 5873 * @return bool True on success, false on failure.5891 * @return int|bool True on success, false on failure. 5874 5892 */ 5875 5893 function set_post_thumbnail( $post, $thumbnail_id ) { … … 5947 5965 * @see update_post_caches() 5948 5966 * 5967 * @global wpdb $wpdb 5968 * 5949 5969 * @param array $ids ID list 5950 5970 * @param bool $update_term_cache Optional. Whether to update the term cache. Default true.
Note: See TracChangeset
for help on using the changeset viewer.