From 05e897ee21a16bdf174ad13648c8776fb0751fd4 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sun, 17 Jul 2022 14:32:11 -0700 Subject: [PATCH] Scaffold --- eth-embed-anchor-fm.php | 20 +++++++++++++++++ inc/class-plugin.php | 49 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 inc/class-plugin.php diff --git a/eth-embed-anchor-fm.php b/eth-embed-anchor-fm.php index bb370d5..89de486 100644 --- a/eth-embed-anchor-fm.php +++ b/eth-embed-anchor-fm.php @@ -27,3 +27,23 @@ */ namespace ETH_Embed_Anchor_FM; + +/** + * Perform setup actions after plugin loads. + * + * @return void + */ +function action_plugins_loaded() { + load_plugin_textdomain( + 'eth-embed-anchor-fm', + false, + dirname( plugin_basename( __FILE__ ) ) . '/languages/' + ); +} +add_action( 'plugins_loaded', __NAMESPACE__ . '\action_plugins_loaded' ); + +/** + * Load plugin classes. + */ +require_once __DIR__ . '/inc/class-plugin.php'; +Plugin::get_instance(); diff --git a/inc/class-plugin.php b/inc/class-plugin.php new file mode 100644 index 0000000..461c552 --- /dev/null +++ b/inc/class-plugin.php @@ -0,0 +1,49 @@ +<?php +/** + * Plugin functionality. + * + * @package ETH_Embed_Anchor_FM + */ + +namespace ETH_Embed_Anchor_FM; + +/** + * Class Plugin. + */ +class Plugin { + /** + * Singleton. + * + * @var Plugin + */ + private static $_instance = null; + + /** + * Implement singleton. + * + * @return Plugin + */ + public static function get_instance(): Plugin { + if ( ! is_a( self::$_instance, __CLASS__ ) ) { + self::$_instance = new self(); + self::$_instance->setup(); + } + + return self::$_instance; + } + + /** + * Silence is golden! + */ + private function __construct() {} + + /** + * Register hooks. + * + * @return void + */ + private function setup(): void { + // TODO: add oEmbed handler. + // TODO: add shortcode. + } +} -- GitLab