has_menu ) { add_action('admin_menu', [$this, 'register_menu_page']); } if ( ( true === $this->has_assets ) && isset( $_GET['page'] ) && false !== strpos( $_GET['page'], SBY_SLUG . '-' . $this->menu_slug ) ) { add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] ); } } public function render() { SBY_View::render($this->template_file); } public function enqueue_assets() { wp_enqueue_style( 'sby-global-style', CUSTOMIZER_PLUGIN_URL . 'assets/css/global.css', false, SBYVER ); //settings page script $script_file = SBY_PLUGIN_URL . 'frontend/build/static/js/main.js'; if ( ! Util::isProduction() ) { $script_file = "http://localhost:3000/static/js/main.js"; } else { wp_enqueue_style( 'sby-settings-style', SBY_PLUGIN_URL . 'frontend/build/static/css/main.css', false, SBYVER ); } wp_enqueue_script( 'sby-settings', $script_file, array( 'wp-i18n' ), SBYVER, true ); wp_localize_script( 'sby-settings', 'sby_settings', $this->get_settings_object() ); wp_set_script_translations('sby-settings', 'feeds-for-youtube', SBY_PLUGIN_DIR . 'languages/'); } public function register_menu_page() { $menu_slug = SBY_SLUG . '-' . $this->menu_slug; if ($this->has_page_restriction) { $menu_slug = 'admin.php?page=sby-feed-builder&tab=more'; } add_submenu_page( SBY_MENU_SLUG, $this->page_title, $this->menu_title, 'manage_options', $menu_slug, [$this, 'render'], $this->menu_position ); } private function get_notifications() { return Container::get_instance()->get(SBY_Notifications::class)->output_return(); } protected function get_settings_object() { return apply_filters( 'sby_localized_settings', [ 'admin_url' => admin_url(), 'ajax_handler' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'sby-admin' ), 'setupPageUrl' => admin_url( 'admin.php?page=youtube-feed-setup' ), 'supportPageUrl' => admin_url( 'admin.php?page=youtube-feed-support' ), 'settingsPageUrl' => admin_url( 'admin.php?page=youtube-feed-settings' ), 'builderUrl' => admin_url( 'admin.php?page=sby-feed-builder' ), 'connectionURL' => Feed_Builder::oauth_connet_url(), 'manageLicense' => 'https://smashballoon.com/account/downloads/?utm_campaign='. sby_utm_campaign() .'&utm_source=settings&utm_medium=manage-license', 'single_video_settings' => sby_is_pro() ? SBY_CPT::get_sby_cpt_settings() : [], 'single_video_admin_url' => admin_url("admin.php?page=youtube-feed-settings#/single-videos"), 'pluginItemName' => SBY_PLUGIN_EDD_NAME, 'licenseType' => 'pro', 'socialWallLinks' => Feed_Builder::get_social_wall_links(), 'socialWallActivated' => is_plugin_active( 'social-wall/social-wall.php' ), 'genericText' => Feed_Builder::get_generic_text(), 'licenseTierFeatures' => (new YouTube_License_Tier)->tier_features(), 'tooltipHelpSvg' => '', 'svgIcons' => Feed_Builder::builder_svg_icons(), 'smashBalloonInfo' => Feed_Builder::get_smashballoon_info(), 'assetsURL' => SBY_PLUGIN_URL . 'frontend/build', 'notifications' => $this->get_notifications(), 'shouldShowPostGracePeriodNotice' => Util::expiredLicenseWithGracePeriodEnded(), 'isLicenseInactive' => empty( Util::get_license_key() ), ] ); } }