~ubuntu-branches/debian/jessie/wordpress/jessie

« back to all changes in this revision

Viewing changes to wp-includes/post-template.php

  • Committer: Package Import Robot
  • Author(s): Craig Small
  • Date: 2014-04-17 20:56:19 UTC
  • mfrom: (1.2.35)
  • Revision ID: package-import@ubuntu.com-20140417205619-nurbet6eho4yvwfv
Tags: 3.9+dfsg-1
* New upstream release
* 3.9 seems to handle different locations for plugins so the
  plugin directory handling patches have been cut back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
 *
97
97
 * @since 0.71
98
98
 *
99
 
 * @param int|object $post Optional. Post ID or object.
 
99
 * @param int|WP_Post $post Optional. Post ID or post object.
100
100
 * @return string
101
101
 */
102
102
function get_the_title( $post = 0 ) {
107
107
 
108
108
        if ( ! is_admin() ) {
109
109
                if ( ! empty( $post->post_password ) ) {
 
110
 
 
111
                        /**
 
112
                         * Filter the text prepended to the post title for protected posts.
 
113
                         *
 
114
                         * The filter is only applied on the front end.
 
115
                         *
 
116
                         * @since 2.8.0
 
117
                         *
 
118
                         * @param string $prepend Text displayed before the post title.
 
119
                         *                        Default 'Protected: %s'.
 
120
                         */
110
121
                        $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ) );
111
122
                        $title = sprintf( $protected_title_format, $title );
112
123
                } else if ( isset( $post->post_status ) && 'private' == $post->post_status ) {
 
124
 
 
125
                        /**
 
126
                         * Filter the text prepended to the post title of private posts.
 
127
                         *
 
128
                         * The filter is only applied on the front end.
 
129
                         *
 
130
                         * @since 2.8.0
 
131
                         *
 
132
                         * @param string $prepend Text displayed before the post title.
 
133
                         *                        Default 'Private: %s'.
 
134
                         */
113
135
                        $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ) );
114
136
                        $title = sprintf( $private_title_format, $title );
115
137
                }
116
138
        }
117
139
 
 
140
        /**
 
141
         * Filter the post title.
 
142
         *
 
143
         * @since 0.71
 
144
         *
 
145
         * @param string $title The post title.
 
146
         * @param int    $id    The post ID.
 
147
         */
118
148
        return apply_filters( 'the_title', $title, $id );
119
149
}
120
150
 
129
159
 *
130
160
 * @since 1.5.0
131
161
 *
132
 
 * @param int $id Optional. Post ID.
 
162
 * @param int|WP_Post $id Optional. Post ID or post object.
133
163
 */
134
164
function the_guid( $id = 0 ) {
135
165
        echo esc_url( get_the_guid( $id ) );
144
174
 *
145
175
 * @since 1.5.0
146
176
 *
147
 
 * @param int $id Optional. Post ID.
 
177
 * @param int|WP_Post $id Optional. Post ID or post object.
148
178
 * @return string
149
179
 */
150
180
function get_the_guid( $id = 0 ) {
151
181
        $post = get_post($id);
152
182
 
153
 
        return apply_filters('get_the_guid', $post->guid);
 
183
        /**
 
184
         * Filter the Global Unique Identifier (guid) of the post.
 
185
         *
 
186
         * @since 1.5.0
 
187
         *
 
188
         * @param string $post_guid Global Unique Identifier (guid) of the post.
 
189
         */
 
190
        return apply_filters( 'get_the_guid', $post->guid );
154
191
}
155
192
 
156
193
/**
163
200
 */
164
201
function the_content( $more_link_text = null, $strip_teaser = false) {
165
202
        $content = get_the_content( $more_link_text, $strip_teaser );
 
203
 
 
204
        /**
 
205
         * Filter the post content.
 
206
         *
 
207
         * @since 0.71
 
208
         *
 
209
         * @param string $content Content of the current post.
 
210
         */
166
211
        $content = apply_filters( 'the_content', $content );
167
212
        $content = str_replace( ']]>', ']]>', $content );
168
213
        echo $content;
221
266
                        $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
222
267
                } else {
223
268
                        if ( ! empty( $more_link_text ) )
 
269
 
 
270
                                /**
 
271
                                 * Filter the Read More link text.
 
272
                                 *
 
273
                                 * @since 2.8.0
 
274
                                 *
 
275
                                 * @param string $more_link_element Read More link element.
 
276
                                 * @param string $more_link_text    Read More text.
 
277
                                 */
224
278
                                $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
225
279
                        $output = force_balance_tags( $output );
226
280
                }
248
302
 * Display the post excerpt.
249
303
 *
250
304
 * @since 0.71
251
 
 * @uses apply_filters() Calls 'the_excerpt' hook on post excerpt.
252
305
 */
253
306
function the_excerpt() {
254
 
        echo apply_filters('the_excerpt', get_the_excerpt());
 
307
 
 
308
        /**
 
309
         * Filter the displayed post excerpt.
 
310
         *
 
311
         * @since 0.71
 
312
         *
 
313
         * @see get_the_excerpt()
 
314
         *
 
315
         * @param string $post_excerpt The post excerpt.
 
316
         */
 
317
        echo apply_filters( 'the_excerpt', get_the_excerpt() );
255
318
}
256
319
 
257
320
/**
272
335
                return __( 'There is no excerpt because this is a protected post.' );
273
336
        }
274
337
 
 
338
        /**
 
339
         * Filter the retrieved post excerpt.
 
340
         *
 
341
         * @since 1.2.0
 
342
         *
 
343
         * @param string $post_excerpt The post excerpt.
 
344
         */
275
345
        return apply_filters( 'get_the_excerpt', $post->post_excerpt );
276
346
}
277
347
 
