SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > woocommerce > src > > Internal > Admin


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins/woocommerce/src//Internal/Admin

NameTypeSizeLast ModifiedActions
BlockTemplates Directory - -
EmailImprovements Directory - -
EmailPreview Directory - -
Emails Directory - -
ImportExport Directory - -
Logging Directory - -
Marketing Directory - -
Notes Directory - -
Onboarding Directory - -
Orders Directory - -
ProductForm Directory - -
ProductReviews Directory - -
RemoteFreeExtensions Directory - -
Schedulers Directory - -
Settings Directory - -
Suggestions Directory - -
WCPayPromotion Directory - -
ActivityPanels.php File 1616 bytes August 24 2022 02:07:06.
Analytics.php File 8041 bytes March 03 2025 22:28:12.
CategoryLookup.php File 8180 bytes April 20 2022 06:50:54.
Coupons.php File 2928 bytes November 14 2024 01:17:00.
CouponsMovedTrait.php File 2203 bytes April 20 2022 06:50:54.
CustomerEffortScoreTracks.php File 17647 bytes May 12 2025 21:07:28.
Events.php File 8761 bytes May 12 2025 21:07:28.
FeaturePlugin.php File 6690 bytes May 12 2025 21:07:28.
Homescreen.php File 8860 bytes September 23 2024 20:44:04.
Loader.php File 19643 bytes May 12 2025 21:07:28.
Marketing.php File 6440 bytes November 14 2024 01:17:00.
Marketplace.php File 5521 bytes March 03 2025 22:28:12.
MobileAppBanner.php File 956 bytes April 20 2022 06:50:54.
RemoteInboxNotifications.php File 932 bytes March 21 2023 20:45:06.
Settings.php File 13762 bytes June 23 2025 19:46:28.
ShippingLabelBanner.php File 4779 bytes September 23 2024 20:44:04.
ShippingLabelBannerDisplayRules.php File 3718 bytes September 04 2024 20:34:26.
SiteHealth.php File 2370 bytes February 22 2023 07:17:34.
Survey.php File 768 bytes April 20 2022 06:50:54.
SystemStatusReport.php File 5990 bytes May 12 2025 21:07:28.
Translations.php File 11942 bytes November 14 2024 01:17:00.
WCAdminAssets.php File 17982 bytes May 12 2025 21:07:28.
WCAdminSharedSettings.php File 2128 bytes April 22 2025 15:40:34.
WCAdminUser.php File 4175 bytes March 26 2024 16:56:02.
WcPayWelcomePage.php File 6481 bytes June 23 2025 19:46:28.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins/woocommerce/src//Internal/Admin/Coupons.php

<?php
/**
 * WooCommerce Marketing > Coupons.
 */

namespace Automattic\WooCommerce\Internal\Admin;

use Automattic\WooCommerce\Admin\Features\Features;
use Automattic\WooCommerce\Admin\PageController;

/**
 * Contains backend logic for the Coupons feature.
 */
class Coupons {

	use CouponsMovedTrait;

	/**
	 * Class instance.
	 *
	 * @var Coupons instance
	 */
	protected static $instance = null;

	/**
	 * Get class instance.
	 */
	public static function get_instance() {
		if ( ! self::$instance ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	/**
	 * Hook into WooCommerce.
	 */
	public function __construct() {
		if ( ! is_admin() ) {
			return;
		}

		// If the main marketing feature is disabled, don't modify coupon behavior.
		if ( ! Features::is_enabled( 'marketing' ) ) {
			return;
		}

		// Only support coupon modifications if coupons are enabled.
		if ( ! wc_coupons_enabled() ) {
			return;
		}

		add_action( 'admin_enqueue_scripts', array( $this, 'maybe_add_marketing_coupon_script' ) );
		add_action( 'woocommerce_register_post_type_shop_coupon', array( $this, 'move_coupons' ) );
		add_action( 'admin_head', array( $this, 'fix_coupon_menu_highlight' ), 99 );
		add_action( 'admin_menu', array( $this, 'maybe_add_coupon_menu_redirect' ) );
	}

	/**
	 * Maybe add menu item back in original spot to help people transition
	 */
	public function maybe_add_coupon_menu_redirect() {
		if ( ! $this->should_display_legacy_menu() ) {
			return;
		}

		add_submenu_page(
			'woocommerce',
			__( 'Coupons', 'woocommerce' ),
			__( 'Coupons', 'woocommerce' ),
			'manage_options',
			'coupons-moved',
			array( $this, 'coupon_menu_moved' )
		);
	}

	/**
	 * Call back for transition menu item
	 */
	public function coupon_menu_moved() {
		wp_safe_redirect( $this->get_legacy_coupon_url(), 301 );
		exit();
	}

	/**
	 * Modify registered post type shop_coupon
	 *
	 * @param array $args Array of post type parameters.
	 *
	 * @return array the filtered parameters.
	 */
	public function move_coupons( $args ) {
		$args['show_in_menu'] = current_user_can( 'manage_woocommerce' ) ? 'woocommerce-marketing' : true;
		return $args;
	}

	/**
	 * Undo WC modifications to $parent_file for 'shop_coupon'
	 */
	public function fix_coupon_menu_highlight() {
		global $parent_file, $post_type;

		if ( $post_type === 'shop_coupon' ) {
			$parent_file = 'woocommerce-marketing'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride
		}
	}

	/**
	 * Maybe add our wc-admin coupon scripts if viewing coupon pages
	 */
	public function maybe_add_marketing_coupon_script() {
		$curent_screen = PageController::get_instance()->get_current_page();
		if ( ! isset( $curent_screen['id'] ) || $curent_screen['id'] !== 'woocommerce-coupons' ) {
			return;
		}

		WCAdminAssets::register_style( 'marketing-coupons', 'style' );
		WCAdminAssets::register_script( 'wp-admin-scripts', 'marketing-coupons', true );
	}
}

SILENT KILLER Tool