PageRenderTime 27ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/server/wordpress/wp-admin/admin-header.php

https://gitlab.com/suporte.spturis/carnaval2015.spturis.com.br
PHP | 315 lines | 150 code | 48 blank | 117 comment | 31 complexity | 755becbf21cf02ee16fb45e4d7221cef MD5 | raw file
  1. <?php
  2. /**
  3. * WordPress Administration Template Header
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
  9. if ( ! defined( 'WP_ADMIN' ) ) {
  10. require_once __DIR__ . '/admin.php';
  11. }
  12. /**
  13. * In case admin-header.php is included in a function.
  14. *
  15. * @global string $title
  16. * @global string $hook_suffix
  17. * @global WP_Screen $current_screen WordPress current screen object.
  18. * @global WP_Locale $wp_locale WordPress date and time locale object.
  19. * @global string $pagenow
  20. * @global string $update_title
  21. * @global int $total_update_count
  22. * @global string $parent_file
  23. * @global string $typenow
  24. */
  25. global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow,
  26. $update_title, $total_update_count, $parent_file, $typenow;
  27. // Catch plugins that include admin-header.php before admin.php completes.
  28. if ( empty( $current_screen ) ) {
  29. set_current_screen();
  30. }
  31. get_admin_page_title();
  32. $title = strip_tags( $title );
  33. if ( is_network_admin() ) {
  34. /* translators: Network admin screen title. %s: Network title. */
  35. $admin_title = sprintf( __( 'Network Admin: %s' ), get_network()->site_name );
  36. } elseif ( is_user_admin() ) {
  37. /* translators: User dashboard screen title. %s: Network title. */
  38. $admin_title = sprintf( __( 'User Dashboard: %s' ), get_network()->site_name );
  39. } else {
  40. $admin_title = get_bloginfo( 'name' );
  41. }
  42. if ( $admin_title === $title ) {
  43. /* translators: Admin screen title. %s: Admin screen name. */
  44. $admin_title = sprintf( __( '%s &#8212; WordPress' ), $title );
  45. } else {
  46. $screen_title = $title;
  47. if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) {
  48. $post_title = get_the_title();
  49. if ( ! empty( $post_title ) ) {
  50. $post_type_obj = get_post_type_object( $typenow );
  51. $screen_title = sprintf(
  52. /* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
  53. __( '%1$s &#8220;%2$s&#8221;' ),
  54. $post_type_obj->labels->edit_item,
  55. $post_title
  56. );
  57. }
  58. }
  59. /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
  60. $admin_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $screen_title, $admin_title );
  61. }
  62. if ( wp_is_recovery_mode() ) {
  63. /* translators: %s: Admin screen title. */
  64. $admin_title = sprintf( __( 'Recovery Mode &#8212; %s' ), $admin_title );
  65. }
  66. /**
  67. * Filters the title tag content for an admin page.
  68. *
  69. * @since 3.1.0
  70. *
  71. * @param string $admin_title The page title, with extra context added.
  72. * @param string $title The original page title.
  73. */
  74. $admin_title = apply_filters( 'admin_title', $admin_title, $title );
  75. wp_user_settings();
  76. _wp_admin_html_begin();
  77. ?>
  78. <title><?php echo esc_html( $admin_title ); ?></title>
  79. <?php
  80. wp_enqueue_style( 'colors' );
  81. wp_enqueue_script( 'utils' );
  82. wp_enqueue_script( 'svg-painter' );
  83. $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
  84. ?>
  85. <script type="text/javascript">
  86. addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
  87. var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
  88. pagenow = '<?php echo esc_js( $current_screen->id ); ?>',
  89. typenow = '<?php echo esc_js( $current_screen->post_type ); ?>',
  90. adminpage = '<?php echo esc_js( $admin_body_class ); ?>',
  91. thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>',
  92. decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>',
  93. isRtl = <?php echo (int) is_rtl(); ?>;
  94. </script>
  95. <?php
  96. /**
  97. * Enqueue scripts for all admin pages.
  98. *
  99. * @since 2.8.0
  100. *
  101. * @param string $hook_suffix The current admin page.
  102. */
  103. do_action( 'admin_enqueue_scripts', $hook_suffix );
  104. /**
  105. * Fires when styles are printed for a specific admin page based on $hook_suffix.
  106. *
  107. * @since 2.6.0
  108. */
  109. do_action( "admin_print_styles-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
  110. /**
  111. * Fires when styles are printed for all admin pages.
  112. *
  113. * @since 2.6.0
  114. */
  115. do_action( 'admin_print_styles' );
  116. /**
  117. * Fires when scripts are printed for a specific admin page based on $hook_suffix.
  118. *
  119. * @since 2.1.0
  120. */
  121. do_action( "admin_print_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
  122. /**
  123. * Fires when scripts are printed for all admin pages.
  124. *
  125. * @since 2.1.0
  126. */
  127. do_action( 'admin_print_scripts' );
  128. /**
  129. * Fires in head section for a specific admin page.
  130. *
  131. * The dynamic portion of the hook name, `$hook_suffix`, refers to the hook suffix
  132. * for the admin page.
  133. *
  134. * @since 2.1.0
  135. */
  136. do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
  137. /**
  138. * Fires in head section for all admin pages.
  139. *
  140. * @since 2.1.0
  141. */
  142. do_action( 'admin_head' );
  143. if ( 'f' === get_user_setting( 'mfold' ) ) {
  144. $admin_body_class .= ' folded';
  145. }
  146. if ( ! get_user_setting( 'unfold' ) ) {
  147. $admin_body_class .= ' auto-fold';
  148. }
  149. if ( is_admin_bar_showing() ) {
  150. $admin_body_class .= ' admin-bar';
  151. }
  152. if ( is_rtl() ) {
  153. $admin_body_class .= ' rtl';
  154. }
  155. if ( $current_screen->post_type ) {
  156. $admin_body_class .= ' post-type-' . $current_screen->post_type;
  157. }
  158. if ( $current_screen->taxonomy ) {
  159. $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
  160. }
  161. $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) );
  162. $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) );
  163. $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
  164. $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
  165. if ( wp_is_mobile() ) {
  166. $admin_body_class .= ' mobile';
  167. }
  168. if ( is_multisite() ) {
  169. $admin_body_class .= ' multisite';
  170. }
  171. if ( is_network_admin() ) {
  172. $admin_body_class .= ' network-admin';
  173. }
  174. $admin_body_class .= ' no-customize-support no-svg';
  175. if ( $current_screen->is_block_editor() ) {
  176. $admin_body_class .= ' block-editor-page wp-embed-responsive';
  177. }
  178. $error_get_last = error_get_last();
  179. // Print a CSS class to make PHP errors visible.
  180. if ( $error_get_last && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
  181. // Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect,
  182. // and should not be displayed with the `error_reporting` level previously set in wp-load.php.
  183. && ( E_NOTICE !== $error_get_last['type'] || 'wp-config.php' !== wp_basename( $error_get_last['file'] ) )
  184. ) {
  185. $admin_body_class .= ' php-error';
  186. }
  187. unset( $error_get_last );
  188. ?>
  189. </head>
  190. <?php
  191. /**
  192. * Filters the CSS classes for the body tag in the admin.
  193. *
  194. * This filter differs from the {@see 'post_class'} and {@see 'body_class'} filters
  195. * in two important ways:
  196. *
  197. * 1. `$classes` is a space-separated string of class names instead of an array.
  198. * 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui,
  199. * and no-js cannot be removed.
  200. *
  201. * @since 2.3.0
  202. *
  203. * @param string $classes Space-separated list of CSS classes.
  204. */
  205. $admin_body_classes = apply_filters( 'admin_body_class', '' );
  206. $admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class );
  207. ?>
  208. <body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes; ?>">
  209. <script type="text/javascript">
  210. document.body.className = document.body.className.replace('no-js','js');
  211. </script>
  212. <?php
  213. // Make sure the customize body classes are correct as early as possible.
  214. if ( current_user_can( 'customize' ) ) {
  215. wp_customize_support_script();
  216. }
  217. ?>
  218. <div id="wpwrap">
  219. <?php require ABSPATH . 'wp-admin/menu-header.php'; ?>
  220. <div id="wpcontent">
  221. <?php
  222. /**
  223. * Fires at the beginning of the content section in an admin page.
  224. *
  225. * @since 3.0.0
  226. */
  227. do_action( 'in_admin_header' );
  228. ?>
  229. <div id="wpbody" role="main">
  230. <?php
  231. unset( $blog_name, $total_update_count, $update_title );
  232. $current_screen->set_parentage( $parent_file );
  233. ?>
  234. <div id="wpbody-content">
  235. <?php
  236. $current_screen->render_screen_meta();
  237. if ( is_network_admin() ) {
  238. /**
  239. * Prints network admin screen notices.
  240. *
  241. * @since 3.1.0
  242. */
  243. do_action( 'network_admin_notices' );
  244. } elseif ( is_user_admin() ) {
  245. /**
  246. * Prints user admin screen notices.
  247. *
  248. * @since 3.1.0
  249. */
  250. do_action( 'user_admin_notices' );
  251. } else {
  252. /**
  253. * Prints admin screen notices.
  254. *
  255. * @since 3.1.0
  256. */
  257. do_action( 'admin_notices' );
  258. }
  259. /**
  260. * Prints generic admin screen notices.
  261. *
  262. * @since 3.1.0
  263. */
  264. do_action( 'all_admin_notices' );
  265. if ( 'options-general.php' === $parent_file ) {
  266. require ABSPATH . 'wp-admin/options-head.php';
  267. }