280
350
 *
281
351
 * @since 2.3.0
282
352
 *
283
 
 * @param int $id Optional. Post ID.
 
353
 * @param int|WP_Post $id Optional. Post ID or post object.
284
354
 * @return bool
285
355
 */
286
356
function has_excerpt( $id = 0 ) {
294
364
 * @since 2.7.0
295
365
 *
296
366
 * @param string|array $class One or more classes to add to the class list.
297
 
 * @param int $post_id An optional post ID.
 
367
 * @param int|WP_Post $post_id Optional. Post ID or post object.
298
368
 */
299
369
function post_class( $class = '', $post_id = null ) {
300
370
        // Separates classes with a single space, collates classes for post DIV
304
374
/**
305
375
 * Retrieve the classes for the post div as an array.
306
376
 *
307
 
 * The class names are add are many. If the post is a sticky, then the 'sticky'
308
 
 * class name. The class 'hentry' is always added to each post. For each
 
377
 * The class names are many. If the post is a sticky, then the 'sticky'
 
378
 * class name. The class 'hentry' is always added to each post. If the post has a
 
379
 * post thumbnail, 'has-post-thumbnail' is added as a class. For each
309
380
 * category, the class will be added with 'category-' with category slug is
310
381
 * added. The tags are the same way as the categories with 'tag-' before the tag
311
382
 * slug. All classes are passed through the filter, 'post_class' with the list
315
386
 * @since 2.7.0
316
387
 *
317
388
 * @param string|array $class One or more classes to add to the class list.
318
 
 * @param int $post_id An optional post ID.
 
389
 * @param int|WP_Post $post_id Optional. Post ID or post object.
319
390
 * @return array Array of classes.
320
391
 */
321
392
function get_post_class( $class = '', $post_id = null ) {
342
413
                        $classes[] = 'format-standard';
343
414
        }
344
415
 
345
 
        // post requires password
346
 
        if ( post_password_required($post->ID) )
 
416
        // Post requires password
 
417
        if ( post_password_required( $post->ID ) ) {
347
418
                $classes[] = 'post-password-required';
 
419
        // Post thumbnails
 
420
        } elseif ( ! is_attachment( $post ) && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) {
 
421
                $classes[] = 'has-post-thumbnail';
 
422
        }
348
423
 
349
424
        // sticky for Sticky Posts
350
425
        if ( is_sticky($post->ID) && is_home() && !is_paged() )
379
454
 
380
455
        $classes = array_map('esc_attr', $classes);
381
456
 
382
 
        return apply_filters('post_class', $classes, $class, $post->ID);
 
457
        /**
 
458
         * Filter the list of CSS classes for the current post.
 
459
         *
 
460
         * @since 2.7.0
 
461
         *
 
462
         * @param array  $classes An array of post classes.
 
463
         * @param string $class   A comma-separated list of additional classes added to the post.
 
464
         * @param int    $post_id The post ID.
 
465
         */
 
466
        return apply_filters( 'post_class', $classes, $class, $post->ID );
383
467
}
384
468
 
385
469
/**
563
647
 
564
648
        $classes = array_map( 'esc_attr', $classes );
565
649
 
 
650
        /**
 
651
         * Filter the list of CSS body classes for the current post or page.
 
652
         *
 
653
         * @since 2.8.0
 
654
         *
 
655
         * @param array  $classes An array of body classes.
 
656
         * @param string $class   A comma-separated list of additional classes added to the body.
 
657
         */
566
658
        return apply_filters( 'body_class', $classes, $class );
567
659
}
568
660
 
