Ticket #27431: 27431.2.diff
File 27431.2.diff, 10.1 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/class-wp-posts-list-table.php
90 90 $post_type = $this->screen->post_type; 91 91 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); 92 92 93 /** 94 * Filter the number of posts displayed per page on the Posts list table. 95 * 96 * @since 2.8.0 97 * 98 * @param int $per_page Number of posts to be displayed. Default 20. 99 * @param string $post_type The post type. 100 */ 93 /** This filter is documented in wp-admin/includes/post.php */ 101 94 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 102 95 103 96 if ( $this->hierarchical_display ) -
src/wp-admin/includes/post.php
274 274 } 275 275 276 276 $attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array(); 277 277 278 /** This filter is documented in wp-admin/includes/media.php */ 278 279 $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data ); 279 280 } … … 495 496 $post = new WP_Post( $post ); 496 497 } 497 498 499 /** 500 * Filter the default post content initially used in the "Write Post" post form. 501 * 502 * @since 1.5.0 503 * 504 * @param string $post_content Default post content. 505 * @param WP_Post $post Post object. 506 */ 498 507 $post->post_content = apply_filters( 'default_content', $post_content, $post ); 499 $post->post_title = apply_filters( 'default_title', $post_title, $post ); 508 509 /** 510 * Filter the default post title initially used in the "Write Post" post form. 511 * 512 * @since 1.5.0 513 * 514 * @param string $post_title Default post title. 515 * @param WP_Post $post Post object. 516 */ 517 $post->post_title = apply_filters( 'default_title', $post_title, $post ); 518 519 /** 520 * Filter the default post excerpt initially used in the "Write Post" post form. 521 * 522 * @since 1.5.0 523 * 524 * @param string $post_excerpt Default post excerpt. 525 * @param WP_Post $post Post object. 526 */ 500 527 $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post ); 501 528 $post->post_name = ''; 502 529 … … 865 892 if ( empty( $posts_per_page ) || $posts_per_page < 1 ) 866 893 $posts_per_page = 20; 867 894 895 /** 896 * Filter the number of items per page to show for a specific 'per_page' type. 897 * 898 * The dynamic hook name, $per_page, refers to a hook name comprised of the post type, 899 * preceded by 'edit_', and succeeded by '_per_page', e.g. 'edit_$post_type_per_page'. 900 * 901 * Some examples of filter hooks generated here include: 'edit_attachment_per_page', 902 * 'edit_post_per_page', 'edit_page_per_page', etc. 903 * 904 * @since 3.0.0 905 * 906 * @param int $posts_per_page Number of posts to display per page for the given 'per_page' 907 * type. Default 20. 908 */ 868 909 $posts_per_page = apply_filters( $per_page, $posts_per_page ); 910 911 /** 912 * Filter the number of posts displayed per page when specifically listing "posts". 913 * 914 * @since 2.8.0 915 * 916 * @param int $per_page Number of posts to be displayed. Default 20. 917 * @param string $post_type The post type. 918 */ 869 919 $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type ); 870 920 871 921 $query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page'); … … 906 956 * can be passed in, which will override the arguments set by this function. 907 957 * 908 958 * @since 2.5.0 909 * @uses apply_filters() Calls 'upload_per_page' on posts_per_page argument910 959 * 911 960 * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal. 912 961 * @return array … … 927 976 $media_per_page = (int) get_user_option( 'upload_per_page' ); 928 977 if ( empty( $media_per_page ) || $media_per_page < 1 ) 929 978 $media_per_page = 20; 979 980 /** 981 * Filter the number of items to list per page when listing media items. 982 * 983 * @since 2.9.0 984 * 985 * @param int $media_per_page Number of media to list. Default 20. 986 */ 930 987 $q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page ); 931 988 932 989 $post_mime_types = get_post_mime_types(); … … 966 1023 $classes = array( '' ); 967 1024 } 968 1025 1026 /** 1027 * Filter the postbox classes for a specific screen and screen ID combo. 1028 * 1029 * The dynamic portions of the hook name, $page, and $id, refer to 1030 * the screen, and screen ID, respectively. 1031 * 1032 * @since 3.2.0 1033 * 1034 * @param array $classes An array of postbox classes. 1035 */ 969 1036 $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes ); 970 1037 return implode( ' ', $classes ); 971 1038 } … … 1017 1084 $uri = untrailingslashit($uri); 1018 1085 $uri = strrev( stristr( strrev( $uri ), '/' ) ); 1019 1086 $uri = untrailingslashit($uri); 1087 1088 /** This filter is documented in wp-admin/edit-tag-form.php */ 1020 1089 $uri = apply_filters( 'editable_slug', $uri ); 1021 1090 if ( !empty($uri) ) 1022 1091 $uri .= '/'; … … 1023 1092 $permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink); 1024 1093 } 1025 1094 1026 $permalink = array($permalink, apply_filters('editable_slug', $post->post_name)); 1095 /** This filter is documented in wp-admin/edit-tag-form.php */ 1096 $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name ) ); 1027 1097 $post->post_status = $original_status; 1028 1098 $post->post_date = $original_date; 1029 1099 $post->post_name = $original_name; … … 1067 1137 if ( isset( $view_post ) ) 1068 1138 $return .= "<span id='view-post-btn'><a href='$permalink' class='button button-small'>$view_post</a></span>\n"; 1069 1139 1070 $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); 1140 /** 1141 * Filter the sample permalink HTML markup to return. 1142 * 1143 * @since 2.9.0 1144 * 1145 * @param string $return Sample permalink HTML markup. 1146 * @param int|WP_Post $id Post object or ID. 1147 * @param string $new_title New sample permalink title. 1148 * @param string $new_slug New sample permalink slug. 1149 */ 1150 $return = apply_filters( 'get_sample_permalink_html', $return, $id, $new_title, $new_slug ); 1071 1151 1072 1152 return $return; 1073 1153 } … … 1099 1179 $return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n"; 1100 1180 } 1101 1181 1102 $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); 1182 /** This filter is documented in wp-admin/includes/post.php */ 1183 $return = apply_filters( 'get_sample_permalink_html', $return, $id, $new_title, $new_slug ); 1103 1184 1104 1185 return $return; 1105 1186 } … … 1137 1218 $content_width = $old_content_width; 1138 1219 } 1139 1220 1221 /** 1222 * Filter the admin post thumbnail HTML markup to return. 1223 * 1224 * @since 2.9.0 1225 * 1226 * @param string $content Admin post thumbnail HTML markup. 1227 * @param int $post_id Post ID. 1228 */ 1140 1229 return apply_filters( 'admin_post_thumbnail_html', $content, $post->ID ); 1141 1230 } 1142 1231 … … 1159 1248 $time = $lock[0]; 1160 1249 $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true ); 1161 1250 1251 /** This filter is documented in wp-admin/includes/ajax-actions.php */ 1162 1252 $time_window = apply_filters( 'wp_check_post_lock_window', 150 ); 1163 1253 1164 1254 if ( $time && $time > time() - $time_window && $user != get_current_user_id() ) … … 1203 1293 $user = get_userdata( $user_id ); 1204 1294 1205 1295 if ( $user ) { 1296 /** 1297 * Filter whether to show the post locked dialog. 1298 * 1299 * Returning a falsey value to the filter will short-circuit displaying the dialog. 1300 * 1301 * @since 3.6.0 1302 * 1303 * @param bool $display Whether to display the dialog. Default true. 1304 * @param WP_User|bool $user WP_User object on success, false otherwise. 1305 */ 1206 1306 if ( ! apply_filters( 'show_post_locked_dialog', true, $post, $user ) ) 1207 1307 return; 1208 1308 … … 1245 1345 $preview_link = ''; 1246 1346 } 1247 1347 1348 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 1248 1349 $preview_link = apply_filters( 'preview_post_link', $preview_link ); 1350 1351 /** 1352 * Filter whether to allow the post lock to be overridden. 1353 * 1354 * Returning a falsey value to the filter will disable the ability 1355 * to override the post lock. 1356 * 1357 * @since 3.6.0 1358 * 1359 * @param bool $override Whether to allow overriding post locks. Default true. 1360 * @param WP_Post $post Post object. 1361 * @param WP_User $user User object. 1362 */ 1249 1363 $override = apply_filters( 'override_post_lock', true, $post, $user ); 1250 1364 $tab_last = $override ? '' : ' wp-tab-last'; 1251 1365 … … 1259 1373 printf( ' ' . __( 'If you take over, %s will be blocked from continuing to edit.' ), esc_html( $user->display_name ) ); 1260 1374 ?> 1261 1375 </p> 1262 <?php do_action( 'post_locked_dialog', $post ); ?> 1376 <?php 1377 /** 1378 * Fires inside the post locked dialog before the buttons are displayed. 1379 * 1380 * @since 3.6.0 1381 * 1382 * @param WP_Post $post Post object. 1383 */ 1384 do_action( 'post_locked_dialog', $post ); 1385 ?> 1263 1386 <p> 1264 1387 <a class="button" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a> 1265 1388 <?php if ( $preview_link ) { ?> … … 1287 1410 <span class="locked-saving hidden"><img src="images/wpspin_light-2x.gif" width="16" height="16" /> <?php _e('Saving revision...'); ?></span> 1288 1411 <span class="locked-saved hidden"><?php _e('Your latest changes were saved as a revision.'); ?></span> 1289 1412 </p> 1290 <?php do_action( 'post_lock_lost_dialog', $post ); ?> 1413 <?php 1414 /** 1415 * Fires inside the dialog displayed when a user has lost the post lock. 1416 * 1417 * @since 3.6.0 1418 * 1419 * @param WP_Post $post Post object. 1420 */ 1421 do_action( 'post_lock_lost_dialog', $post ); 1422 ?> 1291 1423 <p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a></p> 1292 1424 </div> 1293 1425 <?php … … 1412 1544 } 1413 1545 1414 1546 $url = add_query_arg( $query_args, get_permalink( $post->ID ) ); 1547 1548 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 1415 1549 return apply_filters( 'preview_post_link', $url ); 1416 1550 } 1417 1551