Make WordPress Core

Ticket #25505: 25505-patch.diff

File 25505-patch.diff, 30.6 KB (added by dougwollison, 11 years ago)

Fixed diff file with missing punctuation.

  • wp-includes/post.php

     
    189189                $file = $uploads['basedir'] . "/$file";
    190190        if ( $unfiltered )
    191191                return $file;
     192               
     193        /**
     194         * Filter the attachment file path.
     195         *
     196         * @since 2.1.0
     197         *
     198         * @param string $file The file path to be filtered.
     199         * @param int $attachment_id The ID of the attachment.
     200         */
    192201        return apply_filters( 'get_attached_file', $file, $attachment_id );
    193202}
    194203
     
    209218        if ( !get_post( $attachment_id ) )
    210219                return false;
    211220
     221        /**
     222         * Filter the attachment file path before saving.
     223         *
     224         * @since 2.1.0
     225         *
     226         * @param string $file The file path to be filtered.
     227         * @param int $attachment_id The ID of the attachment.
     228         */
    212229        $file = apply_filters( 'update_attached_file', $file, $attachment_id );
    213230        if ( $file = _wp_relative_upload_path( $file ) )
    214231                return update_post_meta( $attachment_id, '_wp_attached_file', $file );
     
    236253                        $new_path = ltrim( $new_path, '/' );
    237254        }
    238255
     256        /**
     257         * Filter the attachment file path before saving.
     258         *
     259         * @since 2.9.0
     260         *
     261         * @param string $newpath The relative path fo the file.
     262         * @param string $path The original absolute path to the file.
     263         */
    239264        return apply_filters( '_wp_relative_upload_path', $new_path, $path );
    240265}
    241266
     
    13311356                register_taxonomy_for_object_type( $taxonomy, $post_type );
    13321357        }
    13331358
     1359        /**
     1360         * Fires actions to be run after a post type is registered.
     1361         *
     1362         * @since 3.3.0
     1363         *
     1364         * @param string $post_type The slug of the post type registered.
     1365         * @param object $args The arguments for the post type registration.
     1366         */
    13341367        do_action( 'registered_post_type', $post_type, $args );
    13351368
    13361369        return $args;
     
    14971530        $labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
    14981531
    14991532        $post_type = $post_type_object->name;
     1533       
     1534        /**
     1535         * Filter the labels for a specific post type.
     1536         *
     1537         * @since 3.5.0
     1538         *
     1539         * @param array $labels the labels for the custom post type.
     1540         */
    15001541        return apply_filters( "post_type_labels_{$post_type}", $labels );
    15011542}
    15021543
     
    19812022                $format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
    19822023
    19832024                if ( $prefixed ) {
    1984                         $value = apply_filters("edit_{$field}", $value, $post_id);
    1985                         // Old school
    1986                         $value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id);
     2025                        /**
     2026                         * Filter and sanitize the value of the prefixed field (for editing).
     2027                         *
     2028                         * @since 2.3.0
     2029                         *
     2030                         * @param mixed $value The Post Object value to sanitize.
     2031                         * @param int $post_id The Post ID.
     2032                         */
     2033                        $value = apply_filters( "edit_{$field}", $value, $post_id );
     2034                        /**
     2035                         * Old school method...
     2036                         * @see edit_{$field} filter above.
     2037                         */
     2038                        $value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id );
    19872039                } else {
    1988                         $value = apply_filters("edit_post_{$field}", $value, $post_id);
     2040                        /**
     2041                         * Non prefixed version...
     2042                         * @see edit_{$field} filter above.
     2043                         */
     2044                        $value = apply_filters( "edit_post_{$field}", $value, $post_id );
    19892045                }
    19902046
    19912047                if ( in_array($field, $format_to_edit) ) {
     
    19982054                }
    19992055        } else if ( 'db' == $context ) {
    20002056                if ( $prefixed ) {
    2001                         $value = apply_filters("pre_{$field}", $value);
    2002                         $value = apply_filters("{$field_no_prefix}_save_pre", $value);
     2057                        /**
     2058                         * Filter and sanitize the value of the prefixed field (for database use).
     2059                         *
     2060                         * @since 2.3.0
     2061                         *
     2062                         * @param mixed $value The Post Object value to sanitize.
     2063                         */
     2064                        $value = apply_filters( "pre_{$field}", $value );
     2065                        /**
     2066                         * Filter value after pre_{$field} is run.
     2067                         *
     2068                         * @since 2.3.0
     2069                         *
     2070                         * @param mixed $value The Post Object value to sanitize.
     2071                         */
     2072                        $value = apply_filters( "{$field_no_prefix}_save_pre", $value );
    20032073                } else {
    2004                         $value = apply_filters("pre_post_{$field}", $value);
    2005                         $value = apply_filters("{$field}_pre", $value);
     2074                        /**
     2075                         * Non prefixed version...
     2076                         * @see pre_{$field} filter above
     2077                         */
     2078                        $value = apply_filters( "pre_post_{$field}", $value );
     2079                        /**
     2080                         * Filter value after pre_post_{$field} is run.
     2081                         *
     2082                         * @since 2.3.0
     2083                         *
     2084                         * @param mixed $value The Post Object value to sanitize.
     2085                         */
     2086                        $value = apply_filters( "{$field}_pre", $value );
    20062087                }
    20072088        } else {
    20082089                // Use display filters by default.
    20092090                if ( $prefixed )
    2010                         $value = apply_filters($field, $value, $post_id, $context);
     2091                        /**
     2092                         * Filter and sanitize the value of the prefixed field (for other contexts).
     2093                         *
     2094                         * @since 2.3.0
     2095                         *
     2096                         * @param mixed $value The Post Object value to sanitize.
     2097                         * @param int $post_id The Post ID.
     2098                         * @param string $context The context to filter for.
     2099                         */
     2100                        $value = apply_filters( $field, $value, $post_id, $context );
    20112101                else
    2012                         $value = apply_filters("post_{$field}", $value, $post_id, $context);
     2102                        /**
     2103                         * Non prefixed version...
     2104                         * @see {$field} filter directly above.
     2105                         */
     2106                        $value = apply_filters( "post_{$field}", $value, $post_id, $context );
    20132107        }
    20142108
    20152109        if ( 'attribute' == $context )
     
    21812275                'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),
    21822276        );
    21832277
    2184         return apply_filters('post_mime_types', $post_mime_types);
     2278        /**
     2279         * Filter the default post mime types.
     2280         *
     2281         * @since 2.5.0
     2282         *
     2283         * @param array $post_mime_types The array of post mime-types in slug=>labels format.
     2284         */
     2285        return apply_filters( 'post_mime_types', $post_mime_types );
    21852286}
    21862287
    21872288/**
     
    22992400        if ( $post->post_type == 'attachment' )
    23002401                return wp_delete_attachment( $postid, $force_delete );
    23012402
    2302         do_action('before_delete_post', $postid);
     2403        /**
     2404         * Fire actions to be run before the post is prepped for deletion.
     2405         *
     2406         * @since 3.2.0
     2407         *
     2408         * @param int $postid The Post ID.
     2409         */
     2410        do_action( 'before_delete_post', $postid );
    23032411
    23042412        delete_post_meta($postid,'_wp_trash_meta_status');
    23052413        delete_post_meta($postid,'_wp_trash_meta_time');
     
    23342442        foreach ( $post_meta_ids as $mid )
    23352443                delete_metadata_by_mid( 'post', $mid );
    23362444
     2445        /**
     2446         * Fires actions to be run JUST before the actual post is deleted.
     2447         *
     2448         * @since 1.2.1 (possibly earlier)
     2449         *
     2450         * @param int $postid The Post ID.
     2451         */
    23372452        do_action( 'delete_post', $postid );
     2453       
     2454        // Delete the post from the database
    23382455        $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
     2456       
     2457        /**
     2458         * Fires actions to be run JUST after the actual post is deleted.
     2459         *
     2460         * @since 2.2.0
     2461         *
     2462         * @param int $postid The Post ID.
     2463         */
    23392464        do_action( 'deleted_post', $postid );
    23402465
    23412466        clean_post_cache( $post );
     
    23472472
    23482473        wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
    23492474
    2350         do_action('after_delete_post', $postid);
     2475        /**
     2476         * Fires actions to run after delete_post has completed.
     2477         *
     2478         * @since 3.2.0
     2479         *
     2480         * @param int $postid The Post ID.
     2481         */
     2482        do_action( 'after_delete_post', $postid );
    23512483
    23522484        return $post;
    23532485}
     
    24032535        if ( $post['post_status'] == 'trash' )
    24042536                return false;
    24052537
    2406         do_action('wp_trash_post', $post_id);
     2538        /**
     2539         * Fires actions to be run before trashing a post.
     2540         *
     2541         * @since 3.3.0
     2542         *
     2543         * @param int $post_id The Post ID.
     2544         */
     2545        do_action( 'wp_trash_post', $post_id );
    24072546
    24082547        add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
    24092548        add_post_meta($post_id,'_wp_trash_meta_time', time());
     
    24132552
    24142553        wp_trash_post_comments($post_id);
    24152554
    2416         do_action('trashed_post', $post_id);
     2555        /**
     2556         * Fires actions to be run after trashing a post.
     2557         *
     2558         * @since 2.9.0
     2559         *
     2560         * @param int $post_id The Post ID.
     2561         */
     2562        do_action( 'trashed_post', $post_id );
    24172563
    24182564        return $post;
    24192565}
     
    24352581        if ( $post['post_status'] != 'trash' )
    24362582                return false;
    24372583
    2438         do_action('untrash_post', $post_id);
     2584        /**
     2585         * Fires actions to be run before untrashing a post.
     2586         *
     2587         * @since 3.3.0
     2588         *
     2589         * @param int $post_id The Post ID.
     2590         */
     2591        do_action( 'untrash_post', $post_id );
    24392592
    24402593        $post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
    24412594
     
    24482601
    24492602        wp_untrash_post_comments($post_id);
    24502603
    2451         do_action('untrashed_post', $post_id);
     2604        /**
     2605         * Fires actions to be run after untrashing a post.
     2606         *
     2607         * @since 2.9.0
     2608         *
     2609         * @param int $post_id The Post ID.
     2610         */
     2611        do_action( 'untrashed_post', $post_id );
    24522612
    24532613        return $post;
    24542614}
     
    24722632
    24732633        $post_id = $post->ID;
    24742634
    2475         do_action('trash_post_comments', $post_id);
     2635        /**
     2636         * Fires actions to be run before trashing the post comments.
     2637         *
     2638         * @since 3.3.0
     2639         *
     2640         * @param int $post_id The Post ID.
     2641         */
     2642        do_action( 'trash_post_comments', $post_id );
    24762643
    24772644        $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) );
    24782645        if ( empty($comments) )
     
    24892656
    24902657        clean_comment_cache( array_keys($statuses) );
    24912658
    2492         do_action('trashed_post_comments', $post_id, $statuses);
     2659        /**
     2660         * Fires actions to be run after trashing the post comments.
     2661         *
     2662         * @since 2.9.0
     2663         *
     2664         * @param int $post_id The Post ID.
     2665         */
     2666        do_action( 'trashed_post_comments', $post_id, $statuses );
    24932667
    24942668        return $result;
    24952669}
     
    25182692        if ( empty($statuses) )
    25192693                return true;
    25202694
    2521         do_action('untrash_post_comments', $post_id);
     2695        /**
     2696         * Fires actions to be run before untrashing the post comments.
     2697         *
     2698         * @since 3.3.0
     2699         *
     2700         * @param int $post_id The Post ID.
     2701         */
     2702        do_action( 'untrash_post_comments', $post_id );
    25222703
    25232704        // Restore each comment to its original status
    25242705        $group_by_status = array();
     
    25372718
    25382719        delete_post_meta($post_id, '_wp_trash_meta_comments_status');
    25392720
    2540         do_action('untrashed_post_comments', $post_id);
     2721        /**
     2722         * Fires actions to be run after untrashing the post comments.
     2723         *
     2724         * @since 2.9.0
     2725         *
     2726         * @param int $post_id The Post ID.
     2727         */
     2728        do_action( 'untrashed_post_comments', $post_id );
    25412729}
    25422730
    25432731/**
     
    27382926        $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' )
    27392927                && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' );
    27402928
     2929        /**
     2930         * Fitler to modify the $maybe_empty value. Use to force the value to true or false.
     2931         *
     2932         * @since 3.3.0
     2933         *
     2934         * @param bool $maybe_empty The current value saying if the post may be empty.
     2935         * @param array $postarr The array of post data elements passed to this function.
     2936         */
    27412937        if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
    27422938                if ( $wp_error )
    27432939                        return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
     
    28503046                $post_parent = 0;
    28513047
    28523048        // Check the post_parent to see if it will cause a hierarchy loop
     3049        /**
     3050         * Filter to test and make sure the post_parent won't cause a heirarchy loop.
     3051         *
     3052         * @since 3.1.0
     3053         *
     3054         * @param int $post_parent The intended post_parent value.
     3055         * @param int $post_ID The ID of the post being inserted/updated.
     3056         * @param array $postarr The modified post array pulling in the modified extracted variables.
     3057         * @param array $postarr The original post array passed to the function.
     3058         */
    28533059        $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
    28543060
    28553061        if ( isset($menu_order) )
     
    28643070
    28653071        // expected_slashed (everything!)
    28663072        $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) );
    2867         $data = apply_filters('wp_insert_post_data', $data, $postarr);
     3073       
     3074        /**
     3075         * Filter the post data before insertion.
     3076         *
     3077         * @since 2.7.0
     3078         *
     3079         * @param array $data The modified post data array.
     3080         * @param array $postarr The original post array passed to the function.
     3081         */
     3082        $data = apply_filters( 'wp_insert_post_data', $data, $postarr );
    28683083        $data = wp_unslash( $data );
    28693084        $where = array( 'ID' => $post_ID );
    28703085
    28713086        if ( $update ) {
     3087                /**
     3088                 * Fire actions to be run before the post is updated.
     3089                 *
     3090                 * @since 2.5.0
     3091                 *
     3092                 * @param int $post_ID The Post ID.
     3093                 * @param array $data The post data array we're updating with.
     3094                 */
    28723095                do_action( 'pre_post_update', $post_ID, $data );
    28733096                if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
    28743097                        if ( $wp_error )
     
    29453168        wp_transition_post_status($data['post_status'], $previous_status, $post);
    29463169
    29473170        if ( $update ) {
    2948                 do_action('edit_post', $post_ID, $post);
     3171                /**
     3172                 * Fire actions to be run after the post has been edited.
     3173                 *
     3174                 * @since 1.2.1
     3175                 *
     3176                 * @param int $post_ID The Post ID.
     3177                 * @param WP_Post $post The Post object (after being updated).
     3178                 */
     3179                do_action( 'edit_post', $post_ID, $post );
     3180               
    29493181                $post_after = get_post($post_ID);
    2950                 do_action( 'post_updated', $post_ID, $post_after, $post_before);
     3182               
     3183                /**
     3184                 * Fire actions to be run after the post has been updated,
     3185                 * with comparision of the post before and after updating.
     3186                 *
     3187                 * @since 3.0.0
     3188                 *
     3189                 * @param int $post_ID The Post ID.
     3190                 * @param WP_Post $post_after The Post object (after being updated).
     3191                 * @param WP_Post $post_before The Post object (before being updated).
     3192                 */
     3193                do_action( 'post_updated', $post_ID, $post_after, $post_before );
    29513194        }
    29523195
     3196        /**
     3197         * Fire actions to be run after updating a post of a specific type.
     3198         *
     3199         * @since 3.7.0
     3200         *
     3201         * @param int $post_ID The Post ID.
     3202         * @param WP_Post $post The Post object (after being updated).
     3203         * @param bool $update Wether or not this was an update vs. an insert.
     3204         */
    29533205        do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
     3206
     3207        /**
     3208         * Fire actions to be run after updating a post.
     3209         *
     3210         * @since 1.5.2
     3211         *
     3212         * @param int $post_ID The Post ID.
     3213         * @param WP_Post $post The Post object (after being updated).
     3214         * @param bool $update Wether or not this was an update vs. an insert.
     3215         */
    29543216        do_action( 'save_post', $post_ID, $post, $update );
     3217
     3218        /**
     3219         * Fire actions to be run after wp_insert_post is completed.
     3220         *
     3221         * @since 2.0
     3222         *
     3223         * @param int $post_ID The Post ID.
     3224         * @param WP_Post $post The Post object (after being updated).
     3225         * @param bool $update Wether or not this was an update vs. an insert.
     3226         */
    29553227        do_action( 'wp_insert_post', $post_ID, $post, $update );
    29563228
    29573229        return $post_ID;
     
    30413313        $old_status = $post->post_status;
    30423314        $post->post_status = 'publish';
    30433315        wp_transition_post_status( 'publish', $old_status, $post );
    3044 
     3316       
     3317        // Duplicate hook
    30453318        do_action( 'edit_post', $post->ID, $post );
     3319       
     3320        // Duplicate hook
    30463321        do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
     3322       
     3323        // Duplicate hook
    30473324        do_action( 'save_post', $post->ID, $post, true );
     3325       
     3326        // Duplicate hook
    30483327        do_action( 'wp_insert_post', $post->ID, $post, true );
    30493328}
    30503329
     
    31123391                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
    31133392                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );
    31143393
    3115                 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
     3394                /**
     3395                 * Filter to flag the post slug as a bad attachment slug.
     3396                 *
     3397                 * @since 3.1.0
     3398                 *
     3399                 * @param bool false The default value for the flag.
     3400                 * @param string $slug The slug to test with.
     3401                 */
     3402                $slug_is_bad = apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug );
     3403               
     3404                if ( $post_name_check || in_array( $slug, $feeds ) || $slug_is_bad ) {
    31163405                        $suffix = 2;
    31173406                        do {
    31183407                                $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
     
    31293418                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
    31303419                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) );
    31313420
    3132                 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug )  || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
     3421                /**
     3422                 * Filter to flag the post slug as a bad hierarchical slug.
     3423                 *
     3424                 * @since 3.1.0
     3425                 *
     3426                 * @param bool false The default value for the flag.
     3427                 * @param string $slug The slug to test with.
     3428                 * @param string $post_type The post's type.
     3429                 * @param int $post_parent The ID of the post's parent.
     3430                 */
     3431                $slug_is_bad = apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent );
     3432
     3433                if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || $slug_is_bad ) {
    31333434                        $suffix = 2;
    31343435                        do {
    31353436                                $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
     
    31433444                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
    31443445                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
    31453446
    3146                 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
     3447                /**
     3448                 * Filter to flag the post slug as a bad flat slug.
     3449                 *
     3450                 * @since 3.1.0
     3451                 *
     3452                 * @param bool false The default value for the flag.
     3453                 * @param string $slug The slug to test with.
     3454                 * @param string $post_type The post's type.
     3455                 */
     3456                $slug_is_bad = apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type );
     3457
     3458                if ( $post_name_check || in_array( $slug, $feeds ) || $slug_is_bad ) {
    31473459                        $suffix = 2;
    31483460                        do {
    31493461                                $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
     
    31543466                }
    31553467        }
    31563468
     3469        /**
     3470         * Filter the unique slug for the post.
     3471         *
     3472         * @since 3.3.0
     3473         *
     3474         * @param string $slug The unique slug to filter.
     3475         * @param int $post_ID The Post ID.
     3476         * @param string $post_status The Post status.
     3477         * @param string $post_type The Post type.
     3478         * @param int $post_parent The Post parent.
     3479         * @param string $slug The original slug passed.
     3480         */
    31573481        return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
    31583482}
    31593483
     
    33353659        $pung = preg_split('/\s/', $pung);
    33363660        $pung[] = $uri;
    33373661        $new = implode("\n", $pung);
    3338         $new = apply_filters('add_ping', $new);
     3662       
     3663        /**
     3664         * Filter the array of "pung" URLs to update with.
     3665         *
     3666         * @since 2.0.0
     3667         *
     3668         * @param array $new The updated array of URLs.
     3669         */
     3670        $new = apply_filters( 'add_ping', $new );
     3671       
    33393672        // expected_slashed ($new)
    33403673        $new = wp_unslash($new);
    33413674        return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
     
    33633696                        $pung[] = trim( $enclosure[ 0 ] );
    33643697                }
    33653698        }
    3366         $pung = apply_filters('get_enclosed', $pung, $post_id);
     3699       
     3700        /**
     3701         * Filter the array of enclosures.
     3702         *
     3703         * @since 2.0.0
     3704         *
     3705         * @param array $pung The list of enclosures.
     3706         * @param int $post_id The Post ID.
     3707         */
     3708        $pung = apply_filters( 'get_enclosed', $pung, $post_id );
    33673709        return $pung;
    33683710}
    33693711
     
    33813723        $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
    33823724        $pung = trim($pung);
    33833725        $pung = preg_split('/\s/', $pung);
    3384         $pung = apply_filters('get_pung', $pung);
     3726       
     3727        /**
     3728         * Filter the array of "pung" URLs to return.
     3729         *
     3730         * @since 2.0.0
     3731         *
     3732         * @param array $new The updated array of URLs.
     3733         */
     3734        $pung = apply_filters( 'get_pung', $pung );
    33853735        return $pung;
    33863736}
    33873737
     
    33993749        $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id ));
    34003750        $to_ping = sanitize_trackback_urls( $to_ping );
    34013751        $to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
    3402         $to_ping = apply_filters('get_to_ping',  $to_ping);
     3752       
     3753        /**
     3754         * Filter the list of URLs to be pinged.
     3755         *
     3756         * @since 2.0.0
     3757         *
     3758         * @param array $to_ping The list of URLs to ping.
     3759         */
     3760        $to_ping = apply_filters( 'get_to_ping',  $to_ping );
    34033761        return $to_ping;
    34043762}
    34053763
     
    37274085        if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
    37284086                // Convert to WP_Post instances
    37294087                $pages = array_map( 'get_post', $cache );
    3730                 $pages = apply_filters('get_pages', $pages, $r);
     4088               
     4089                /**
     4090                 * Filter the list of pages being fetched.
     4091                 *
     4092                 * @since 2.1.0
     4093                 *
     4094                 * @param array $pages The array of pages being fetched.
     4095                 * @param array $r The parsed arguments passed to this function.
     4096                 */
     4097                $pages = apply_filters( 'get_pages', $pages, $r );
    37314098                return $pages;
    37324099        }
    37334100
     
    38574224        $pages = $wpdb->get_results($query);
    38584225
    38594226        if ( empty($pages) ) {
    3860                 $pages = apply_filters('get_pages', array(), $r);
     4227                // Duplicate hook
     4228                $pages = apply_filters( 'get_pages', array(), $r );
    38614229                return $pages;
    38624230        }
    38634231
     
    38964264        // Convert to WP_Post instances
    38974265        $pages = array_map( 'get_post', $pages );
    38984266
    3899         $pages = apply_filters('get_pages', $pages, $r);
     4267        // Duplicate hook
     4268        $pages = apply_filters( 'get_pages', $pages, $r );
    39004269
    39014270        return $pages;
    39024271}
     
    41114480                add_post_meta( $post_ID, '_wp_attachment_context', $context, true );
    41124481
    41134482        if ( $update) {
    4114                 do_action('edit_attachment', $post_ID);
     4483                /**
     4484                 * Fires actions to run after an attachment has been edited.
     4485                 *
     4486                 * @since 2.0.0
     4487                 *
     4488                 * @param int $post_ID The Post ID.
     4489                 */
     4490                do_action( 'edit_attachment', $post_ID );
    41154491        } else {
    4116                 do_action('add_attachment', $post_ID);
     4492                /**
     4493                 * Fires actions to run after an attachment has been added.
     4494                 *
     4495                 * @since 2.0.0
     4496                 *
     4497                 * @param int $post_ID The Post ID.
     4498                 */
     4499                do_action( 'add_attachment', $post_ID );
    41174500        }
    41184501
    41194502        return $post_ID;
     
    41654548        if ( is_multisite() )
    41664549                delete_transient( 'dirsize_cache' );
    41674550
    4168         do_action('delete_attachment', $post_id);
     4551        /**
     4552         * Fires actions to be run before preperation for attachment deletion.
     4553         *
     4554         * @since 2.0.0
     4555         *
     4556         * @param int $post_id The attachment id.
     4557         */
     4558        do_action( 'delete_attachment', $post_id );
    41694559
    41704560        wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
    41714561        wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
     
    41804570        foreach ( $post_meta_ids as $mid )
    41814571                delete_metadata_by_mid( 'post', $mid );
    41824572
     4573        // Duplicate hook
    41834574        do_action( 'delete_post', $post_id );
     4575       
    41844576        $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
     4577       
     4578        // Duplicate hook
    41854579        do_action( 'deleted_post', $post_id );
    41864580
    41874581        $uploadpath = wp_upload_dir();
     
    41904584                // Don't delete the thumb if another attachment uses it
    41914585                if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $meta['thumb'] . '%', $post_id)) ) {
    41924586                        $thumbfile = str_replace(basename($file), $meta['thumb'], $file);
    4193                         $thumbfile = apply_filters('wp_delete_file', $thumbfile);
     4587                       
     4588                        /**
     4589                         * Filter the path of file to delete.
     4590                         *
     4591                         * @since 2.1.0
     4592                         *
     4593                         * @param string $thumbfile The name of the thumbnail file.
     4594                         */
     4595                        $thumbfile = apply_filters( 'wp_delete_file', $thumbfile );
     4596                       
    41944597                        @ unlink( path_join($uploadpath['basedir'], $thumbfile) );
    41954598                }
    41964599        }
    41974600
    41984601        // remove intermediate and backup images if there are any
    41994602        foreach ( $intermediate_sizes as $intermediate ) {
     4603                // Duplicate hook
    42004604                $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] );
    42014605                @ unlink( path_join($uploadpath['basedir'], $intermediate_file) );
    42024606        }
     
    42044608        if ( is_array($backup_sizes) ) {
    42054609                foreach ( $backup_sizes as $size ) {
    42064610                        $del_file = path_join( dirname($meta['file']), $size['file'] );
    4207                         $del_file = apply_filters('wp_delete_file', $del_file);
     4611                        // Duplicate hook
     4612                        $del_file = apply_filters( 'wp_delete_file', $del_file );
    42084613                        @ unlink( path_join($uploadpath['basedir'], $del_file) );
    42094614                }
    42104615        }
    42114616
    4212         $file = apply_filters('wp_delete_file', $file);
     4617        // Duplicate hook
     4618        $file = apply_filters( 'wp_delete_file', $file );
    42134619
    42144620        if ( ! empty($file) )
    42154621                @ unlink($file);
     
    42374643
    42384644        if ( $unfiltered )
    42394645                return $data;
    4240 
     4646       
     4647        /**
     4648         * Filter the attachment metadata.
     4649         *
     4650         * @since 2.1.0
     4651         *
     4652         * @param array $data The attachment metadata array.
     4653         * @param int $post->ID The Post ID.
     4654         */
    42414655        return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
    42424656}
    42434657
     
    42554669        if ( !$post = get_post( $post_id ) )
    42564670                return false;
    42574671
     4672        // Duplicate hook
    42584673        if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
    42594674                return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
    42604675        else
     
    42924707        if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recommended to rely upon this.
    42934708                $url = get_the_guid( $post->ID );
    42944709
     4710        /**
     4711         * Filter the attachment's URL.
     4712         *
     4713         * @since 2.1.0
     4714         *
     4715         * @param string $url The attachment URL.
     4716         * @param int $post->ID The Post ID.
     4717         */
    42954718        $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
    42964719
    42974720        if ( empty( $url ) )
     
    43184741        $file = get_attached_file( $post->ID );
    43194742
    43204743        if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) )
     4744                /**
     4745                 * Filter the path to the thumbnail file.
     4746                 *
     4747                 * @since 2.1.0
     4748                 *
     4749                 * @param string $thumbfile The path to the thumbnail file.
     4750                 * @param int $post->ID The Post ID.
     4751                 */
    43214752                return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
     4753       
    43224754        return false;
    43234755}
    43244756
     
    43464778
    43474779        $url = str_replace(basename($url), basename($thumb), $url);
    43484780
     4781        /**
     4782         * Filter the URL of the thumbnail file.
     4783         *
     4784         * @since 2.1.0
     4785         *
     4786         * @param string $url The URL of the thumbnail.
     4787         * @param int $post->ID The Post ID.
     4788         */
    43494789        return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID );
    43504790}
    43514791
     
    44104850                $icon_files = wp_cache_get('icon_files');
    44114851
    44124852                if ( !is_array($icon_files) ) {
     4853                        /**
     4854                         * Filter the path to the icons directory.
     4855                         *
     4856                         * @since 2.0.0
     4857                         *
     4858                         * @param string The absolute path to the icon directory.
     4859                         */
    44134860                        $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
     4861                       
     4862                        /**
     4863                         * Filter the URI to the icons directory.
     4864                         *
     4865                         * @since 2.0
     4866                         *
     4867                         * @param string The URI to the icon directory.
     4868                         */
    44144869                        $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/crystal') );
     4870                       
     4871                        /**
     4872                         * Filter the icon directories array.
     4873                         *
     4874                         * @since 2.5.0
     4875                         *
     4876                         * @param array The icon directories array.
     4877                         */
    44154878                        $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) );
     4879                       
    44164880                        $icon_files = array();
    44174881                        while ( $dirs ) {
    44184882                                $keys = array_keys( $dirs );
     
    44594923                }
    44604924        }
    44614925
     4926        /**
     4927         * Filter the icon mime type.
     4928         *
     4929         * @since 2.1.0
     4930         *
     4931         * @param string $icon The path to the icon image.
     4932         * @param string $mime The mime type the icon represents.
     4933         * @param int $post_id The Post ID.
     4934         */
    44624935        return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type.
    44634936}
    44644937
     
    45395012        if ( ! $post_type_obj )
    45405013                return $full ? 'WHERE 1 = 0' : ' 1 = 0 ';
    45415014
    4542         // This hook is deprecated. Why you'd want to use it, I dunno.
     5015        /**
     5016         * Filter for creating the read_private_posts capability.
     5017         *
     5018         * @deprecated
     5019         *
     5020         * @since 2.2.0
     5021         *
     5022         * @param string '' An empty string.
     5023         */
    45435024        if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) )
    45445025                $cap = $post_type_obj->cap->read_private_posts;
    45455026
     
    45915072 * @return string The date of the last post.
    45925073 */
    45935074function get_lastpostdate($timezone = 'server') {
    4594         return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone );
     5075        $date = _get_last_post_time( $timezone, 'date' );
     5076       
     5077        /**
     5078         * Filters the last post date.
     5079         *
     5080         * @since 2.3.0
     5081         *
     5082         * @param string $date The date field of the timestamp.
     5083         * @param string $timezone The location used to get the time.
     5084         */
     5085        return apply_filters( 'get_lastpostdate', $date, $timezone );
    45955086}
    45965087
    45975088/**
     
    46135104        $lastpostdate = get_lastpostdate($timezone);
    46145105        if ( $lastpostdate > $lastpostmodified )
    46155106                $lastpostmodified = $lastpostdate;
    4616 
     5107       
     5108        /**
     5109         * Filters the last post modified dated.
     5110         *
     5111         * @since 2.3.0
     5112         *
     5113         * @param string $lastpostmodified The modified field of the timestamp.
     5114         * @param string $timezone The location used to get the time.
     5115         */
    46175116        return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
    46185117}
    46195118
     
    47165215
    47175216        wp_cache_delete( 'wp_get_archives', 'general' );
    47185217
     5218        /**
     5219         * Fires actions to be run once the post cache has been cleaned.
     5220         *
     5221         * @since 2.5.0
     5222         *
     5223         * @param int $post->ID The Post ID.
     5224         * @param WP_Post The Post object.
     5225         */
    47195226        do_action( 'clean_post_cache', $post->ID, $post );
    47205227
    47215228        if ( is_post_type_hierarchical( $post->post_type ) )
     
    47235230
    47245231        if ( 'page' == $post->post_type ) {
    47255232                wp_cache_delete( 'all_page_ids', 'posts' );
     5233               
     5234                /**
     5235                 * Fires actions to be run once the page cache has been cleaned.
     5236                 *
     5237                 * @since 2.5.0
     5238                 *
     5239                 * @param int $post->ID The Post ID.
     5240                 */
    47265241                do_action( 'clean_page_cache', $post->ID );
    47275242        }
    47285243
     
    48295344        if ( $clean_terms )
    48305345                clean_object_term_cache($id, 'attachment');
    48315346
    4832         do_action('clean_attachment_cache', $id);
     5347        /**
     5348         * Fires actions to run once the attachment cache has been cleaned.
     5349         *
     5350         * @since 3.0.0
     5351         *
     5352         * @param int $id The attachment ID.
     5353         */
     5354        do_action( 'clean_attachment_cache', $id );
    48335355}
    48345356
    48355357//
     
    48565378                // Reset GUID if transitioning to publish and it is empty
    48575379                if ( '' == get_the_guid($post->ID) )
    48585380                        $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
     5381                       
     5382                /**
     5383                 * Fires actions to run once the post status has been changed
     5384                 * from private to published
     5385                 *
     5386                 * @deprecated Use 'private_to_publish' instead.
     5387                 *
     5388                 * @since 1.5.2
     5389                 *
     5390                 * @param int $post->ID The Post ID.
     5391                 */
    48595392                do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish
    48605393        }
    48615394
     
    49015434 */
    49025435function _publish_post_hook($post_id) {
    49035436        if ( defined('XMLRPC_REQUEST') )
     5437                /**
     5438                 * Fires actions to be run before scheduling,
     5439                 * provided XMLRPC_REQUEST is defined.
     5440                 *
     5441                 * @since 2.1.0
     5442                 *
     5443                 * @param int $post_id The Post ID.
     5444                 */
    49045445                do_action('xmlrpc_publish_post', $post_id);
    49055446
    49065447        if ( defined('WP_IMPORTING') )
     
    49085449
    49095450        if ( get_option('default_pingback_flag') )
    49105451                add_post_meta( $post_id, '_pingme', '1' );
     5452               
    49115453        add_post_meta( $post_id, '_encloseme', '1' );
    49125454
    49135455        wp_schedule_single_event(time(), 'do_pings');