593
685
        return ! $hasher->CheckPassword( $post->post_password, $hash );
594
686
}
595
687
 
596
 
/**
597
 
 * Page Template Functions for usage in Themes
598
 
 *
599
 
 * @package WordPress
600
 
 * @subpackage Template
601
 
 */
 
688
//
 
689
// Page Template Functions for usage in Themes
 
690
//
602
691
 
603
692
/**
604
693
 * The formatted output of a list of pages.
650
739
        );
651
740
 
652
741
        $r = wp_parse_args( $args, $defaults );
 
742
 
 
743
        /**
 
744
         * Filter the arguments used in retrieving page links for paginated posts.
 
745
         *
 
746
         * @since 3.0.0
 
747
         *
 
748
         * @param array $r An array of arguments for page links for paginated posts.
 
749
         */
653
750
        $r = apply_filters( 'wp_link_pages_args', $r );
654
751
        extract( $r, EXTR_SKIP );
655
752
 
663
760
                                $link = $link_before . str_replace( '%', $i, $pagelink ) . $link_after;
664
761
                                if ( $i != $page || ! $more && 1 == $page )
665
762
                                        $link = _wp_link_page( $i ) . $link . '</a>';
 
763
 
 
764
                                /**
 
765
                                 * Filter the HTML output of individual page number links.
 
766
                                 *
 
767
                                 * @since 3.6.0
 
768
                                 *
 
769
                                 * @param string $link The page number HTML output.
 
770
                                 * @param int    $i    Page number for paginated posts' page links.
 
771
                                 */
666
772
                                $link = apply_filters( 'wp_link_pages_link', $link, $i );
667
773
                                $output .= $separator . $link;
668
774
                        }
672
778
                        $i = $page - 1;
673
779
                        if ( $i ) {
674
780
                                $link = _wp_link_page( $i ) . $link_before . $previouspagelink . $link_after . '</a>';
 
781
 
 
782
                                /** This filter is documented in wp-includes/post-template.php */
675
783
                                $link = apply_filters( 'wp_link_pages_link', $link, $i );
676
784
                                $output .= $separator . $link;
677
785
                        }
678
786
                        $i = $page + 1;
679
787
                        if ( $i <= $numpages ) {
680
788
                                $link = _wp_link_page( $i ) . $link_before . $nextpagelink . $link_after . '</a>';
 
789
 
 
790
                                /** This filter is documented in wp-includes/post-template.php */
681
791
                                $link = apply_filters( 'wp_link_pages_link', $link, $i );
682
792
                                $output .= $separator . $link;
683
793
                        }
685
795
                }
686
796
        }
687
797
 
 
798
        /**
 
799
         * Filter the HTML output of page links for paginated posts.
 
800
         *
 
801
         * @since 3.6.0
 
802
         *
 
803
         * @param string $output HTML output of paginated posts' page links.
 
804
         * @param array  $args   An array of arguments.
 
805
         */
688
806
        $output = apply_filters( 'wp_link_pages', $output, $args );
689
807
 
690
808
        if ( $echo )
717
835
                        $url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
718
836
        }
719
837
 
 
838
        if ( is_preview() ) {
 
839
                $url = add_query_arg( array(
 
840
                        'preview' => 'true'
 
841
                ), $url );
 
842
 
 
843
                if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) {
 
844
                        $url = add_query_arg( array(
 
845
                                'preview_id'    => wp_unslash( $_GET['preview_id'] ),
 
846
                                'preview_nonce' => wp_unslash( $_GET['preview_nonce'] )
 
847
                        ), $url );
 
848
                }
 
849
        }
 
850
 
720
851
        return '<a href="' . esc_url( $url ) . '">';
721
852
}
722
853
 
759
890
                                continue;
760
891
                        $values = array_map('trim', get_post_custom_values($key));
761
892
                        $value = implode($values,', ');
762
 
                        echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value);
 
893
 
 
894
                        /**
 
895
                         * Filter the HTML output of the li element in the post custom fields list.
 
896
                         *
 
897
                         * @since 2.2.0
 
898
                         *
 
899
                         * @param string $html  The HTML output for the li element.
 
900
                         * @param string $key   Meta key.
 
901
                         * @param string $value Meta value.
 
902
                         */
 
