-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin-boilerplate.php
More file actions
64 lines (57 loc) · 1.92 KB
/
plugin-boilerplate.php
File metadata and controls
64 lines (57 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Plugin Name: Boilerplate Plugin
* Plugin URI: https://www.pacificdev.com/
* Description: This is a plugin boilerplate.
* Version: 0.0.1
* Last Update: 2023-04-24
* Author: PacificDev
* Author URI: https://www.pacificdev.com/
* License: MIT
* Depends: PHP 8.0, WordPress 5.0
* Developer: Jenny Martinez
* Developer URI: http://github.com/lajennylove/
* @package BoilerplatePlugin
**/
// Exit if accessed directly.
defined( 'ABSPATH' ) or die( 'Hey, what are you doing here? You silly human!' );
// Loading autoload
if ( file_exists( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) {
require_once dirname( __FILE__ ) . '/vendor/autoload.php';
}
// Getting plugin data.
$plugin_data = get_file_data(__FILE__, array('Version' => 'Version'), false);
// Defining plugin constants.
define( 'BOILERPLATE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'BOILERPLATE_PLUGIN_TEMPLATES', plugin_dir_path( __FILE__ ) . 'templates/' );
define( 'BOILERPLATE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'BOILERPLATE_PLUGIN_BASE', plugin_basename( __FILE__ ) );
define( 'BOILERPLATE_VERSION', $plugin_data['Version'] );
/**
* Registering the activation function.
*
* @return void
*/
function activateBoilerPlatePlugin(): void
{
// Public method to execute when the plugin is activated.
Engine\Base\Activate::activate();
}
register_activation_hook( BOILERPLATE_PLUGIN_DIR, 'activateBoilerPlatePlugin' );
/**
* Registering the deactivation function.
*
* @return void
*/
function deactivateBoilerPlatePlugin(): void
{
// Public method to execute when the plugin is deactivated.
Engine\Base\Deactivate::deactivate();
}
register_deactivation_hook( BOILERPLATE_PLUGIN_DIR, 'deactivateBoilerPlatePlugin' );
/**
* Initializing all the core classes of the plugin.
*
* @return void
*/
if ( class_exists('Engine\\boilerPlate') ) new Engine\boilerPlate();