Skip to content

Commit f8678b0

Browse files
authored
Merge pull request #3312 from Strategy11/remove_defered_hooks
Remove defered hook changes
2 parents 04e03f1 + 48d2707 commit f8678b0

3 files changed

Lines changed: 14 additions & 48 deletions

File tree

classes/controllers/FrmHooksController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ public static function load_hooks() {
104104
// Simple Blocks Controller.
105105
add_action( 'init', 'FrmSimpleBlocksController::register_simple_form_block' );
106106

107-
FrmUsageController::add_schedules_filter();
108107
add_action( 'formidable_send_usage', 'FrmUsageController::send_snapshot' );
109108

110109
/**

classes/controllers/FrmOnboardingWizardController.php

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -126,33 +126,18 @@ class FrmOnboardingWizardController {
126126
public static function load_admin_hooks() {
127127
self::set_page_url();
128128
add_action( 'admin_init', self::class . '::do_admin_redirects' );
129-
self::load_translated_admin_hooks();
130-
}
131-
132-
/**
133-
* Initializes the hooks that depend on translated strings.
134-
*
135-
* Defers itself to init when called earlier, because add_wizard_to_floating_links()
136-
* translates and maybe_load_page() reads the inbox option, which applies that filter.
137-
* Translating before the text domain is loaded triggers a _load_textdomain_just_in_time
138-
* notice in WordPress 6.7+.
139-
*
140-
* @since x.x
141-
*
142-
* @return void
143-
*/
144-
public static function load_translated_admin_hooks() {
145-
if ( ! did_action( 'init' ) ) {
146-
add_action( 'init', self::class . '::load_translated_admin_hooks' );
147-
return;
148-
}
149129

150130
if ( self::has_onboarding_been_skipped() ) {
151131
add_filter( 'option_frm_inbox', self::class . '::add_wizard_to_floating_links' );
152132
}
153133

154-
// Load page if admin page is Onboarding Wizard.
155-
self::maybe_load_page();
134+
/**
135+
* Load page if admin page is Onboarding Wizard.
136+
* This waits for init because it reads the inbox option, and the filter above translates
137+
* when it does. Translating before the text domain is loaded triggers a
138+
* _load_textdomain_just_in_time notice in WordPress 6.7+.
139+
*/
140+
add_action( 'init', self::class . '::maybe_load_page' );
156141
}
157142

158143
/**

classes/controllers/FrmUsageController.php

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,40 +53,22 @@ public static function schedule_send() {
5353
wp_schedule_event( $init_send, 'weekly', 'formidable_send_usage' );
5454
}
5555

56-
/**
57-
* Registers the filter that adds our custom cron schedule.
58-
*
59-
* The filter callback translates the schedule label, and 'cron_schedules' can be applied
60-
* at any point in the request, so this defers itself until the text domain has loaded.
61-
* Priority 0 keeps the schedule available to _wp_cron(), which runs on init at 10.
62-
*
63-
* @since x.x
64-
*
65-
* @return void
66-
*/
67-
public static function add_schedules_filter() {
68-
if ( ! did_action( 'init' ) ) {
69-
add_action( 'init', self::class . '::add_schedules_filter', 0 );
70-
return;
71-
}
72-
73-
add_filter( 'cron_schedules', self::class . '::add_schedules' );
74-
}
75-
7656
/**
7757
* Adds once weekly to the existing schedules.
7858
*
59+
* WordPress core registers an identical 'weekly' schedule of its own, so this adds nothing.
60+
* The 'cron_schedules' registration is gone, and with it the translated label that made
61+
* this run before the text domain loaded.
62+
*
7963
* @since 3.06.04
64+
* @deprecated x.x
8065
*
81-
* @param array $schedules Schedules.
66+
* @param array $schedules Unused. The registered cron schedules, keyed by schedule name.
8267
*
8368
* @return array
8469
*/
8570
public static function add_schedules( $schedules = array() ) {
86-
$schedules['weekly'] = array(
87-
'interval' => DAY_IN_SECONDS * 7,
88-
'display' => __( 'Once Weekly', 'formidable' ),
89-
);
71+
_deprecated_function( __METHOD__, 'x.x' );
9072
return $schedules;
9173
}
9274

0 commit comments

Comments
 (0)