903
                        echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
763
904
                }
764
905
                echo "</ul>\n";
765
906
        }
805
946
                $output .= "</select>\n";
806
947
        }
807
948
 
808
 
        $output = apply_filters('wp_dropdown_pages', $output);
 
949
        /**
 
950
         * Filter the HTML output of a list of pages as a drop down.
 
951
         *
 
952
         * @since 2.1.0
 
953
         *
 
954
         * @param string $output HTML output for drop down list of pages.
 
955
         */
 
956
        $output = apply_filters( 'wp_dropdown_pages', $output );
809
957
 
810
958
        if ( $echo )
811
959
                echo $output;
842
990
 
843
991
        // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)
844
992
        $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array();
845
 
        $r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', $exclude_array) );
 
993
 
 
994
        /**
 
995
         * Filter the array of pages to exclude from the pages list.
 
996
         *
 
997
         * @since 2.1.0
 
998
         *
 
999
         * @param array $exclude_array An array of page IDs to exclude.
 
1000
         */
 
1001
        $r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
846
1002
 
847
1003
        // Query pages.
848
1004
        $r['hierarchical'] = 0;
853
1009
                        $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
854
1010
 
855
1011
                global $wp_query;
856
 
                if ( is_page() || is_attachment() || $wp_query->is_posts_page )
857
 
                        $current_page = $wp_query->get_queried_object_id();
 
1012
                if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
 
1013
                        $current_page = get_queried_object_id();
 
1014
                } elseif ( is_singular() ) {
 
1015
                        $queried_object = get_queried_object();
 
1016
                        if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
 
1017
                                $current_page = $queried_object->ID;
 
1018
                        }
 
1019
                }
 
1020
 
858
1021
                $output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
859
1022
 
860
1023
                if ( $r['title_li'] )
861
1024
                        $output .= '</ul></li>';
862
1025
        }
863
1026
 
864
 
        $output = apply_filters('wp_list_pages', $output, $r);
 
1027
        /**
 
1028
         * Filter the HTML output of the pages to list.
 
1029
         *
 
1030
         * @since 1.5.1
 
1031
         *
 
1032
         * @see wp_list_pages()
 
1033
         *
 
1034
         * @param string $output HTML output of the pages list.
 
1035
         * @param array  $r      An array of page-listing arguments.
 
1036
         */
 
1037
        $output = apply_filters( 'wp_list_pages', $output, $r );
865
1038
 
866
1039
        if ( $r['echo'] )
867
1040
                echo $output;
898
1071
function wp_page_menu( $args = array() ) {
899
1072
        $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
900
1073
        $args = wp_parse_args( $args, $defaults );
 
1074
 
 
1075
        /**
 
1076
         * Filter the arguments used to generate a page-based menu.
 
1077
         *
 
1078
         * @since 2.7.0
 
1079
         *
 
1080
         * @see wp_page_menu()
 
1081
         *
 
1082
         * @param array $args An array of page menu arguments.
 
1083
         */
901
1084
        $args = apply_filters( 'wp_page_menu_args', $args );
902
1085
 
903
1086
        $menu = '';
933
1116
                $menu = '<ul>' . $menu . '</ul>';
934
1117
 
935
1118
        $menu = '<div class="' . esc_attr($args['menu_class']) . '">' . $menu . "</div>\n";
 
1119
 
 
1120
        /**
 
1121
         * Filter the HTML output of a page-based menu.
 
1122
         *
 
1123
         * @since 2.7.0
 
1124
         *
 
1125
         * @see wp_page_menu()
 
1126
         *
 
1127
         * @param string $menu The HTML output.
 
1128
         * @param array  $args An array of arguments.
 
1129
         */
936
1130
        $menu = apply_filters( 'wp_page_menu', $menu, $args );
937
1131
        if ( $args['echo'] )
938
1132
                echo $menu;
986
1180
/**
987
1181
 * Create HTML list of pages.
988
1182
 *
989
 
 * @package WordPress
990
1183
 * @since 2.1.0
991
1184
 * @uses Walker
992
1185
 */
1066
1259
                        $css_class[] = 'current_page_parent';
1067
1260
                }
