-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrt-theplugin.php
93 lines (80 loc) · 1.98 KB
/
rt-theplugin.php
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/*
* Plugin Name: The Plugin.
* Plugin URI: https://github.com/maaprote
* Description: Make Magic
* Version: 1.0.0
* Requires at least: 5.5
* Requires PHP: 7.2
* Author: Rodrigo Teixeira
* Author URI: https://github.com/maaprote
* License: GPL v3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Update URI:
* Text Domain: rt-theplugin
* Domain Path: /languages
*/
namespace Rodrigo\ThePlugin;
use Rodrigo\ThePlugin\Admin\PluginManager;
use Rodrigo\ThePlugin\Admin\AdminAssets;
use Rodrigo\ThePlugin\Admin\OptionsPage;
use Rodrigo\ThePlugin\Frontend\MainAssets as FrontendAssets;
use Rodrigo\ThePlugin\Frontend\Shortcodes\DisplayNewsletterEntries;
use Rodrigo\ThePlugin\Frontend\Shortcodes\NewsletterForm;
use Rodrigo\ThePlugin\Rest\CustomEndpoints;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'The_Plugin' ) ) {
final class The_Plugin {
/**
* Constructor.
*
*/
public function __construct() {
$this->define_constants();
$this->load_textdomain();
$this->includes();
}
/**
* Define constants.
*
* @return void
*/
private function define_constants() {
define( 'RT_THEPLUGIN_PLUGIN_VERSION', '1.0.0' );
define( 'RT_THEPLUGIN_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'RT_THEPLUGIN_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
/**
* Load plugin textdomain.
*
* @return void
*/
public function load_textdomain() {
load_plugin_textdomain( 'rt-theplugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
/**
* Includes.
*
* @return void
*/
private function includes() {
require __DIR__ . '/vendor/autoload.php';
$classes = array(
PluginManager::class,
AdminAssets::class,
OptionsPage::class,
FrontendAssets::class,
NewsletterForm::class,
DisplayNewsletterEntries::class,
CustomEndpoints::class,
);
foreach ( $classes as $class ) {
new $class();
}
}
}
new The_Plugin();
}