In the style of #30947 and default-filters.php, add 2 new files to wp-admin/includes:

`admin-filters.php`
`ms-admin-filters.php`

There are random actions and filters littered among files like `misc.php`. These files contain functions that won't work outside of admin context and are typically only loaded in files that have already loaded the admin bootstrap.

See #32529.

Built from https://develop.svn.wordpress.org/trunk@32653


git-svn-id: http://core.svn.wordpress.org/trunk@32623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-05-29 17:04:26 +00:00
parent 9a29d8ac7b
commit a51dfa3971
19 changed files with 142 additions and 92 deletions

View File

@ -0,0 +1,107 @@
<?php
/**
* Administration hooks
*
* @package WordPress
*
* @since 4.3.0
*/
/** Bookmark hooks */
add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' );
/** Dashboard hooks */
add_action( 'activity_box_end', 'wp_dashboard_quota' );
/** Media hooks */
add_filter( 'media_upload_tabs', 'update_gallery_tab' );
add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
add_action( 'media_buttons', 'media_buttons' );
add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 );
add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 );
add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
add_action( 'post-html-upload-ui', 'media_upload_html_bypass' );
add_filter( 'async_upload_image', 'get_media_item', 10, 2 );
add_filter( 'async_upload_audio', 'get_media_item', 10, 2 );
add_filter( 'async_upload_video', 'get_media_item', 10, 2 );
add_filter( 'async_upload_file', 'get_media_item', 10, 2 );
add_action( 'media_upload_image', 'wp_media_upload_handler' );
add_action( 'media_upload_audio', 'wp_media_upload_handler' );
add_action( 'media_upload_video', 'wp_media_upload_handler' );
add_action( 'media_upload_file', 'wp_media_upload_handler' );
add_filter( 'media_upload_gallery', 'media_upload_gallery' );
add_filter( 'media_upload_library', 'media_upload_library' );
add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' );
/** Misc hooks */
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 );
add_action( 'admin_head', 'wp_color_scheme_settings' );
add_action( 'admin_head', '_ipad_meta' );
add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 3 );
add_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 );
add_filter( 'heartbeat_received', 'wp_refresh_post_nonces', 10, 3 );
add_filter( 'heartbeat_settings', 'wp_heartbeat_set_suspension' );
// Run later as we have to set DOING_AUTOSAVE for back-compat
add_filter( 'heartbeat_received', 'heartbeat_autosave', 500, 2 );
add_action( 'post_edit_form_tag', 'post_form_autocomplete_off' );
add_action( 'admin_head', 'wp_admin_canonical_url' );
/** Nav Menu hooks */
add_action( 'admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items' );
/** Plugin hooks */
add_filter( 'whitelist_options', 'option_update_filter' );
/** Plugin Install hooks */
add_action( 'install_plugins_featured', 'install_dashboard' );
add_action( 'install_plugins_upload', 'install_plugins_upload' );
add_action( 'install_plugins_search', 'display_plugins_table' );
add_action( 'install_plugins_popular', 'display_plugins_table' );
add_action( 'install_plugins_recommended', 'display_plugins_table' );
add_action( 'install_plugins_new', 'display_plugins_table' );
add_action( 'install_plugins_beta', 'display_plugins_table' );
add_action( 'install_plugins_favorites', 'display_plugins_table' );
add_action( 'install_plugins_pre_plugin-information', 'install_plugin_information' );
/** Template hooks */
add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
add_action( 'user_register', array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) );
/** Theme hooks */
add_action( 'customize_controls_print_footer_scripts', 'customize_themes_print_templates' );
/** Theme Install hooks */
// add_action('install_themes_dashboard', 'install_themes_dashboard');
// add_action('install_themes_upload', 'install_themes_upload', 10, 0);
// add_action('install_themes_search', 'display_themes');
// add_action('install_themes_featured', 'display_themes');
// add_action('install_themes_new', 'display_themes');
// add_action('install_themes_updated', 'display_themes');
add_action( 'install_themes_pre_theme-information', 'install_theme_information' );
/** User hooks */
add_action( 'admin_init', 'default_password_nag_handler' );
add_action( 'profile_update', 'default_password_nag_edit_user', 10, 2 );
add_action( 'admin_notices', 'default_password_nag' );
/** Update hooks */
add_filter( 'update_footer', 'core_update_footer' );
add_action( 'admin_notices', 'update_nag', 3 );
add_action( 'network_admin_notices', 'update_nag', 3 );
add_action( 'admin_init', 'wp_plugin_update_rows' );
add_action( 'admin_init', 'wp_theme_update_rows' );
add_action( 'admin_notices', 'maintenance_nag' );
add_action( 'network_admin_notices', 'maintenance_nag' );
/** Update Core hooks */
add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
/** Upgrade hooks */
add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );

