<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[25747] trunk/src/wp-admin/admin.php: Hook documentation for wp-admin/admin.php.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/25747">25747</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-10-09 21:00:41 +0000 (Wed, 09 Oct 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Hook documentation for wp-admin/admin.php.

props DrewAPicture for initial patch.
fixes <a href="http://core.trac.wordpress.org/ticket/25442">#25442</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminadminphp">trunk/src/wp-admin/admin.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminadminphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/admin.php (25746 => 25747)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/admin.php     2013-10-09 20:38:26 UTC (rev 25746)
+++ trunk/src/wp-admin/admin.php        2013-10-09 21:00:41 UTC (rev 25747)
</span><span class="lines">@@ -36,27 +36,43 @@
</span><span class="cx">  update_option( 'db_upgraded',  false );
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * Runs on the next page load after successful upgrade
</del><ins>+         * Fires on the next page load after a successful DB upgrade.
</ins><span class="cx">    *
</span><del>-        * @since 2.8
</del><ins>+         * @since 2.8.0
</ins><span class="cx">    */
</span><del>-       do_action('after_db_upgrade');
</del><ins>+        do_action( 'after_db_upgrade' );
</ins><span class="cx"> } elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) {
</span><span class="cx">  if ( !is_multisite() ) {
</span><span class="cx">          wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
</span><span class="cx">          exit;
</span><ins>+
+       /**
+        * Filter whether to attempt to perform the multisite DB upgrade routine.
+        *
+        * In single site, the user would be redirected to wp-admin/upgrade.php.
+        * In multisite, it is automatically fired, but only when this filter
+        * returns true.
+        *
+        * If the network is 50 sites or less, it will run every time. Otherwise,
+        * it will throttle itself to reduce load.
+        *
+        * @since 3.0.0
+        *
+        * @param bool true Whether to perform the Multisite upgrade routine. Default true.
+        */
</ins><span class="cx">   } elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
</span><del>-               /**
-                * On really small MU installs run the upgrader every time,
-                * else run it less often to reduce load.
-                *
-                * @since 2.8.4b
-                */
</del><span class="cx">           $c = get_blog_count();
</span><span class="cx">          // If 50 or fewer sites, run every time. Else, run "about ten percent" of the time. Shh, don't check that math.
</span><span class="cx">          if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) {
</span><span class="cx">                  require_once( ABSPATH . WPINC . '/http.php' );
</span><span class="cx">                  $response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) );
</span><ins>+                       /**
+                        * Fires after the multisite DB upgrade is complete.
+                        *
+                        * @since 3.0.0
+                        *
+                        * @param array|WP_Error $response The upgrade response array or WP_Error on failure.
+                        */
</ins><span class="cx">                   do_action( 'after_mu_upgrade', $response );
</span><span class="cx">                  unset($response);
</span><span class="cx">          }
</span><span class="lines">@@ -103,10 +119,35 @@
</span><span class="cx"> else
</span><span class="cx">  require(ABSPATH . 'wp-admin/menu.php');
</span><span class="cx"> 
</span><del>-if ( current_user_can( 'manage_options' ) )
</del><ins>+if ( current_user_can( 'manage_options' ) ) {
+       /**
+        * Filter the maximum memory limit available for administration screens.
+        *
+        * This only applies to administrators, who may require more memory for tasks like updates.
+        * Memory limits when processing images (uploaded or edited by users of any role) are
+        * handled separately.
+        *
+        * The WP_MAX_MEMORY_LIMIT constant specifically defines the maximum memory limit available
+        * when in the administration back-end. The default is 256M, or 256 megabytes of memory.
+        *
+        * @since 3.0.0
+        *
+        * @param string 'WP_MAX_MEMORY_LIMIT' The maximum WordPress memory limit. Default 256M.
+        */
</ins><span class="cx">   @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
</span><ins>+}
</ins><span class="cx"> 
</span><del>-do_action('admin_init');
</del><ins>+/**
+ * Fires as an admin screen or script is being initialized.
+ *
+ * Note, this does not just run on user-facing admin screens.
+ * It runs on admin-ajax.php and admin-post.php as well.
+ *
+ * This is roughly analgous to the more general 'init' hook, which fires earlier.
+ *
+ * @since 2.5.0
+ */
+do_action( 'admin_init' );
</ins><span class="cx"> 
</span><span class="cx"> if ( isset($plugin_page) ) {
</span><span class="cx">  if ( !empty($typenow) )
</span><span class="lines">@@ -142,11 +183,38 @@
</span><span class="cx"> // Handle plugin admin pages.
</span><span class="cx"> if ( isset($plugin_page) ) {
</span><span class="cx">  if ( $page_hook ) {
</span><del>-               do_action('load-' . $page_hook);
</del><ins>+                /**
+                * Fires before a particular screen is loaded.
+                *
+                * The load-* hook fires in a number of contexts. This hook is for plugin screens
+                * where a callback is provided when the screen is registered.
+                *
+                * The dynamic portion of the hook name, $page_hook, refers to a mixture of plugin
+                * page information including:
+                * 1. The page type. If the plugin page is registered as a submenu page, such as for
+                *    Settings, the page type would be 'settings'. Otherwise the type is 'toplevel'.
+                * 2. A separator of '_page_'.
+                * 3. The plugin basename minus the file extension.
+                *
+                * Together, the three parts form the $page_hook. Citing the example above,
+                * the hook name used would be 'load-settings_page_pluginbasename'.
+                *
+                * @see get_plugin_page_hook()
+                *
+                * @since 2.1.0
+                */
+               do_action( 'load-' . $page_hook );
</ins><span class="cx">           if (! isset($_GET['noheader']))
</span><span class="cx">                  require_once(ABSPATH . 'wp-admin/admin-header.php');
</span><span class="cx"> 
</span><del>-               do_action($page_hook);
</del><ins>+                /**
+                * Used to call the registered callback for a plugin screen.
+                *
+                * @access private
+                *
+                * @since 1.5.0
+                */
+               do_action( $page_hook );
</ins><span class="cx">   } else {
</span><span class="cx">          if ( validate_file($plugin_page) )
</span><span class="cx">                  wp_die(__('Invalid plugin page'));
</span><span class="lines">@@ -154,7 +222,19 @@
</span><span class="cx">          if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) )
</span><span class="cx">                  wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
</span><span class="cx"> 
</span><del>-               do_action('load-' . $plugin_page);
</del><ins>+                /**
+                * Fires before a particular screen is loaded.
+                *
+                * The load-* hook fires in a number of contexts. This hook is for plugin screens
+                * where the file to load is directly included, rather than the use of a function.
+                *
+                * The dynamic portion of the hook name, $plugin_page, refers to the plugin basename.
+                *
+                * @see plugin_basename()
+                *
+                * @since 1.5.0
+                */
+               do_action( 'load-' . $plugin_page );
</ins><span class="cx"> 
</span><span class="cx">          if ( !isset($_GET['noheader']))
</span><span class="cx">                  require_once(ABSPATH . 'wp-admin/admin-header.php');
</span><span class="lines">@@ -185,6 +265,13 @@
</span><span class="cx">          exit;
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Fires before an importer screen is loaded.
+        *
+        * The dynamic portion of the hook name, $importer, refers to the importer slug.
+        *
+        * @since 3.5.0
+        */
</ins><span class="cx">   do_action( 'load-importer-' . $importer );
</span><span class="cx"> 
</span><span class="cx">  $parent_file = 'tools.php';
</span><span class="lines">@@ -198,6 +285,16 @@
</span><span class="cx"> 
</span><span class="cx">  define('WP_IMPORTING', true);
</span><span class="cx"> 
</span><ins>+       /**
+        * Whether to filter imported data through kses on import.
+        *
+        * Multisite uses this hook to filter all data through kses by default,
+        * as a super administrator may be assisting an untrusted user.
+        *
+        * @since 3.1.0
+        *
+        * @param bool false Whether to force data to be filtered through kses. Default false.
+        */
</ins><span class="cx">   if ( apply_filters( 'force_filtered_html_on_import', false ) )
</span><span class="cx">          kses_init_filters();  // Always filter imported data with kses on multisite.
</span><span class="cx"> 
</span><span class="lines">@@ -210,7 +307,18 @@
</span><span class="cx"> 
</span><span class="cx">  exit();
</span><span class="cx"> } else {
</span><del>-       do_action("load-$pagenow");
</del><ins>+        /**
+        * Fires before a particular screen is loaded.
+        *
+        * The load-* hook fires in a number of contexts. This hook is for core screens.
+        *
+        * The dynamic portion of the hook name, $pagenow, is a global variable
+        * referring to the filename of the current page, such as 'admin.php',
+        * 'post-new.php' etc. A complete hook for the latter would be 'load-post-new.php'.
+        *
+        * @since 2.1.0
+        */
+       do_action( 'load-' . $pagenow );
</ins><span class="cx">   // Backwards compatibility with old load-page-new.php, load-page.php,
</span><span class="cx">  // and load-categories.php actions.
</span><span class="cx">  if ( $typenow == 'page' ) {
</span><span class="lines">@@ -226,5 +334,14 @@
</span><span class="cx">  }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-if ( !empty($_REQUEST['action']) )
-       do_action('admin_action_' . $_REQUEST['action']);
</del><ins>+if ( ! empty( $_REQUEST['action'] ) ) {
+       /**
+        * Fires when an 'action' request variable is sent.
+        *
+        * The dynamic portion of the hook name, $_REQUEST['action'],
+        * refers to the action derived from the GET or POST request.
+        *
+        * @since 2.6.0
+        */
+       do_action( 'admin_action_' . $_REQUEST['action'] );
+}
</ins></span></pre>
</div>
</div>

</body>
</html>