builder = Container::getInstance()->get(Feed_Builder::class); $this->notifications = $notifications; } public function register() { add_action('admin_menu', [$this, 'register_menus']); } public function register_menus() { $cap = current_user_can( 'manage_options' ) ? 'manage_options' : 'manage_youtube_feed_options'; add_menu_page( __('YouTube Feed', 'feeds-for-youtube'), __('YouTube Feed', 'feeds-for-youtube') . $this->alert_html(), $cap, SBY_MENU_SLUG, null, 'dashicons-video-alt3', 99 ); add_submenu_page( SBY_MENU_SLUG, __( 'All Feeds', 'feeds-for-youtube' ), __( 'All Feeds', 'feeds-for-youtube' ), $cap, SBY_MENU_SLUG, array( $this->builder, 'feed_builder' ), 0 ); if ( (sby_is_pro() && empty( Util::get_license_key() )) || Util::is_license_expired() || !sby_is_pro() ) { add_submenu_page( SBY_MENU_SLUG, __( 'Upgrade to Pro', 'feeds-for-youtube' ), __( 'Try the Pro Demo', 'feeds-for-youtube' ), $cap, 'https://smashballoon.com/youtube-feed/demo/?utm_campaign=youtube-free&utm_source=menu-link&utm_medium=upgrade-link', '' ); } if ( sby_should_add_free_plugin_submenu( 'facebook' ) ) { add_submenu_page( SBY_MENU_SLUG, __( 'Facebook Feed', 'feeds-for-youtube' ), '' . __( 'Facebook Feed', 'feeds-for-youtube' ) . '', 'manage_options', 'admin.php?page=sby-feed-builder&tab=more', 5 ); } if ( sby_should_add_free_plugin_submenu( 'instagram' ) ) { add_submenu_page( SBY_MENU_SLUG, __( 'Instagram Feed', 'feeds-for-youtube' ), '' . __( 'Instagram Feed', 'feeds-for-youtube' ) . '', 'manage_options', 'admin.php?page=sby-feed-builder&tab=more', 6 ); } if ( sby_should_add_free_plugin_submenu( 'twitter' ) ) { add_submenu_page( SBY_MENU_SLUG, __( 'Twitter Feed', 'feeds-for-youtube' ), '' . __( 'Twitter Feed', 'feeds-for-youtube' ) . '', 'manage_options', 'admin.php?page=sby-feed-builder&tab=more', 7 ); } if ( sby_should_add_free_plugin_submenu( 'tiktok' ) ) { add_submenu_page( SBY_MENU_SLUG, __( 'Tiktok Feed', 'feeds-for-youtube' ), '' . __( 'Tiktok Feed', 'feeds-for-youtube' ) . '', 'manage_options', 'admin.php?page=sby-feed-builder&tab=more', 8 ); } if ( sby_should_add_free_plugin_submenu( 'reviews' ) ) { add_submenu_page( SBY_MENU_SLUG, __( 'Reviews Feed', 'feeds-for-youtube' ), '' . __( 'Reviews Feed', 'feeds-for-youtube' ) . '', 'manage_options', 'admin.php?page=sby-feed-builder&tab=more', 9 ); } } private function alert_html() { $notice = ''; $notice_bubble = ''; $notifications = $this->notifications->get(); if ( empty( $notice ) && ! empty( $notifications ) && is_array( $notifications ) ) { $notice_bubble = ' ' . count( $notifications ) . ''; } if ( sby_is_pro() && empty( Util::get_license_key() ) || Util::is_license_expired() ) { $notice_bubble = ' 1'; } return $notice_bubble . $notice; } }