v1.0.0
This commit is contained in:
commit
e1f5a47c96
22 changed files with 3155 additions and 0 deletions
76
includes/class-fontdelbosc-combustible-plugin.php
Normal file
76
includes/class-fontdelbosc-combustible-plugin.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin bootstrap singleton.
|
||||
*
|
||||
* @package FontdelboscCombustible
|
||||
*/
|
||||
|
||||
declare( strict_types=1 );
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Wires hooks and loads the textdomain.
|
||||
*/
|
||||
final class Fontdelbosc_Combustible_Plugin {
|
||||
|
||||
/**
|
||||
* Singleton instance.
|
||||
*
|
||||
* @var self|null
|
||||
*/
|
||||
private static ?self $instance = null;
|
||||
|
||||
/**
|
||||
* Returns the singleton.
|
||||
*/
|
||||
public static function instance(): self {
|
||||
return self::$instance ??= new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor: wires every hook.
|
||||
*/
|
||||
private function __construct() {
|
||||
add_action( 'plugins_loaded', array( self::class, 'load_textdomain' ) );
|
||||
add_action( 'wp_enqueue_scripts', array( self::class, 'register_assets' ) );
|
||||
add_action( 'init', array( 'Fontdelbosc_Combustible_Shortcode', 'init' ) );
|
||||
add_action( 'widgets_init', array( self::class, 'register_widget' ) );
|
||||
|
||||
if ( is_admin() ) {
|
||||
Fontdelbosc_Combustible_Admin::init();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the plugin textdomain.
|
||||
*/
|
||||
public static function load_textdomain(): void {
|
||||
load_plugin_textdomain(
|
||||
'fontdelbosc-combustible',
|
||||
false,
|
||||
dirname( plugin_basename( FONTDELBOSC_COMBUSTIBLE_FILE ) ) . '/languages/'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the public stylesheet.
|
||||
*/
|
||||
public static function register_assets(): void {
|
||||
$css = FONTDELBOSC_COMBUSTIBLE_DIR . 'public/css/fdbc-fuel.css';
|
||||
|
||||
wp_register_style(
|
||||
'fdbc-fuel',
|
||||
plugin_dir_url( FONTDELBOSC_COMBUSTIBLE_FILE ) . 'public/css/fdbc-fuel.css',
|
||||
array(),
|
||||
(string) filemtime( $css )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the widget.
|
||||
*/
|
||||
public static function register_widget(): void {
|
||||
register_widget( 'Fontdelbosc_Combustible_Widget' );
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue