%s

', sprintf( /* translators: 1: PERFLAB_SQLITE_DB_DROPIN_VERSION constant, 2: db.php drop-in path */ __( 'The SQLite Integration module is active, but the %1$s constant is missing. It appears you already have another %2$s file present on your site. ', 'performance-lab' ), 'PERFLAB_SQLITE_DB_DROPIN_VERSION', '' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php' ) ); return; } // The dropin db.php is missing. printf( '

%s

', sprintf( /* translators: 1: db.php drop-in path, 2: Admin URL to deactivate the module */ __( 'The SQLite Integration module is active, but the %1$s file is missing. Please deactivate the module and re-activate it to try again.', 'performance-lab' ), '' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php', esc_url( admin_url( 'options-general.php?page=' . PERFLAB_MODULES_SCREEN ) ) ) ); } add_action( 'admin_notices', 'perflab_sqlite_plugin_admin_notice' ); // Add the admin notices. /** * Adds a link to the admin bar. * * @since 2.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param WP_Admin_Bar $admin_bar The admin bar object. */ function perflab_sqlite_plugin_adminbar_item( $admin_bar ) { global $wpdb; if ( defined( 'PERFLAB_SQLITE_DB_DROPIN_VERSION' ) && defined( 'DATABASE_TYPE' ) && 'sqlite' === DATABASE_TYPE ) { $title = '' . __( 'Database: SQLite', 'performance-lab' ) . ''; } elseif ( stripos( $wpdb->db_server_info(), 'maria' ) !== false ) { $title = '' . __( 'Database: MariaDB', 'performance-lab' ) . ''; } else { $title = '' . __( 'Database: MySQL', 'performance-lab' ) . ''; } $args = array( 'id' => 'performance-lab-sqlite', 'parent' => 'top-secondary', 'title' => $title, 'href' => esc_url( admin_url( 'options-general.php?page=' . PERFLAB_MODULES_SCREEN ) ), 'meta' => false, ); $admin_bar->add_node( $args ); } add_action( 'admin_bar_menu', 'perflab_sqlite_plugin_adminbar_item', 999 );