View File

@ -15,6 +15,9 @@ if ( ! defined('WP_ADMIN') ) {
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' );
}
/** WordPress Administration Hooks */
require_once(ABSPATH . 'wp-admin/includes/admin-filters.php');
/** WordPress Bookmark Administration API */
require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
@ -69,6 +72,7 @@ require_once(ABSPATH . 'wp-admin/includes/deprecated.php');
/** WordPress Multisite support API */
if ( is_multisite() ) {
require_once(ABSPATH . 'wp-admin/includes/ms-admin-filters.php');
require_once(ABSPATH . 'wp-admin/includes/ms.php');
require_once(ABSPATH . 'wp-admin/includes/ms-deprecated.php');
}

View File

@ -116,9 +116,7 @@ function wp_delete_link( $link_id ) {
* @return array The requested link's categories
*/
function wp_get_link_cats( $link_id = 0 ) {
$cats = wp_get_object_terms( $link_id, 'link_category', array('fields' => 'ids') );
return array_unique( $cats );
}
@ -308,4 +306,3 @@ function wp_link_manager_disabled_message() {
wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
}
add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' );

View File

@ -1624,8 +1624,6 @@ class Theme_Upgrader extends WP_Upgrader {
}
add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
/**
* Language pack upgrader, for updating translations of plugins, themes, and core.
*

View File

@ -1197,7 +1197,6 @@ function wp_dashboard_quota() {
</div>
<?php
}
add_action( 'activity_box_end', 'wp_dashboard_quota' );
// Display Browser Nag Meta Box
function wp_dashboard_browser_nag() {

View File

@ -63,7 +63,6 @@ function update_gallery_tab($tabs) {
return $tabs;
}
add_filter('media_upload_tabs', 'update_gallery_tab');
/**
* {@internal Missing Short Description}}
@ -220,7 +219,6 @@ function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $
*/
return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
}
add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
/**
* Private preg_replace callback used in image_add_caption()
@ -577,7 +575,6 @@ function media_buttons($editor_id = 'content') {
echo $legacy_filter;
}
}
add_action( 'media_buttons', 'media_buttons' );
/**
*
@ -1141,8 +1138,6 @@ function image_attachment_fields_to_save( $post, $attachment ) {
return $post;
}
add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 );
/**
* {@internal Missing Short Description}}
*
@ -1168,8 +1163,6 @@ function image_media_send_to_editor($html, $attachment_id, $attachment) {
return $html;
}
add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);
/**
* {@internal Missing Short Description}}
*
@ -2611,7 +2604,6 @@ function media_upload_flash_bypass() {
</p>
<?php
}
add_action('post-plupload-upload-ui', 'media_upload_flash_bypass');
/**
* Displays the browser's built-in uploader message.
@ -2625,7 +2617,6 @@ function media_upload_html_bypass() {
</p>
<?php
}
add_action('post-html-upload-ui', 'media_upload_html_bypass');
/**
* Used to display a "After a file has been uploaded..." help message.
@ -2908,21 +2899,6 @@ function attachment_submitbox_metadata() {
endif;
}
add_filter( 'async_upload_image', 'get_media_item', 10, 2 );
add_filter( 'async_upload_audio', 'get_media_item', 10, 2 );
add_filter( 'async_upload_video', 'get_media_item', 10, 2 );
add_filter( 'async_upload_file', 'get_media_item', 10, 2 );
add_action( 'media_upload_image', 'wp_media_upload_handler' );
add_action( 'media_upload_audio', 'wp_media_upload_handler' );
add_action( 'media_upload_video', 'wp_media_upload_handler' );
add_action( 'media_upload_file', 'wp_media_upload_handler' );
add_filter( 'media_upload_gallery', 'media_upload_gallery' );
add_filter( 'media_upload_library', 'media_upload_library' );
add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' );
/**
* Parse ID3v2, ID3v1, and getID3 comments to extract usable data
*

View File

@ -250,10 +250,6 @@ function update_home_siteurl( $old_value, $value ) {
flush_rewrite_rules();
}
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 );
/**
* Shorten an URL, to be used as link text
*
@ -679,7 +675,6 @@ function wp_color_scheme_settings() {
echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n";
}
add_action( 'admin_head', 'wp_color_scheme_settings' );
function _ipad_meta() {
if ( wp_is_mobile() ) {
@ -688,7 +683,6 @@ function _ipad_meta() {
<?php
}
}
add_action('admin_head', '_ipad_meta');
/**
* Check lock status for posts displayed on the Posts screen
@ -719,7 +713,6 @@ function wp_check_locked_posts( $response, $data, $screen_id ) {
return $response;
}
add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 3 );
/**
* Check lock status on the New/Edit Post screen and refresh the lock
@ -758,7 +751,6 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
return $response;
}
add_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 );
/**
* Check nonce expiration on the New/Edit Post screen and refresh if needed
@ -792,7 +784,6 @@ function wp_refresh_post_nonces( $response, $data, $screen_id ) {
return $response;
}
add_filter( 'heartbeat_received', 'wp_refresh_post_nonces', 10, 3 );
/**
* Disable suspension of Heartbeat on the Add/Edit Post screens.
@ -813,7 +804,6 @@ function wp_heartbeat_set_suspension( $settings ) {
return $settings;
}
add_filter( 'heartbeat_settings', 'wp_heartbeat_set_suspension' );
/**
* Autosave with heartbeat
@ -838,8 +828,6 @@ function heartbeat_autosave( $response, $data ) {
return $response;
}
// Run later as we have to set DOING_AUTOSAVE for back-compat
add_filter( 'heartbeat_received', 'heartbeat_autosave', 500, 2 );
/**
* Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
@ -858,7 +846,6 @@ function post_form_autocomplete_off() {
echo ' autocomplete="off"';
}
}
add_action( 'post_edit_form_tag', 'post_form_autocomplete_off' );
/**
* Remove single-use URL parameters and create canonical link based on new URL.
@ -903,4 +890,3 @@ function wp_admin_canonical_url() {
</script>
<?php
}
add_action( 'admin_head', 'wp_admin_canonical_url' );

View File

@ -0,0 +1,30 @@
<?php
/**
* Multisite Administration hooks
*
* @package WordPress
*
* @since 4.3.0
*/
add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );
add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
add_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
add_action( 'admin_notices', 'new_user_email_admin_notice' );
add_action( 'wpmueditblogaction', 'upload_space_setting' );
add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );
add_action( 'admin_page_access_denied', '_access_denied_splash', 99 );
add_filter( 'import_allow_create_users', 'check_import_new_users' );
add_action( 'admin_notices', 'site_admin_notice' );
add_action( 'network_admin_notices', 'site_admin_notice' );
add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 );

