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', 'tables', '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' ), 'tables' => __( 'Tables', '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 ) { ?>
} $finding * @return string */ private static function finding_text( array $finding ) { $data = $finding['data']; switch ( $finding['code'] ) { case 'missing_key': /* translators: 1: kind of key (Index, unique key or primary key), 2: name of the key, 3: columns */ return sprintf( __( 'Missing %1$s "%2$s" on the columns %3$s. WordPress expects it for this table.', '360-orbit-database-cleaner' ), 'primary' === $data['type'] ? __( 'primary key', '360-orbit-database-cleaner' ) : ( 'unique' === $data['type'] ? __( 'unique key', '360-orbit-database-cleaner' ) : __( 'index', '360-orbit-database-cleaner' ) ), $data['key'], $data['columns'] ); case 'engine': /* translators: %s: name of the storage engine, e.g. "MyISAM" */ return sprintf( __( 'Storage engine %s instead of InnoDB: it locks the whole table on every write and is not crash-safe. Ask your host to convert it.', '360-orbit-database-cleaner' ), $data['engine'] ); case 'charset': /* translators: %s: collation, e.g. "utf8_general_ci" */ return sprintf( __( 'Collation %s: characters outside the basic range (emoji, some scripts) are not stored correctly. utf8mb4 is the modern choice.', '360-orbit-database-cleaner' ), $data['collation'] ); case 'fragmented': /* translators: %s: size of the unused space, e.g. "12 MB" */ return sprintf( __( 'About %s of unused space. Rebuilding the table gives it back.', '360-orbit-database-cleaner' ), size_format( (int) $data['free'] ) ); } return ''; } /** * Tabellen-Check: nur lesend. Zeigt je Tabelle Groesse und Befunde; ein fehlender Index erscheint als * Anweisung zum Kopieren, ausgefuehrt wird nichts. */ private static function render_tables_tab() { $report = Wp360_Database_Cleaner_Index_Check::report(); $warnings = 0; $hints = 0; $data = 0; $index = 0; foreach ( $report as $row ) { $data += $row['data']; $index += $row['index']; foreach ( $row['findings'] as $finding ) { if ( 'warning' === $finding['level'] ) { ++$warnings; } else { ++$hints; } } } ?>

' . esc_html( number_format_i18n( count( $report ) ) ) . '', '' . esc_html( size_format( $data ) ) . '', '' . esc_html( size_format( $index ) ) . '' ); ?>

0 ) { printf( /* translators: %s: number of missing indexes */ esc_html( _n( '%s index that WordPress expects is missing.', '%s indexes that WordPress expects are missing.', $warnings, '360-orbit-database-cleaner' ) ), esc_html( number_format_i18n( $warnings ) ) ); } else { esc_html_e( 'All indexes that WordPress expects are in place.', '360-orbit-database-cleaner' ); } if ( $hints > 0 ) { echo ' '; printf( /* translators: %s: number of hints */ esc_html( _n( '%s hint about tables.', '%s hints about tables.', $hints, '360-orbit-database-cleaner' ) ), esc_html( number_format_i18n( $hints ) ) ); } ?>

0 ) { ?>

' . esc_html__( '(plugin)', '360-orbit-database-cleaner' ) . ''; ?>


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. ?>