Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
83.33% covered (warning)
83.33%
10 / 12
0.00% covered (danger)
0.00%
0 / 1
CRAP
n/a
0 / 0
BrianHenryIE\WP_Plugins_Page\instantiate_bh_wp_plugins_page
83.33% covered (warning)
83.33%
5 / 6
0.00% covered (danger)
0.00%
0 / 1
3.04
1<?php
2/**
3 * The plugin bootstrap file
4 *
5 * This file is read by WordPress to generate the plugin information in the plugin
6 * admin area. This file also WP_Includes all of the dependencies used by the plugin,
7 * registers the activation and deactivation functions, and defines a function
8 * that starts the plugin.
9 *
10 * @link              https://github.com/brianhenryie/bh-wp-plugins-page
11 * @since             1.0.0
12 * @package           brianhenryie/bh-wp-plugins-page
13 *
14 * @wordpress-plugin
15 * Plugin Name:       Plugins Page Cleanup
16 * Plugin URI:        http://github.com/BrianHenryIE/bh-wp-plugins-page/
17 * Description:       Removes formatting and up-sells, and moves Settings links to the beginning and Deactivate links to the end of plugins.php action links. Disables plugin deactivation surveys.
18 * Version:           1.2.0
19 * Requires PHP:      8.0
20 * Author:            BrianHenryIE
21 * Author URI:        https://BrianHenry.ie
22 * License:           GPL-2.0+
23 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
24 * Text Domain:       bh-wp-plugins-page
25 * Domain Path:       /languages
26 *
27 * GitHub Plugin URI: https://github.com/BrianHenryIE/bh-wp-plugins-page/
28 * Release Asset:     true
29 */
30
31namespace BrianHenryIE\WP_Plugins_Page;
32
33// If this file is called directly, abort.
34use BrianHenryIE\WP_Plugins_Page\API\Settings;
35use BrianHenryIE\WP_Plugins_Page\API\API;
36use BrianHenryIE\WP_Plugins_Page\BrianHenryIE\WP_Logger\Logger;
37
38if ( ! defined( 'WPINC' ) ) {
39    throw new \Exception( 'WordPress required but not loaded.' );
40}
41
42require_once plugin_dir_path( __FILE__ ) . 'autoload.php';
43
44/**
45 * Current plugin version.
46 * Start at version 1.0.0 and use SemVer - https://semver.org
47 * Rename this for your plugin and update it as you release new versions.
48 */
49define( 'BH_WP_PLUGINS_PAGE_VERSION', '1.2.0' );
50define( 'BH_WP_PLUGINS_PAGE_BASENAME', plugin_basename( __FILE__ ) );
51
52/**
53 * Begins execution of the plugin.
54 *
55 * Since everything within the plugin is registered via hooks,
56 * then kicking off the plugin from this point in the file does
57 * not affect the page life cycle.
58 *
59 * @since    1.0.0
60 */
61function instantiate_bh_wp_plugins_page(): void {
62
63    // If we're not in the Admin UI, we have nothing to do.
64    if ( ! is_admin() && ! wp_doing_ajax() ) {
65        return;
66    }
67
68    $settings = new Settings();
69
70    $logger = Logger::instance( $settings );
71
72    $api = new API( $logger );
73
74    new BH_WP_Plugins_Page( $settings, $api, $logger );
75}
76
77/**
78 * The core plugin class that is used to define internationalization,
79 * admin-specific hooks, and frontend-facing site hooks.
80 */
81instantiate_bh_wp_plugins_page();
82
83