View File

@ -41,7 +41,6 @@ function check_upload_size( $file ) {
return $file;
}
add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );
/**
* Delete a blog.
@ -300,8 +299,6 @@ All at ###SITENAME###
wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), $content );
}
add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
/**
* Sends an email when an email address change is requested.
@ -383,7 +380,6 @@ All at ###SITENAME###
$_POST['email'] = $current_user->user_email;
}
}
add_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
/**
* Adds an admin notice alerting the user to check for confirmation email
@ -395,7 +391,6 @@ function new_user_email_admin_notice() {
if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( get_current_user_id() . '_new_email' ) )
echo "<div class='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>";
}
add_action( 'admin_notices', 'new_user_email_admin_notice' );
/**
* Check whether a blog has used its allotted upload space.
@ -490,7 +485,6 @@ function upload_space_setting( $id ) {
</tr>
<?php
}
add_action( 'wpmueditblogaction', 'upload_space_setting' );
/**
* Update the status of a user in the database.
@ -621,7 +615,6 @@ function sync_category_tag_slugs( $term, $taxonomy ) {
}
return $term;
}
add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );
/**
* Displays an access denied message when a user tries to view a site's dashboard they
@ -662,7 +655,6 @@ function _access_denied_splash() {
wp_die( $output, 403 );
}
add_action( 'admin_page_access_denied', '_access_denied_splash', 99 );
/**
* Checks if the current user has permissions to import new users.
@ -677,7 +669,6 @@ function check_import_new_users( $permission ) {
return false;
return true;
}
add_filter( 'import_allow_create_users', 'check_import_new_users' );
// See "import_allow_fetch_attachments" and "import_attachment_size_limit" filters too.
/**
@ -746,8 +737,6 @@ function site_admin_notice() {
if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version )
echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "</div>";
}
add_action( 'admin_notices', 'site_admin_notice' );
add_action( 'network_admin_notices', 'site_admin_notice' );
/**
* Avoids a collision between a site slug and a permalink slug.
@ -782,7 +771,6 @@ function avoid_blog_page_permalink_collision( $data, $postarr ) {
}
return $data;
}
add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 );
/**
* Handles the display of choosing a user's primary site.

View File

@ -1254,7 +1254,6 @@ function _wp_delete_orphaned_draft_menu_items() {
foreach( (array) $menu_items_to_delete as $menu_item_id )
wp_delete_post( $menu_item_id, true );
}
add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
/**
* Saves nav menu items

View File

@ -158,7 +158,6 @@ function install_dashboard() {
}
echo '</p><br class="clear" />';
}
add_action( 'install_plugins_featured', 'install_dashboard' );
/**
* Display search form for searching plugins.
@ -209,7 +208,6 @@ function install_plugins_upload() {
</div>
<?php
}
add_action('install_plugins_upload', 'install_plugins_upload' );
/**
* Show a username form for the favorites page
@ -258,12 +256,6 @@ function display_plugins_table() {
</form>
<?php
}
add_action( 'install_plugins_search', 'display_plugins_table' );
add_action( 'install_plugins_popular', 'display_plugins_table' );
add_action( 'install_plugins_recommended', 'display_plugins_table' );
add_action( 'install_plugins_new', 'display_plugins_table' );
add_action( 'install_plugins_beta', 'display_plugins_table' );
add_action( 'install_plugins_favorites', 'display_plugins_table' );
/**
* Determine the status we can perform on a plugin.
@ -582,4 +574,3 @@ function install_plugin_information() {
iframe_footer();
exit;
}
add_action('install_plugins_pre_plugin-information', 'install_plugin_information');

View File

@ -1852,7 +1852,6 @@ function option_update_filter( $options ) {
return $options;
}
add_filter( 'whitelist_options', 'option_update_filter' );
/**
* {@internal Missing Short Description}}

View File

@ -2186,9 +2186,6 @@ final class WP_Internal_Pointers {
}
}
add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
add_action( 'user_register', array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) );
/**
* Convert a screen string to a screen object
*

View File

@ -132,7 +132,6 @@ function install_themes_dashboard() {
</form>
<?php
}
// add_action('install_themes_dashboard', 'install_themes_dashboard');
function install_themes_upload() {
?>
@ -144,7 +143,6 @@ function install_themes_upload() {
</form>
<?php
}
// add_action('install_themes_upload', 'install_themes_upload', 10, 0);
/**
* Prints a theme on the Install Themes pages.
@ -180,10 +178,6 @@ function display_themes() {
$wp_list_table->display();
}
// add_action('install_themes_search', 'display_themes');
// add_action('install_themes_featured', 'display_themes');
// add_action('install_themes_new', 'display_themes');
// add_action('install_themes_updated', 'display_themes');
/**
* Display theme information in dialog box form.
@ -208,4 +202,3 @@ function install_theme_information() {
iframe_footer();
exit;
}
add_action('install_themes_pre_theme-information', 'install_theme_information');

View File

@ -565,4 +565,3 @@ function customize_themes_print_templates() {
</script>
<?php
}
add_action( 'customize_controls_print_footer_scripts', 'customize_themes_print_templates' );

View File

@ -1210,7 +1210,6 @@ window.location = 'about.php?updated';
include(ABSPATH . 'wp-admin/admin-footer.php');
exit();
}
add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
/**
* Cleans up Genericons example files.

View File

@ -188,7 +188,6 @@ function core_update_footer( $msg = '' ) {
return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
}
}
add_filter( 'update_footer', 'core_update_footer' );
/**
*
@ -216,8 +215,6 @@ function update_nag() {
}
echo "<div class='update-nag'>$msg</div>";
}
add_action( 'admin_notices', 'update_nag', 3 );
add_action( 'network_admin_notices', 'update_nag', 3 );
// Called directly from dashboard
function update_right_now_message() {
@ -266,7 +263,6 @@ function wp_plugin_update_rows() {
}
}
}
add_action( 'admin_init', 'wp_plugin_update_rows' );
function wp_plugin_update_row( $file, $plugin_data ) {
$current = get_site_transient( 'update_plugins' );
@ -362,7 +358,6 @@ function wp_theme_update_rows() {
}
}
}
add_action( 'admin_init', 'wp_theme_update_rows' );
function wp_theme_update_row( $theme_key, $theme ) {
$current = get_site_transient( 'update_themes' );
@ -441,5 +436,3 @@ function maintenance_nag() {
echo "<div class='update-nag'>$msg</div>";
}
add_action( 'admin_notices', 'maintenance_nag' );
add_action( 'network_admin_notices', 'maintenance_nag' );

View File

@ -386,7 +386,6 @@ function wp_revoke_user($id) {
$user->remove_all_caps();
}
add_action('admin_init', 'default_password_nag_handler');
/**
* @since 2.8.0
*/
@ -409,8 +408,6 @@ function default_password_nag_handler($errors = false) {
}
}
add_action('profile_update', 'default_password_nag_edit_user', 10, 2);
/**
* @since 2.8.0
*/
@ -428,8 +425,6 @@ function default_password_nag_edit_user($user_ID, $old_data) {
}
}
add_action('admin_notices', 'default_password_nag');
/**
* @since 2.8.0
*

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32652';
$wp_version = '4.3-alpha-32653';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.