Ticket #19342: 19342.diff

File 19342.diff, 1.6 KB (added by nacin, 18 months ago)
Line 
1Index: wp-admin/includes/template.php
2===================================================================
3--- wp-admin/includes/template.php      (revision 19417)
4+++ wp-admin/includes/template.php      (working copy)
5@@ -1795,4 +1795,21 @@
6        }
7 }
8 
9-add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
10\ No newline at end of file
11+add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
12+
13+
14+/**
15+ * Convert a screen string to a screen object
16+ *
17+ * @since 3.0.0
18+ *
19+ * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
20+ * @return WP_Screen Screen object.
21+ */
22+function convert_to_screen( $hook_name ) {
23+       if ( ! is_admin() )
24+               _doing_it_wrong( "Do not include wp-admin/includes/template.php directly. You're giving the core developers a heart attack." );
25+               return (object) array( 'id' => $hook_name, 'base' => $hook_name );
26+       }
27+       return WP_Screen::get( $hook_name );
28+}
29\ No newline at end of file
30Index: wp-admin/includes/screen.php
31===================================================================
32--- wp-admin/includes/screen.php        (revision 19418)
33+++ wp-admin/includes/screen.php        (working copy)
34@@ -108,18 +108,6 @@
35 }
36 
37 /**
38- * Convert a screen string to a screen object
39- *
40- * @since 3.0.0
41- *
42- * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
43- * @return WP_Screen Screen object.
44- */
45-function convert_to_screen( $hook_name ) {
46-       return WP_Screen::get( $hook_name );
47-}
48-
49-/**
50  * Add contextual help text for a page.
51  *
52  * Creates a 'Screen Info' help tab.