1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* The file that defines the core plugin class
|
4
|
|
|
*
|
5
|
|
|
* A class definition that includes attributes and functions used across both the
|
6
|
|
|
* public-facing side of the site and the admin area.
|
7
|
|
|
*
|
8
|
|
|
* @link https://www.yikesplugins.com/
|
9
|
|
|
* @since 1.0.0
|
10
|
|
|
*
|
11
|
|
|
* @package Yikes_Inc_Easy_Mailchimp_Extender
|
12
|
|
|
* @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes
|
13
|
|
|
*/
|
14
|
|
|
/**
|
15
|
|
|
* The core plugin class.
|
16
|
|
|
*
|
17
|
|
|
* This is used to define internationalization, admin-specific hooks, and
|
18
|
|
|
* public-facing site hooks.
|
19
|
|
|
*
|
20
|
|
|
* Also maintains the unique identifier of this plugin as well as the current
|
21
|
|
|
* version of the plugin.
|
22
|
|
|
*
|
23
|
|
|
* @since 1.0.0
|
24
|
|
|
* @package Yikes_Inc_Easy_Mailchimp_Extender
|
25
|
|
|
* @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes
|
26
|
|
|
* @author YIKES Inc. <[email protected]>
|
27
|
|
|
*/
|
28
|
|
|
class Yikes_Inc_Easy_Mailchimp_Extender {
|
29
|
|
|
/**
|
30
|
|
|
* The loader that's responsible for maintaining and registering all hooks that power
|
31
|
|
|
* the plugin.
|
32
|
|
|
*
|
33
|
|
|
* @since 1.0.0
|
34
|
|
|
* @access protected
|
35
|
|
|
* @var Yikes_Inc_Easy_Mailchimp_Extender_Loader $loader Maintains and registers all hooks for the plugin.
|
36
|
|
|
*/
|
37
|
|
|
protected $loader;
|
38
|
|
|
/**
|
39
|
|
|
* The unique identifier of this plugin.
|
40
|
|
|
*
|
41
|
|
|
* @since 1.0.0
|
42
|
|
|
* @access protected
|
43
|
|
|
* @var string $yikes_inc_easy_mailchimp_extender The string used to uniquely identify this plugin.
|
44
|
|
|
*/
|
45
|
|
|
protected $yikes_inc_easy_mailchimp_extender = 'yikes-inc-easy-mailchimp-extender';
|
46
|
|
|
/**
|
47
|
|
|
* The current version of the plugin.
|
48
|
|
|
*
|
49
|
|
|
* @since 1.0.0
|
50
|
|
|
* @access protected
|
51
|
|
|
* @var string $version The current version of the plugin.
|
52
|
|
|
*/
|
53
|
|
|
protected $version;
|
54
|
|
|
|
55
|
|
|
/**
|
56
|
|
|
* Our form interface instance.
|
57
|
|
|
*
|
58
|
|
|
* @var Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface
|
59
|
|
|
*/
|
60
|
|
|
protected $form_interface;
|
61
|
|
|
|
62
|
|
|
/**
|
63
|
|
|
* Define the core functionality of the plugin.
|
64
|
|
|
*
|
65
|
|
|
* Set the plugin name and the plugin version that can be used throughout the plugin.
|
66
|
|
|
* Load the dependencies, and set the hooks for the admin area and
|
67
|
|
|
* the public-facing side of the site.
|
68
|
|
|
*
|
69
|
|
|
* @since 1.0.0
|
70
|
|
|
*
|
71
|
|
|
* @param Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface $form_interface
|
72
|
|
|
*/
|
73
|
|
|
public function __construct( Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface $form_interface ) {
|
74
|
|
|
$this->version = YIKES_MC_VERSION;
|
75
|
|
|
$this->form_interface = $form_interface;
|
76
|
|
|
$this->load_dependencies();
|
77
|
|
|
$this->define_admin_hooks();
|
78
|
|
|
$this->define_public_hooks();
|
79
|
|
|
}
|
80
|
|
|
/**
|
81
|
|
|
* Load the required dependencies for this plugin.
|
82
|
|
|
*
|
83
|
|
|
* Include the following files that make up the plugin:
|
84
|
|
|
*
|
85
|
|
|
* - Yikes_Inc_Easy_Mailchimp_Extender_Loader. Orchestrates the hooks of the plugin.
|
86
|
|
|
* - Yikes_Inc_Easy_Mailchimp_Extender_i18n. Defines internationalization functionality.
|
87
|
|
|
* - Yikes_Inc_Easy_Mailchimp_Extender_Admin. Defines all hooks for the admin area.
|
88
|
|
|
* - Yikes_Inc_Easy_Mailchimp_Extender_Public. Defines all hooks for the public side of the site.
|
89
|
|
|
*
|
90
|
|
|
* Create an instance of the loader which will be used to register the hooks
|
91
|
|
|
* with WordPress.
|
92
|
|
|
*
|
93
|
|
|
* @since 1.0.0
|
94
|
|
|
* @access private
|
95
|
|
|
*/
|
96
|
|
|
private function load_dependencies() {
|
97
|
|
|
/**
|
98
|
|
|
* The class responsible for orchestrating the actions and filters of the
|
99
|
|
|
* core plugin.
|
100
|
|
|
*/
|
101
|
|
|
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-yikes-inc-easy-mailchimp-extender-loader.php';
|
102
|
|
|
/**
|
103
|
|
|
* The class responsible for defining all actions that occur in the admin area.
|
104
|
|
|
*/
|
105
|
|
|
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-yikes-inc-easy-mailchimp-extender-admin.php';
|
106
|
|
|
/**
|
107
|
|
|
* The class responsible for defining all actions that occur in the public-facing
|
108
|
|
|
* side of the site.
|
109
|
|
|
*/
|
110
|
|
|
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-yikes-inc-easy-mailchimp-extender-public.php';
|
111
|
|
|
/**
|
112
|
|
|
* The class responsible for orchestrating the actions and filters for the Gutenberg blocks
|
113
|
|
|
*/
|
114
|
|
|
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'blocks/maybe-do-blocks.php';
|
115
|
|
|
$this->loader = new Yikes_Inc_Easy_Mailchimp_Extender_Loader();
|
116
|
|
|
}
|
117
|
|
|
/**
|
118
|
|
|
* Register all of the hooks related to the admin area functionality
|
119
|
|
|
* of the plugin.
|
120
|
|
|
*
|
121
|
|
|
* @since 1.0.0
|
122
|
|
|
* @access private
|
123
|
|
|
*/
|
124
|
|
|
private function define_admin_hooks() {
|
125
|
|
|
$plugin_admin = new Yikes_Inc_Easy_Mailchimp_Forms_Admin( $this->get_yikes_inc_easy_mailchimp_extender(), $this->get_version(), $this->form_interface );
|
126
|
|
|
$plugin_admin->hooks();
|
127
|
|
|
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
|
128
|
|
|
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
|
129
|
|
|
}
|
130
|
|
|
/**
|
131
|
|
|
* Register all of the hooks related to the public-facing functionality
|
132
|
|
|
* of the plugin.
|
133
|
|
|
*
|
134
|
|
|
* @since 1.0.0
|
135
|
|
|
* @access private
|
136
|
|
|
*/
|
137
|
|
|
private function define_public_hooks() {
|
138
|
|
|
$plugin_public = new Yikes_Inc_Easy_Mailchimp_Extender_Public( $this->get_yikes_inc_easy_mailchimp_extender(), $this->get_version() );
|
|
|
|
|
139
|
|
|
}
|
140
|
|
|
/**
|
141
|
|
|
* Run the loader to execute all of the hooks with WordPress.
|
142
|
|
|
*
|
143
|
|
|
* @since 1.0.0
|
144
|
|
|
*/
|
145
|
|
|
public function run() {
|
146
|
|
|
$this->loader->run();
|
147
|
|
|
}
|
148
|
|
|
/**
|
149
|
|
|
* The name of the plugin used to uniquely identify it within the context of
|
150
|
|
|
* WordPress and to define internationalization functionality.
|
151
|
|
|
*
|
152
|
|
|
* @since 1.0.0
|
153
|
|
|
* @return string The name of the plugin.
|
154
|
|
|
*/
|
155
|
|
|
public function get_yikes_inc_easy_mailchimp_extender() {
|
156
|
|
|
return $this->yikes_inc_easy_mailchimp_extender;
|
157
|
|
|
}
|
158
|
|
|
/**
|
159
|
|
|
* The reference to the class that orchestrates the hooks with the plugin.
|
160
|
|
|
*
|
161
|
|
|
* @since 1.0.0
|
162
|
|
|
* @return Yikes_Inc_Easy_Mailchimp_Extender_Loader Orchestrates the hooks of the plugin.
|
163
|
|
|
*/
|
164
|
|
|
public function get_loader() {
|
165
|
|
|
return $this->loader;
|
166
|
|
|
}
|
167
|
|
|
/**
|
168
|
|
|
* Retrieve the version number of the plugin.
|
169
|
|
|
*
|
170
|
|
|
* @since 1.0.0
|
171
|
|
|
* @return string The version number of the plugin.
|
172
|
|
|
*/
|
173
|
|
|
public function get_version() {
|
174
|
|
|
return $this->version;
|
175
|
|
|
}
|
176
|
|
|
}
|
177
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.