diff --git a/classes/controllers/FrmAppController.php b/classes/controllers/FrmAppController.php index c4a3eca9da..3af9f88e69 100644 --- a/classes/controllers/FrmAppController.php +++ b/classes/controllers/FrmAppController.php @@ -16,8 +16,6 @@ public static function menu() { $menu_name = FrmAppHelper::get_menu_name(); add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', self::menu_icon(), self::get_menu_position() ); - - self::maybe_add_black_friday_submenu_item(); } /** @@ -42,82 +40,6 @@ private static function menu_icon() { return apply_filters( 'frm_icon', $icon ); } - /** - * @since 6.16 - * - * @return void - */ - private static function maybe_add_black_friday_submenu_item() { - if ( ! current_user_can( 'frm_change_settings' ) ) { - return; - } - - $is_black_friday = self::is_black_friday(); - $is_cyber_monday = self::is_cyber_monday(); - - if ( ! $is_black_friday && ! $is_cyber_monday ) { - return; - } - - $black_friday_menu_label = $is_black_friday ? __( 'Black Friday!', 'formidable' ) : __( 'Cyber Monday!', 'formidable' ); - $black_friday_menu_label = '' . esc_html( $black_friday_menu_label ) . ''; - - add_action( - 'admin_menu', - function () use ( $black_friday_menu_label ) { - add_submenu_page( - 'formidable', - 'Formidable', - $black_friday_menu_label, - 'frm_change_settings', - 'formidable-black-friday', - function () { - // This function should do nothing. The redirect is handled earlier to avoid header conflicts. - } - ); - }, - 1000 - ); - } - - /** - * Black Friday sale is from November 25 to 29. - * - * @since 6.16 - * - * @return bool - */ - private static function is_black_friday() { - return self::within_sale_date_range( '2024-11-25', '2024-11-29' ); - } - - /** - * Cyber Monday sale rules from November 30 to December 4. - * - * @since 6.16 - * - * @return bool - */ - private static function is_cyber_monday() { - return self::within_sale_date_range( '2024-11-30', '2024-12-04' ); - } - - /** - * Check if the current time is within a sale date range. - * Our sales are based on Eastern Time, so we use New York's timezone. - * - * @since 6.16 - * - * @param string $from The beginning of the date range. Y-m-d format is expected. - * @param string $to The end of the date range. Y-m-d format is expected. - * @return bool - */ - private static function within_sale_date_range( $from, $to ) { - $date = new DateTime( 'now', new DateTimeZone( 'America/New_York' ) ); - $today = $date->format( 'Y-m-d' ); - return $today >= $from && $today <= $to; - } - /** * @since 3.0 */ @@ -640,19 +562,6 @@ public static function admin_init() { die(); } - if ( 'formidable-black-friday' === FrmAppHelper::get_param( 'page' ) && current_user_can( 'frm_change_settings' ) ) { - wp_redirect( - FrmAppHelper::admin_upgrade_link( - array( - 'medium' => 'black-friday-submenu', - 'content' => self::is_cyber_monday() ? 'cyber-monday-submenu' : 'black-friday-submenu', - ), - 'black-friday' - ) - ); - die(); - } - // Register personal data hooks. new FrmPersonalData();