self::SLUG ), admin_url( 'admin.php' ) ); array_unshift( $links, '' . esc_html__( 'Settings', '360-orbit-database-cleaner' ) . '' ); return $links; } public static function register_menu() { self::$hook = add_submenu_page( Wp360_Database_Cleaner_Orbit_Menu::SLUG, 'Database Cleaner', 'Database Cleaner', '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-dc-help-basics', 'title' => __( 'What does Database Cleaner do?', '360-orbit-database-cleaner' ), 'content' => '

' . __( 'It shows which options WordPress loads into memory on every single page request (autoload) and lets you stop the ones you do not need from loading. It also removes expired transients and old post revisions.', '360-orbit-database-cleaner' ) . '

', ) ); $screen->add_help_tab( array( 'id' => 'wp360-dc-help-safe', 'title' => __( 'Is it safe?', '360-orbit-database-cleaner' ), 'content' => '

' . __( 'Nothing is removed without showing you first what would be removed. WordPress core options cannot be changed. Take a backup before cleaning up a live site.', '360-orbit-database-cleaner' ) . '

', ) ); } /** * Deaktivierungs-Rueckfrage: kein Formular, nur ein kurzer Hinweis vor dem * eigentlichen Deaktivieren in der Plugin-Liste, was dabei aufhoert und was * erhalten bleibt. * * @param string $hook Aktuelle Admin-Seite. */ public static function enqueue_deactivation_notice_script( $hook ) { if ( 'plugins.php' !== $hook || ! defined( 'WP360_DC_FILE' ) ) { return; } $basename = plugin_basename( WP360_DC_FILE ); $message = __( 'Deactivate Database Cleaner? Nothing is cleaned up automatically while it is inactive. Your settings and history stay saved and come back if you reactivate the plugin.', '360-orbit-database-cleaner' ); // Kein eigenes Script-Tag im Markup (WordPress.org-Richtlinie): ein Handle // ohne Datei, an das der Code per wp_add_inline_script() haengt. wp_register_script( 'wp360-dc-deactivate', false, array(), WP360_DC_VERSION, true ); wp_enqueue_script( 'wp360-dc-deactivate' ); wp_add_inline_script( 'wp360-dc-deactivate', sprintf( '( function () { var row = document.querySelector( %s ); var link = row ? row.querySelector( \'a[href*="action=deactivate"]\' ) : null; if ( ! link ) { return; } link.addEventListener( \'click\', function ( event ) { if ( ! window.confirm( %s ) ) { event.preventDefault(); } } ); } )();', wp_json_encode( 'tr[data-plugin="' . $basename . '"]' ), wp_json_encode( $message ) ) ); } /** * 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-database-cleaner' !== $slug ) { return $lines; } $total = Wp360_Database_Cleaner_Autoload_Scanner::total(); $lines[] = sprintf( /* translators: %s: total size of autoloaded options, e.g. "412 KB" */ __( 'Autoload: %s', '360-orbit-database-cleaner' ), size_format( $total['bytes'] ) ); 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( 'autoload', 'cleanup', 'history', 'settings', '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 'autoload'; } public static function enqueue_assets( $hook ) { if ( self::$hook !== $hook ) { return; } wp_enqueue_style( 'wp360-dc-admin', WP360_DC_URL . 'assets/admin.css', array(), WP360_DC_VERSION ); wp_enqueue_script( 'wp360-dc-admin', WP360_DC_URL . 'assets/admin.js', array( 'jquery' ), WP360_DC_VERSION, true ); wp_localize_script( 'wp360-dc-admin', 'wp360DatabaseCleaner', array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( Wp360_Database_Cleaner_Ajax::NONCE_ACTION ), 'strings' => array( 'saved' => __( 'Saved.', '360-orbit-database-cleaner' ), 'saveError' => __( 'Error while saving.', '360-orbit-database-cleaner' ), 'working' => __( 'Working …', '360-orbit-database-cleaner' ), 'failed' => __( 'The action failed.', '360-orbit-database-cleaner' ), 'stalled' => __( 'Stopped: some entries could not be removed.', '360-orbit-database-cleaner' ), ), ) ); } private static function render_tabs( $current_tab ) { $tabs = array( 'autoload' => __( 'Autoload', '360-orbit-database-cleaner' ), 'cleanup' => __( 'Clean up', '360-orbit-database-cleaner' ), 'history' => __( 'History', '360-orbit-database-cleaner' ), 'settings' => __( 'Settings', '360-orbit-database-cleaner' ), ); // 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'] = __( 'Database Cleaner Pro', '360-orbit-database-cleaner' ); } ?>

__( 'Low', '360-orbit-database-cleaner' ), 'medium' => __( 'Medium', '360-orbit-database-cleaner' ), 'high' => __( 'High', '360-orbit-database-cleaner' ), ); ?>

' . esc_html( number_format_i18n( $scan['count'] ) ) . '', '' . esc_html( size_format( $scan['bytes'] ) ) . '' ); ?>

$change ) { ?>

label() ); ?>

description() ); ?>

' . esc_html( isset( $data['name'] ) ? (string) $data['name'] : '' ) . ''; $was = '' . esc_html( isset( $data['previous'] ) ? (string) $data['previous'] : '' ) . ''; switch ( $entry['type'] ) { case 'autoload_off': /* translators: 1: option name, 2: previous autoload value */ return sprintf( esc_html__( 'Stopped %1$s from loading automatically (was: %2$s)', '360-orbit-database-cleaner' ), $name, $was ); case 'autoload_on': /* translators: 1: option name, 2: previous autoload value */ return sprintf( esc_html__( 'Set %1$s to load automatically (was: %2$s)', '360-orbit-database-cleaner' ), $name, $was ); case 'cleanup': $task = Wp360_Database_Cleaner_Cleaner::task( isset( $data['task'] ) ? (string) $data['task'] : '' ); $count = isset( $data['deleted'] ) ? (int) $data['deleted'] : 0; $text = esc_html( $task ? $task->history_text( $count ) : ( isset( $data['task'] ) ? (string) $data['task'] : '' ) ); return $text; case 'autoload_undo': /* translators: %s: option name */ return sprintf( esc_html__( 'Undid the change to %s', '360-orbit-database-cleaner' ), $name ); default: return esc_html( (string) $entry['type'] ); } } private static function render_history_tab() { $entries = Wp360_Database_Cleaner_History::all(); ?>

array() ) ); ?>

360 Orbit ()

-- das steckt hier im Flex-Branding-Block, die Meldung erschiene also neben der Ueberschrift statt darunter. ?>