Skip to content

Commit

Permalink
Initial Release
Browse files Browse the repository at this point in the history
  • Loading branch information
dbccomm committed Aug 30, 2023
0 parents commit 6314aa2
Show file tree
Hide file tree
Showing 8 changed files with 1,687 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

# WordPress Splash Modal Plugin

## Version: 1.0.0

### Author: Bruno Laferrière
- Email: [email protected]


## Introduction

This WordPress plugin displays a splash modal to your website's visitors. The modal appears only once per visitor and utilizes cookies to ensure this behavior. The modal is mobile-responsive and customizable in both appearance and content.
Features

Display once per visitor using cookies
Customizable modal header and body text
Customizable button labels and links
Mobile-responsive design

## Installation

Download the repository as a ZIP file.
Upload the ZIP file to your WordPress installation through Plugins -> Add New -> Upload Plugin.
Activate the plugin.

## Usage

Once activated, the plugin will automatically display a splash modal to new visitors of your website.
Customization

You can customize the modal's appearance and content by modifying the plugin's PHP and CSS files.

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Feel free to modify this template to better fit your project's specific needs!
118 changes: 118 additions & 0 deletions core/boot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php
/**
* Bootstrapping functionality for DBC Splashplugin.
*
* Handles the initialization and setup of the plugin.
*
* @package dbccomm\dbcSplash\core
*/

namespace dbccomm\dbcSplash\core;

// Block direct calls for security.
if ( ! function_exists( 'add_action' ) ) {
die( esc_html_x( 'Direct access is not allowed.', 'security message', 'dbcsplash' ) );
}

/**
* Boot class.
*
* Handles the bootstrapping of the plugin, including activation, deactivation,
* text domain loading, and class includes.
*
* @final
*/
final class Boot {

/**
* @var Boot $instance The single instance of the class.
*/
private static $instance;

/**
* Creates or returns an instance of this class.
*
* @return Boot A single instance of this class.
*/
final public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}

return self::$instance;
}

/**
* Boot constructor.
*
* Initializes the plugin by registering hooks and including required files.
*
* @final
*/
final private function __construct() {

$plugin_dir = dirname( \dbccomm\dbcSplash\FILE );

// Register Activation and Deactivation methods.
register_activation_hook( \dbccomm\dbcSplash\FILE, [ $this, 'activate' ] );
register_deactivation_hook( \dbccomm\dbcSplash\FILE, [ $this, 'deactivate' ] );

// Load Translation.
add_action( 'init', [ $this, 'load_textdomain' ] );

// Include Plugin Updater and classes.
require_once $plugin_dir . '/plugin-updater.php';
new \dbccomm\dbcSplash\DBC_Plugin_Updater(
\dbccomm\dbcSplash\REPO,
array(
'tested' => \dbccomm\dbcSplash\TESTED,
'requires' => \dbccomm\dbcSplash\REQUIRES,
'requires_php' => \dbccomm\dbcSplash\REQUIRES_PHP,
)
);

// Conditionally load admin or frontend classes.
if ( is_admin() ) {

require_once $plugin_dir . '/core/dbc-class-register-menu.php';
require_once $plugin_dir . '/core/dbc-class-menu-splash.php';


} else {
// Include any frontend-specific files here.
require_once $plugin_dir . '/core/dbc-class-footer-splash.php';

}
}

/**
* Activation method.
*
* Handles tasks to be run when the plugin is activated.
*
* @final
*/
final public function activate() {
// Activation logic.
}

/**
* Deactivation method.
*
* Handles tasks to be run when the plugin is deactivated.
*
* @final
*/
final public function deactivate() {
// Deactivation logic.
}

/**
* Loads the text domain for translation.
*
* @final
*/
final public function load_textdomain() {
load_plugin_textdomain( 'dbcSplash', false, basename( dirname( \dbccomm\dbcSplash\FILE ) ) . '/languages/' );
}
}
Loading

0 comments on commit 6314aa2

Please sign in to comment.