self::SLUG ), admin_url( 'admin.php' ) ); array_unshift( $links, '' . esc_html__( 'Settings', '360-orbit-shortlink-service' ) . '' ); return $links; } public static function register_menu() { self::$hook = add_submenu_page( Wp360_Shortlink_Service_Orbit_Menu::SLUG, __( 'Shortlink Service', '360-orbit-shortlink-service' ), __( 'Shortlink Service', '360-orbit-shortlink-service' ), 'manage_options', self::SLUG, array( __CLASS__, 'render_page' ) ); add_action( 'load-' . self::$hook, array( __CLASS__, 'add_help_tabs' ) ); } /** * Einheitliches Hilfe-Panel: WordPress' eigene "Hilfe"-Lasche oben rechts * mit den wichtigsten Fragen. Reine Texte, keine Logik. */ public static function add_help_tabs() { $screen = get_current_screen(); if ( ! $screen ) { return; } $screen->add_help_tab( array( 'id' => 'wp360-sl-help-basics', 'title' => __( 'What does Shortlink Service do?', '360-orbit-shortlink-service' ), 'content' => '
' . __( 'It gives every link you create a short, permanent address like /shortlinks/k3x9tq. Printed or shared addresses keep working, even when you later point the link to a different page.', '360-orbit-shortlink-service' ) . '
', ) ); $screen->add_help_tab( array( 'id' => 'wp360-sl-help-cache', 'title' => __( 'Page cache or CDN', '360-orbit-shortlink-service' ), 'content' => '' . __( 'If you use a page cache or a CDN, exclude the path /shortlinks/ from caching. Otherwise a changed target URL reaches visitors with a delay.', '360-orbit-shortlink-service' ) . '
', ) ); } /** * Gesundheitscheck: traegt zur gemeinsamen "360 WP Orbit"-Uebersicht bei, * rein lesend, nichts wird hier ausgeloest. Bewusst am gemeinsamen, nicht * praefigierten Filter 'wp360_orbit_health' registriert (siehe * class-orbit-menu.php). * * @param array $lines Bisherige Zeilen. * @param string $slug Slug des Plugins, fuer das die Zeilen gefragt sind. * @return array */ public static function health_lines( array $lines, $slug ) { if ( '360-orbit-shortlink-service' !== $slug ) { return $lines; } $lines[] = sprintf( /* translators: %s: number of published shortlinks */ __( 'Shortlinks: %s', '360-orbit-shortlink-service' ), number_format_i18n( (int) wp_count_posts( Wp360_Shortlink_Service_Post_Type::POST_TYPE )->publish ) ); return $lines; } private static function current_tab() { // 'pro' ist ein einziger Hinweis-Tab im FREE-Build; 'license' gibt es nur im PRO-Build. $valid = array( 'overview', 'pro' ); if ( isset( $_GET['tab'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $tab = sanitize_key( wp_unslash( $_GET['tab'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( in_array( $tab, $valid, true ) ) { return $tab; } } return 'overview'; } private static function render_tabs( $current_tab ) { $tabs = array( 'overview' => __( 'Overview', '360-orbit-shortlink-service' ), ); // FREE: ein einziger Pro-Tab statt gesperrter Attrappen-Tabs // (WordPress.org-Richtlinie 11: Upgrade-Hinweise sparsam und nur auf // der eigenen Einstellungsseite). $show_pro_tab = true; if ( $show_pro_tab ) { $tabs['pro'] = __( 'Shortlink Service Pro', '360-orbit-shortlink-service' ); } ?>