1068
1261
 
 
1262
                /**
 
1263
                 * Filter the list of CSS classes to include with each page item in the list.
 
1264
                 *
 
1265
                 * @since 2.8.0
 
1266
                 *
 
1267
                 * @see wp_list_pages()
 
1268
                 *
 
1269
                 * @param array   $css_class    An array of CSS classes to be applied
 
1270
                 *                             to each list item.
 
1271
                 * @param WP_Post $page         Page data object.
 
1272
                 * @param int     $depth        Depth of page, used for padding.
 
1273
                 * @param array   $args         An array of arguments.
 
1274
                 * @param int     $current_page ID of the current page.
 
1275
                 */
1069
1276
                $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
1070
1277
 
1071
1278
                if ( '' === $page->post_title )
1102
1309
/**
1103
1310
 * Create HTML dropdown list of pages.
1104
1311
 *
1105
 
 * @package WordPress
1106
1312
 * @since 2.1.0
1107
1313
 * @uses Walker
1108
1314
 */
1139
1345
                if ( $page->ID == $args['selected'] )
1140
1346
                        $output .= ' selected="selected"';
1141
1347
                $output .= '>';
1142
 
                $title = apply_filters( 'list_pages', $page->post_title, $page );
 
1348
 
 
1349
                $title = $page->post_title;
 
1350
                if ( '' === $title ) {
 
1351
                        $title = sprintf( __( '#%d (no title)' ), $page->ID );
 
1352
                }
 
1353
 
 
1354
                /**
 
1355
                 * Filter the page title when creating an HTML drop-down list of pages.
 
1356
                 *
 
1357
                 * @since 3.1.0
 
1358
                 *
 
1359
                 * @param string $title Page title.
 
1360
                 * @param object $page  Page data object.
 
1361
                 */
 
1362
                $title = apply_filters( 'list_pages', $title, $page );
1143
1363
                $output .= $pad . esc_html( $title );
1144
1364
                $output .= "</option>\n";
1145
1365
        }
1154
1374
 *
1155
1375
 * @since 2.0.0
1156
1376
 *
1157
 
 * @param int $id Optional. Post ID.
 
1377
 * @param int|WP_Post $id Optional. Post ID or post object.
1158
1378
 * @param bool $fullsize Optional, default is false. Whether to use full size.
1159
1379
 * @param bool $deprecated Deprecated. Not used.
1160
1380
 * @param bool $permalink Optional, default is false. Whether to include permalink.
1175
1395
 * @since 2.5.0
1176
1396
 * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function.
1177
1397
 *
1178
 
 * @param int $id Optional. Post ID.
 
1398
 * @param int|WP_Post $id Optional. Post ID or post object.
1179
1399
 * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string.
1180
1400
 * @param bool $permalink Optional, default is false. Whether to add permalink to image.
1181
1401
 * @param bool $icon Optional, default is false. Whether to include icon.
1204
1424
        if ( trim( $link_text ) == '' )
1205
1425
                $link_text = $_post->post_title;
1206
1426
 
 
1427
        /**
 
1428
         * Filter a retrieved attachment page link.
 
1429
         *
 
1430
         * @since 2.7.0
 
1431
         *
 
1432
         * @param string      $link_html The page link HTML output.
 
1433
         * @param int         $id        Post ID.
 
1434
         * @param string      $size      Image size. Default 'thumbnail'.
 
1435
         * @param bool        $permalink Whether to add permalink to image. Default false.
 
1436
         * @param bool        $icon      Whether to include an icon. Default false.
 
1437
         * @param string|bool $text      If string, will be link text. Default false.
 
1438
         */
1207
1439
        return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text );
1208
1440
}
1209
1441
 
1211
1443
 * Wrap attachment in <<p>> element before content.
1212
1444
 *
1213
1445
 * @since 2.0.0
1214
 
 * @uses apply_filters() Calls 'prepend_attachment' hook on HTML content.
1215
1446
 *
1216
1447
 * @param string $content
1217
1448
 * @return string
1222
1453
        if ( empty($post->post_type) || $post->post_type != 'attachment' )
1223
1454
                return $content;
1224
1455
 
1225
 
        $p = '<p class="attachment">';
1226
 
        // show the medium sized image representation of the attachment if available, and link to the raw file
1227
 
        $p .= wp_get_attachment_link(0, 'medium', false);
1228
 
        $p .= '</p>';
1229
 
        $p = apply_filters('prepend_attachment', $p);
 
1456
        if ( 0 === strpos( $post->post_mime_type, 'video' ) ) {
 
1457
                $meta = wp_get_attachment_metadata( get_the_ID() );
 
1458
                $atts = array( 'src' => wp_get_attachment_url() );
 
1459
                if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
 
1460
                        $atts['width'] = (int) $meta['width'];
 
1461
                        $atts['height'] = (int) $meta['height'];
 
1462
                }
 
