| @@ -167,8 +167,18 @@ | ||
| 167 | 167 | */ |
| 168 | 168 | add_action( 'admin_enqueue_scripts', array( Charitable_Admin_Blocks::get_instance(), 'admin_enqueue_scripts' ) ); |
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | + * Enqueue Charitable's styles for the block editor canvas (the editor iframe). | |
| 172 | + * | |
| 173 | + * Must be on `enqueue_block_assets` rather than `admin_enqueue_scripts` — that is the hook | |
| 174 | + * core collects when building the iframe's assets. | |
| 175 | + * | |
| 176 | + * @see Charitable_Admin_Blocks::enqueue_block_editor_canvas_styles() | |
| 177 | + */ | |
| 178 | +add_action( 'enqueue_block_assets', array( Charitable_Admin_Blocks::get_instance(), 'enqueue_block_editor_canvas_styles' ) ); | |
| 179 | + | |
| 180 | +/** | |
| 171 | 181 | * Enqueue Charitable's campaign builder congrats wizard related scripts & styles. |
| 172 | 182 | * |
| 173 | 183 | * @see Charitable_Campaign_Congrats_Wizard::init() |
| 174 | 184 | */ |
| @@ -230,8 +240,69 @@ | ||
| 230 | 240 | add_filter( 'charitable_submenu_pages', array( Charitable_Notifications::get_instance(), 'add_notifications_to_menu' ), 2 ); |
| 231 | 241 | add_filter( 'wp_ajax_charitable_notification_dismiss', array( Charitable_Notifications::get_instance(), 'dismiss' ), 10 ); |
| 232 | 242 | add_filter( 'wp_ajax_charitable_notification_dismiss_multiple', array( Charitable_Notifications::get_instance(), 'dismiss_multiple' ), 10 ); |
| 233 | 243 | add_action( 'admin_init', array( Charitable_Notifications::get_instance(), 'maybe_redirect_from_notifications' ), 10 ); |
| 244 | + | |
| 245 | +/** | |
| 246 | + * Notifications v2 — Settings must init before Local Notifications and Cron | |
| 247 | + * so is_category_enabled() is available to both. | |
| 248 | + * | |
| 249 | + * @since 1.8.12 | |
| 250 | + */ | |
| 251 | +Charitable_Notification_Settings::get_instance()->init(); | |
| 252 | + | |
| 253 | +/** | |
| 254 | + * Local Notifications — manages locally-generated notifications. | |
| 255 | + * | |
| 256 | + * @since 1.8.12 | |
| 257 | + */ | |
| 258 | +Charitable_Local_Notifications::get_instance()->init(); | |
| 259 | + | |
| 260 | +/** | |
| 261 | + * Notification Cron — schedules and runs periodic checks. | |
| 262 | + * | |
| 263 | + * @since 1.8.12 | |
| 264 | + */ | |
| 265 | +Charitable_Notification_Cron::get_instance()->init(); | |
| 266 | + | |
| 267 | +/** | |
| 268 | + * Notification Triggers — hook-based milestone and lifecycle events. | |
| 269 | + * | |
| 270 | + * @since 1.8.12 | |
| 271 | + */ | |
| 272 | +Charitable_Notification_Triggers::get_instance()->init(); | |
| 273 | + | |
| 274 | +/** | |
| 275 | + * Notifications V2 onboarding tour. | |
| 276 | + * | |
| 277 | + * @since 1.8.12 | |
| 278 | + */ | |
| 279 | +// Charitable_Notification_Onboarding::get_instance()->init(); // TODO: re-enable before release | |
| 280 | + | |
| 281 | +/** | |
| 282 | + * New Announcement Feed. | |
| 283 | + * | |
| 284 | + * @since 1.8.12 | |
| 285 | + */ | |
| 286 | +Charitable_New_Feed::get_instance()->init(); | |
| 287 | + | |
| 288 | +/** | |
| 289 | + * Notifications V2 test helper (admin-only). Triggered by ?charitable_notif_test=<action>. | |
| 290 | + * | |
| 291 | + * This is a development-only QA harness that seeds/clears notification state and | |
| 292 | + * fires cron jobs on demand. It is a state-changing GET handler with no nonce, so | |
| 293 | + * it must never be wired up in a production build. It is gated behind both WP_DEBUG | |
| 294 | + * and an explicit opt-in constant; to enable it locally, define both in wp-config.php: | |
| 295 | + * | |
| 296 | + * define( 'WP_DEBUG', true ); | |
| 297 | + * define( 'CHARITABLE_NOTIFICATION_TEST_HELPER', true ); | |
| 298 | + * | |
| 299 | + * @since 1.8.12 | |
| 300 | + */ | |
| 301 | +if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'CHARITABLE_NOTIFICATION_TEST_HELPER' ) && CHARITABLE_NOTIFICATION_TEST_HELPER ) { | |
| 302 | + Charitable_Notification_Test_Helper::get_instance()->init(); | |
| 303 | + add_action( 'admin_notices', array( Charitable_Notification_Test_Helper::get_instance(), 'maybe_show_notice' ) ); | |
| 304 | +} | |
| 234 | 305 | |
| 235 | 306 | /** |
| 236 | 307 | * Event Driven notifications and items, added mostly in 1.8.3. |
| 237 | 308 | * |