| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Auto Hide Admin Bar |
| 4 |
* Description: Automatically hides the Toolbar. Will show the Toolbar when hovering over the top of the site. |
| 5 |
* Author: Marcel Bootsman |
| 6 |
* Author URI: https://marcelbootsman.nl |
| 7 |
* Github Plugin URI: https://github.com/mbootsman/auto-hide-admin-bar |
| 8 |
* Primary Branch: main |
| 9 |
* Text Domain: auto-hide-admin-bar |
| 10 |
* Domain Path: /languages/ |
| 11 |
* License: GPLv2 |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
* Requires at least: 6.0 |
| 14 |
* Requires PHP: 8.4 |
| 15 |
* Version: 1.8.0 |
| 16 |
* |
| 17 |
* @package AHAB |
| 18 |
*/ |
| 19 |
|
| 20 |
use AHAB\App\Plugin; |
| 21 |
use AHAB\App\Admin; |
| 22 |
use AHAB\App\Settings; |
| 23 |
use AHAB\App\Frontend; |
| 24 |
|
| 25 |
\define( 'AHAB_VERSION', '1.8.0' ); |
| 26 |
\define( 'AHAB_DIR', \plugin_dir_path( __FILE__ ) ); // Full path with trailing slash. |
| 27 |
\define( 'AHAB_URL', \plugin_dir_url( __FILE__ ) ); // With trailing slash. |
| 28 |
\define( 'AHAB_SLUG', \basename( __DIR__ ) ); // auto-hide-admin-bar. |
| 29 |
|
| 30 |
if ( ! \defined( 'ABSPATH' ) ) { |
| 31 |
return; // WP not loaded. |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Autoload internal classes. |
| 36 |
*/ |
| 37 |
require_once AHAB_DIR . 'app/class-plugin.php'; |
| 38 |
\spl_autoload_register( array( Plugin::class, 'autoloader' ) ); |
| 39 |
|
| 40 |
\register_uninstall_hook( __FILE__, array( Plugin::class, 'uninstall' ) ); |
| 41 |
|
| 42 |
|
| 43 |
\add_action( 'init', array( Plugin::class, 'load_textdomain' ), 9 ); |
| 44 |
\add_filter( 'plugin_action_links_' . \plugin_basename( __FILE__ ), array( Plugin::class, 'settings_link' ) ); |
| 45 |
\add_filter( 'gu_override_dot_org', array( Plugin::class, 'override_dot_org' ) ); |
| 46 |
|
| 47 |
// Handle the options page. |
| 48 |
\add_action( 'admin_menu', array( Admin::class, 'register_options_page' ) ); |
| 49 |
\add_action( 'admin_init', array( Settings::class, 'register_settings' ) ); |
| 50 |
|
| 51 |
\add_action( 'admin_bar_menu', array( Frontend::class, 'admin_bar_item' ), 0 ); |
| 52 |
\add_action( 'wp_enqueue_scripts', array( Frontend::class, 'enqueue_scripts' ), 0 ); |
| 53 |
|