1463
                $p = wp_video_shortcode( $atts );
 
1464
        } elseif ( 0 === strpos( $post->post_mime_type, 'audio' ) ) {
 
1465
                $p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
 
1466
        } else {
 
1467
                $p = '<p class="attachment">';
 
1468
                // show the medium sized image representation of the attachment if available, and link to the raw file
 
1469
                $p .= wp_get_attachment_link(0, 'medium', false);
 
1470
                $p .= '</p>';
 
1471
        }
 
1472
 
 
1473
        /**
 
1474
         * Filter the attachment markup to be prepended to the post content.
 
1475
         *
 
1476
         * @since 2.0.0
 
1477
         *
 
1478
         * @see prepend_attachment()
 
1479
         *
 
1480
         * @param string $p The attachment HTML output.
 
1481
         */
 
1482
        $p = apply_filters( 'prepend_attachment', $p );
1230
1483
 
1231
1484
        return "$p\n$content";
1232
1485
}
1240
1493
 *
1241
1494
 * @since 1.0.0
1242
1495
 * @uses apply_filters() Calls 'the_password_form' filter on output.
1243
 
 * @param int|WP_Post $post Optional. A post id or post object. Defaults to the current post when in The Loop, undefined otherwise.
 
1496
 * @param int|WP_Post $post Optional. A post ID or post object.
1244
1497
 * @return string HTML content for password form for password protected post.
1245
1498
 */
1246
1499
function get_the_password_form( $post = 0 ) {
1250
1503
        <p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p>
1251
1504
        <p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__( 'Submit' ) . '" /></p></form>
1252
1505
        ';
 
1506
 
 
1507
        /**
 
1508
         * Filter the HTML output for the protected post password form.
 
1509
         *
 
1510
         * If modifying the password field, please note that the core database schema
 
1511
         * limits the password field to 20 characters regardless of the value of the
 
1512
         * size attribute in the form input.
 
1513
         *
 
1514
         * @since 2.7.0
 
1515
         *
 
1516
         * @param string $output The password form HTML output.
 
1517
         */
1253
1518
        return apply_filters( 'the_password_form', $output );
1254
1519
}
1255
1520
 
1306
1571
/**
1307
1572
 * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
1308
1573
 *
1309
 
 * @package WordPress
1310
 
 * @subpackage Post_Revisions
1311
1574
 * @since 2.6.0
1312
1575
 *
1313
1576
 * @uses date_i18n()
1345
1608
/**
1346
1609
 * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
1347
1610
 *
1348
 
 * @package WordPress
1349
 
 * @subpackage Post_Revisions
1350
1611
 * @since 3.6.0
1351
1612
 *
1352
1613
 * @uses date_i18n()
1398
1659
 * Can output either a UL with edit links or a TABLE with diff interface, and
1399
1660
 * restore action links.
1400
1661
 *
1401
 
 * @package WordPress
1402
 
 * @subpackage Post_Revisions
1403
1662
 * @since 2.6.0
1404
1663
 *
1405
1664
 * @uses wp_get_post_revisions()
1407
1666
 * @uses get_edit_post_link()
1408
1667
 * @uses get_the_author_meta()
1409
1668
 *
1410
 
 * @param int|object $post_id Post ID or post object.
 
1669
 * @param int|WP_Post $post_id Optional. Post ID or post object.
1411
1670
 * @param string $type 'all' (default), 'revision' or 'autosave'
1412
1671
 * @return null
1413
1672
 */
1442
1701
        echo $rows;
1443
1702
        echo "</ul>";
1444
1703
}
1445
 
 
1446
 
/**
1447
 
 * Dashboard CSS fixes for 3.8.2.
1448
 
 *
1449
 
 * This function cheaply fixes #WP27082 and #WP26910 in lieu of
1450
 
 * changing the massive wp-admin.css file in a point release.
1451
 
 * This lucky includes file was already receiving an update.
1452
 
 *
1453
 
 * @since 3.8.2
1454
 
 * @access private
1455
 
 */
1456
 
function wp_382_css_hotfix() {
1457
 
        echo '<style type="text/css">
1458
 
#activity-widget #the-comment-list .comment-item { position: relative; }
1459
 
.tagsdiv .newtag { padding: 6px 10px; height: auto; }
1460
 
</style>
1461
 
';
1462
 
}
1463
 
add_action( 'admin_print_styles', 'wp_382_css_hotfix', 30 );