*/ public static function lazy_hooks() { $s = 'GateForge\\Storage\\'; $r = 'GateForge\\Runtime\\'; $a = 'GateForge\\Admin\\'; return array( // Widget saves (10.6): late, after the widget's own update(). array( 'widget_update_callback', $s . 'Widget_Copyover', 'carry', 99, 4 ), // Block rules in every post type (10.6), and the pre-kses encoding fix. array( 'wp_insert_post_data', $s . 'Block_Rules', 'filter_post_data', 99, 2 ), array( 'content_save_pre', $s . 'Block_Rules', 'encode_before_kses', 5, 1 ), array( 'wp_after_insert_post', $s . 'Block_Rules', 'after_insert', 10, 2 ), // Schedule boundaries (10.8). array( 'gateforge_schedule_boundary', $r . 'Schedule', 'on_boundary', 10, 0 ), array( 'wp_after_insert_post', $r . 'Schedule', 'on_post_saved', 20, 2 ), array( 'deleted_post', $r . 'Schedule', 'on_post_deleted', 10, 1 ), array( 'update_option_timezone_string', $r . 'Schedule', 'reschedule', 10, 0 ), array( 'update_option_gmt_offset', $r . 'Schedule', 'reschedule', 10, 0 ), // Editor and widget-screen assets (10.2, 10.3). array( 'enqueue_block_editor_assets', $a . 'Editor_Assets', 'block_editor', 10, 1 ), array( 'enqueue_block_assets', $a . 'Editor_Assets', 'canvas', 10, 1 ), array( 'admin_enqueue_scripts', $a . 'Editor_Assets', 'widgets_screen', 10, 1 ), array( 'customize_controls_enqueue_scripts', $a . 'Editor_Assets', 'widget_form', 10, 1 ), ); } /** * Add the lazy hooks. */ private static function wire_lazy() { foreach ( self::lazy_hooks() as $h ) { add_filter( $h[0], array( $h[1], $h[2] ), $h[3], $h[4] ); } } /** * Screen IDs that count as GateForge screens (notices). Add-ons extend the * list through the gtfg_admin_screens filter. * * @param array $ours Built-in screen IDs. * @return array */ public static function admin_screens( array $ours ) { $list = apply_filters( 'gtfg_admin_screens', $ours ); return is_array( $list ) ? array_values( array_filter( $list, 'is_string' ) ) : $ours; } /** * Plugins-list row: Diagnostics link (the Tip Jar link is added by Import_Page). * * @param array $links Links. * @return array */ public static function action_links( $links ) { if ( current_user_can( 'edit_theme_options' ) ) { $links[] = '' . esc_html__( 'Diagnostics', 'gateforge' ) . ''; } return $links; } }