| @@ -1,7 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Functions to add admin notices if necessary. |
| 4 | + * | |
| 5 | + * @since 1.0.0 | |
| 6 | + * @package wp-sqlite-integration | |
| 4 | 7 | */ |
| 5 | 8 | |
| 6 | 9 | /** |
| 7 | 10 | * Add admin notices. |
| @@ -8,11 +11,8 @@ | ||
| 8 | 11 | * |
| 9 | 12 | * When the plugin gets merged in wp-core, this is not to be ported. |
| 10 | 13 | */ |
| 11 | 14 | function sqlite_plugin_admin_notice() { |
| 12 | - if ( ! current_user_can( sqlite_plugin_get_manage_capability() ) ) { | |
| 13 | - return; | |
| 14 | - } | |
| 15 | 15 | |
| 16 | 16 | // Don't print notices in the plugin's admin screen. |
| 17 | 17 | global $current_screen; |
| 18 | 18 | if ( isset( $current_screen->base ) && 'settings_page_sqlite-integration' === $current_screen->base ) { |
| @@ -18,13 +18,13 @@ | ||
| 18 | 18 | if ( isset( $current_screen->base ) && 'settings_page_sqlite-integration' === $current_screen->base ) { |
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - // Bail early if the pdo_sqlite extension is not loaded. | |
| 22 | + // If PDO SQLite is not loaded, bail early. | |
| 23 | 23 | if ( ! extension_loaded( 'pdo_sqlite' ) ) { |
| 24 | 24 | printf( |
| 25 | 25 | '<div class="notice notice-error"><p>%s</p></div>', |
| 26 | - esc_html__( 'The SQLite Integration plugin is active, but the pdo_sqlite extension is missing from your server. Please make sure that pdo_sqlite is enabled in your PHP installation.', 'sqlite-database-integration' ) | |
| 26 | + esc_html__( 'The SQLite Integration plugin is active, but the PDO SQLite extension is missing from your server. Please make sure that PDO SQLite is enabled in your PHP installation.', 'sqlite-database-integration' ) | |
| 27 | 27 | ); |
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | |
| @@ -65,9 +65,12 @@ | ||
| 65 | 65 | sprintf( |
| 66 | 66 | /* translators: 1: db.php drop-in path, 2: Admin URL to deactivate the module */ |
| 67 | 67 | __( 'The SQLite Integration plugin is active, but the %1$s file is missing. Please <a href="%2$s">deactivate the plugin</a> and re-activate it to try again.', 'sqlite-database-integration' ), |
| 68 | 68 | '<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>', |
| 69 | - esc_url( self_admin_url( 'plugins.php' ) ) | |
| 69 | + esc_url( admin_url( 'plugins.php' ) ) | |
| 70 | 70 | ) |
| 71 | 71 | ); |
| 72 | 72 | } |
| 73 | -add_action( is_multisite() ? 'network_admin_notices' : 'admin_notices', 'sqlite_plugin_admin_notice' ); // Add the admin notices. | |
| 73 | +add_action( 'admin_notices', 'sqlite_plugin_admin_notice' ); // Add the admin notices. | |
| 74 | + | |
| 75 | +// Remove the PL-plugin admin notices for SQLite. | |
| 76 | +remove_action( 'admin_notices', 'perflab_sqlite_plugin_admin_notice' ); | |