' . $ecp_string . '
plugin_path . 'src/admin-views/tribe-options-addons-api.php'; } /** * should we show the upgrade nags? * * @since 4.9.12 * @since 6.0.5 Moved to Settings class. * * @return boolean */ public function show_upgrade(): bool { // This allows sub-site admins to utilize this setting when their access to plugins is restricted. $can_show_tab = current_user_can( 'activate_plugins' ) || ( is_multisite() && current_user_can( 'customize' ) ); /** * Provides an opportunity to override the decision to show or hide the upgrade tab. * * Normally it will only show if the current user has the "activate_plugins" capability * and there are some currently-activated premium plugins. * * @since 4.9.12 * @since 6.0.0 This filter now controls only the capability to show the Upgrade tab. * * @param bool $can_show_tab True or False for showing the Upgrade Tab. */ $can_show_tab = apply_filters( 'tribe_events_show_upgrade_tab', $can_show_tab ); if ( ! $can_show_tab ) { return false; } /** * Filters whether the Upgrade Tab has actually any content to show or not. * * @since 6.0.0 * * @param bool $has_content Whether the tab has any content to show or not. */ if ( ! apply_filters( 'tec_events_upgrade_tab_has_content', false ) ) { return false; } return true; } /** * Create the upgrade tab * * @since 4.9.12 * @since 5.15.0 Added check to see if we are on TEC settings page. * @since 6.0.5 Moved to Settings class. */ public function do_upgrade_tab( $admin_page ): void { // Bail if we're not on TEC settings. if ( ! empty( $admin_page ) && static::$settings_page_id !== $admin_page ) { return; } if ( ! $this->show_upgrade() ) { return; } tribe_asset( Plugin::instance(), 'tribe-admin-upgrade-page', 'admin-upgrade-page.js', [ 'tribe-common' ], 'admin_enqueue_scripts', [ 'localize' => [ 'name' => 'tribe_upgrade', 'data' => [ 'v2_is_enabled' => tribe_events_views_v2_is_enabled(), 'button_text' => __( 'Upgrade your calendar views', 'the-events-calendar' ), ], ], ] ); $upgrade_tab_html = ''; $upgrade_tab = [ 'info-box-description' => [ 'type' => 'html', 'html' => $upgrade_tab_html, ], ]; /** * Allows the fields displayed in the upgrade tab to be modified. * * @since 4.9.12 * * @param array $upgrade_tab Array of fields used to setup the Upgrade Tab. */ $upgrade_fields = apply_filters( 'tribe_upgrade_fields', $upgrade_tab ); new Tribe__Settings_Tab( 'upgrade', esc_html__( 'Upgrade', 'the-events-calendar' ), [ 'priority' => 100, 'fields' => $upgrade_fields, 'network_admin' => is_network_admin(), 'show_save' => true, ] ); add_filter( 'tec_events_settings_tabs_ids', function( $tabs ) { $tabs[] = 'upgrade'; return $tabs; } ); } /** * When TEC is activated, the Events top level menu item in the dashboard needs the post_type appended to it * * @since 4.3.5 * @since 6.0.5 Moved to Settings class. * * @param string $url Settings URL to filter * * @return string */ public function filter_url( $url ): string { if ( is_network_admin() ) { return $url; } return add_query_arg( [ 'post_type' => Plugin::POSTTYPE ], $url ); } }