PHP 8.2.31
Preview: CouponsMovedTrait.php Size: 2.41 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/Internal/Admin/CouponsMovedTrait.php

<?php
/**
 * A Trait to help with managing the legacy coupon menu.
 */

namespace Automattic\WooCommerce\Internal\Admin;

use Automattic\WooCommerce\Admin\Features\Features;

/**
 * CouponsMovedTrait trait.
 */
trait CouponsMovedTrait {

	/**
	 * The GET query key for the legacy menu.
	 *
	 * @var string
	 */
	protected static $query_key = 'legacy_coupon_menu';

	/**
	 * The key for storing an option in the DB.
	 *
	 * @var string
	 */
	protected static $option_key = 'wc_admin_show_legacy_coupon_menu';

	/**
	 * Get the URL for the legacy coupon management.
	 *
	 * @return string The unescaped URL for the legacy coupon management page.
	 */
	protected static function get_legacy_coupon_url() {
		return self::get_coupon_url( [ self::$query_key => true ] );
	}

	/**
	 * Get the URL for the coupon management page.
	 *
	 * @param array $args Additional URL query arguments.
	 *
	 * @return string
	 */
	protected static function get_coupon_url( $args = [] ) {
		$args = array_merge(
			[
				'post_type' => 'shop_coupon',
			],
			$args
		);

		return add_query_arg( $args, admin_url( 'edit.php' ) );
	}

	/**
	 * Get the new URL for managing coupons.
	 *
	 * @param string $page The management page.
	 *
	 * @return string
	 */
	protected static function get_management_url( $page ) {
		$path = '';
		switch ( $page ) {
			case 'coupon':
			case 'coupons':
				return self::get_coupon_url();

			case 'marketing':
				$path = self::get_marketing_path();
				break;
		}

		return "wc-admin&path={$path}";
	}

	/**
	 * Get the WC Admin path for the marking page.
	 *
	 * @return string
	 */
	protected static function get_marketing_path() {
		return '/marketing/overview';
	}

	/**
	 * Whether we should display the legacy coupon menu item.
	 *
	 * @return bool
	 */
	protected static function should_display_legacy_menu() {
		/**
		 * Filter to determine whether to display the legacy coupon menu item.
		 *
		 * @since 10.5.0
		 *
		 * @param bool $display Whether the menu should be displayed or not.
		 * @return bool
		 */
		return apply_filters(
			'wc_admin_show_legacy_coupon_menu',
			! Features::is_enabled( 'navigation' )
		);
	}

	/**
	 * Set whether we should display the legacy coupon menu item.
	 *
	 * @deprecated 10.5.0 No longer in use.
	 *
	 * @param bool $display Whether the menu should be displayed or not.
	 */
	protected static function display_legacy_menu( $display = false ) {
		update_option( self::$option_key, $display ? 1 : 0 );
	}
}

Directory Contents

Dirs: 18 × Files: 25

Name Size Perms Modified Actions
Agentic DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Emails DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Logging DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Marketing DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Notes DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Orders DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Settings DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
1.58 KB lrw-r--r-- 2022-08-24 02:07:06
Edit Download
11.78 KB lrw-r--r-- 2026-01-19 14:46:18
Edit Download
7.99 KB lrw-r--r-- 2022-04-20 06:50:54
Edit Download
2.86 KB lrw-r--r-- 2024-11-14 01:17:00
Edit Download
2.41 KB lrw-r--r-- 2026-01-19 14:46:18
Edit Download
17.65 KB lrw-r--r-- 2025-11-24 23:10:10
Edit Download
8.54 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
6.77 KB lrw-r--r-- 2026-02-23 17:58:34
Edit Download
8.70 KB lrw-r--r-- 2026-05-11 17:17:08
Edit Download
19.18 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
6.29 KB lrw-r--r-- 2024-11-14 01:17:00
Edit Download
3.48 KB lrw-r--r-- 2026-01-19 14:46:18
Edit Download
956 B lrw-r--r-- 2022-04-20 06:50:54
Edit Download
932 B lrw-r--r-- 2023-03-21 20:45:06
Edit Download
14.61 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
4.67 KB lrw-r--r-- 2024-09-23 20:44:04
Edit Download
3.63 KB lrw-r--r-- 2024-09-04 20:34:26
Edit Download
2.31 KB lrw-r--r-- 2023-02-22 07:17:34
Edit Download
768 B lrw-r--r-- 2022-04-20 06:50:54
Edit Download
5.85 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
11.66 KB lrw-r--r-- 2024-11-14 01:17:00
Edit Download
17.74 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
2.08 KB lrw-r--r-- 2025-04-22 15:40:34
Edit Download
5.26 KB lrw-r--r-- 2025-10-06 17:56:06
Edit Download
6.33 KB lrw-r--r-- 2025-06-23 19:46:28
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).