register(); add_action('init', function () { do_action('streamcast_csf_init'); }, 5); add_action('admin_enqueue_scripts', [__CLASS__, 'enqueue_admin_assets']); add_action('admin_menu', [__CLASS__, 'add_help_pages']); add_shortcode('stream', [__CLASS__, 'stream_shortcode']); add_filter('plugin_action_links_' . plugin_basename(STREAMCAST_PLUGIN_FILE), [$this, 'add_action_links']); } public static function load_metabox() { if(class_exists('STREAMCAST_STREAMCAST_CSF')) { require_once STREAMCAST_PLUGIN_PATH . 'inc/class-streamcast-metabox.php'; } } public static function enqueue_admin_assets($hook) { global $typenow; if ('streamcast' === $typenow) { wp_enqueue_script('streamcast-admin-post-js', STREAMCAST_PLUGIN_DIR . 'build/admin-post.js', [], STREAMCAST_PLUGIN_VERSION, true); wp_enqueue_style('streamcast-admin-post-css', STREAMCAST_PLUGIN_DIR . 'build/admin-post.css', [], STREAMCAST_PLUGIN_VERSION); wp_enqueue_style('streamcast-admin-css', STREAMCAST_PLUGIN_DIR . 'assets/admin.css', [], STREAMCAST_PLUGIN_VERSION); wp_enqueue_script('streamcast-admin-js', STREAMCAST_PLUGIN_DIR . 'assets/admin.js', ['jquery'], STREAMCAST_PLUGIN_VERSION, true); } if ('streamcast_page_streamcast' === $hook) { wp_enqueue_style('streamcast-dashboard-css', STREAMCAST_PLUGIN_DIR . 'build/admin-dashboard.css', [], STREAMCAST_PLUGIN_VERSION); $asset_file = include STREAMCAST_PLUGIN_PATH . 'build/admin-dashboard.asset.php'; wp_enqueue_script('apb-admin-dashboard', STREAMCAST_PLUGIN_DIR . 'build/admin-dashboard.js', array_merge($asset_file['dependencies'], ['wp-util']), STREAMCAST_PLUGIN_VERSION, true); } } public static function add_help_pages() { add_submenu_page( 'edit.php?post_type=streamcast', 'Demo & Help', 'Demo & Help', 'manage_options', 'streamcast', [__CLASS__, 'render_dashboard'] ); } public static function render_dashboard() { ?>