Completed
Branch FET-10766-extract-activation-d... (a650cc)
by
unknown
116:57 queued 106:13
created
form_sections/strategies/layout/EE_Admin_Two_Column_Layout.strategy.php 2 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,81 +10,81 @@
 block discarded – undo
10 10
 class EE_Admin_Two_Column_Layout extends EE_Two_Column_Layout
11 11
 {
12 12
 
13
-    /**
14
-     * Overriding the parent table layout to include <tbody> tags
15
-     *
16
-     * @param array $additional_args
17
-     * @return string
18
-     */
19
-    public function layout_form_begin($additional_args = array())
20
-    {
21
-        $this->_form_section->set_html_class('form-table');
22
-        return parent::layout_form_begin($additional_args);
23
-    }
13
+	/**
14
+	 * Overriding the parent table layout to include <tbody> tags
15
+	 *
16
+	 * @param array $additional_args
17
+	 * @return string
18
+	 */
19
+	public function layout_form_begin($additional_args = array())
20
+	{
21
+		$this->_form_section->set_html_class('form-table');
22
+		return parent::layout_form_begin($additional_args);
23
+	}
24 24
 
25 25
 
26 26
 
27
-    /**
28
-     * Lays out a row for the subsection
29
-     *
30
-     * @param EE_Form_Section_Proper $form_section
31
-     * @return string
32
-     */
33
-    public function layout_subsection($form_section)
34
-    {
35
-        if ($form_section instanceof EE_Form_Section_Proper) {
36
-            return EEH_HTML::no_row($form_section->get_html());
37
-        }
38
-        if ($form_section instanceof EE_Form_Section_HTML) {
39
-            return EEH_HTML::no_row($form_section->get_html());
40
-        }
41
-        return '';
42
-    }
27
+	/**
28
+	 * Lays out a row for the subsection
29
+	 *
30
+	 * @param EE_Form_Section_Proper $form_section
31
+	 * @return string
32
+	 */
33
+	public function layout_subsection($form_section)
34
+	{
35
+		if ($form_section instanceof EE_Form_Section_Proper) {
36
+			return EEH_HTML::no_row($form_section->get_html());
37
+		}
38
+		if ($form_section instanceof EE_Form_Section_HTML) {
39
+			return EEH_HTML::no_row($form_section->get_html());
40
+		}
41
+		return '';
42
+	}
43 43
 
44 44
 
45 45
 
46
-    /**
47
-     * Lays out the row for the input, including label and errors
48
-     *
49
-     * @param EE_Form_Input_Base $input
50
-     * @return string
51
-     * @throws EE_Error
52
-     */
53
-    public function layout_input($input)
54
-    {
55
-        if ($input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy
56
-            || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
57
-            || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
58
-        ) {
59
-            $input->set_html_class($input->html_class() . ' large-text');
60
-        }
61
-        if ($input instanceof EE_Text_Area_Input) {
62
-            $input->set_rows(4);
63
-            $input->set_cols(60);
64
-        }
65
-        $input_html = $input->get_html_for_input();
66
-        // maybe add errors and help text ?
67
-        $input_html .= $input->get_html_for_errors() !== ''
68
-            ? EEH_HTML::nl() . $input->get_html_for_errors()
69
-            : '';
70
-        $input_html .= $input->get_html_for_help() !== ''
71
-            ? EEH_HTML::nl() . $input->get_html_for_help()
72
-            : '';
73
-        //overriding parent to add wp admin specific things.
74
-        $html = '';
75
-        if ($input instanceof EE_Hidden_Input) {
76
-            $html .= EEH_HTML::no_row($input->get_html_for_input());
77
-        } else {
78
-            $html .= EEH_HTML::tr(
79
-                EEH_HTML::th(
80
-                    $input->get_html_for_label(),
81
-                    '',
82
-                    '',
83
-                    '',
84
-                    'scope="row"'
85
-                ) . EEH_HTML::td($input_html)
86
-            );
87
-        }
88
-        return $html;
89
-    }
46
+	/**
47
+	 * Lays out the row for the input, including label and errors
48
+	 *
49
+	 * @param EE_Form_Input_Base $input
50
+	 * @return string
51
+	 * @throws EE_Error
52
+	 */
53
+	public function layout_input($input)
54
+	{
55
+		if ($input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy
56
+			|| $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
57
+			|| $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
58
+		) {
59
+			$input->set_html_class($input->html_class() . ' large-text');
60
+		}
61
+		if ($input instanceof EE_Text_Area_Input) {
62
+			$input->set_rows(4);
63
+			$input->set_cols(60);
64
+		}
65
+		$input_html = $input->get_html_for_input();
66
+		// maybe add errors and help text ?
67
+		$input_html .= $input->get_html_for_errors() !== ''
68
+			? EEH_HTML::nl() . $input->get_html_for_errors()
69
+			: '';
70
+		$input_html .= $input->get_html_for_help() !== ''
71
+			? EEH_HTML::nl() . $input->get_html_for_help()
72
+			: '';
73
+		//overriding parent to add wp admin specific things.
74
+		$html = '';
75
+		if ($input instanceof EE_Hidden_Input) {
76
+			$html .= EEH_HTML::no_row($input->get_html_for_input());
77
+		} else {
78
+			$html .= EEH_HTML::tr(
79
+				EEH_HTML::th(
80
+					$input->get_html_for_label(),
81
+					'',
82
+					'',
83
+					'',
84
+					'scope="row"'
85
+				) . EEH_HTML::td($input_html)
86
+			);
87
+		}
88
+		return $html;
89
+	}
90 90
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
57 57
             || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
58 58
         ) {
59
-            $input->set_html_class($input->html_class() . ' large-text');
59
+            $input->set_html_class($input->html_class().' large-text');
60 60
         }
61 61
         if ($input instanceof EE_Text_Area_Input) {
62 62
             $input->set_rows(4);
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
         $input_html = $input->get_html_for_input();
66 66
         // maybe add errors and help text ?
67 67
         $input_html .= $input->get_html_for_errors() !== ''
68
-            ? EEH_HTML::nl() . $input->get_html_for_errors()
68
+            ? EEH_HTML::nl().$input->get_html_for_errors()
69 69
             : '';
70 70
         $input_html .= $input->get_html_for_help() !== ''
71
-            ? EEH_HTML::nl() . $input->get_html_for_help()
71
+            ? EEH_HTML::nl().$input->get_html_for_help()
72 72
             : '';
73 73
         //overriding parent to add wp admin specific things.
74 74
         $html = '';
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                     '',
83 83
                     '',
84 84
                     'scope="row"'
85
-                ) . EEH_HTML::td($input_html)
85
+                ).EEH_HTML::td($input_html)
86 86
             );
87 87
         }
88 88
         return $html;
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Form_Section_Layout_Base.strategy.php 2 patches
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -15,257 +15,257 @@
 block discarded – undo
15 15
 abstract class EE_Form_Section_Layout_Base
16 16
 {
17 17
 
18
-    /**
19
-     * Form form section to lay out
20
-     *
21
-     * @var EE_Form_Section_Proper
22
-     */
23
-    protected $_form_section;
24
-
25
-
26
-
27
-    /**
28
-     *  __construct
29
-     */
30
-    public function __construct()
31
-    {
32
-    }
33
-
34
-
35
-
36
-    /**
37
-     * The form section on which this strategy is to perform
38
-     *
39
-     * @param EE_Form_Section_Proper $form
40
-     */
41
-    public function _construct_finalize(EE_Form_Section_Proper $form)
42
-    {
43
-        $this->_form_section = $form;
44
-    }
45
-
46
-
47
-
48
-    /**
49
-     * @return EE_Form_Section_Proper
50
-     */
51
-    public function form_section()
52
-    {
53
-        return $this->_form_section;
54
-    }
55
-
56
-
57
-
58
-    /**
59
-     * Also has teh side effect of enqueuing any needed JS and CSS for
60
-     * this form.
61
-     * Creates all the HTML necessary for displaying this form, its inputs, and
62
-     * proper subsections.
63
-     * Returns the HTML
64
-     *
65
-     * @return string HTML for displaying
66
-     * @throws EE_Error
67
-     */
68
-    public function layout_form()
69
-    {
70
-        $html = '';
71
-        // layout_form_begin
72
-        $html .= apply_filters(
73
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
74
-            $this->layout_form_begin(),
75
-            $this->_form_section
76
-        );
77
-        // layout_form_loop
78
-        $html .= apply_filters(
79
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
80
-            $this->layout_form_loop(),
81
-            $this->_form_section
82
-        );
83
-        // layout_form_end
84
-        $html .= apply_filters(
85
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
86
-            $this->layout_form_end(),
87
-            $this->_form_section
88
-        );
89
-        $html = $this->add_form_section_hooks_and_filters($html);
90
-        return $html;
91
-    }
92
-
93
-
94
-
95
-    /**
96
-     * @return string
97
-     * @throws EE_Error
98
-     */
99
-    public function layout_form_loop()
100
-    {
101
-        $html = '';
102
-        foreach ($this->_form_section->subsections() as $name => $subsection) {
103
-            if ($subsection instanceof EE_Form_Input_Base) {
104
-                $html .= apply_filters(
105
-                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'
106
-                    . $name . '__in_' . $this->_form_section->name(),
107
-                    $this->layout_input($subsection),
108
-                    $this->_form_section,
109
-                    $subsection
110
-                );
111
-            } elseif ($subsection instanceof EE_Form_Section_Base) {
112
-                $html .= apply_filters(
113
-                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'
114
-                    . $name . '__in_' . $this->_form_section->name(),
115
-                    $this->layout_subsection($subsection),
116
-                    $this->_form_section,
117
-                    $subsection
118
-                );
119
-            }
120
-        }
121
-        return $html;
122
-    }
123
-
124
-
125
-
126
-    /**
127
-     * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
128
-     *
129
-     * @return string
130
-     */
131
-    abstract public function layout_form_begin();
132
-
133
-
134
-
135
-    /**
136
-     * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
137
-     *
138
-     * @return string
139
-     */
140
-    abstract public function layout_form_end();
141
-
142
-
143
-
144
-    /**
145
-     * Should be used internally by layout_form() to layout each input (eg, if this layout
146
-     * is putting each input in a row of its own, this should probably be called by a
147
-     *  foreach loop in layout_form() (WITHOUT adding any content directly within layout_form()'s foreach loop.
148
-     * Eg, this method should add the tr and td tags). This method is exposed in case you want to completely
149
-     * customize the form's layout, but would like to make use of it for laying out
150
-     * 'easy-to-layout' inputs
151
-     *
152
-     * @param EE_Form_Input_Base $input
153
-     * @return string html
154
-     */
155
-    abstract public function layout_input($input);
156
-
157
-
158
-
159
-    /**
160
-     * Similar to layout_input(), should be used internally by layout_form() within a
161
-     * loop to layout each proper subsection. Unlike layout_input(), however, it is assumed
162
-     * that the proper subsection will layout its container, label, etc on its own.
163
-     *
164
-     * @param EE_Form_Section_Base $subsection
165
-     * @return string html
166
-     */
167
-    abstract public function layout_subsection($subsection);
168
-
169
-
170
-
171
-    /**
172
-     * Gets the HTML for the label tag and its contents for the input
173
-     *
174
-     * @param EE_Form_Input_Base $input
175
-     * @return string
176
-     */
177
-    public function display_label($input)
178
-    {
179
-        $class = $input->required()
180
-            ? 'ee-required-label ' . $input->html_label_class()
181
-            : $input->html_label_class();
182
-        $label_text = $input->required()
183
-            ? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
184
-            : $input->html_label_text();
185
-        return '<label id="'
186
-               . $input->html_label_id()
187
-               . '" class="'
188
-               . $class
189
-               . '" style="'
190
-               . $input->html_label_style()
191
-               . '" for="' . $input->html_name()
192
-               . '">'
193
-               . $label_text
194
-               . '</label>';
195
-    }
196
-
197
-
198
-
199
-    /**
200
-     * returns the HTML for the server-side validation errors for the specified input
201
-     * Note that if JS is enabled, it should remove these and instead
202
-     * populate the form's errors in the jquery validate fashion
203
-     * using the localized data provided to the JS
204
-     *
205
-     * @param EE_Form_Input_Base $input
206
-     * @return string
207
-     */
208
-    public function display_errors($input)
209
-    {
210
-        if ($input->get_validation_errors()) {
211
-            return "<label  id='"
212
-                   . $input->html_id()
213
-                   . "-error' class='error' for='{$input->html_name()}'>"
214
-                   . $input->get_validation_error_string()
215
-                   . '</label>';
216
-        }
217
-        return '';
218
-    }
219
-
220
-
221
-
222
-    /**
223
-     * Displays the help span for the specified input
224
-     *
225
-     * @param EE_Form_Input_Base $input
226
-     * @return string
227
-     */
228
-    public function display_help_text($input)
229
-    {
230
-        if ($input->html_help_text() !== '') {
231
-            $tag = is_admin() ? 'p' : 'span';
232
-            return '<'
233
-                   . $tag
234
-                   . ' id="'
235
-                   . $input->html_id()
236
-                   . '-help" class="'
237
-                   . $input->html_help_class()
238
-                   . '" style="'
239
-                   . $input->html_help_style()
240
-                   . '">'
241
-                   . $input->html_help_text()
242
-                   . '</'
243
-                   . $tag
244
-                   . '>';
245
-        }
246
-        return '';
247
-    }
248
-
249
-
250
-
251
-    /**
252
-     * Does an action and hook onto the end of teh form
253
-     *
254
-     * @param string $html
255
-     * @return string
256
-     */
257
-    public function add_form_section_hooks_and_filters($html)
258
-    {
259
-        // replace dashes and spaces with underscores
260
-        $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
261
-        do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
262
-        $html = (string) apply_filters(
263
-            'AFEE__Form_Section_Layout__' . $hook_name . '__html',
264
-            $html,
265
-            $this->_form_section
266
-        );
267
-        $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
268
-        $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
269
-        return $html;
270
-    }
18
+	/**
19
+	 * Form form section to lay out
20
+	 *
21
+	 * @var EE_Form_Section_Proper
22
+	 */
23
+	protected $_form_section;
24
+
25
+
26
+
27
+	/**
28
+	 *  __construct
29
+	 */
30
+	public function __construct()
31
+	{
32
+	}
33
+
34
+
35
+
36
+	/**
37
+	 * The form section on which this strategy is to perform
38
+	 *
39
+	 * @param EE_Form_Section_Proper $form
40
+	 */
41
+	public function _construct_finalize(EE_Form_Section_Proper $form)
42
+	{
43
+		$this->_form_section = $form;
44
+	}
45
+
46
+
47
+
48
+	/**
49
+	 * @return EE_Form_Section_Proper
50
+	 */
51
+	public function form_section()
52
+	{
53
+		return $this->_form_section;
54
+	}
55
+
56
+
57
+
58
+	/**
59
+	 * Also has teh side effect of enqueuing any needed JS and CSS for
60
+	 * this form.
61
+	 * Creates all the HTML necessary for displaying this form, its inputs, and
62
+	 * proper subsections.
63
+	 * Returns the HTML
64
+	 *
65
+	 * @return string HTML for displaying
66
+	 * @throws EE_Error
67
+	 */
68
+	public function layout_form()
69
+	{
70
+		$html = '';
71
+		// layout_form_begin
72
+		$html .= apply_filters(
73
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
74
+			$this->layout_form_begin(),
75
+			$this->_form_section
76
+		);
77
+		// layout_form_loop
78
+		$html .= apply_filters(
79
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
80
+			$this->layout_form_loop(),
81
+			$this->_form_section
82
+		);
83
+		// layout_form_end
84
+		$html .= apply_filters(
85
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
86
+			$this->layout_form_end(),
87
+			$this->_form_section
88
+		);
89
+		$html = $this->add_form_section_hooks_and_filters($html);
90
+		return $html;
91
+	}
92
+
93
+
94
+
95
+	/**
96
+	 * @return string
97
+	 * @throws EE_Error
98
+	 */
99
+	public function layout_form_loop()
100
+	{
101
+		$html = '';
102
+		foreach ($this->_form_section->subsections() as $name => $subsection) {
103
+			if ($subsection instanceof EE_Form_Input_Base) {
104
+				$html .= apply_filters(
105
+					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'
106
+					. $name . '__in_' . $this->_form_section->name(),
107
+					$this->layout_input($subsection),
108
+					$this->_form_section,
109
+					$subsection
110
+				);
111
+			} elseif ($subsection instanceof EE_Form_Section_Base) {
112
+				$html .= apply_filters(
113
+					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'
114
+					. $name . '__in_' . $this->_form_section->name(),
115
+					$this->layout_subsection($subsection),
116
+					$this->_form_section,
117
+					$subsection
118
+				);
119
+			}
120
+		}
121
+		return $html;
122
+	}
123
+
124
+
125
+
126
+	/**
127
+	 * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
128
+	 *
129
+	 * @return string
130
+	 */
131
+	abstract public function layout_form_begin();
132
+
133
+
134
+
135
+	/**
136
+	 * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
137
+	 *
138
+	 * @return string
139
+	 */
140
+	abstract public function layout_form_end();
141
+
142
+
143
+
144
+	/**
145
+	 * Should be used internally by layout_form() to layout each input (eg, if this layout
146
+	 * is putting each input in a row of its own, this should probably be called by a
147
+	 *  foreach loop in layout_form() (WITHOUT adding any content directly within layout_form()'s foreach loop.
148
+	 * Eg, this method should add the tr and td tags). This method is exposed in case you want to completely
149
+	 * customize the form's layout, but would like to make use of it for laying out
150
+	 * 'easy-to-layout' inputs
151
+	 *
152
+	 * @param EE_Form_Input_Base $input
153
+	 * @return string html
154
+	 */
155
+	abstract public function layout_input($input);
156
+
157
+
158
+
159
+	/**
160
+	 * Similar to layout_input(), should be used internally by layout_form() within a
161
+	 * loop to layout each proper subsection. Unlike layout_input(), however, it is assumed
162
+	 * that the proper subsection will layout its container, label, etc on its own.
163
+	 *
164
+	 * @param EE_Form_Section_Base $subsection
165
+	 * @return string html
166
+	 */
167
+	abstract public function layout_subsection($subsection);
168
+
169
+
170
+
171
+	/**
172
+	 * Gets the HTML for the label tag and its contents for the input
173
+	 *
174
+	 * @param EE_Form_Input_Base $input
175
+	 * @return string
176
+	 */
177
+	public function display_label($input)
178
+	{
179
+		$class = $input->required()
180
+			? 'ee-required-label ' . $input->html_label_class()
181
+			: $input->html_label_class();
182
+		$label_text = $input->required()
183
+			? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
184
+			: $input->html_label_text();
185
+		return '<label id="'
186
+			   . $input->html_label_id()
187
+			   . '" class="'
188
+			   . $class
189
+			   . '" style="'
190
+			   . $input->html_label_style()
191
+			   . '" for="' . $input->html_name()
192
+			   . '">'
193
+			   . $label_text
194
+			   . '</label>';
195
+	}
196
+
197
+
198
+
199
+	/**
200
+	 * returns the HTML for the server-side validation errors for the specified input
201
+	 * Note that if JS is enabled, it should remove these and instead
202
+	 * populate the form's errors in the jquery validate fashion
203
+	 * using the localized data provided to the JS
204
+	 *
205
+	 * @param EE_Form_Input_Base $input
206
+	 * @return string
207
+	 */
208
+	public function display_errors($input)
209
+	{
210
+		if ($input->get_validation_errors()) {
211
+			return "<label  id='"
212
+				   . $input->html_id()
213
+				   . "-error' class='error' for='{$input->html_name()}'>"
214
+				   . $input->get_validation_error_string()
215
+				   . '</label>';
216
+		}
217
+		return '';
218
+	}
219
+
220
+
221
+
222
+	/**
223
+	 * Displays the help span for the specified input
224
+	 *
225
+	 * @param EE_Form_Input_Base $input
226
+	 * @return string
227
+	 */
228
+	public function display_help_text($input)
229
+	{
230
+		if ($input->html_help_text() !== '') {
231
+			$tag = is_admin() ? 'p' : 'span';
232
+			return '<'
233
+				   . $tag
234
+				   . ' id="'
235
+				   . $input->html_id()
236
+				   . '-help" class="'
237
+				   . $input->html_help_class()
238
+				   . '" style="'
239
+				   . $input->html_help_style()
240
+				   . '">'
241
+				   . $input->html_help_text()
242
+				   . '</'
243
+				   . $tag
244
+				   . '>';
245
+		}
246
+		return '';
247
+	}
248
+
249
+
250
+
251
+	/**
252
+	 * Does an action and hook onto the end of teh form
253
+	 *
254
+	 * @param string $html
255
+	 * @return string
256
+	 */
257
+	public function add_form_section_hooks_and_filters($html)
258
+	{
259
+		// replace dashes and spaces with underscores
260
+		$hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
261
+		do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
262
+		$html = (string) apply_filters(
263
+			'AFEE__Form_Section_Layout__' . $hook_name . '__html',
264
+			$html,
265
+			$this->_form_section
266
+		);
267
+		$html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
268
+		$html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
269
+		return $html;
270
+	}
271 271
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
         $html = '';
71 71
         // layout_form_begin
72 72
         $html .= apply_filters(
73
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
73
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_'.$this->_form_section->name(),
74 74
             $this->layout_form_begin(),
75 75
             $this->_form_section
76 76
         );
77 77
         // layout_form_loop
78 78
         $html .= apply_filters(
79
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
79
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_'.$this->_form_section->name(),
80 80
             $this->layout_form_loop(),
81 81
             $this->_form_section
82 82
         );
83 83
         // layout_form_end
84 84
         $html .= apply_filters(
85
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
85
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_'.$this->_form_section->name(),
86 86
             $this->layout_form_end(),
87 87
             $this->_form_section
88 88
         );
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             if ($subsection instanceof EE_Form_Input_Base) {
104 104
                 $html .= apply_filters(
105 105
                     'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'
106
-                    . $name . '__in_' . $this->_form_section->name(),
106
+                    . $name.'__in_'.$this->_form_section->name(),
107 107
                     $this->layout_input($subsection),
108 108
                     $this->_form_section,
109 109
                     $subsection
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             } elseif ($subsection instanceof EE_Form_Section_Base) {
112 112
                 $html .= apply_filters(
113 113
                     'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'
114
-                    . $name . '__in_' . $this->_form_section->name(),
114
+                    . $name.'__in_'.$this->_form_section->name(),
115 115
                     $this->layout_subsection($subsection),
116 116
                     $this->_form_section,
117 117
                     $subsection
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
     public function display_label($input)
178 178
     {
179 179
         $class = $input->required()
180
-            ? 'ee-required-label ' . $input->html_label_class()
180
+            ? 'ee-required-label '.$input->html_label_class()
181 181
             : $input->html_label_class();
182 182
         $label_text = $input->required()
183
-            ? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
183
+            ? $input->html_label_text().'<span class="ee-asterisk">*</span>'
184 184
             : $input->html_label_text();
185 185
         return '<label id="'
186 186
                . $input->html_label_id()
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                . $class
189 189
                . '" style="'
190 190
                . $input->html_label_style()
191
-               . '" for="' . $input->html_name()
191
+               . '" for="'.$input->html_name()
192 192
                . '">'
193 193
                . $label_text
194 194
                . '</label>';
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
     {
259 259
         // replace dashes and spaces with underscores
260 260
         $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
261
-        do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
261
+        do_action('AHEE__Form_Section_Layout__'.$hook_name, $this->_form_section);
262 262
         $html = (string) apply_filters(
263
-            'AFEE__Form_Section_Layout__' . $hook_name . '__html',
263
+            'AFEE__Form_Section_Layout__'.$hook_name.'__html',
264 264
             $html,
265 265
             $this->_form_section
266 266
         );
267
-        $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
268
-        $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
267
+        $html .= EEH_HTML::nl().'<!-- AHEE__Form_Section_Layout__'.$hook_name.'__html -->';
268
+        $html .= EEH_HTML::nl().'<!-- AFEE__Form_Section_Layout__'.$hook_name.' -->';
269 269
         return $html;
270 270
     }
271 271
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/strategies/filter/VsprintfFilter.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -24,49 +24,49 @@
 block discarded – undo
24 24
 class VsprintfFilter extends FormHtmlFilter
25 25
 {
26 26
 
27
-    /**
28
-     * @var string $format
29
-     */
30
-    protected $format = '';
31
-
32
-
33
-    /**
34
-     * @var array $args
35
-     */
36
-    protected $args = array();
37
-
38
-
39
-
40
-    /**
41
-     * VsprintfFilter constructor.
42
-     *
43
-     * @param string $format
44
-     * @param array  $args
45
-     */
46
-    public function __construct($format, array $args)
47
-    {
48
-        $this->format = $format;
49
-        $this->args   = $args;
50
-    }
51
-
52
-
53
-
54
-    /**
55
-     * @param                             $html
56
-     * @param EE_Form_Section_Validatable $form_section
57
-     * @return string
58
-     */
59
-    public function filterHtml($html, EE_Form_Section_Validatable $form_section)
60
-    {
61
-        $this->args[] = $html;
62
-        if ($form_section instanceof EE_Form_Section_Proper) {
63
-            $subsections = $form_section->subsections();
64
-            foreach ((array)$subsections as $subsection) {
65
-                $this->args[] = $subsection->get_html();
66
-            }
67
-        }
68
-        return vsprintf($this->format, $this->args);
69
-    }
27
+	/**
28
+	 * @var string $format
29
+	 */
30
+	protected $format = '';
31
+
32
+
33
+	/**
34
+	 * @var array $args
35
+	 */
36
+	protected $args = array();
37
+
38
+
39
+
40
+	/**
41
+	 * VsprintfFilter constructor.
42
+	 *
43
+	 * @param string $format
44
+	 * @param array  $args
45
+	 */
46
+	public function __construct($format, array $args)
47
+	{
48
+		$this->format = $format;
49
+		$this->args   = $args;
50
+	}
51
+
52
+
53
+
54
+	/**
55
+	 * @param                             $html
56
+	 * @param EE_Form_Section_Validatable $form_section
57
+	 * @return string
58
+	 */
59
+	public function filterHtml($html, EE_Form_Section_Validatable $form_section)
60
+	{
61
+		$this->args[] = $html;
62
+		if ($form_section instanceof EE_Form_Section_Proper) {
63
+			$subsections = $form_section->subsections();
64
+			foreach ((array)$subsections as $subsection) {
65
+				$this->args[] = $subsection->get_html();
66
+			}
67
+		}
68
+		return vsprintf($this->format, $this->args);
69
+	}
70 70
 
71 71
 
72 72
 
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Checkbox_Display_Strategy.strategy.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -15,61 +15,61 @@
 block discarded – undo
15 15
 class EE_Checkbox_Display_Strategy extends EE_Compound_Input_Display_Strategy
16 16
 {
17 17
 
18
-    /**
19
-     * @throws EE_Error
20
-     * @return string of html to display the field
21
-     */
22
-    public function display()
23
-    {
24
-        $input = $this->get_input();
25
-        $multi = count($input->options()) > 1;
26
-        $input->set_label_sizes();
27
-        $label_size_class = $input->get_label_size_class();
28
-        $html             = '';
29
-        if (! is_array($input->raw_value()) && $input->raw_value() !== null) {
30
-            EE_Error::doing_it_wrong(
31
-                'EE_Checkbox_Display_Strategy::display()',
32
-                sprintf(
33
-                    esc_html__(
34
-                        'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"',
35
-                        'event_espresso'
36
-                    ),
37
-                    $input->html_id(),
38
-                    var_export($input->raw_value(), true),
39
-                    $input->html_name() . '[]'
40
-                ),
41
-                '4.8.1'
42
-            );
43
-        }
44
-        $input_raw_value = (array)$input->raw_value();
45
-        foreach ($input->options() as $value => $display_text) {
46
-            $value = $input->get_normalization_strategy()->unnormalize_one($value);
47
-            $html_id = $this->get_sub_input_id($value);
48
-            $html .= EEH_HTML::nl(0, 'checkbox');
49
-            $html .= '<label for="'
50
-                     . $html_id
51
-                     . '" id="'
52
-                     . $html_id
53
-                     . '-lbl" class="ee-checkbox-label-after'
54
-                     . $label_size_class
55
-                     . '">';
56
-            $html .= EEH_HTML::nl(1, 'checkbox');
57
-            $html .= '<input type="checkbox"';
58
-            $html .= ' name="' . $input->html_name() . '[]"';
59
-            $html .= ' id="' . $html_id . '"';
60
-            $html .= ' class="' . $input->html_class() . '"';
61
-            $html .= ' style="' . $input->html_style() . '"';
62
-            $html .= ' value="' . esc_attr($value) . '"';
63
-            $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
64
-                ? ' checked="checked"'
65
-                : '';
66
-            $html .= ' ' . $this->_input->other_html_attributes();
67
-            $html .= '>&nbsp;';
68
-            $html .= $display_text;
69
-            $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
70
-        }
71
-        return $html;
72
-    }
18
+	/**
19
+	 * @throws EE_Error
20
+	 * @return string of html to display the field
21
+	 */
22
+	public function display()
23
+	{
24
+		$input = $this->get_input();
25
+		$multi = count($input->options()) > 1;
26
+		$input->set_label_sizes();
27
+		$label_size_class = $input->get_label_size_class();
28
+		$html             = '';
29
+		if (! is_array($input->raw_value()) && $input->raw_value() !== null) {
30
+			EE_Error::doing_it_wrong(
31
+				'EE_Checkbox_Display_Strategy::display()',
32
+				sprintf(
33
+					esc_html__(
34
+						'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"',
35
+						'event_espresso'
36
+					),
37
+					$input->html_id(),
38
+					var_export($input->raw_value(), true),
39
+					$input->html_name() . '[]'
40
+				),
41
+				'4.8.1'
42
+			);
43
+		}
44
+		$input_raw_value = (array)$input->raw_value();
45
+		foreach ($input->options() as $value => $display_text) {
46
+			$value = $input->get_normalization_strategy()->unnormalize_one($value);
47
+			$html_id = $this->get_sub_input_id($value);
48
+			$html .= EEH_HTML::nl(0, 'checkbox');
49
+			$html .= '<label for="'
50
+					 . $html_id
51
+					 . '" id="'
52
+					 . $html_id
53
+					 . '-lbl" class="ee-checkbox-label-after'
54
+					 . $label_size_class
55
+					 . '">';
56
+			$html .= EEH_HTML::nl(1, 'checkbox');
57
+			$html .= '<input type="checkbox"';
58
+			$html .= ' name="' . $input->html_name() . '[]"';
59
+			$html .= ' id="' . $html_id . '"';
60
+			$html .= ' class="' . $input->html_class() . '"';
61
+			$html .= ' style="' . $input->html_style() . '"';
62
+			$html .= ' value="' . esc_attr($value) . '"';
63
+			$html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
64
+				? ' checked="checked"'
65
+				: '';
66
+			$html .= ' ' . $this->_input->other_html_attributes();
67
+			$html .= '>&nbsp;';
68
+			$html .= $display_text;
69
+			$html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
70
+		}
71
+		return $html;
72
+	}
73 73
 
74 74
 
75 75
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $input->set_label_sizes();
27 27
         $label_size_class = $input->get_label_size_class();
28 28
         $html             = '';
29
-        if (! is_array($input->raw_value()) && $input->raw_value() !== null) {
29
+        if ( ! is_array($input->raw_value()) && $input->raw_value() !== null) {
30 30
             EE_Error::doing_it_wrong(
31 31
                 'EE_Checkbox_Display_Strategy::display()',
32 32
                 sprintf(
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
                     ),
37 37
                     $input->html_id(),
38 38
                     var_export($input->raw_value(), true),
39
-                    $input->html_name() . '[]'
39
+                    $input->html_name().'[]'
40 40
                 ),
41 41
                 '4.8.1'
42 42
             );
43 43
         }
44
-        $input_raw_value = (array)$input->raw_value();
44
+        $input_raw_value = (array) $input->raw_value();
45 45
         foreach ($input->options() as $value => $display_text) {
46 46
             $value = $input->get_normalization_strategy()->unnormalize_one($value);
47 47
             $html_id = $this->get_sub_input_id($value);
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
                      . '">';
56 56
             $html .= EEH_HTML::nl(1, 'checkbox');
57 57
             $html .= '<input type="checkbox"';
58
-            $html .= ' name="' . $input->html_name() . '[]"';
59
-            $html .= ' id="' . $html_id . '"';
60
-            $html .= ' class="' . $input->html_class() . '"';
61
-            $html .= ' style="' . $input->html_style() . '"';
62
-            $html .= ' value="' . esc_attr($value) . '"';
58
+            $html .= ' name="'.$input->html_name().'[]"';
59
+            $html .= ' id="'.$html_id.'"';
60
+            $html .= ' class="'.$input->html_class().'"';
61
+            $html .= ' style="'.$input->html_style().'"';
62
+            $html .= ' value="'.esc_attr($value).'"';
63 63
             $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
64 64
                 ? ' checked="checked"'
65 65
                 : '';
66
-            $html .= ' ' . $this->_input->other_html_attributes();
66
+            $html .= ' '.$this->_input->other_html_attributes();
67 67
             $html .= '>&nbsp;';
68 68
             $html .= $display_text;
69
-            $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
69
+            $html .= EEH_HTML::nl(-1, 'checkbox').'</label>';
70 70
         }
71 71
         return $html;
72 72
     }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Radio_Button_Input.input.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@
 block discarded – undo
15 15
 class EE_Radio_Button_Input extends EE_Form_Input_With_Options_Base
16 16
 {
17 17
 
18
-    /**
19
-     * @param array $answer_options
20
-     * @param array $input_settings
21
-     */
22
-    public function __construct($answer_options, $input_settings = array())
23
-    {
24
-        $this->_set_display_strategy(new EE_Radio_Button_Display_Strategy());
25
-        $this->_add_validation_strategy(
26
-            new EE_Enum_Validation_Strategy(
27
-                isset($input_settings['validation_error_message'])
28
-                    ? $input_settings['validation_error_message']
29
-                    : null
30
-            )
31
-        );
32
-        $this->_multiple_selections = false;
33
-        parent::__construct($answer_options, $input_settings);
34
-    }
18
+	/**
19
+	 * @param array $answer_options
20
+	 * @param array $input_settings
21
+	 */
22
+	public function __construct($answer_options, $input_settings = array())
23
+	{
24
+		$this->_set_display_strategy(new EE_Radio_Button_Display_Strategy());
25
+		$this->_add_validation_strategy(
26
+			new EE_Enum_Validation_Strategy(
27
+				isset($input_settings['validation_error_message'])
28
+					? $input_settings['validation_error_message']
29
+					: null
30
+			)
31
+		);
32
+		$this->_multiple_selections = false;
33
+		parent::__construct($answer_options, $input_settings);
34
+	}
35 35
 
36 36
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Datepicker_Input.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,47 +13,47 @@
 block discarded – undo
13 13
 class EE_Datepicker_Input extends EE_Form_Input_Base
14 14
 {
15 15
 
16
-    /**
17
-     * @param array $input_settings
18
-     */
19
-    public function __construct($input_settings = array())
20
-    {
21
-        $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker'));
22
-        $this->_set_normalization_strategy(new EE_Text_Normalization());
23
-        //we could do better for validation, but at least verify its plaintext
24
-        $this->_add_validation_strategy(
25
-            new EE_Plaintext_Validation_Strategy(
26
-                isset($input_settings['validation_error_message'])
27
-                    ? $input_settings['validation_error_message']
28
-                    : null
29
-            )
30
-        );
31
-        parent::__construct($input_settings);
32
-        $this->set_html_class($this->html_class() . ' datepicker');
33
-        // add some style and make it dance
34
-        add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
35
-        add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
36
-    }
37
-
38
-
39
-
40
-    /**
41
-     *    enqueue_styles_and_scripts
42
-     *
43
-     * @access        public
44
-     * @return        void
45
-     */
46
-    public static function enqueue_styles_and_scripts()
47
-    {
48
-        // load css
49
-        wp_register_style(
50
-            'espresso-ui-theme',
51
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
52
-            array(),
53
-            EVENT_ESPRESSO_VERSION
54
-        );
55
-        wp_enqueue_style('espresso-ui-theme');
56
-    }
16
+	/**
17
+	 * @param array $input_settings
18
+	 */
19
+	public function __construct($input_settings = array())
20
+	{
21
+		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker'));
22
+		$this->_set_normalization_strategy(new EE_Text_Normalization());
23
+		//we could do better for validation, but at least verify its plaintext
24
+		$this->_add_validation_strategy(
25
+			new EE_Plaintext_Validation_Strategy(
26
+				isset($input_settings['validation_error_message'])
27
+					? $input_settings['validation_error_message']
28
+					: null
29
+			)
30
+		);
31
+		parent::__construct($input_settings);
32
+		$this->set_html_class($this->html_class() . ' datepicker');
33
+		// add some style and make it dance
34
+		add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
35
+		add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
36
+	}
37
+
38
+
39
+
40
+	/**
41
+	 *    enqueue_styles_and_scripts
42
+	 *
43
+	 * @access        public
44
+	 * @return        void
45
+	 */
46
+	public static function enqueue_styles_and_scripts()
47
+	{
48
+		// load css
49
+		wp_register_style(
50
+			'espresso-ui-theme',
51
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
52
+			array(),
53
+			EVENT_ESPRESSO_VERSION
54
+		);
55
+		wp_enqueue_style('espresso-ui-theme');
56
+	}
57 57
 
58 58
 
59 59
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             )
30 30
         );
31 31
         parent::__construct($input_settings);
32
-        $this->set_html_class($this->html_class() . ' datepicker');
32
+        $this->set_html_class($this->html_class().' datepicker');
33 33
         // add some style and make it dance
34 34
         add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
35 35
         add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         // load css
49 49
         wp_register_style(
50 50
             'espresso-ui-theme',
51
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
51
+            EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
52 52
             array(),
53 53
             EVENT_ESPRESSO_VERSION
54 54
         );
Please login to merge, or discard this patch.
core/EE_System.core.php 1 patch
Indentation   +884 added lines, -884 removed lines patch added patch discarded remove patch
@@ -31,902 +31,902 @@
 block discarded – undo
31 31
 {
32 32
 
33 33
 
34
-    /**
35
-     * @deprecated 4.9.40
36
-     * @see        \EventEspresso\core\services\activation\RequestTypeDetector
37
-     */
38
-    const req_type_normal = 0;
39
-
40
-    /**
41
-     * @deprecated 4.9.40
42
-     * @see        \EventEspresso\core\services\activation\RequestTypeDetector
43
-     */
44
-    const req_type_new_activation = 1;
45
-
46
-    /**
47
-     * @deprecated 4.9.40
48
-     * @see        \EventEspresso\core\services\activation\RequestTypeDetector
49
-     */
50
-    const req_type_reactivation = 2;
51
-
52
-    /**
53
-     * @deprecated 4.9.40
54
-     * @see        \EventEspresso\core\services\activation\RequestTypeDetector
55
-     */
56
-    const req_type_upgrade = 3;
57
-
58
-    /**
59
-     * @deprecated 4.9.40
60
-     * @see        \EventEspresso\core\services\activation\RequestTypeDetector
61
-     */
62
-    const req_type_downgrade = 4;
63
-
64
-    /**
65
-     * @deprecated since version 4.6.0.dev.006
66
-     * Now whenever a new_activation is detected the request type is still just
67
-     * new_activation (same for reactivation, upgrade, downgrade etc), but if we'r ein maintenance mode
68
-     * EE_System::initialize_db_if_no_migrations_required and EE_Addon::initialize_db_if_no_migrations_required
69
-     * will instead enqueue that EE plugin's db initialization for when we're taken out of maintenance mode.
70
-     * (Specifically, when the migration manager indicates migrations are finished
71
-     * EE_Data_Migration_Manager::initialize_db_for_enqueued_ee_plugins() will be called)
72
-     */
73
-    const req_type_activation_but_not_installed = 5;
74
-
75
-    /**
76
-     * @deprecated 4.9.40
77
-     * @see        \EventEspresso\core\services\activation\RequestTypeDetector
78
-     */
79
-    const addon_activation_history_option_prefix = 'ee_addon_activation_history_';
80
-
81
-
82
-    /**
83
-     * @var EE_System $_instance
84
-     */
85
-    private static $_instance;
86
-
87
-    /**
88
-     * @var EE_Registry $registry
89
-     */
90
-    private $registry;
91
-
92
-    /**
93
-     * @var LoaderInterface $loader
94
-     */
95
-    private $loader;
96
-
97
-    /**
98
-     * @var EE_Capabilities $capabilities
99
-     */
100
-    private $capabilities;
101
-
102
-    /**
103
-     * @var EE_Maintenance_Mode $maintenance_mode
104
-     */
105
-    private $maintenance_mode;
106
-
107
-    /**
108
-     * @var ActivationsAndUpgradesManager $activations_and_upgrades_manager
109
-     */
110
-    private $activations_and_upgrades_manager;
111
-
112
-    /**
113
-     * @var ActivationHistory $activation_history
114
-     */
115
-    private $activation_history;
116
-
117
-    /**
118
-     * @var \EventEspresso\core\services\activation\RequestType $request_type
119
-     */
120
-    private $request_type;
121
-
122
-    /**
123
-     * @var bool $activation_detected
124
-     */
125
-    private $activation_detected = false;
126
-
127
-
128
-
129
-    /**
130
-     * @singleton method used to instantiate class object
131
-     * @param EE_Registry|null         $registry
132
-     * @param LoaderInterface|null     $loader
133
-     * @param EE_Maintenance_Mode|null $maintenance_mode
134
-     * @return EE_System
135
-     */
136
-    public static function instance(
137
-        EE_Registry $registry = null,
138
-        LoaderInterface $loader = null,
139
-        EE_Maintenance_Mode $maintenance_mode = null
140
-    ) {
141
-        // check if class object is instantiated
142
-        if (! self::$_instance instanceof EE_System) {
143
-            self::$_instance = new self(
144
-                $registry,
145
-                $loader,
146
-                $maintenance_mode
147
-            );
148
-        }
149
-        return self::$_instance;
150
-    }
151
-
152
-
153
-
154
-    /**
155
-     * resets the instance and returns it
156
-     *
157
-     * @return EE_System
158
-     * @throws InvalidInterfaceException
159
-     * @throws InvalidDataTypeException
160
-     * @throws DomainException
161
-     * @throws InvalidArgumentException
162
-     * @throws InvalidEntityException
163
-     */
164
-    public static function reset()
165
-    {
166
-        //make sure none of the old hooks are left hanging around
167
-        remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
168
-        //we need to reset the migration manager in order for it to detect DMSs properly
169
-        EE_Data_Migration_Manager::reset();
170
-        self::instance()->detect_activations_or_upgrades();
171
-        self::instance()->activations_and_upgrades_manager->performActivationsAndUpgrades();
172
-        return self::instance();
173
-    }
174
-
175
-
176
-
177
-    /**
178
-     * sets hooks for running rest of system
179
-     * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point
180
-     * starting EE Addons from any other point may lead to problems
181
-     *
182
-     * @param EE_Registry         $registry
183
-     * @param LoaderInterface     $loader
184
-     * @param EE_Maintenance_Mode $maintenance_mode
185
-     */
186
-    private function __construct(
187
-        EE_Registry $registry,
188
-        LoaderInterface $loader,
189
-        EE_Maintenance_Mode $maintenance_mode
190
-    ) {
191
-        $this->registry = $registry;
192
-        $this->loader = $loader;
193
-        $this->maintenance_mode = $maintenance_mode;
194
-        do_action('AHEE__EE_System__construct__begin', $this);
195
-        add_action(
196
-            'AHEE__EE_Bootstrap__load_espresso_addons',
197
-            array($this, 'loadCapabilities'),
198
-            5
199
-        );
200
-        add_action(
201
-            'AHEE__EE_Bootstrap__load_espresso_addons',
202
-            array($this, 'loadCommandBus'),
203
-            7
204
-        );
205
-        add_action(
206
-            'AHEE__EE_Bootstrap__load_espresso_addons',
207
-            array($this, 'loadPluginApi'),
208
-            9
209
-        );
210
-        // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
211
-        add_action(
212
-            'AHEE__EE_Bootstrap__load_espresso_addons',
213
-            array($this, 'load_espresso_addons')
214
-        );
215
-        // when an ee addon is activated, we want to call the core hook(s) again
216
-        // because the newly-activated addon didn't get a chance to run at all
217
-        add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
218
-        // detect whether install or upgrade
219
-        add_action(
220
-            'AHEE__EE_Bootstrap__detect_activations_or_upgrades',
221
-            array($this, 'detect_activations_or_upgrades'),
222
-            3
223
-        );
224
-        // load EE_Config, EE_Textdomain, etc
225
-        add_action(
226
-            'AHEE__EE_Bootstrap__load_core_configuration',
227
-            array($this, 'load_core_configuration'),
228
-            5
229
-        );
230
-        // load EE_Config, EE_Textdomain, etc
231
-        add_action(
232
-            'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets',
233
-            array($this, 'register_shortcodes_modules_and_widgets'),
234
-            7
235
-        );
236
-        // you wanna get going? I wanna get going... let's get going!
237
-        add_action(
238
-            'AHEE__EE_Bootstrap__brew_espresso',
239
-            array($this, 'brew_espresso'),
240
-            9
241
-        );
242
-        //other housekeeping
243
-        //exclude EE critical pages from wp_list_pages
244
-        add_filter(
245
-            'wp_list_pages_excludes',
246
-            array($this, 'remove_pages_from_wp_list_pages'),
247
-            10
248
-        );
249
-        // ALL EE Addons should use the following hook point to attach their initial setup too
250
-        // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
251
-        do_action('AHEE__EE_System__construct__complete', $this);
252
-    }
253
-
254
-
255
-
256
-    /**
257
-     * load and setup EE_Capabilities
258
-     *
259
-     * @return void
260
-     * @throws InvalidArgumentException
261
-     * @throws InvalidInterfaceException
262
-     * @throws InvalidDataTypeException
263
-     * @throws EE_Error
264
-     */
265
-    public function loadCapabilities()
266
-    {
267
-        $this->capabilities = $this->loader->getShared('EE_Capabilities');
268
-        add_action(
269
-            'AHEE__EE_Capabilities__init_caps__before_initialization',
270
-            function() {
271
-                LoaderFactory::getLoader()->getShared('EE_Payment_Method_Manager');
272
-            }
273
-        );
274
-    }
275
-
276
-
277
-
278
-    /**
279
-     * create and cache the CommandBus, and also add middleware
280
-     * The CapChecker middleware requires the use of EE_Capabilities
281
-     * which is why we need to load the CommandBus after Caps are set up
282
-     *
283
-     * @return void
284
-     * @throws EE_Error
285
-     */
286
-    public function loadCommandBus()
287
-    {
288
-        $this->loader->getShared(
289
-            'CommandBusInterface',
290
-            array(
291
-                null,
292
-                apply_filters(
293
-                    'FHEE__EE_Load_Espresso_Core__handle_request__CommandBus_middleware',
294
-                    array(
295
-                        $this->loader->getShared('EventEspresso\core\services\commands\middleware\CapChecker'),
296
-                        $this->loader->getShared('EventEspresso\core\services\commands\middleware\AddActionHook'),
297
-                    )
298
-                ),
299
-            )
300
-        );
301
-    }
302
-
303
-
304
-
305
-    /**
306
-     * @return void
307
-     * @throws EE_Error
308
-     */
309
-    public function loadPluginApi()
310
-    {
311
-        // set autoloaders for all of the classes implementing EEI_Plugin_API
312
-        // which provide helpers for EE plugin authors to more easily register certain components with EE.
313
-        EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api');
314
-    }
315
-
316
-
317
-
318
-    /**
319
-     * Gets the ActivationHistory object for this addon
320
-     *
321
-     * @return ActivationHistory
322
-     */
323
-    public function getActivationHistory()
324
-    {
325
-        return $this->activation_history;
326
-    }
327
-
328
-
329
-
330
-    /**
331
-     * @param ActivationHistory $activation_history
332
-     */
333
-    public function setActivationHistory(ActivationHistory $activation_history)
334
-    {
335
-        $this->activation_history = $activation_history;
336
-    }
337
-
338
-
339
-
340
-    /**
341
-     * @return RequestType
342
-     */
343
-    public function getRequestType()
344
-    {
345
-        return $this->request_type;
346
-    }
347
-
348
-
349
-
350
-    /**
351
-     * @param RequestType $request_type
352
-     */
353
-    public function setRequestType(RequestType $request_type)
354
-    {
355
-        $this->request_type = $request_type;
356
-    }
357
-
358
-    /**
359
-     * load_espresso_addons
360
-     * allow addons to load first so that they can set hooks for running DMS's, etc
361
-     * this is hooked into both:
362
-     *    'AHEE__EE_Bootstrap__load_core_configuration'
363
-     *        which runs during the WP 'plugins_loaded' action at priority 5
364
-     *    and the WP 'activate_plugin' hook point
365
-     *
366
-     * @return void
367
-     * @throws EE_Error
368
-     */
369
-    public function load_espresso_addons()
370
-    {
371
-        do_action('AHEE__EE_System__load_espresso_addons');
372
-        //if the WP API basic auth plugin isn't already loaded, load it now.
373
-        //We want it for mobile apps. Just include the entire plugin
374
-        //also, don't load the basic auth when a plugin is getting activated, because
375
-        //it could be the basic auth plugin, and it doesn't check if its methods are already defined
376
-        //and causes a fatal error
377
-        if (
378
-            ! (
379
-                isset($_GET['activate'])
380
-                && $_GET['activate'] === 'true'
381
-            )
382
-            && ! function_exists('json_basic_auth_handler')
383
-            && ! function_exists('json_basic_auth_error')
384
-            && ! (
385
-                isset($_GET['action'])
386
-                && in_array($_GET['action'], array('activate', 'activate-selected'), true)
387
-            )
388
-        ) {
389
-            include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
390
-        }
391
-        do_action('AHEE__EE_System__load_espresso_addons__complete');
392
-    }
393
-
394
-
395
-
396
-    /**
397
-     * detect_activations_or_upgrades
398
-     * Checks for activation or upgrade of core first;
399
-     * then also checks if any registered addons have been activated or upgraded
400
-     * This is hooked into 'AHEE__EE_Bootstrap__detect_activations_or_upgrades'
401
-     * which runs during the WP 'plugins_loaded' action at priority 3
402
-     *
403
-     * @return void
404
-     * @throws DomainException
405
-     * @throws InvalidArgumentException
406
-     * @throws InvalidEntityException
407
-     * @throws InvalidInterfaceException
408
-     * @throws InvalidDataTypeException
409
-     */
410
-    public function detect_activations_or_upgrades()
411
-    {
412
-        if(
413
-            (defined('DOING_AJAX') && DOING_AJAX)
414
-            || (defined('REST_REQUEST') && REST_REQUEST)
415
-        ) {
416
-            return;
417
-        }
418
-        $this->activations_and_upgrades_manager = ActivationsFactory::getActivationsAndUpgradesManager();
419
-        $this->activation_detected = $this->activations_and_upgrades_manager->detectActivationsAndVersionChanges(
420
-            array_merge(
421
-                array($this),
422
-                get_object_vars($this->registry->addons)
423
-            )
424
-        );
425
-    }
426
-
427
-
428
-
429
-    /**
430
-     * load_core_configuration
431
-     * this is hooked into 'AHEE__EE_Bootstrap__load_core_configuration'
432
-     * which runs during the WP 'plugins_loaded' action at priority 5
433
-     *
434
-     * @return void
435
-     * @throws ReflectionException
436
-     */
437
-    public function load_core_configuration()
438
-    {
439
-        do_action('AHEE__EE_System__load_core_configuration__begin', $this);
440
-        $this->loader->getShared('EE_Load_Textdomain');
441
-        //load textdomain
442
-        EE_Load_Textdomain::load_textdomain();
443
-        // load and setup EE_Config and EE_Network_Config
444
-        $config = $this->loader->getShared('EE_Config');
445
-        $this->loader->getShared('EE_Network_Config');
446
-        // setup autoloaders
447
-        // enable logging?
448
-        if ($config->admin->use_full_logging) {
449
-            $this->loader->getShared('EE_Log');
450
-        }
451
-        // check for activation errors
452
-        $activation_errors = get_option('ee_plugin_activation_errors', false);
453
-        if ($activation_errors) {
454
-            EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
455
-            update_option('ee_plugin_activation_errors', false);
456
-        }
457
-        // get model names
458
-        $this->_parse_model_names();
459
-        //load caf stuff a chance to play during the activation process too.
460
-        $this->_maybe_brew_regular();
461
-        do_action('AHEE__EE_System__load_core_configuration__complete', $this);
462
-    }
463
-
464
-
465
-
466
-    /**
467
-     * cycles through all of the models/*.model.php files, and assembles an array of model names
468
-     *
469
-     * @return void
470
-     * @throws ReflectionException
471
-     */
472
-    private function _parse_model_names()
473
-    {
474
-        //get all the files in the EE_MODELS folder that end in .model.php
475
-        $models = glob(EE_MODELS . '*.model.php');
476
-        $model_names = array();
477
-        $non_abstract_db_models = array();
478
-        foreach ($models as $model) {
479
-            // get model classname
480
-            $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
481
-            $short_name = str_replace('EEM_', '', $classname);
482
-            $reflectionClass = new ReflectionClass($classname);
483
-            if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
484
-                $non_abstract_db_models[$short_name] = $classname;
485
-            }
486
-            $model_names[$short_name] = $classname;
487
-        }
488
-        $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
489
-        $this->registry->non_abstract_db_models = apply_filters(
490
-            'FHEE__EE_System__parse_implemented_model_names',
491
-            $non_abstract_db_models
492
-        );
493
-    }
494
-
495
-
496
-
497
-    /**
498
-     * The purpose of this method is to simply check for a file named "caffeinated/brewing_regular.php" for any hooks
499
-     * that need to be setup before our EE_System launches.
500
-     *
501
-     * @return void
502
-     */
503
-    private function _maybe_brew_regular()
504
-    {
505
-        if (
506
-            ! $this->activation_detected
507
-            && (! defined('EE_DECAF') || EE_DECAF !== true)
508
-            && is_readable(EE_CAFF_PATH . 'brewing_regular.php')
509
-        ) {
510
-            require_once EE_CAFF_PATH . 'brewing_regular.php';
511
-        }
512
-    }
513
-
514
-
515
-
516
-    /**
517
-     * register_shortcodes_modules_and_widgets
518
-     * generate lists of shortcodes and modules, then verify paths and classes
519
-     * This is hooked into 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'
520
-     * which runs during the WP 'plugins_loaded' action at priority 7
521
-     *
522
-     * @access public
523
-     * @return void
524
-     * @throws Exception
525
-     */
526
-    public function register_shortcodes_modules_and_widgets()
527
-    {
528
-        if ($this->activation_detected) {
529
-            return;
530
-        }
531
-        // check for addons using old hook point
532
-        if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
533
-            $this->_incompatible_addon_error();
534
-        }
535
-        do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
536
-        try {
537
-            // load, register, and add shortcodes the new way
538
-            $this->loader->getShared(
539
-                'EventEspresso\core\services\shortcodes\ShortcodesManager',
540
-                array(
541
-                    // and the old way, but we'll put it under control of the new system
542
-                    EE_Config::getLegacyShortcodesManager()
543
-                )
544
-            );
545
-        } catch (Exception $exception) {
546
-            new ExceptionStackTraceDisplay($exception);
547
-        }
548
-    }
549
-
550
-
551
-
552
-    /**
553
-     * _incompatible_addon_error
554
-     *
555
-     * @access public
556
-     * @return void
557
-     */
558
-    private function _incompatible_addon_error()
559
-    {
560
-        // get array of classes hooking into here
561
-        $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook(
562
-            'AHEE__EE_System__register_shortcodes_modules_and_addons'
563
-        );
564
-        if (! empty($class_names)) {
565
-            $msg = __(
566
-                'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:',
567
-                'event_espresso'
568
-            );
569
-            $msg .= '<ul>';
570
-            foreach ($class_names as $class_name) {
571
-                $msg .= '<li><b>Event Espresso - ' . str_replace(
572
-                        array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '',
573
-                        $class_name
574
-                    ) . '</b></li>';
575
-            }
576
-            $msg .= '</ul>';
577
-            $msg .= __(
578
-                'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.',
579
-                'event_espresso'
580
-            );
581
-            // save list of incompatible addons to wp-options for later use
582
-            add_option('ee_incompatible_addons', $class_names, '', 'no');
583
-            if (is_admin()) {
584
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
585
-            }
586
-        }
587
-    }
588
-
589
-
590
-
591
-    /**
592
-     * brew_espresso
593
-     * begins the process of setting hooks for initializing EE in the correct order
594
-     * This is happening on the 'AHEE__EE_Bootstrap__brew_espresso' hook point
595
-     * which runs during the WP 'plugins_loaded' action at priority 9
596
-     *
597
-     * @return void
598
-     */
599
-    public function brew_espresso()
600
-    {
601
-        if ($this->activation_detected) {
602
-            add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
603
-            return;
604
-        }
605
-        do_action('AHEE__EE_System__brew_espresso__begin', $this);
606
-        // load some final core systems
607
-        add_action('init', array($this, 'set_hooks_for_core'), 1);
608
-        add_action('init', array($this, 'load_CPTs_and_session'), 5);
609
-        add_action('init', array($this, 'load_controllers'), 7);
610
-        add_action('init', array($this, 'core_loaded_and_ready'), 9);
611
-        add_action('init', array($this, 'initialize'), 10);
612
-        add_action('init', array($this, 'initialize_last'), 100);
613
-        if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', true)) {
614
-            // pew pew pew
615
-            $this->loader->getShared('EE_PUE');
616
-            do_action('AHEE__EE_System__brew_espresso__after_pue_init');
617
-        }
618
-        do_action('AHEE__EE_System__brew_espresso__complete', $this);
619
-    }
620
-
621
-
622
-
623
-    /**
624
-     *    set_hooks_for_core
625
-     *
626
-     * @access public
627
-     * @return    void
628
-     * @throws EE_Error
629
-     */
630
-    public function set_hooks_for_core()
631
-    {
632
-        do_action('AHEE__EE_System__set_hooks_for_core');
633
-        //caps need to be initialized on every request so that capability maps are set.
634
-        //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
635
-        $this->capabilities->init_caps();
636
-    }
637
-
638
-
639
-
640
-    /**
641
-     *    perform_activations_upgrades_and_migrations
642
-     *
643
-     * @access public
644
-     * @return    void
645
-     */
646
-    public function perform_activations_upgrades_and_migrations()
647
-    {
648
-        do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
649
-    }
650
-
651
-
652
-
653
-    /**
654
-     *    load_CPTs_and_session
655
-     *
656
-     * @access public
657
-     * @return    void
658
-     */
659
-    public function load_CPTs_and_session()
660
-    {
661
-        do_action('AHEE__EE_System__load_CPTs_and_session__start');
662
-        // register Custom Post Types
663
-        $this->loader->getShared('EE_Register_CPTs');
664
-        do_action('AHEE__EE_System__load_CPTs_and_session__complete');
665
-    }
666
-
667
-
668
-
669
-    /**
670
-     * load_controllers
671
-     * this is the best place to load any additional controllers that needs access to EE core.
672
-     * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this
673
-     * time
674
-     *
675
-     * @access public
676
-     * @return void
677
-     */
678
-    public function load_controllers()
679
-    {
680
-        do_action('AHEE__EE_System__load_controllers__start');
681
-        // let's get it started
682
-        if (! is_admin() && ! $this->maintenance_mode->level()) {
683
-            do_action('AHEE__EE_System__load_controllers__load_front_controllers');
684
-            $this->loader->getShared('EE_Front_Controller');
685
-        } else if (! EE_FRONT_AJAX) {
686
-            do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
687
-            $this->loader->getShared('EE_Admin');
688
-        }
689
-        do_action('AHEE__EE_System__load_controllers__complete');
690
-    }
691
-
692
-
693
-
694
-    /**
695
-     * core_loaded_and_ready
696
-     * all of the basic EE core should be loaded at this point and available regardless of M-Mode
697
-     *
698
-     * @access public
699
-     * @return void
700
-     */
701
-    public function core_loaded_and_ready()
702
-    {
703
-        $this->loader->getShared('EE_Session');
704
-        do_action('AHEE__EE_System__core_loaded_and_ready');
705
-        // load_espresso_template_tags
706
-        if (is_readable(EE_PUBLIC . 'template_tags.php')) {
707
-            require_once(EE_PUBLIC . 'template_tags.php');
708
-        }
709
-        do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
710
-        $this->loader->getShared('EventEspresso\core\services\assets\Registry');
711
-    }
712
-
713
-
714
-
715
-    /**
716
-     * initialize
717
-     * this is the best place to begin initializing client code
718
-     *
719
-     * @access public
720
-     * @return void
721
-     */
722
-    public function initialize()
723
-    {
724
-        do_action('AHEE__EE_System__initialize');
725
-    }
726
-
727
-
728
-
729
-    /**
730
-     * initialize_last
731
-     * this is run really late during the WP init hook point, and ensures that mostly everything else that needs to
732
-     * initialize has done so
733
-     *
734
-     * @access public
735
-     * @return void
736
-     */
737
-    public function initialize_last()
738
-    {
739
-        do_action('AHEE__EE_System__initialize_last');
740
-        add_action('admin_bar_init', array($this, 'addEspressoToolbar'));
741
-    }
742
-
743
-
744
-
745
-    /**
746
-     * @return void
747
-     * @throws EE_Error
748
-     */
749
-    public function addEspressoToolbar()
750
-    {
751
-        $this->loader->getShared(
752
-            'EventEspresso\core\domain\services\admin\AdminToolBar',
753
-            array($this->capabilities)
754
-        );
755
-    }
756
-
757
-
758
-
759
-    /**
760
-     * do_not_cache
761
-     * sets no cache headers and defines no cache constants for WP plugins
762
-     *
763
-     * @access public
764
-     * @return void
765
-     */
766
-    public static function do_not_cache()
767
-    {
768
-        // set no cache constants
769
-        if (! defined('DONOTCACHEPAGE')) {
770
-            define('DONOTCACHEPAGE', true);
771
-        }
772
-        if (! defined('DONOTCACHCEOBJECT')) {
773
-            define('DONOTCACHCEOBJECT', true);
774
-        }
775
-        if (! defined('DONOTCACHEDB')) {
776
-            define('DONOTCACHEDB', true);
777
-        }
778
-        // add no cache headers
779
-        add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
780
-        // plus a little extra for nginx and Google Chrome
781
-        add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
782
-        // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
783
-        remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
784
-    }
785
-
786
-
787
-
788
-    /**
789
-     *    extra_nocache_headers
790
-     *
791
-     * @access    public
792
-     * @param $headers
793
-     * @return    array
794
-     */
795
-    public static function extra_nocache_headers($headers)
796
-    {
797
-        // for NGINX
798
-        $headers['X-Accel-Expires'] = 0;
799
-        // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
800
-        $headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0';
801
-        return $headers;
802
-    }
803
-
804
-
805
-
806
-    /**
807
-     *    nocache_headers
808
-     *
809
-     * @access    public
810
-     * @return    void
811
-     */
812
-    public static function nocache_headers()
813
-    {
814
-        nocache_headers();
815
-    }
816
-
817
-
818
-
819
-
820
-    /**
821
-     * simply hooks into "wp_list_pages_exclude" filter (for wp_list_pages method) and makes sure EE critical pages are
822
-     * never returned with the function.
823
-     *
824
-     * @param  array $exclude_array any existing pages being excluded are in this array.
825
-     * @return array
826
-     */
827
-    public function remove_pages_from_wp_list_pages($exclude_array)
828
-    {
829
-        return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
830
-    }
831
-
832
-
833
-
834
-    /******************************** DEPRECATED ***************************************/
835
-
836
-
837
-
838
-    /**
839
-     * @deprecated 4.9.40
840
-     * @return void
841
-     */
842
-    public function detect_if_activation_or_upgrade()
843
-    {
844
-    }
845
-
846
-
847
-
848
-    /**
849
-     * @deprecated 4.9.40
850
-     * @param null $version_history
851
-     * @param null $current_version_to_add
852
-     * @return void
853
-     */
854
-    public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null)
855
-    {
856
-    }
857
-
858
-
859
-
860
-    /**
861
-     * @deprecated 4.9.40
862
-     * @param null $espresso_db_update
863
-     * @return int one of the constants on EE_System::req_type_
864
-     */
865
-    public function detect_req_type($espresso_db_update = null)
866
-    {
867
-        return $this->getRequestType()->getRequestType();
868
-    }
869
-
870
-
871
-
872
-    /**
873
-     * @deprecated 4.9.40
874
-     * @return bool
875
-     */
876
-    public function is_major_version_change()
877
-    {
878
-        return $this->getRequestType()->isMajorVersionChange();
879
-    }
34
+	/**
35
+	 * @deprecated 4.9.40
36
+	 * @see        \EventEspresso\core\services\activation\RequestTypeDetector
37
+	 */
38
+	const req_type_normal = 0;
39
+
40
+	/**
41
+	 * @deprecated 4.9.40
42
+	 * @see        \EventEspresso\core\services\activation\RequestTypeDetector
43
+	 */
44
+	const req_type_new_activation = 1;
45
+
46
+	/**
47
+	 * @deprecated 4.9.40
48
+	 * @see        \EventEspresso\core\services\activation\RequestTypeDetector
49
+	 */
50
+	const req_type_reactivation = 2;
51
+
52
+	/**
53
+	 * @deprecated 4.9.40
54
+	 * @see        \EventEspresso\core\services\activation\RequestTypeDetector
55
+	 */
56
+	const req_type_upgrade = 3;
57
+
58
+	/**
59
+	 * @deprecated 4.9.40
60
+	 * @see        \EventEspresso\core\services\activation\RequestTypeDetector
61
+	 */
62
+	const req_type_downgrade = 4;
63
+
64
+	/**
65
+	 * @deprecated since version 4.6.0.dev.006
66
+	 * Now whenever a new_activation is detected the request type is still just
67
+	 * new_activation (same for reactivation, upgrade, downgrade etc), but if we'r ein maintenance mode
68
+	 * EE_System::initialize_db_if_no_migrations_required and EE_Addon::initialize_db_if_no_migrations_required
69
+	 * will instead enqueue that EE plugin's db initialization for when we're taken out of maintenance mode.
70
+	 * (Specifically, when the migration manager indicates migrations are finished
71
+	 * EE_Data_Migration_Manager::initialize_db_for_enqueued_ee_plugins() will be called)
72
+	 */
73
+	const req_type_activation_but_not_installed = 5;
74
+
75
+	/**
76
+	 * @deprecated 4.9.40
77
+	 * @see        \EventEspresso\core\services\activation\RequestTypeDetector
78
+	 */
79
+	const addon_activation_history_option_prefix = 'ee_addon_activation_history_';
80
+
81
+
82
+	/**
83
+	 * @var EE_System $_instance
84
+	 */
85
+	private static $_instance;
86
+
87
+	/**
88
+	 * @var EE_Registry $registry
89
+	 */
90
+	private $registry;
91
+
92
+	/**
93
+	 * @var LoaderInterface $loader
94
+	 */
95
+	private $loader;
96
+
97
+	/**
98
+	 * @var EE_Capabilities $capabilities
99
+	 */
100
+	private $capabilities;
101
+
102
+	/**
103
+	 * @var EE_Maintenance_Mode $maintenance_mode
104
+	 */
105
+	private $maintenance_mode;
106
+
107
+	/**
108
+	 * @var ActivationsAndUpgradesManager $activations_and_upgrades_manager
109
+	 */
110
+	private $activations_and_upgrades_manager;
111
+
112
+	/**
113
+	 * @var ActivationHistory $activation_history
114
+	 */
115
+	private $activation_history;
116
+
117
+	/**
118
+	 * @var \EventEspresso\core\services\activation\RequestType $request_type
119
+	 */
120
+	private $request_type;
121
+
122
+	/**
123
+	 * @var bool $activation_detected
124
+	 */
125
+	private $activation_detected = false;
126
+
127
+
128
+
129
+	/**
130
+	 * @singleton method used to instantiate class object
131
+	 * @param EE_Registry|null         $registry
132
+	 * @param LoaderInterface|null     $loader
133
+	 * @param EE_Maintenance_Mode|null $maintenance_mode
134
+	 * @return EE_System
135
+	 */
136
+	public static function instance(
137
+		EE_Registry $registry = null,
138
+		LoaderInterface $loader = null,
139
+		EE_Maintenance_Mode $maintenance_mode = null
140
+	) {
141
+		// check if class object is instantiated
142
+		if (! self::$_instance instanceof EE_System) {
143
+			self::$_instance = new self(
144
+				$registry,
145
+				$loader,
146
+				$maintenance_mode
147
+			);
148
+		}
149
+		return self::$_instance;
150
+	}
151
+
152
+
153
+
154
+	/**
155
+	 * resets the instance and returns it
156
+	 *
157
+	 * @return EE_System
158
+	 * @throws InvalidInterfaceException
159
+	 * @throws InvalidDataTypeException
160
+	 * @throws DomainException
161
+	 * @throws InvalidArgumentException
162
+	 * @throws InvalidEntityException
163
+	 */
164
+	public static function reset()
165
+	{
166
+		//make sure none of the old hooks are left hanging around
167
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
168
+		//we need to reset the migration manager in order for it to detect DMSs properly
169
+		EE_Data_Migration_Manager::reset();
170
+		self::instance()->detect_activations_or_upgrades();
171
+		self::instance()->activations_and_upgrades_manager->performActivationsAndUpgrades();
172
+		return self::instance();
173
+	}
174
+
175
+
176
+
177
+	/**
178
+	 * sets hooks for running rest of system
179
+	 * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point
180
+	 * starting EE Addons from any other point may lead to problems
181
+	 *
182
+	 * @param EE_Registry         $registry
183
+	 * @param LoaderInterface     $loader
184
+	 * @param EE_Maintenance_Mode $maintenance_mode
185
+	 */
186
+	private function __construct(
187
+		EE_Registry $registry,
188
+		LoaderInterface $loader,
189
+		EE_Maintenance_Mode $maintenance_mode
190
+	) {
191
+		$this->registry = $registry;
192
+		$this->loader = $loader;
193
+		$this->maintenance_mode = $maintenance_mode;
194
+		do_action('AHEE__EE_System__construct__begin', $this);
195
+		add_action(
196
+			'AHEE__EE_Bootstrap__load_espresso_addons',
197
+			array($this, 'loadCapabilities'),
198
+			5
199
+		);
200
+		add_action(
201
+			'AHEE__EE_Bootstrap__load_espresso_addons',
202
+			array($this, 'loadCommandBus'),
203
+			7
204
+		);
205
+		add_action(
206
+			'AHEE__EE_Bootstrap__load_espresso_addons',
207
+			array($this, 'loadPluginApi'),
208
+			9
209
+		);
210
+		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
211
+		add_action(
212
+			'AHEE__EE_Bootstrap__load_espresso_addons',
213
+			array($this, 'load_espresso_addons')
214
+		);
215
+		// when an ee addon is activated, we want to call the core hook(s) again
216
+		// because the newly-activated addon didn't get a chance to run at all
217
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
218
+		// detect whether install or upgrade
219
+		add_action(
220
+			'AHEE__EE_Bootstrap__detect_activations_or_upgrades',
221
+			array($this, 'detect_activations_or_upgrades'),
222
+			3
223
+		);
224
+		// load EE_Config, EE_Textdomain, etc
225
+		add_action(
226
+			'AHEE__EE_Bootstrap__load_core_configuration',
227
+			array($this, 'load_core_configuration'),
228
+			5
229
+		);
230
+		// load EE_Config, EE_Textdomain, etc
231
+		add_action(
232
+			'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets',
233
+			array($this, 'register_shortcodes_modules_and_widgets'),
234
+			7
235
+		);
236
+		// you wanna get going? I wanna get going... let's get going!
237
+		add_action(
238
+			'AHEE__EE_Bootstrap__brew_espresso',
239
+			array($this, 'brew_espresso'),
240
+			9
241
+		);
242
+		//other housekeeping
243
+		//exclude EE critical pages from wp_list_pages
244
+		add_filter(
245
+			'wp_list_pages_excludes',
246
+			array($this, 'remove_pages_from_wp_list_pages'),
247
+			10
248
+		);
249
+		// ALL EE Addons should use the following hook point to attach their initial setup too
250
+		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
251
+		do_action('AHEE__EE_System__construct__complete', $this);
252
+	}
253
+
254
+
255
+
256
+	/**
257
+	 * load and setup EE_Capabilities
258
+	 *
259
+	 * @return void
260
+	 * @throws InvalidArgumentException
261
+	 * @throws InvalidInterfaceException
262
+	 * @throws InvalidDataTypeException
263
+	 * @throws EE_Error
264
+	 */
265
+	public function loadCapabilities()
266
+	{
267
+		$this->capabilities = $this->loader->getShared('EE_Capabilities');
268
+		add_action(
269
+			'AHEE__EE_Capabilities__init_caps__before_initialization',
270
+			function() {
271
+				LoaderFactory::getLoader()->getShared('EE_Payment_Method_Manager');
272
+			}
273
+		);
274
+	}
275
+
276
+
277
+
278
+	/**
279
+	 * create and cache the CommandBus, and also add middleware
280
+	 * The CapChecker middleware requires the use of EE_Capabilities
281
+	 * which is why we need to load the CommandBus after Caps are set up
282
+	 *
283
+	 * @return void
284
+	 * @throws EE_Error
285
+	 */
286
+	public function loadCommandBus()
287
+	{
288
+		$this->loader->getShared(
289
+			'CommandBusInterface',
290
+			array(
291
+				null,
292
+				apply_filters(
293
+					'FHEE__EE_Load_Espresso_Core__handle_request__CommandBus_middleware',
294
+					array(
295
+						$this->loader->getShared('EventEspresso\core\services\commands\middleware\CapChecker'),
296
+						$this->loader->getShared('EventEspresso\core\services\commands\middleware\AddActionHook'),
297
+					)
298
+				),
299
+			)
300
+		);
301
+	}
302
+
303
+
304
+
305
+	/**
306
+	 * @return void
307
+	 * @throws EE_Error
308
+	 */
309
+	public function loadPluginApi()
310
+	{
311
+		// set autoloaders for all of the classes implementing EEI_Plugin_API
312
+		// which provide helpers for EE plugin authors to more easily register certain components with EE.
313
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api');
314
+	}
315
+
316
+
317
+
318
+	/**
319
+	 * Gets the ActivationHistory object for this addon
320
+	 *
321
+	 * @return ActivationHistory
322
+	 */
323
+	public function getActivationHistory()
324
+	{
325
+		return $this->activation_history;
326
+	}
327
+
328
+
329
+
330
+	/**
331
+	 * @param ActivationHistory $activation_history
332
+	 */
333
+	public function setActivationHistory(ActivationHistory $activation_history)
334
+	{
335
+		$this->activation_history = $activation_history;
336
+	}
337
+
338
+
339
+
340
+	/**
341
+	 * @return RequestType
342
+	 */
343
+	public function getRequestType()
344
+	{
345
+		return $this->request_type;
346
+	}
347
+
348
+
349
+
350
+	/**
351
+	 * @param RequestType $request_type
352
+	 */
353
+	public function setRequestType(RequestType $request_type)
354
+	{
355
+		$this->request_type = $request_type;
356
+	}
357
+
358
+	/**
359
+	 * load_espresso_addons
360
+	 * allow addons to load first so that they can set hooks for running DMS's, etc
361
+	 * this is hooked into both:
362
+	 *    'AHEE__EE_Bootstrap__load_core_configuration'
363
+	 *        which runs during the WP 'plugins_loaded' action at priority 5
364
+	 *    and the WP 'activate_plugin' hook point
365
+	 *
366
+	 * @return void
367
+	 * @throws EE_Error
368
+	 */
369
+	public function load_espresso_addons()
370
+	{
371
+		do_action('AHEE__EE_System__load_espresso_addons');
372
+		//if the WP API basic auth plugin isn't already loaded, load it now.
373
+		//We want it for mobile apps. Just include the entire plugin
374
+		//also, don't load the basic auth when a plugin is getting activated, because
375
+		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
376
+		//and causes a fatal error
377
+		if (
378
+			! (
379
+				isset($_GET['activate'])
380
+				&& $_GET['activate'] === 'true'
381
+			)
382
+			&& ! function_exists('json_basic_auth_handler')
383
+			&& ! function_exists('json_basic_auth_error')
384
+			&& ! (
385
+				isset($_GET['action'])
386
+				&& in_array($_GET['action'], array('activate', 'activate-selected'), true)
387
+			)
388
+		) {
389
+			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
390
+		}
391
+		do_action('AHEE__EE_System__load_espresso_addons__complete');
392
+	}
393
+
394
+
395
+
396
+	/**
397
+	 * detect_activations_or_upgrades
398
+	 * Checks for activation or upgrade of core first;
399
+	 * then also checks if any registered addons have been activated or upgraded
400
+	 * This is hooked into 'AHEE__EE_Bootstrap__detect_activations_or_upgrades'
401
+	 * which runs during the WP 'plugins_loaded' action at priority 3
402
+	 *
403
+	 * @return void
404
+	 * @throws DomainException
405
+	 * @throws InvalidArgumentException
406
+	 * @throws InvalidEntityException
407
+	 * @throws InvalidInterfaceException
408
+	 * @throws InvalidDataTypeException
409
+	 */
410
+	public function detect_activations_or_upgrades()
411
+	{
412
+		if(
413
+			(defined('DOING_AJAX') && DOING_AJAX)
414
+			|| (defined('REST_REQUEST') && REST_REQUEST)
415
+		) {
416
+			return;
417
+		}
418
+		$this->activations_and_upgrades_manager = ActivationsFactory::getActivationsAndUpgradesManager();
419
+		$this->activation_detected = $this->activations_and_upgrades_manager->detectActivationsAndVersionChanges(
420
+			array_merge(
421
+				array($this),
422
+				get_object_vars($this->registry->addons)
423
+			)
424
+		);
425
+	}
426
+
427
+
428
+
429
+	/**
430
+	 * load_core_configuration
431
+	 * this is hooked into 'AHEE__EE_Bootstrap__load_core_configuration'
432
+	 * which runs during the WP 'plugins_loaded' action at priority 5
433
+	 *
434
+	 * @return void
435
+	 * @throws ReflectionException
436
+	 */
437
+	public function load_core_configuration()
438
+	{
439
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
440
+		$this->loader->getShared('EE_Load_Textdomain');
441
+		//load textdomain
442
+		EE_Load_Textdomain::load_textdomain();
443
+		// load and setup EE_Config and EE_Network_Config
444
+		$config = $this->loader->getShared('EE_Config');
445
+		$this->loader->getShared('EE_Network_Config');
446
+		// setup autoloaders
447
+		// enable logging?
448
+		if ($config->admin->use_full_logging) {
449
+			$this->loader->getShared('EE_Log');
450
+		}
451
+		// check for activation errors
452
+		$activation_errors = get_option('ee_plugin_activation_errors', false);
453
+		if ($activation_errors) {
454
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
455
+			update_option('ee_plugin_activation_errors', false);
456
+		}
457
+		// get model names
458
+		$this->_parse_model_names();
459
+		//load caf stuff a chance to play during the activation process too.
460
+		$this->_maybe_brew_regular();
461
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
462
+	}
463
+
464
+
465
+
466
+	/**
467
+	 * cycles through all of the models/*.model.php files, and assembles an array of model names
468
+	 *
469
+	 * @return void
470
+	 * @throws ReflectionException
471
+	 */
472
+	private function _parse_model_names()
473
+	{
474
+		//get all the files in the EE_MODELS folder that end in .model.php
475
+		$models = glob(EE_MODELS . '*.model.php');
476
+		$model_names = array();
477
+		$non_abstract_db_models = array();
478
+		foreach ($models as $model) {
479
+			// get model classname
480
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
481
+			$short_name = str_replace('EEM_', '', $classname);
482
+			$reflectionClass = new ReflectionClass($classname);
483
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
484
+				$non_abstract_db_models[$short_name] = $classname;
485
+			}
486
+			$model_names[$short_name] = $classname;
487
+		}
488
+		$this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
489
+		$this->registry->non_abstract_db_models = apply_filters(
490
+			'FHEE__EE_System__parse_implemented_model_names',
491
+			$non_abstract_db_models
492
+		);
493
+	}
494
+
495
+
496
+
497
+	/**
498
+	 * The purpose of this method is to simply check for a file named "caffeinated/brewing_regular.php" for any hooks
499
+	 * that need to be setup before our EE_System launches.
500
+	 *
501
+	 * @return void
502
+	 */
503
+	private function _maybe_brew_regular()
504
+	{
505
+		if (
506
+			! $this->activation_detected
507
+			&& (! defined('EE_DECAF') || EE_DECAF !== true)
508
+			&& is_readable(EE_CAFF_PATH . 'brewing_regular.php')
509
+		) {
510
+			require_once EE_CAFF_PATH . 'brewing_regular.php';
511
+		}
512
+	}
513
+
514
+
515
+
516
+	/**
517
+	 * register_shortcodes_modules_and_widgets
518
+	 * generate lists of shortcodes and modules, then verify paths and classes
519
+	 * This is hooked into 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'
520
+	 * which runs during the WP 'plugins_loaded' action at priority 7
521
+	 *
522
+	 * @access public
523
+	 * @return void
524
+	 * @throws Exception
525
+	 */
526
+	public function register_shortcodes_modules_and_widgets()
527
+	{
528
+		if ($this->activation_detected) {
529
+			return;
530
+		}
531
+		// check for addons using old hook point
532
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
533
+			$this->_incompatible_addon_error();
534
+		}
535
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
536
+		try {
537
+			// load, register, and add shortcodes the new way
538
+			$this->loader->getShared(
539
+				'EventEspresso\core\services\shortcodes\ShortcodesManager',
540
+				array(
541
+					// and the old way, but we'll put it under control of the new system
542
+					EE_Config::getLegacyShortcodesManager()
543
+				)
544
+			);
545
+		} catch (Exception $exception) {
546
+			new ExceptionStackTraceDisplay($exception);
547
+		}
548
+	}
549
+
550
+
551
+
552
+	/**
553
+	 * _incompatible_addon_error
554
+	 *
555
+	 * @access public
556
+	 * @return void
557
+	 */
558
+	private function _incompatible_addon_error()
559
+	{
560
+		// get array of classes hooking into here
561
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook(
562
+			'AHEE__EE_System__register_shortcodes_modules_and_addons'
563
+		);
564
+		if (! empty($class_names)) {
565
+			$msg = __(
566
+				'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:',
567
+				'event_espresso'
568
+			);
569
+			$msg .= '<ul>';
570
+			foreach ($class_names as $class_name) {
571
+				$msg .= '<li><b>Event Espresso - ' . str_replace(
572
+						array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '',
573
+						$class_name
574
+					) . '</b></li>';
575
+			}
576
+			$msg .= '</ul>';
577
+			$msg .= __(
578
+				'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.',
579
+				'event_espresso'
580
+			);
581
+			// save list of incompatible addons to wp-options for later use
582
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
583
+			if (is_admin()) {
584
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
585
+			}
586
+		}
587
+	}
588
+
589
+
590
+
591
+	/**
592
+	 * brew_espresso
593
+	 * begins the process of setting hooks for initializing EE in the correct order
594
+	 * This is happening on the 'AHEE__EE_Bootstrap__brew_espresso' hook point
595
+	 * which runs during the WP 'plugins_loaded' action at priority 9
596
+	 *
597
+	 * @return void
598
+	 */
599
+	public function brew_espresso()
600
+	{
601
+		if ($this->activation_detected) {
602
+			add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
603
+			return;
604
+		}
605
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
606
+		// load some final core systems
607
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
608
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
609
+		add_action('init', array($this, 'load_controllers'), 7);
610
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
611
+		add_action('init', array($this, 'initialize'), 10);
612
+		add_action('init', array($this, 'initialize_last'), 100);
613
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', true)) {
614
+			// pew pew pew
615
+			$this->loader->getShared('EE_PUE');
616
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
617
+		}
618
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
619
+	}
620
+
621
+
622
+
623
+	/**
624
+	 *    set_hooks_for_core
625
+	 *
626
+	 * @access public
627
+	 * @return    void
628
+	 * @throws EE_Error
629
+	 */
630
+	public function set_hooks_for_core()
631
+	{
632
+		do_action('AHEE__EE_System__set_hooks_for_core');
633
+		//caps need to be initialized on every request so that capability maps are set.
634
+		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
635
+		$this->capabilities->init_caps();
636
+	}
637
+
638
+
639
+
640
+	/**
641
+	 *    perform_activations_upgrades_and_migrations
642
+	 *
643
+	 * @access public
644
+	 * @return    void
645
+	 */
646
+	public function perform_activations_upgrades_and_migrations()
647
+	{
648
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
649
+	}
650
+
651
+
652
+
653
+	/**
654
+	 *    load_CPTs_and_session
655
+	 *
656
+	 * @access public
657
+	 * @return    void
658
+	 */
659
+	public function load_CPTs_and_session()
660
+	{
661
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
662
+		// register Custom Post Types
663
+		$this->loader->getShared('EE_Register_CPTs');
664
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
665
+	}
666
+
667
+
668
+
669
+	/**
670
+	 * load_controllers
671
+	 * this is the best place to load any additional controllers that needs access to EE core.
672
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this
673
+	 * time
674
+	 *
675
+	 * @access public
676
+	 * @return void
677
+	 */
678
+	public function load_controllers()
679
+	{
680
+		do_action('AHEE__EE_System__load_controllers__start');
681
+		// let's get it started
682
+		if (! is_admin() && ! $this->maintenance_mode->level()) {
683
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
684
+			$this->loader->getShared('EE_Front_Controller');
685
+		} else if (! EE_FRONT_AJAX) {
686
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
687
+			$this->loader->getShared('EE_Admin');
688
+		}
689
+		do_action('AHEE__EE_System__load_controllers__complete');
690
+	}
691
+
692
+
693
+
694
+	/**
695
+	 * core_loaded_and_ready
696
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
697
+	 *
698
+	 * @access public
699
+	 * @return void
700
+	 */
701
+	public function core_loaded_and_ready()
702
+	{
703
+		$this->loader->getShared('EE_Session');
704
+		do_action('AHEE__EE_System__core_loaded_and_ready');
705
+		// load_espresso_template_tags
706
+		if (is_readable(EE_PUBLIC . 'template_tags.php')) {
707
+			require_once(EE_PUBLIC . 'template_tags.php');
708
+		}
709
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
710
+		$this->loader->getShared('EventEspresso\core\services\assets\Registry');
711
+	}
712
+
713
+
714
+
715
+	/**
716
+	 * initialize
717
+	 * this is the best place to begin initializing client code
718
+	 *
719
+	 * @access public
720
+	 * @return void
721
+	 */
722
+	public function initialize()
723
+	{
724
+		do_action('AHEE__EE_System__initialize');
725
+	}
726
+
727
+
728
+
729
+	/**
730
+	 * initialize_last
731
+	 * this is run really late during the WP init hook point, and ensures that mostly everything else that needs to
732
+	 * initialize has done so
733
+	 *
734
+	 * @access public
735
+	 * @return void
736
+	 */
737
+	public function initialize_last()
738
+	{
739
+		do_action('AHEE__EE_System__initialize_last');
740
+		add_action('admin_bar_init', array($this, 'addEspressoToolbar'));
741
+	}
742
+
743
+
744
+
745
+	/**
746
+	 * @return void
747
+	 * @throws EE_Error
748
+	 */
749
+	public function addEspressoToolbar()
750
+	{
751
+		$this->loader->getShared(
752
+			'EventEspresso\core\domain\services\admin\AdminToolBar',
753
+			array($this->capabilities)
754
+		);
755
+	}
756
+
757
+
758
+
759
+	/**
760
+	 * do_not_cache
761
+	 * sets no cache headers and defines no cache constants for WP plugins
762
+	 *
763
+	 * @access public
764
+	 * @return void
765
+	 */
766
+	public static function do_not_cache()
767
+	{
768
+		// set no cache constants
769
+		if (! defined('DONOTCACHEPAGE')) {
770
+			define('DONOTCACHEPAGE', true);
771
+		}
772
+		if (! defined('DONOTCACHCEOBJECT')) {
773
+			define('DONOTCACHCEOBJECT', true);
774
+		}
775
+		if (! defined('DONOTCACHEDB')) {
776
+			define('DONOTCACHEDB', true);
777
+		}
778
+		// add no cache headers
779
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
780
+		// plus a little extra for nginx and Google Chrome
781
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
782
+		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
783
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
784
+	}
785
+
786
+
787
+
788
+	/**
789
+	 *    extra_nocache_headers
790
+	 *
791
+	 * @access    public
792
+	 * @param $headers
793
+	 * @return    array
794
+	 */
795
+	public static function extra_nocache_headers($headers)
796
+	{
797
+		// for NGINX
798
+		$headers['X-Accel-Expires'] = 0;
799
+		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
800
+		$headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0';
801
+		return $headers;
802
+	}
803
+
804
+
805
+
806
+	/**
807
+	 *    nocache_headers
808
+	 *
809
+	 * @access    public
810
+	 * @return    void
811
+	 */
812
+	public static function nocache_headers()
813
+	{
814
+		nocache_headers();
815
+	}
816
+
817
+
818
+
819
+
820
+	/**
821
+	 * simply hooks into "wp_list_pages_exclude" filter (for wp_list_pages method) and makes sure EE critical pages are
822
+	 * never returned with the function.
823
+	 *
824
+	 * @param  array $exclude_array any existing pages being excluded are in this array.
825
+	 * @return array
826
+	 */
827
+	public function remove_pages_from_wp_list_pages($exclude_array)
828
+	{
829
+		return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
830
+	}
831
+
832
+
833
+
834
+	/******************************** DEPRECATED ***************************************/
835
+
836
+
837
+
838
+	/**
839
+	 * @deprecated 4.9.40
840
+	 * @return void
841
+	 */
842
+	public function detect_if_activation_or_upgrade()
843
+	{
844
+	}
845
+
846
+
847
+
848
+	/**
849
+	 * @deprecated 4.9.40
850
+	 * @param null $version_history
851
+	 * @param null $current_version_to_add
852
+	 * @return void
853
+	 */
854
+	public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null)
855
+	{
856
+	}
857
+
858
+
859
+
860
+	/**
861
+	 * @deprecated 4.9.40
862
+	 * @param null $espresso_db_update
863
+	 * @return int one of the constants on EE_System::req_type_
864
+	 */
865
+	public function detect_req_type($espresso_db_update = null)
866
+	{
867
+		return $this->getRequestType()->getRequestType();
868
+	}
869
+
870
+
871
+
872
+	/**
873
+	 * @deprecated 4.9.40
874
+	 * @return bool
875
+	 */
876
+	public function is_major_version_change()
877
+	{
878
+		return $this->getRequestType()->isMajorVersionChange();
879
+	}
880 880
 
881 881
 
882 882
 
883
-    /**
884
-     * @deprecated 4.9.40
885
-     * @param array  $activation_history_for_addon
886
-     * @param string $activation_indicator_option_name
887
-     * @param string $version_to_upgrade_to
888
-     * @return int one of the constants on EE_System::req_type_*
889
-     */
890
-    public static function detect_req_type_given_activation_history(
891
-        $activation_history_for_addon,
892
-        $activation_indicator_option_name,
893
-        $version_to_upgrade_to
894
-    ) {
895
-        return EE_System::instance()->getRequestType()->getRequestType();
896
-    }
883
+	/**
884
+	 * @deprecated 4.9.40
885
+	 * @param array  $activation_history_for_addon
886
+	 * @param string $activation_indicator_option_name
887
+	 * @param string $version_to_upgrade_to
888
+	 * @return int one of the constants on EE_System::req_type_*
889
+	 */
890
+	public static function detect_req_type_given_activation_history(
891
+		$activation_history_for_addon,
892
+		$activation_indicator_option_name,
893
+		$version_to_upgrade_to
894
+	) {
895
+		return EE_System::instance()->getRequestType()->getRequestType();
896
+	}
897 897
 
898 898
 
899 899
 
900
-    /**
901
-     * @deprecated 4.9.40
902
-     * @param boolean $initialize_addons_too
903
-     * @param boolean $verify_schema
904
-     * @return void
905
-     * @throws EE_Error
906
-     */
907
-    public function initialize_db_if_no_migrations_required($initialize_addons_too = false, $verify_schema = true)
908
-    {
909
-    }
900
+	/**
901
+	 * @deprecated 4.9.40
902
+	 * @param boolean $initialize_addons_too
903
+	 * @param boolean $verify_schema
904
+	 * @return void
905
+	 * @throws EE_Error
906
+	 */
907
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = false, $verify_schema = true)
908
+	{
909
+	}
910 910
 
911 911
 
912 912
 
913
-    /**
914
-     * @deprecated 4.9.40
915
-     * @throws EE_Error
916
-     */
917
-    public function initialize_addons()
918
-    {
919
-    }
913
+	/**
914
+	 * @deprecated 4.9.40
915
+	 * @throws EE_Error
916
+	 */
917
+	public function initialize_addons()
918
+	{
919
+	}
920 920
 
921 921
 
922 922
 
923
-    /**
924
-     * @deprecated 4.9.40
925
-     * @return void
926
-     */
927
-    public function redirect_to_about_ee()
928
-    {
929
-    }
923
+	/**
924
+	 * @deprecated 4.9.40
925
+	 * @return void
926
+	 */
927
+	public function redirect_to_about_ee()
928
+	{
929
+	}
930 930
 
931 931
 
932 932
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Addon.lib.php 2 patches
Indentation   +1013 added lines, -1013 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -19,1074 +19,1074 @@  discard block
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * possibly truncated version of the EE core version string
24
-     *
25
-     * @var string
26
-     */
27
-    protected static $_core_version = '';
22
+	/**
23
+	 * possibly truncated version of the EE core version string
24
+	 *
25
+	 * @var string
26
+	 */
27
+	protected static $_core_version = '';
28 28
 
29
-    /**
30
-     * Holds values for registered addons
31
-     *
32
-     * @var array
33
-     */
34
-    protected static $_settings = array();
29
+	/**
30
+	 * Holds values for registered addons
31
+	 *
32
+	 * @var array
33
+	 */
34
+	protected static $_settings = array();
35 35
 
36
-    /**
37
-     * @var  array $_incompatible_addons keys are addon SLUGS
38
-     * (first argument passed to EE_Register_Addon::register()), keys are
39
-     * their MINIMUM VERSION (with all 5 parts. Eg 1.2.3.rc.004).
40
-     * Generally this should be used sparingly, as we don't want to muddle up
41
-     * EE core with knowledge of ALL the addons out there.
42
-     * If you want NO versions of an addon to run with a certain version of core,
43
-     * it's usually best to define the addon's "min_core_version" as part of its call
44
-     * to EE_Register_Addon::register(), rather than using this array with a super high value for its
45
-     * minimum plugin version.
46
-     * @access    protected
47
-     */
48
-    protected static $_incompatible_addons = array(
49
-        'Multi_Event_Registration' => '2.0.11.rc.002',
50
-        'Promotions'               => '1.0.0.rc.084',
51
-    );
36
+	/**
37
+	 * @var  array $_incompatible_addons keys are addon SLUGS
38
+	 * (first argument passed to EE_Register_Addon::register()), keys are
39
+	 * their MINIMUM VERSION (with all 5 parts. Eg 1.2.3.rc.004).
40
+	 * Generally this should be used sparingly, as we don't want to muddle up
41
+	 * EE core with knowledge of ALL the addons out there.
42
+	 * If you want NO versions of an addon to run with a certain version of core,
43
+	 * it's usually best to define the addon's "min_core_version" as part of its call
44
+	 * to EE_Register_Addon::register(), rather than using this array with a super high value for its
45
+	 * minimum plugin version.
46
+	 * @access    protected
47
+	 */
48
+	protected static $_incompatible_addons = array(
49
+		'Multi_Event_Registration' => '2.0.11.rc.002',
50
+		'Promotions'               => '1.0.0.rc.084',
51
+	);
52 52
 
53 53
 
54
-    /**
55
-     * We should always be comparing core to a version like '4.3.0.rc.000',
56
-     * not just '4.3.0'.
57
-     * So if the addon developer doesn't provide that full version string,
58
-     * fill in the blanks for them
59
-     *
60
-     * @param string $min_core_version
61
-     * @return string always like '4.3.0.rc.000'
62
-     */
63
-    protected static function _effective_version($min_core_version)
64
-    {
65
-        // versions: 4 . 3 . 1 . p . 123
66
-        // offsets:    0 . 1 . 2 . 3 . 4
67
-        $version_parts = explode('.', $min_core_version);
68
-        //check they specified the micro version (after 2nd period)
69
-        if (! isset($version_parts[2])) {
70
-            $version_parts[2] = '0';
71
-        }
72
-        //if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
73
-        //soon we can assume that's 'rc', but this current version is 'alpha'
74
-        if (! isset($version_parts[3])) {
75
-            $version_parts[3] = 'dev';
76
-        }
77
-        if (! isset($version_parts[4])) {
78
-            $version_parts[4] = '000';
79
-        }
80
-        return implode('.', $version_parts);
81
-    }
54
+	/**
55
+	 * We should always be comparing core to a version like '4.3.0.rc.000',
56
+	 * not just '4.3.0'.
57
+	 * So if the addon developer doesn't provide that full version string,
58
+	 * fill in the blanks for them
59
+	 *
60
+	 * @param string $min_core_version
61
+	 * @return string always like '4.3.0.rc.000'
62
+	 */
63
+	protected static function _effective_version($min_core_version)
64
+	{
65
+		// versions: 4 . 3 . 1 . p . 123
66
+		// offsets:    0 . 1 . 2 . 3 . 4
67
+		$version_parts = explode('.', $min_core_version);
68
+		//check they specified the micro version (after 2nd period)
69
+		if (! isset($version_parts[2])) {
70
+			$version_parts[2] = '0';
71
+		}
72
+		//if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
73
+		//soon we can assume that's 'rc', but this current version is 'alpha'
74
+		if (! isset($version_parts[3])) {
75
+			$version_parts[3] = 'dev';
76
+		}
77
+		if (! isset($version_parts[4])) {
78
+			$version_parts[4] = '000';
79
+		}
80
+		return implode('.', $version_parts);
81
+	}
82 82
 
83 83
 
84
-    /**
85
-     * Returns whether or not the min core version requirement of the addon is met
86
-     *
87
-     * @param string $min_core_version    the minimum core version required by the addon
88
-     * @param string $actual_core_version the actual core version, optional
89
-     * @return boolean
90
-     */
91
-    public static function _meets_min_core_version_requirement(
92
-        $min_core_version,
93
-        $actual_core_version = EVENT_ESPRESSO_VERSION
94
-    ) {
95
-        return version_compare(
96
-            self::_effective_version($actual_core_version),
97
-            self::_effective_version($min_core_version),
98
-            '>='
99
-        );
100
-    }
84
+	/**
85
+	 * Returns whether or not the min core version requirement of the addon is met
86
+	 *
87
+	 * @param string $min_core_version    the minimum core version required by the addon
88
+	 * @param string $actual_core_version the actual core version, optional
89
+	 * @return boolean
90
+	 */
91
+	public static function _meets_min_core_version_requirement(
92
+		$min_core_version,
93
+		$actual_core_version = EVENT_ESPRESSO_VERSION
94
+	) {
95
+		return version_compare(
96
+			self::_effective_version($actual_core_version),
97
+			self::_effective_version($min_core_version),
98
+			'>='
99
+		);
100
+	}
101 101
 
102 102
 
103
-    /**
104
-     *    Method for registering new EE_Addons.
105
-     * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE
106
-     * AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components. However, it
107
-     * may also be called after the 'activate_plugin' action (when an addon is activated), because an activating addon
108
-     * won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired. If its called after
109
-     * 'activate_plugin', it registers the addon still, but its components are not registered
110
-     * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do
111
-     * anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns
112
-     * (so that we can detect that the addon has activated on the subsequent request)
113
-     *
114
-     * @since    4.3.0
115
-     * @param string                  $addon_name                           the EE_Addon's name. Required.
116
-     * @param  array                  $setup_args                           {                                    An
117
-     *                                                                      array of arguments provided for registering
118
-     *                                                                      the message type.
119
-     * @type  string                  $class_name                           the addon's main file name.
120
-     *                                                                      If left blank, generated from the addon
121
-     *                                                                      name, changes something like "calendar" to
122
-     *                                                                      "EE_Calendar"
123
-     * @type string                   $min_core_version                     the minimum version of EE Core that the
124
-     *       addon will work with. eg "4.8.1.rc.084"
125
-     * @type string                   $version                              the "software" version for the addon. eg
126
-     *       "1.0.0.p" for a first stable release, or "1.0.0.rc.043" for a version in progress
127
-     * @type string                   $main_file_path                       the full server path to the main file
128
-     *       loaded
129
-     *                                                                      directly by WP
130
-     * @type string                   $admin_path                           full server path to the folder where the
131
-     *       addon\'s admin files reside
132
-     * @type string                   $admin_callback                       a method to be called when the EE Admin is
133
-     *       first invoked, can be used for hooking into any admin page
134
-     * @type string                   $config_section                       the section name for this addon's
135
-     *       configuration settings section (defaults to "addons")
136
-     * @type string                   $config_class                         the class name for this addon's
137
-     *       configuration settings object
138
-     * @type string                   $config_name                          the class name for this addon's
139
-     *       configuration settings object
140
-     * @type string                   $autoloader_paths                     an array of class names and the full server
141
-     *       paths to those files. Required.
142
-     * @type string                   $autoloader_folders                   an array of  "full server paths" for any
143
-     *       folders containing classes that might be invoked by the addon
144
-     * @type string                   $dms_paths                            an array of full server paths to folders
145
-     *       that contain data migration scripts. Required.
146
-     * @type string                   $module_paths                         an array of full server paths to any
147
-     *       EED_Modules used by the addon
148
-     * @type string                   $shortcode_paths                      an array of full server paths to folders
149
-     *       that contain EES_Shortcodes
150
-     * @type string                   $widget_paths                         an array of full server paths to folders
151
-     *       that contain WP_Widgets
152
-     * @type string                   $pue_options
153
-     * @type array                    $capabilities                         an array indexed by role name
154
-     *                                                                      (i.e administrator,author ) and the values
155
-     *                                                                      are an array of caps to add to the role.
156
-     *                                                                      'administrator' => array(
157
-     *                                                                      'read_addon', 'edit_addon', etc.
158
-     *                                                                      ).
159
-     * @type EE_Meta_Capability_Map[] $capability_maps                      an array of EE_Meta_Capability_Map object
160
-     *       for any addons that need to register any special meta mapped capabilities.  Should be indexed where the
161
-     *       key is the EE_Meta_Capability_Map class name and the values are the arguments sent to the class.
162
-     * @type array                    $model_paths                          array of folders containing DB models
163
-     * @see      EE_Register_Model
164
-     * @type array                    $class_paths                          array of folders containing DB classes
165
-     * @see      EE_Register_Model
166
-     * @type array                    $model_extension_paths                array of folders containing DB model
167
-     *       extensions
168
-     * @see      EE_Register_Model_Extension
169
-     * @type array                    $class_extension_paths                array of folders containing DB class
170
-     *       extensions
171
-     * @see      EE_Register_Model_Extension
172
-     * @type array message_types {
173
-     *                                                                      An array of message types with the key as
174
-     *                                                                      the message type name and the values as
175
-     *                                                                      below:
176
-     * @type string                   $mtfilename                           The filename of the message type being
177
-     *       registered. This will be the main EE_{Messagetype_Name}_message_type class.
178
-     *                                                                      (eg.
179
-     *                                                                      EE_Declined_Registration_message_type.class.php)
180
-     *                                                                      Required.
181
-     * @type array                    $autoloadpaths                        An array of paths to add to the messages
182
-     *                                                                      autoloader for the new message type.
183
-     *                                                                      Required.
184
-     * @type array                    $messengers_to_activate_with          An array of messengers that this message
185
-     *                                                                      type should activate with. Each value in
186
-     *                                                                      the
187
-     *                                                                      array
188
-     *                                                                      should match the name property of a
189
-     *                                                                      EE_messenger. Optional.
190
-     * @type array                    $messengers_to_validate_with          An array of messengers that this message
191
-     *                                                                      type should validate with. Each value in
192
-     *                                                                      the
193
-     *                                                                      array
194
-     *                                                                      should match the name property of an
195
-     *                                                                      EE_messenger.
196
-     *                                                                      Optional.
197
-     *                                                                      }
198
-     * @type array                    $custom_post_types
199
-     * @type array                    $custom_taxonomies
200
-     * @type array                    $payment_method_paths                 each element is the folder containing the
201
-     *                                                                      EE_PMT_Base child class
202
-     *                                                                      (eg,
203
-     *                                                                      '/wp-content/plugins/my_plugin/Payomatic/'
204
-     *                                                                      which contains the files
205
-     *                                                                      EE_PMT_Payomatic.pm.php)
206
-     * @type array                    $default_terms
207
-     * @type array                    $namespace                            {
208
-     *                                                                      An array with two items for registering the
209
-     *                                                                      addon's namespace. (If, for some reason,
210
-     *                                                                      you
211
-     *                                                                      require additional namespaces, use
212
-     *                                                                      EventEspresso\core\Psr4Autoloader::addNamespace()
213
-     *                                                                      directly)
214
-     * @see      EventEspresso\core\Psr4Autoloader::addNamespace()
215
-     * @type string                   $FQNS                                 the namespace prefix
216
-     * @type string                   $DIR                                  a base directory for class files in the
217
-     *       namespace.
218
-     *                                                                      }
219
-     *                                                                      }
220
-     * @throws EE_Error
221
-     * @return void
222
-     */
223
-    public static function register($addon_name = '', $setup_args = array())
224
-    {
225
-        // required fields MUST be present, so let's make sure they are.
226
-        \EE_Register_Addon::_verify_parameters($addon_name, $setup_args);
227
-        // get class name for addon
228
-        $class_name = \EE_Register_Addon::_parse_class_name($addon_name, $setup_args);
229
-        //setup $_settings array from incoming values.
230
-        $addon_settings = \EE_Register_Addon::_get_addon_settings($class_name, $setup_args);
231
-        // setup PUE
232
-        \EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args);
233
-        // does this addon work with this version of core or WordPress ?
234
-        if (! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
235
-            return;
236
-        }
237
-        // register namespaces
238
-        \EE_Register_Addon::_setup_namespaces($addon_settings);
239
-        // check if this is an activation request
240
-        if (\EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) {
241
-            // dont bother setting up the rest of the addon atm
242
-            return;
243
-        }
244
-        // we need cars
245
-        \EE_Register_Addon::_setup_autoloaders($addon_name);
246
-        // register new models and extensions
247
-        \EE_Register_Addon::_register_models_and_extensions($addon_name);
248
-        // setup DMS
249
-        \EE_Register_Addon::_register_data_migration_scripts($addon_name);
250
-        // if config_class is present let's register config.
251
-        \EE_Register_Addon::_register_config($addon_name);
252
-        // register admin pages
253
-        \EE_Register_Addon::_register_admin_pages($addon_name);
254
-        // add to list of modules to be registered
255
-        \EE_Register_Addon::_register_modules($addon_name);
256
-        // add to list of shortcodes to be registered
257
-        \EE_Register_Addon::_register_shortcodes($addon_name);
258
-        // add to list of widgets to be registered
259
-        \EE_Register_Addon::_register_widgets($addon_name);
260
-        // register capability related stuff.
261
-        \EE_Register_Addon::_register_capabilities($addon_name);
262
-        // any message type to register?
263
-        \EE_Register_Addon::_register_message_types($addon_name);
264
-        // any custom post type/ custom capabilities or default terms to register
265
-        \EE_Register_Addon::_register_custom_post_types($addon_name);
266
-        // and any payment methods
267
-        \EE_Register_Addon::_register_payment_methods($addon_name);
268
-        // load and instantiate main addon class
269
-        $addon = \EE_Register_Addon::_load_and_init_addon_class($addon_name);
103
+	/**
104
+	 *    Method for registering new EE_Addons.
105
+	 * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE
106
+	 * AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components. However, it
107
+	 * may also be called after the 'activate_plugin' action (when an addon is activated), because an activating addon
108
+	 * won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired. If its called after
109
+	 * 'activate_plugin', it registers the addon still, but its components are not registered
110
+	 * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do
111
+	 * anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns
112
+	 * (so that we can detect that the addon has activated on the subsequent request)
113
+	 *
114
+	 * @since    4.3.0
115
+	 * @param string                  $addon_name                           the EE_Addon's name. Required.
116
+	 * @param  array                  $setup_args                           {                                    An
117
+	 *                                                                      array of arguments provided for registering
118
+	 *                                                                      the message type.
119
+	 * @type  string                  $class_name                           the addon's main file name.
120
+	 *                                                                      If left blank, generated from the addon
121
+	 *                                                                      name, changes something like "calendar" to
122
+	 *                                                                      "EE_Calendar"
123
+	 * @type string                   $min_core_version                     the minimum version of EE Core that the
124
+	 *       addon will work with. eg "4.8.1.rc.084"
125
+	 * @type string                   $version                              the "software" version for the addon. eg
126
+	 *       "1.0.0.p" for a first stable release, or "1.0.0.rc.043" for a version in progress
127
+	 * @type string                   $main_file_path                       the full server path to the main file
128
+	 *       loaded
129
+	 *                                                                      directly by WP
130
+	 * @type string                   $admin_path                           full server path to the folder where the
131
+	 *       addon\'s admin files reside
132
+	 * @type string                   $admin_callback                       a method to be called when the EE Admin is
133
+	 *       first invoked, can be used for hooking into any admin page
134
+	 * @type string                   $config_section                       the section name for this addon's
135
+	 *       configuration settings section (defaults to "addons")
136
+	 * @type string                   $config_class                         the class name for this addon's
137
+	 *       configuration settings object
138
+	 * @type string                   $config_name                          the class name for this addon's
139
+	 *       configuration settings object
140
+	 * @type string                   $autoloader_paths                     an array of class names and the full server
141
+	 *       paths to those files. Required.
142
+	 * @type string                   $autoloader_folders                   an array of  "full server paths" for any
143
+	 *       folders containing classes that might be invoked by the addon
144
+	 * @type string                   $dms_paths                            an array of full server paths to folders
145
+	 *       that contain data migration scripts. Required.
146
+	 * @type string                   $module_paths                         an array of full server paths to any
147
+	 *       EED_Modules used by the addon
148
+	 * @type string                   $shortcode_paths                      an array of full server paths to folders
149
+	 *       that contain EES_Shortcodes
150
+	 * @type string                   $widget_paths                         an array of full server paths to folders
151
+	 *       that contain WP_Widgets
152
+	 * @type string                   $pue_options
153
+	 * @type array                    $capabilities                         an array indexed by role name
154
+	 *                                                                      (i.e administrator,author ) and the values
155
+	 *                                                                      are an array of caps to add to the role.
156
+	 *                                                                      'administrator' => array(
157
+	 *                                                                      'read_addon', 'edit_addon', etc.
158
+	 *                                                                      ).
159
+	 * @type EE_Meta_Capability_Map[] $capability_maps                      an array of EE_Meta_Capability_Map object
160
+	 *       for any addons that need to register any special meta mapped capabilities.  Should be indexed where the
161
+	 *       key is the EE_Meta_Capability_Map class name and the values are the arguments sent to the class.
162
+	 * @type array                    $model_paths                          array of folders containing DB models
163
+	 * @see      EE_Register_Model
164
+	 * @type array                    $class_paths                          array of folders containing DB classes
165
+	 * @see      EE_Register_Model
166
+	 * @type array                    $model_extension_paths                array of folders containing DB model
167
+	 *       extensions
168
+	 * @see      EE_Register_Model_Extension
169
+	 * @type array                    $class_extension_paths                array of folders containing DB class
170
+	 *       extensions
171
+	 * @see      EE_Register_Model_Extension
172
+	 * @type array message_types {
173
+	 *                                                                      An array of message types with the key as
174
+	 *                                                                      the message type name and the values as
175
+	 *                                                                      below:
176
+	 * @type string                   $mtfilename                           The filename of the message type being
177
+	 *       registered. This will be the main EE_{Messagetype_Name}_message_type class.
178
+	 *                                                                      (eg.
179
+	 *                                                                      EE_Declined_Registration_message_type.class.php)
180
+	 *                                                                      Required.
181
+	 * @type array                    $autoloadpaths                        An array of paths to add to the messages
182
+	 *                                                                      autoloader for the new message type.
183
+	 *                                                                      Required.
184
+	 * @type array                    $messengers_to_activate_with          An array of messengers that this message
185
+	 *                                                                      type should activate with. Each value in
186
+	 *                                                                      the
187
+	 *                                                                      array
188
+	 *                                                                      should match the name property of a
189
+	 *                                                                      EE_messenger. Optional.
190
+	 * @type array                    $messengers_to_validate_with          An array of messengers that this message
191
+	 *                                                                      type should validate with. Each value in
192
+	 *                                                                      the
193
+	 *                                                                      array
194
+	 *                                                                      should match the name property of an
195
+	 *                                                                      EE_messenger.
196
+	 *                                                                      Optional.
197
+	 *                                                                      }
198
+	 * @type array                    $custom_post_types
199
+	 * @type array                    $custom_taxonomies
200
+	 * @type array                    $payment_method_paths                 each element is the folder containing the
201
+	 *                                                                      EE_PMT_Base child class
202
+	 *                                                                      (eg,
203
+	 *                                                                      '/wp-content/plugins/my_plugin/Payomatic/'
204
+	 *                                                                      which contains the files
205
+	 *                                                                      EE_PMT_Payomatic.pm.php)
206
+	 * @type array                    $default_terms
207
+	 * @type array                    $namespace                            {
208
+	 *                                                                      An array with two items for registering the
209
+	 *                                                                      addon's namespace. (If, for some reason,
210
+	 *                                                                      you
211
+	 *                                                                      require additional namespaces, use
212
+	 *                                                                      EventEspresso\core\Psr4Autoloader::addNamespace()
213
+	 *                                                                      directly)
214
+	 * @see      EventEspresso\core\Psr4Autoloader::addNamespace()
215
+	 * @type string                   $FQNS                                 the namespace prefix
216
+	 * @type string                   $DIR                                  a base directory for class files in the
217
+	 *       namespace.
218
+	 *                                                                      }
219
+	 *                                                                      }
220
+	 * @throws EE_Error
221
+	 * @return void
222
+	 */
223
+	public static function register($addon_name = '', $setup_args = array())
224
+	{
225
+		// required fields MUST be present, so let's make sure they are.
226
+		\EE_Register_Addon::_verify_parameters($addon_name, $setup_args);
227
+		// get class name for addon
228
+		$class_name = \EE_Register_Addon::_parse_class_name($addon_name, $setup_args);
229
+		//setup $_settings array from incoming values.
230
+		$addon_settings = \EE_Register_Addon::_get_addon_settings($class_name, $setup_args);
231
+		// setup PUE
232
+		\EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args);
233
+		// does this addon work with this version of core or WordPress ?
234
+		if (! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
235
+			return;
236
+		}
237
+		// register namespaces
238
+		\EE_Register_Addon::_setup_namespaces($addon_settings);
239
+		// check if this is an activation request
240
+		if (\EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) {
241
+			// dont bother setting up the rest of the addon atm
242
+			return;
243
+		}
244
+		// we need cars
245
+		\EE_Register_Addon::_setup_autoloaders($addon_name);
246
+		// register new models and extensions
247
+		\EE_Register_Addon::_register_models_and_extensions($addon_name);
248
+		// setup DMS
249
+		\EE_Register_Addon::_register_data_migration_scripts($addon_name);
250
+		// if config_class is present let's register config.
251
+		\EE_Register_Addon::_register_config($addon_name);
252
+		// register admin pages
253
+		\EE_Register_Addon::_register_admin_pages($addon_name);
254
+		// add to list of modules to be registered
255
+		\EE_Register_Addon::_register_modules($addon_name);
256
+		// add to list of shortcodes to be registered
257
+		\EE_Register_Addon::_register_shortcodes($addon_name);
258
+		// add to list of widgets to be registered
259
+		\EE_Register_Addon::_register_widgets($addon_name);
260
+		// register capability related stuff.
261
+		\EE_Register_Addon::_register_capabilities($addon_name);
262
+		// any message type to register?
263
+		\EE_Register_Addon::_register_message_types($addon_name);
264
+		// any custom post type/ custom capabilities or default terms to register
265
+		\EE_Register_Addon::_register_custom_post_types($addon_name);
266
+		// and any payment methods
267
+		\EE_Register_Addon::_register_payment_methods($addon_name);
268
+		// load and instantiate main addon class
269
+		$addon = \EE_Register_Addon::_load_and_init_addon_class($addon_name);
270 270
 
271
-        //delay calling after_registration hook on each addon until after all add-ons have been registered.
272
-        add_action('AHEE__EE_System__load_espresso_addons__complete', array($addon, 'after_registration'), 999);
273
-    }
271
+		//delay calling after_registration hook on each addon until after all add-ons have been registered.
272
+		add_action('AHEE__EE_System__load_espresso_addons__complete', array($addon, 'after_registration'), 999);
273
+	}
274 274
 
275 275
 
276
-    /**
277
-     * @param string $addon_name
278
-     * @param array  $setup_args
279
-     * @return void
280
-     * @throws \EE_Error
281
-     */
282
-    private static function _verify_parameters($addon_name, array $setup_args)
283
-    {
284
-        // required fields MUST be present, so let's make sure they are.
285
-        if (empty($addon_name) || ! is_array($setup_args)) {
286
-            throw new EE_Error(
287
-                __(
288
-                    'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.',
289
-                    'event_espresso'
290
-                )
291
-            );
292
-        }
293
-        if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
294
-            throw new EE_Error(
295
-                sprintf(
296
-                    __(
297
-                        'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s',
298
-                        'event_espresso'
299
-                    ),
300
-                    implode(',', array_keys($setup_args))
301
-                )
302
-            );
303
-        }
304
-        // check that addon has not already been registered with that name
305
-        if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
306
-            throw new EE_Error(
307
-                sprintf(
308
-                    __(
309
-                        'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.',
310
-                        'event_espresso'
311
-                    ),
312
-                    $addon_name
313
-                )
314
-            );
315
-        }
316
-    }
276
+	/**
277
+	 * @param string $addon_name
278
+	 * @param array  $setup_args
279
+	 * @return void
280
+	 * @throws \EE_Error
281
+	 */
282
+	private static function _verify_parameters($addon_name, array $setup_args)
283
+	{
284
+		// required fields MUST be present, so let's make sure they are.
285
+		if (empty($addon_name) || ! is_array($setup_args)) {
286
+			throw new EE_Error(
287
+				__(
288
+					'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.',
289
+					'event_espresso'
290
+				)
291
+			);
292
+		}
293
+		if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
294
+			throw new EE_Error(
295
+				sprintf(
296
+					__(
297
+						'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s',
298
+						'event_espresso'
299
+					),
300
+					implode(',', array_keys($setup_args))
301
+				)
302
+			);
303
+		}
304
+		// check that addon has not already been registered with that name
305
+		if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
306
+			throw new EE_Error(
307
+				sprintf(
308
+					__(
309
+						'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.',
310
+						'event_espresso'
311
+					),
312
+					$addon_name
313
+				)
314
+			);
315
+		}
316
+	}
317 317
 
318 318
 
319
-    /**
320
-     * @param string $addon_name
321
-     * @param array  $setup_args
322
-     * @return string
323
-     */
324
-    private static function _parse_class_name($addon_name, array $setup_args)
325
-    {
326
-        if (empty($setup_args['class_name'])) {
327
-            // generate one by first separating name with spaces
328
-            $class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
329
-            //capitalize, then replace spaces with underscores
330
-            $class_name = str_replace(' ', '_', ucwords($class_name));
331
-        } else {
332
-            $class_name = $setup_args['class_name'];
333
-        }
334
-        return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
335
-    }
319
+	/**
320
+	 * @param string $addon_name
321
+	 * @param array  $setup_args
322
+	 * @return string
323
+	 */
324
+	private static function _parse_class_name($addon_name, array $setup_args)
325
+	{
326
+		if (empty($setup_args['class_name'])) {
327
+			// generate one by first separating name with spaces
328
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
329
+			//capitalize, then replace spaces with underscores
330
+			$class_name = str_replace(' ', '_', ucwords($class_name));
331
+		} else {
332
+			$class_name = $setup_args['class_name'];
333
+		}
334
+		return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
335
+	}
336 336
 
337 337
 
338
-    /**
339
-     * @param string $class_name
340
-     * @param array  $setup_args
341
-     * @return array
342
-     */
343
-    private static function _get_addon_settings($class_name, array $setup_args)
344
-    {
345
-        //setup $_settings array from incoming values.
346
-        $addon_settings = array(
347
-            // generated from the addon name, changes something like "calendar" to "EE_Calendar"
348
-            'class_name'            => $class_name,
349
-            // the addon slug for use in URLs, etc
350
-            'plugin_slug'           => isset($setup_args['plugin_slug'])
351
-                ? (string)$setup_args['plugin_slug']
352
-                : '',
353
-            // page slug to be used when generating the "Settings" link on the WP plugin page
354
-            'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
355
-                ? (string)$setup_args['plugin_action_slug']
356
-                : '',
357
-            // the "software" version for the addon
358
-            'version'               => isset($setup_args['version'])
359
-                ? (string)$setup_args['version']
360
-                : '',
361
-            // the minimum version of EE Core that the addon will work with
362
-            'min_core_version'      => isset($setup_args['min_core_version'])
363
-                ? (string)$setup_args['min_core_version']
364
-                : '',
365
-            // the minimum version of WordPress that the addon will work with
366
-            'min_wp_version'        => isset($setup_args['min_wp_version'])
367
-                ? (string)$setup_args['min_wp_version']
368
-                : EE_MIN_WP_VER_REQUIRED,
369
-            // full server path to main file (file loaded directly by WP)
370
-            'main_file_path'        => isset($setup_args['main_file_path'])
371
-                ? (string)$setup_args['main_file_path']
372
-                : '',
373
-            // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
374
-            'admin_path'            => isset($setup_args['admin_path'])
375
-                ? (string)$setup_args['admin_path'] : '',
376
-            // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
377
-            'admin_callback'        => isset($setup_args['admin_callback'])
378
-                ? (string)$setup_args['admin_callback']
379
-                : '',
380
-            // the section name for this addon's configuration settings section (defaults to "addons")
381
-            'config_section'        => isset($setup_args['config_section'])
382
-                ? (string)$setup_args['config_section']
383
-                : 'addons',
384
-            // the class name for this addon's configuration settings object
385
-            'config_class'          => isset($setup_args['config_class'])
386
-                ? (string)$setup_args['config_class'] : '',
387
-            //the name given to the config for this addons' configuration settings object (optional)
388
-            'config_name'           => isset($setup_args['config_name'])
389
-                ? (string)$setup_args['config_name'] : '',
390
-            // an array of "class names" => "full server paths" for any classes that might be invoked by the addon
391
-            'autoloader_paths'      => isset($setup_args['autoloader_paths'])
392
-                ? (array)$setup_args['autoloader_paths']
393
-                : array(),
394
-            // an array of  "full server paths" for any folders containing classes that might be invoked by the addon
395
-            'autoloader_folders'    => isset($setup_args['autoloader_folders'])
396
-                ? (array)$setup_args['autoloader_folders']
397
-                : array(),
398
-            // array of full server paths to any EE_DMS data migration scripts used by the addon
399
-            'dms_paths'             => isset($setup_args['dms_paths'])
400
-                ? (array)$setup_args['dms_paths']
401
-                : array(),
402
-            // array of full server paths to any EED_Modules used by the addon
403
-            'module_paths'          => isset($setup_args['module_paths'])
404
-                ? (array)$setup_args['module_paths']
405
-                : array(),
406
-            // array of full server paths to any EES_Shortcodes used by the addon
407
-            'shortcode_paths'       => isset($setup_args['shortcode_paths'])
408
-                ? (array)$setup_args['shortcode_paths']
409
-                : array(),
410
-            'shortcode_fqcns' => isset($setup_args['shortcode_fqcns'])
411
-                ? (array) $setup_args['shortcode_fqcns']
412
-                : array(),
413
-            // array of full server paths to any WP_Widgets used by the addon
414
-            'widget_paths'          => isset($setup_args['widget_paths'])
415
-                ? (array)$setup_args['widget_paths']
416
-                : array(),
417
-            // array of PUE options used by the addon
418
-            'pue_options'           => isset($setup_args['pue_options'])
419
-                ? (array)$setup_args['pue_options']
420
-                : array(),
421
-            'message_types'         => isset($setup_args['message_types'])
422
-                ? (array)$setup_args['message_types']
423
-                : array(),
424
-            'capabilities'          => isset($setup_args['capabilities'])
425
-                ? (array)$setup_args['capabilities']
426
-                : array(),
427
-            'capability_maps'       => isset($setup_args['capability_maps'])
428
-                ? (array)$setup_args['capability_maps']
429
-                : array(),
430
-            'model_paths'           => isset($setup_args['model_paths'])
431
-                ? (array)$setup_args['model_paths']
432
-                : array(),
433
-            'class_paths'           => isset($setup_args['class_paths'])
434
-                ? (array)$setup_args['class_paths']
435
-                : array(),
436
-            'model_extension_paths' => isset($setup_args['model_extension_paths'])
437
-                ? (array)$setup_args['model_extension_paths']
438
-                : array(),
439
-            'class_extension_paths' => isset($setup_args['class_extension_paths'])
440
-                ? (array)$setup_args['class_extension_paths']
441
-                : array(),
442
-            'custom_post_types'     => isset($setup_args['custom_post_types'])
443
-                ? (array)$setup_args['custom_post_types']
444
-                : array(),
445
-            'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
446
-                ? (array)$setup_args['custom_taxonomies']
447
-                : array(),
448
-            'payment_method_paths'  => isset($setup_args['payment_method_paths'])
449
-                ? (array)$setup_args['payment_method_paths']
450
-                : array(),
451
-            'default_terms'         => isset($setup_args['default_terms'])
452
-                ? (array)$setup_args['default_terms']
453
-                : array(),
454
-            // if not empty, inserts a new table row after this plugin's row on the WP Plugins page
455
-            // that can be used for adding upgrading/marketing info
456
-            'plugins_page_row'      => isset($setup_args['plugins_page_row'])
457
-                ? $setup_args['plugins_page_row']
458
-                : '',
459
-            'namespace'             => isset(
460
-                $setup_args['namespace'],
461
-                $setup_args['namespace']['FQNS'],
462
-                $setup_args['namespace']['DIR']
463
-            )
464
-                ? (array)$setup_args['namespace']
465
-                : array(),
466
-        );
467
-        // if plugin_action_slug is NOT set, but an admin page path IS set,
468
-        // then let's just use the plugin_slug since that will be used for linking to the admin page
469
-        $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug'])
470
-                                                && ! empty($addon_settings['admin_path'])
471
-            ? $addon_settings['plugin_slug']
472
-            : $addon_settings['plugin_action_slug'];
473
-        // full server path to main file (file loaded directly by WP)
474
-        $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
475
-        return $addon_settings;
476
-    }
338
+	/**
339
+	 * @param string $class_name
340
+	 * @param array  $setup_args
341
+	 * @return array
342
+	 */
343
+	private static function _get_addon_settings($class_name, array $setup_args)
344
+	{
345
+		//setup $_settings array from incoming values.
346
+		$addon_settings = array(
347
+			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
348
+			'class_name'            => $class_name,
349
+			// the addon slug for use in URLs, etc
350
+			'plugin_slug'           => isset($setup_args['plugin_slug'])
351
+				? (string)$setup_args['plugin_slug']
352
+				: '',
353
+			// page slug to be used when generating the "Settings" link on the WP plugin page
354
+			'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
355
+				? (string)$setup_args['plugin_action_slug']
356
+				: '',
357
+			// the "software" version for the addon
358
+			'version'               => isset($setup_args['version'])
359
+				? (string)$setup_args['version']
360
+				: '',
361
+			// the minimum version of EE Core that the addon will work with
362
+			'min_core_version'      => isset($setup_args['min_core_version'])
363
+				? (string)$setup_args['min_core_version']
364
+				: '',
365
+			// the minimum version of WordPress that the addon will work with
366
+			'min_wp_version'        => isset($setup_args['min_wp_version'])
367
+				? (string)$setup_args['min_wp_version']
368
+				: EE_MIN_WP_VER_REQUIRED,
369
+			// full server path to main file (file loaded directly by WP)
370
+			'main_file_path'        => isset($setup_args['main_file_path'])
371
+				? (string)$setup_args['main_file_path']
372
+				: '',
373
+			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
374
+			'admin_path'            => isset($setup_args['admin_path'])
375
+				? (string)$setup_args['admin_path'] : '',
376
+			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
377
+			'admin_callback'        => isset($setup_args['admin_callback'])
378
+				? (string)$setup_args['admin_callback']
379
+				: '',
380
+			// the section name for this addon's configuration settings section (defaults to "addons")
381
+			'config_section'        => isset($setup_args['config_section'])
382
+				? (string)$setup_args['config_section']
383
+				: 'addons',
384
+			// the class name for this addon's configuration settings object
385
+			'config_class'          => isset($setup_args['config_class'])
386
+				? (string)$setup_args['config_class'] : '',
387
+			//the name given to the config for this addons' configuration settings object (optional)
388
+			'config_name'           => isset($setup_args['config_name'])
389
+				? (string)$setup_args['config_name'] : '',
390
+			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
391
+			'autoloader_paths'      => isset($setup_args['autoloader_paths'])
392
+				? (array)$setup_args['autoloader_paths']
393
+				: array(),
394
+			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
395
+			'autoloader_folders'    => isset($setup_args['autoloader_folders'])
396
+				? (array)$setup_args['autoloader_folders']
397
+				: array(),
398
+			// array of full server paths to any EE_DMS data migration scripts used by the addon
399
+			'dms_paths'             => isset($setup_args['dms_paths'])
400
+				? (array)$setup_args['dms_paths']
401
+				: array(),
402
+			// array of full server paths to any EED_Modules used by the addon
403
+			'module_paths'          => isset($setup_args['module_paths'])
404
+				? (array)$setup_args['module_paths']
405
+				: array(),
406
+			// array of full server paths to any EES_Shortcodes used by the addon
407
+			'shortcode_paths'       => isset($setup_args['shortcode_paths'])
408
+				? (array)$setup_args['shortcode_paths']
409
+				: array(),
410
+			'shortcode_fqcns' => isset($setup_args['shortcode_fqcns'])
411
+				? (array) $setup_args['shortcode_fqcns']
412
+				: array(),
413
+			// array of full server paths to any WP_Widgets used by the addon
414
+			'widget_paths'          => isset($setup_args['widget_paths'])
415
+				? (array)$setup_args['widget_paths']
416
+				: array(),
417
+			// array of PUE options used by the addon
418
+			'pue_options'           => isset($setup_args['pue_options'])
419
+				? (array)$setup_args['pue_options']
420
+				: array(),
421
+			'message_types'         => isset($setup_args['message_types'])
422
+				? (array)$setup_args['message_types']
423
+				: array(),
424
+			'capabilities'          => isset($setup_args['capabilities'])
425
+				? (array)$setup_args['capabilities']
426
+				: array(),
427
+			'capability_maps'       => isset($setup_args['capability_maps'])
428
+				? (array)$setup_args['capability_maps']
429
+				: array(),
430
+			'model_paths'           => isset($setup_args['model_paths'])
431
+				? (array)$setup_args['model_paths']
432
+				: array(),
433
+			'class_paths'           => isset($setup_args['class_paths'])
434
+				? (array)$setup_args['class_paths']
435
+				: array(),
436
+			'model_extension_paths' => isset($setup_args['model_extension_paths'])
437
+				? (array)$setup_args['model_extension_paths']
438
+				: array(),
439
+			'class_extension_paths' => isset($setup_args['class_extension_paths'])
440
+				? (array)$setup_args['class_extension_paths']
441
+				: array(),
442
+			'custom_post_types'     => isset($setup_args['custom_post_types'])
443
+				? (array)$setup_args['custom_post_types']
444
+				: array(),
445
+			'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
446
+				? (array)$setup_args['custom_taxonomies']
447
+				: array(),
448
+			'payment_method_paths'  => isset($setup_args['payment_method_paths'])
449
+				? (array)$setup_args['payment_method_paths']
450
+				: array(),
451
+			'default_terms'         => isset($setup_args['default_terms'])
452
+				? (array)$setup_args['default_terms']
453
+				: array(),
454
+			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page
455
+			// that can be used for adding upgrading/marketing info
456
+			'plugins_page_row'      => isset($setup_args['plugins_page_row'])
457
+				? $setup_args['plugins_page_row']
458
+				: '',
459
+			'namespace'             => isset(
460
+				$setup_args['namespace'],
461
+				$setup_args['namespace']['FQNS'],
462
+				$setup_args['namespace']['DIR']
463
+			)
464
+				? (array)$setup_args['namespace']
465
+				: array(),
466
+		);
467
+		// if plugin_action_slug is NOT set, but an admin page path IS set,
468
+		// then let's just use the plugin_slug since that will be used for linking to the admin page
469
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug'])
470
+												&& ! empty($addon_settings['admin_path'])
471
+			? $addon_settings['plugin_slug']
472
+			: $addon_settings['plugin_action_slug'];
473
+		// full server path to main file (file loaded directly by WP)
474
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
475
+		return $addon_settings;
476
+	}
477 477
 
478 478
 
479
-    /**
480
-     * @param string $addon_name
481
-     * @param array  $addon_settings
482
-     * @return boolean
483
-     */
484
-    private static function _addon_is_compatible($addon_name, array $addon_settings)
485
-    {
486
-        global $wp_version;
487
-        $incompatibility_message = '';
488
-        //check whether this addon version is compatible with EE core
489
-        if (
490
-            isset(EE_Register_Addon::$_incompatible_addons[$addon_name])
491
-            && ! self::_meets_min_core_version_requirement(
492
-                EE_Register_Addon::$_incompatible_addons[$addon_name],
493
-                $addon_settings['version']
494
-            )
495
-        ) {
496
-            $incompatibility_message = sprintf(
497
-                __(
498
-                    '%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon is not compatible with this version of Event Espresso.%2$sPlease upgrade your "%1$s" addon to version %3$s or newer to resolve this issue.'
499
-                ),
500
-                $addon_name,
501
-                '<br />',
502
-                EE_Register_Addon::$_incompatible_addons[$addon_name],
503
-                '<span style="font-weight: bold; color: #D54E21;">',
504
-                '</span><br />'
505
-            );
506
-        } else if (
507
-        ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())
508
-        ) {
509
-            $incompatibility_message = sprintf(
510
-                __(
511
-                    '%5$sIMPORTANT!%6$sThe Event Espresso "%1$s" addon requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-activate "%1$s".',
512
-                    'event_espresso'
513
-                ),
514
-                $addon_name,
515
-                self::_effective_version($addon_settings['min_core_version']),
516
-                self::_effective_version(espresso_version()),
517
-                '<br />',
518
-                '<span style="font-weight: bold; color: #D54E21;">',
519
-                '</span><br />'
520
-            );
521
-        } else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) {
522
-            $incompatibility_message = sprintf(
523
-                __(
524
-                    '%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.',
525
-                    'event_espresso'
526
-                ),
527
-                $addon_name,
528
-                $addon_settings['min_wp_version'],
529
-                '<br />',
530
-                '<span style="font-weight: bold; color: #D54E21;">',
531
-                '</span><br />'
532
-            );
533
-        }
534
-        if (! empty($incompatibility_message)) {
535
-            // remove 'activate' from the REQUEST
536
-            // so WP doesn't erroneously tell the user the plugin activated fine when it didn't
537
-            unset($_GET['activate'], $_REQUEST['activate']);
538
-            if (current_user_can('activate_plugins')) {
539
-                // show an error message indicating the plugin didn't activate properly
540
-                EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
541
-            }
542
-            // BAIL FROM THE ADDON REGISTRATION PROCESS
543
-            return false;
544
-        }
545
-        // addon IS compatible
546
-        return true;
547
-    }
479
+	/**
480
+	 * @param string $addon_name
481
+	 * @param array  $addon_settings
482
+	 * @return boolean
483
+	 */
484
+	private static function _addon_is_compatible($addon_name, array $addon_settings)
485
+	{
486
+		global $wp_version;
487
+		$incompatibility_message = '';
488
+		//check whether this addon version is compatible with EE core
489
+		if (
490
+			isset(EE_Register_Addon::$_incompatible_addons[$addon_name])
491
+			&& ! self::_meets_min_core_version_requirement(
492
+				EE_Register_Addon::$_incompatible_addons[$addon_name],
493
+				$addon_settings['version']
494
+			)
495
+		) {
496
+			$incompatibility_message = sprintf(
497
+				__(
498
+					'%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon is not compatible with this version of Event Espresso.%2$sPlease upgrade your "%1$s" addon to version %3$s or newer to resolve this issue.'
499
+				),
500
+				$addon_name,
501
+				'<br />',
502
+				EE_Register_Addon::$_incompatible_addons[$addon_name],
503
+				'<span style="font-weight: bold; color: #D54E21;">',
504
+				'</span><br />'
505
+			);
506
+		} else if (
507
+		! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())
508
+		) {
509
+			$incompatibility_message = sprintf(
510
+				__(
511
+					'%5$sIMPORTANT!%6$sThe Event Espresso "%1$s" addon requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-activate "%1$s".',
512
+					'event_espresso'
513
+				),
514
+				$addon_name,
515
+				self::_effective_version($addon_settings['min_core_version']),
516
+				self::_effective_version(espresso_version()),
517
+				'<br />',
518
+				'<span style="font-weight: bold; color: #D54E21;">',
519
+				'</span><br />'
520
+			);
521
+		} else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) {
522
+			$incompatibility_message = sprintf(
523
+				__(
524
+					'%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.',
525
+					'event_espresso'
526
+				),
527
+				$addon_name,
528
+				$addon_settings['min_wp_version'],
529
+				'<br />',
530
+				'<span style="font-weight: bold; color: #D54E21;">',
531
+				'</span><br />'
532
+			);
533
+		}
534
+		if (! empty($incompatibility_message)) {
535
+			// remove 'activate' from the REQUEST
536
+			// so WP doesn't erroneously tell the user the plugin activated fine when it didn't
537
+			unset($_GET['activate'], $_REQUEST['activate']);
538
+			if (current_user_can('activate_plugins')) {
539
+				// show an error message indicating the plugin didn't activate properly
540
+				EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
541
+			}
542
+			// BAIL FROM THE ADDON REGISTRATION PROCESS
543
+			return false;
544
+		}
545
+		// addon IS compatible
546
+		return true;
547
+	}
548 548
 
549 549
 
550
-    /**
551
-     * if plugin update engine is being used for auto-updates,
552
-     * then let's set that up now before going any further so that ALL addons can be updated
553
-     * (not needed if PUE is not being used)
554
-     *
555
-     * @param string $addon_name
556
-     * @param string $class_name
557
-     * @param array  $setup_args
558
-     * @return void
559
-     */
560
-    private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
561
-    {
562
-        if (! empty($setup_args['pue_options'])) {
563
-            self::$_settings[$addon_name]['pue_options'] = array(
564
-                'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
565
-                    ? (string)$setup_args['pue_options']['pue_plugin_slug']
566
-                    : 'espresso_' . strtolower($class_name),
567
-                'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
568
-                    ? (string)$setup_args['pue_options']['plugin_basename']
569
-                    : plugin_basename($setup_args['main_file_path']),
570
-                'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
571
-                    ? (string)$setup_args['pue_options']['checkPeriod']
572
-                    : '24',
573
-                'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
574
-                    ? (string)$setup_args['pue_options']['use_wp_update']
575
-                    : false,
576
-            );
577
-            add_action(
578
-                'AHEE__EE_System__brew_espresso__after_pue_init',
579
-                array('EE_Register_Addon', 'load_pue_update')
580
-            );
581
-        }
582
-    }
550
+	/**
551
+	 * if plugin update engine is being used for auto-updates,
552
+	 * then let's set that up now before going any further so that ALL addons can be updated
553
+	 * (not needed if PUE is not being used)
554
+	 *
555
+	 * @param string $addon_name
556
+	 * @param string $class_name
557
+	 * @param array  $setup_args
558
+	 * @return void
559
+	 */
560
+	private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
561
+	{
562
+		if (! empty($setup_args['pue_options'])) {
563
+			self::$_settings[$addon_name]['pue_options'] = array(
564
+				'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
565
+					? (string)$setup_args['pue_options']['pue_plugin_slug']
566
+					: 'espresso_' . strtolower($class_name),
567
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
568
+					? (string)$setup_args['pue_options']['plugin_basename']
569
+					: plugin_basename($setup_args['main_file_path']),
570
+				'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
571
+					? (string)$setup_args['pue_options']['checkPeriod']
572
+					: '24',
573
+				'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
574
+					? (string)$setup_args['pue_options']['use_wp_update']
575
+					: false,
576
+			);
577
+			add_action(
578
+				'AHEE__EE_System__brew_espresso__after_pue_init',
579
+				array('EE_Register_Addon', 'load_pue_update')
580
+			);
581
+		}
582
+	}
583 583
 
584 584
 
585
-    /**
586
-     * register namespaces right away before any other files or classes get loaded, but AFTER the version checks
587
-     *
588
-     * @param array $addon_settings
589
-     * @return void
590
-     */
591
-    private static function _setup_namespaces(array $addon_settings)
592
-    {
593
-        //
594
-        if (
595
-        isset(
596
-            $addon_settings['namespace'],
597
-            $addon_settings['namespace']['FQNS'],
598
-            $addon_settings['namespace']['DIR']
599
-        )
600
-        ) {
601
-            EE_Psr4AutoloaderInit::psr4_loader()->addNamespace(
602
-                $addon_settings['namespace']['FQNS'],
603
-                $addon_settings['namespace']['DIR']
604
-            );
605
-        }
606
-    }
585
+	/**
586
+	 * register namespaces right away before any other files or classes get loaded, but AFTER the version checks
587
+	 *
588
+	 * @param array $addon_settings
589
+	 * @return void
590
+	 */
591
+	private static function _setup_namespaces(array $addon_settings)
592
+	{
593
+		//
594
+		if (
595
+		isset(
596
+			$addon_settings['namespace'],
597
+			$addon_settings['namespace']['FQNS'],
598
+			$addon_settings['namespace']['DIR']
599
+		)
600
+		) {
601
+			EE_Psr4AutoloaderInit::psr4_loader()->addNamespace(
602
+				$addon_settings['namespace']['FQNS'],
603
+				$addon_settings['namespace']['DIR']
604
+			);
605
+		}
606
+	}
607 607
 
608 608
 
609
-    /**
610
-     * @param string $addon_name
611
-     * @param array  $addon_settings
612
-     * @return bool
613
-     */
614
-    private static function _addon_activation($addon_name, array $addon_settings)
615
-    {
616
-        // this is an activation request
617
-        if (did_action('activate_plugin')) {
618
-            //to find if THIS is the addon that was activated, just check if we have already registered it or not
619
-            //(as the newly-activated addon wasn't around the first time addons were registered).
620
-            //Note: the presence of pue_options in the addon registration options will initialize the $_settings
621
-            //property for the add-on, but the add-on is only partially initialized.  Hence, the additional check.
622
-            if (
623
-                ! isset(self::$_settings[$addon_name])
624
-                || (
625
-                    isset(self::$_settings[$addon_name]) && ! isset(self::$_settings[$addon_name]['class_name'])
626
-                )
627
-            ) {
628
-                self::$_settings[$addon_name] = $addon_settings;
629
-                $addon                        = self::_load_and_init_addon_class($addon_name);
630
-                $addon->set_activation_indicator_option();
631
-                // dont bother setting up the rest of the addon.
632
-                // we know it was just activated and the request will end soon
633
-            }
634
-            return true;
635
-        }
636
-        // make sure this was called in the right place!
637
-        if (
638
-            ! did_action('AHEE__EE_System__load_espresso_addons')
639
-            || has_filter('AHEE__EE_System__perform_activations_upgrades_and_migrations')
640
-        ) {
641
-            EE_Error::doing_it_wrong(
642
-                __METHOD__,
643
-                sprintf(
644
-                    __(
645
-                        'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.',
646
-                        'event_espresso'
647
-                    ),
648
-                    $addon_name
649
-                ),
650
-                '4.3.0'
651
-            );
652
-        }
653
-        // make sure addon settings are set correctly without overwriting anything existing
654
-        if (isset(self::$_settings[$addon_name])) {
655
-            self::$_settings[$addon_name] += $addon_settings;
656
-        } else {
657
-            self::$_settings[$addon_name] = $addon_settings;
658
-        }
659
-        return false;
660
-    }
609
+	/**
610
+	 * @param string $addon_name
611
+	 * @param array  $addon_settings
612
+	 * @return bool
613
+	 */
614
+	private static function _addon_activation($addon_name, array $addon_settings)
615
+	{
616
+		// this is an activation request
617
+		if (did_action('activate_plugin')) {
618
+			//to find if THIS is the addon that was activated, just check if we have already registered it or not
619
+			//(as the newly-activated addon wasn't around the first time addons were registered).
620
+			//Note: the presence of pue_options in the addon registration options will initialize the $_settings
621
+			//property for the add-on, but the add-on is only partially initialized.  Hence, the additional check.
622
+			if (
623
+				! isset(self::$_settings[$addon_name])
624
+				|| (
625
+					isset(self::$_settings[$addon_name]) && ! isset(self::$_settings[$addon_name]['class_name'])
626
+				)
627
+			) {
628
+				self::$_settings[$addon_name] = $addon_settings;
629
+				$addon                        = self::_load_and_init_addon_class($addon_name);
630
+				$addon->set_activation_indicator_option();
631
+				// dont bother setting up the rest of the addon.
632
+				// we know it was just activated and the request will end soon
633
+			}
634
+			return true;
635
+		}
636
+		// make sure this was called in the right place!
637
+		if (
638
+			! did_action('AHEE__EE_System__load_espresso_addons')
639
+			|| has_filter('AHEE__EE_System__perform_activations_upgrades_and_migrations')
640
+		) {
641
+			EE_Error::doing_it_wrong(
642
+				__METHOD__,
643
+				sprintf(
644
+					__(
645
+						'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.',
646
+						'event_espresso'
647
+					),
648
+					$addon_name
649
+				),
650
+				'4.3.0'
651
+			);
652
+		}
653
+		// make sure addon settings are set correctly without overwriting anything existing
654
+		if (isset(self::$_settings[$addon_name])) {
655
+			self::$_settings[$addon_name] += $addon_settings;
656
+		} else {
657
+			self::$_settings[$addon_name] = $addon_settings;
658
+		}
659
+		return false;
660
+	}
661 661
 
662 662
 
663
-    /**
664
-     * @param string $addon_name
665
-     * @return void
666
-     * @throws \EE_Error
667
-     */
668
-    private static function _setup_autoloaders($addon_name)
669
-    {
670
-        if (! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
671
-            // setup autoloader for single file
672
-            EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
673
-        }
674
-        // setup autoloaders for folders
675
-        if (! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
676
-            foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
677
-                EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
678
-            }
679
-        }
680
-    }
663
+	/**
664
+	 * @param string $addon_name
665
+	 * @return void
666
+	 * @throws \EE_Error
667
+	 */
668
+	private static function _setup_autoloaders($addon_name)
669
+	{
670
+		if (! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
671
+			// setup autoloader for single file
672
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
673
+		}
674
+		// setup autoloaders for folders
675
+		if (! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
676
+			foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
677
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
678
+			}
679
+		}
680
+	}
681 681
 
682 682
 
683
-    /**
684
-     * register new models and extensions
685
-     *
686
-     * @param string $addon_name
687
-     * @return void
688
-     * @throws \EE_Error
689
-     */
690
-    private static function _register_models_and_extensions($addon_name)
691
-    {
692
-        // register new models
693
-        if (
694
-            ! empty(self::$_settings[$addon_name]['model_paths'])
695
-            || ! empty(self::$_settings[$addon_name]['class_paths'])
696
-        ) {
697
-            EE_Register_Model::register(
698
-                $addon_name,
699
-                array(
700
-                    'model_paths' => self::$_settings[$addon_name]['model_paths'],
701
-                    'class_paths' => self::$_settings[$addon_name]['class_paths'],
702
-                )
703
-            );
704
-        }
705
-        // register model extensions
706
-        if (
707
-            ! empty(self::$_settings[$addon_name]['model_extension_paths'])
708
-            || ! empty(self::$_settings[$addon_name]['class_extension_paths'])
709
-        ) {
710
-            EE_Register_Model_Extensions::register(
711
-                $addon_name,
712
-                array(
713
-                    'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'],
714
-                    'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'],
715
-                )
716
-            );
717
-        }
718
-    }
683
+	/**
684
+	 * register new models and extensions
685
+	 *
686
+	 * @param string $addon_name
687
+	 * @return void
688
+	 * @throws \EE_Error
689
+	 */
690
+	private static function _register_models_and_extensions($addon_name)
691
+	{
692
+		// register new models
693
+		if (
694
+			! empty(self::$_settings[$addon_name]['model_paths'])
695
+			|| ! empty(self::$_settings[$addon_name]['class_paths'])
696
+		) {
697
+			EE_Register_Model::register(
698
+				$addon_name,
699
+				array(
700
+					'model_paths' => self::$_settings[$addon_name]['model_paths'],
701
+					'class_paths' => self::$_settings[$addon_name]['class_paths'],
702
+				)
703
+			);
704
+		}
705
+		// register model extensions
706
+		if (
707
+			! empty(self::$_settings[$addon_name]['model_extension_paths'])
708
+			|| ! empty(self::$_settings[$addon_name]['class_extension_paths'])
709
+		) {
710
+			EE_Register_Model_Extensions::register(
711
+				$addon_name,
712
+				array(
713
+					'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'],
714
+					'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'],
715
+				)
716
+			);
717
+		}
718
+	}
719 719
 
720 720
 
721
-    /**
722
-     * @param string $addon_name
723
-     * @return void
724
-     * @throws \EE_Error
725
-     */
726
-    private static function _register_data_migration_scripts($addon_name)
727
-    {
728
-        // setup DMS
729
-        if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
730
-            EE_Register_Data_Migration_Scripts::register(
731
-                $addon_name,
732
-                array('dms_paths' => self::$_settings[$addon_name]['dms_paths'])
733
-            );
734
-        }
735
-    }
721
+	/**
722
+	 * @param string $addon_name
723
+	 * @return void
724
+	 * @throws \EE_Error
725
+	 */
726
+	private static function _register_data_migration_scripts($addon_name)
727
+	{
728
+		// setup DMS
729
+		if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
730
+			EE_Register_Data_Migration_Scripts::register(
731
+				$addon_name,
732
+				array('dms_paths' => self::$_settings[$addon_name]['dms_paths'])
733
+			);
734
+		}
735
+	}
736 736
 
737 737
 
738
-    /**
739
-     * @param string $addon_name
740
-     * @return void
741
-     * @throws \EE_Error
742
-     */
743
-    private static function _register_config($addon_name)
744
-    {
745
-        // if config_class is present let's register config.
746
-        if (! empty(self::$_settings[$addon_name]['config_class'])) {
747
-            EE_Register_Config::register(
748
-                self::$_settings[$addon_name]['config_class'],
749
-                array(
750
-                    'config_section' => self::$_settings[$addon_name]['config_section'],
751
-                    'config_name'    => self::$_settings[$addon_name]['config_name'],
752
-                )
753
-            );
754
-        }
755
-    }
738
+	/**
739
+	 * @param string $addon_name
740
+	 * @return void
741
+	 * @throws \EE_Error
742
+	 */
743
+	private static function _register_config($addon_name)
744
+	{
745
+		// if config_class is present let's register config.
746
+		if (! empty(self::$_settings[$addon_name]['config_class'])) {
747
+			EE_Register_Config::register(
748
+				self::$_settings[$addon_name]['config_class'],
749
+				array(
750
+					'config_section' => self::$_settings[$addon_name]['config_section'],
751
+					'config_name'    => self::$_settings[$addon_name]['config_name'],
752
+				)
753
+			);
754
+		}
755
+	}
756 756
 
757 757
 
758
-    /**
759
-     * @param string $addon_name
760
-     * @return void
761
-     * @throws \EE_Error
762
-     */
763
-    private static function _register_admin_pages($addon_name)
764
-    {
765
-        if (! empty(self::$_settings[$addon_name]['admin_path'])) {
766
-            EE_Register_Admin_Page::register(
767
-                $addon_name,
768
-                array('page_path' => self::$_settings[$addon_name]['admin_path'])
769
-            );
770
-        }
771
-    }
758
+	/**
759
+	 * @param string $addon_name
760
+	 * @return void
761
+	 * @throws \EE_Error
762
+	 */
763
+	private static function _register_admin_pages($addon_name)
764
+	{
765
+		if (! empty(self::$_settings[$addon_name]['admin_path'])) {
766
+			EE_Register_Admin_Page::register(
767
+				$addon_name,
768
+				array('page_path' => self::$_settings[$addon_name]['admin_path'])
769
+			);
770
+		}
771
+	}
772 772
 
773 773
 
774
-    /**
775
-     * @param string $addon_name
776
-     * @return void
777
-     * @throws \EE_Error
778
-     */
779
-    private static function _register_modules($addon_name)
780
-    {
781
-        if (! empty(self::$_settings[$addon_name]['module_paths'])) {
782
-            EE_Register_Module::register(
783
-                $addon_name,
784
-                array('module_paths' => self::$_settings[$addon_name]['module_paths'])
785
-            );
786
-        }
787
-    }
774
+	/**
775
+	 * @param string $addon_name
776
+	 * @return void
777
+	 * @throws \EE_Error
778
+	 */
779
+	private static function _register_modules($addon_name)
780
+	{
781
+		if (! empty(self::$_settings[$addon_name]['module_paths'])) {
782
+			EE_Register_Module::register(
783
+				$addon_name,
784
+				array('module_paths' => self::$_settings[$addon_name]['module_paths'])
785
+			);
786
+		}
787
+	}
788 788
 
789 789
 
790
-    /**
791
-     * @param string $addon_name
792
-     * @return void
793
-     * @throws \EE_Error
794
-     */
795
-    private static function _register_shortcodes($addon_name)
796
-    {
797
-        if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
798
-            || ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
799
-        ) {
800
-            EE_Register_Shortcode::register(
801
-                $addon_name,
802
-                array(
803
-                    'shortcode_paths' => isset(self::$_settings[$addon_name]['shortcode_paths'])
804
-                        ? self::$_settings[$addon_name]['shortcode_paths']
805
-                        : array(),
806
-                    'shortcode_fqcns' => isset(self::$_settings[$addon_name]['shortcode_fqcns'])
807
-                        ? self::$_settings[$addon_name]['shortcode_fqcns']
808
-                        : array()
809
-                )
810
-            );
811
-        }
812
-    }
790
+	/**
791
+	 * @param string $addon_name
792
+	 * @return void
793
+	 * @throws \EE_Error
794
+	 */
795
+	private static function _register_shortcodes($addon_name)
796
+	{
797
+		if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
798
+			|| ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
799
+		) {
800
+			EE_Register_Shortcode::register(
801
+				$addon_name,
802
+				array(
803
+					'shortcode_paths' => isset(self::$_settings[$addon_name]['shortcode_paths'])
804
+						? self::$_settings[$addon_name]['shortcode_paths']
805
+						: array(),
806
+					'shortcode_fqcns' => isset(self::$_settings[$addon_name]['shortcode_fqcns'])
807
+						? self::$_settings[$addon_name]['shortcode_fqcns']
808
+						: array()
809
+				)
810
+			);
811
+		}
812
+	}
813 813
 
814 814
 
815
-    /**
816
-     * @param string $addon_name
817
-     * @return void
818
-     * @throws \EE_Error
819
-     */
820
-    private static function _register_widgets($addon_name)
821
-    {
822
-        if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
823
-            EE_Register_Widget::register(
824
-                $addon_name,
825
-                array('widget_paths' => self::$_settings[$addon_name]['widget_paths'])
826
-            );
827
-        }
828
-    }
815
+	/**
816
+	 * @param string $addon_name
817
+	 * @return void
818
+	 * @throws \EE_Error
819
+	 */
820
+	private static function _register_widgets($addon_name)
821
+	{
822
+		if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
823
+			EE_Register_Widget::register(
824
+				$addon_name,
825
+				array('widget_paths' => self::$_settings[$addon_name]['widget_paths'])
826
+			);
827
+		}
828
+	}
829 829
 
830 830
 
831
-    /**
832
-     * @param string $addon_name
833
-     * @return void
834
-     * @throws \EE_Error
835
-     */
836
-    private static function _register_capabilities($addon_name)
837
-    {
838
-        if (! empty(self::$_settings[$addon_name]['capabilities'])) {
839
-            EE_Register_Capabilities::register(
840
-                $addon_name,
841
-                array(
842
-                    'capabilities'       => self::$_settings[$addon_name]['capabilities'],
843
-                    'capability_maps'    => self::$_settings[$addon_name]['capability_maps'],
844
-                )
845
-            );
846
-        }
847
-    }
831
+	/**
832
+	 * @param string $addon_name
833
+	 * @return void
834
+	 * @throws \EE_Error
835
+	 */
836
+	private static function _register_capabilities($addon_name)
837
+	{
838
+		if (! empty(self::$_settings[$addon_name]['capabilities'])) {
839
+			EE_Register_Capabilities::register(
840
+				$addon_name,
841
+				array(
842
+					'capabilities'       => self::$_settings[$addon_name]['capabilities'],
843
+					'capability_maps'    => self::$_settings[$addon_name]['capability_maps'],
844
+				)
845
+			);
846
+		}
847
+	}
848 848
 
849 849
 
850
-    /**
851
-     * @param string $addon_name
852
-     * @return void
853
-     * @throws \EE_Error
854
-     */
855
-    private static function _register_message_types($addon_name)
856
-    {
857
-        if (! empty(self::$_settings[$addon_name]['message_types'])) {
858
-            add_action(
859
-                'EE_Brewing_Regular___messages_caf',
860
-                array('EE_Register_Addon', 'register_message_types')
861
-            );
862
-        }
863
-    }
850
+	/**
851
+	 * @param string $addon_name
852
+	 * @return void
853
+	 * @throws \EE_Error
854
+	 */
855
+	private static function _register_message_types($addon_name)
856
+	{
857
+		if (! empty(self::$_settings[$addon_name]['message_types'])) {
858
+			add_action(
859
+				'EE_Brewing_Regular___messages_caf',
860
+				array('EE_Register_Addon', 'register_message_types')
861
+			);
862
+		}
863
+	}
864 864
 
865 865
 
866
-    /**
867
-     * @param string $addon_name
868
-     * @return void
869
-     * @throws \EE_Error
870
-     */
871
-    private static function _register_custom_post_types($addon_name)
872
-    {
873
-        if (
874
-            ! empty(self::$_settings[$addon_name]['custom_post_types'])
875
-            || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])
876
-        ) {
877
-            EE_Register_CPT::register(
878
-                $addon_name,
879
-                array(
880
-                    'cpts'          => self::$_settings[$addon_name]['custom_post_types'],
881
-                    'cts'           => self::$_settings[$addon_name]['custom_taxonomies'],
882
-                    'default_terms' => self::$_settings[$addon_name]['default_terms'],
883
-                )
884
-            );
885
-        }
886
-    }
866
+	/**
867
+	 * @param string $addon_name
868
+	 * @return void
869
+	 * @throws \EE_Error
870
+	 */
871
+	private static function _register_custom_post_types($addon_name)
872
+	{
873
+		if (
874
+			! empty(self::$_settings[$addon_name]['custom_post_types'])
875
+			|| ! empty(self::$_settings[$addon_name]['custom_taxonomies'])
876
+		) {
877
+			EE_Register_CPT::register(
878
+				$addon_name,
879
+				array(
880
+					'cpts'          => self::$_settings[$addon_name]['custom_post_types'],
881
+					'cts'           => self::$_settings[$addon_name]['custom_taxonomies'],
882
+					'default_terms' => self::$_settings[$addon_name]['default_terms'],
883
+				)
884
+			);
885
+		}
886
+	}
887 887
 
888 888
 
889
-    /**
890
-     * @param string $addon_name
891
-     * @return void
892
-     * @throws \EE_Error
893
-     */
894
-    private static function _register_payment_methods($addon_name)
895
-    {
896
-        if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
897
-            EE_Register_Payment_Method::register(
898
-                $addon_name,
899
-                array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths'])
900
-            );
901
-        }
902
-    }
889
+	/**
890
+	 * @param string $addon_name
891
+	 * @return void
892
+	 * @throws \EE_Error
893
+	 */
894
+	private static function _register_payment_methods($addon_name)
895
+	{
896
+		if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
897
+			EE_Register_Payment_Method::register(
898
+				$addon_name,
899
+				array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths'])
900
+			);
901
+		}
902
+	}
903 903
 
904 904
 
905
-    /**
906
-     * Loads and instantiates the EE_Addon class and adds it onto the registry
907
-     *
908
-     * @param string $addon_name
909
-     * @return EE_Addon
910
-     */
911
-    private static function _load_and_init_addon_class($addon_name)
912
-    {
913
-        $addon = EE_Registry::instance()->load_addon(
914
-            dirname(self::$_settings[$addon_name]['main_file_path']),
915
-            self::$_settings[$addon_name]['class_name']
916
-        );
917
-        $addon->set_name($addon_name);
918
-        $addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
919
-        $addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
920
-        $addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
921
-        $addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
922
-        $addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
923
-        $addon->set_version(self::$_settings[$addon_name]['version']);
924
-        $addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
925
-        $addon->set_config_section(self::$_settings[$addon_name]['config_section']);
926
-        $addon->set_config_class(self::$_settings[$addon_name]['config_class']);
927
-        $addon->set_config_name(self::$_settings[$addon_name]['config_name']);
928
-        //unfortunately this can't be hooked in upon construction, because we don't have
929
-        //the plugin mainfile's path upon construction.
930
-        register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
931
-        // call any additional admin_callback functions during load_admin_controller hook
932
-        if (! empty(self::$_settings[$addon_name]['admin_callback'])) {
933
-            add_action(
934
-                'AHEE__EE_System__load_controllers__load_admin_controllers',
935
-                array($addon, self::$_settings[$addon_name]['admin_callback'])
936
-            );
937
-        }
938
-        return $addon;
939
-    }
905
+	/**
906
+	 * Loads and instantiates the EE_Addon class and adds it onto the registry
907
+	 *
908
+	 * @param string $addon_name
909
+	 * @return EE_Addon
910
+	 */
911
+	private static function _load_and_init_addon_class($addon_name)
912
+	{
913
+		$addon = EE_Registry::instance()->load_addon(
914
+			dirname(self::$_settings[$addon_name]['main_file_path']),
915
+			self::$_settings[$addon_name]['class_name']
916
+		);
917
+		$addon->set_name($addon_name);
918
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
919
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
920
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
921
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
922
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
923
+		$addon->set_version(self::$_settings[$addon_name]['version']);
924
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
925
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
926
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
927
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
928
+		//unfortunately this can't be hooked in upon construction, because we don't have
929
+		//the plugin mainfile's path upon construction.
930
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
931
+		// call any additional admin_callback functions during load_admin_controller hook
932
+		if (! empty(self::$_settings[$addon_name]['admin_callback'])) {
933
+			add_action(
934
+				'AHEE__EE_System__load_controllers__load_admin_controllers',
935
+				array($addon, self::$_settings[$addon_name]['admin_callback'])
936
+			);
937
+		}
938
+		return $addon;
939
+	}
940 940
 
941 941
 
942
-    /**
943
-     *    load_pue_update - Update notifications
944
-     *
945
-     * @return    void
946
-     */
947
-    public static function load_pue_update()
948
-    {
949
-        // load PUE client
950
-        require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
951
-        // cycle thru settings
952
-        foreach (self::$_settings as $settings) {
953
-            if (! empty($settings['pue_options'])) {
954
-                // initiate the class and start the plugin update engine!
955
-                new PluginUpdateEngineChecker(
956
-                // host file URL
957
-                    'https://eventespresso.com',
958
-                    // plugin slug(s)
959
-                    array(
960
-                        'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
961
-                        'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
962
-                    ),
963
-                    // options
964
-                    array(
965
-                        'apikey'            => EE_Registry::instance()->NET_CFG->core->site_license_key,
966
-                        'lang_domain'       => 'event_espresso',
967
-                        'checkPeriod'       => $settings['pue_options']['checkPeriod'],
968
-                        'option_key'        => 'site_license_key',
969
-                        'options_page_slug' => 'event_espresso',
970
-                        'plugin_basename'   => $settings['pue_options']['plugin_basename'],
971
-                        // if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP
972
-                        'use_wp_update'     => $settings['pue_options']['use_wp_update'],
973
-                    )
974
-                );
975
-            }
976
-        }
977
-    }
942
+	/**
943
+	 *    load_pue_update - Update notifications
944
+	 *
945
+	 * @return    void
946
+	 */
947
+	public static function load_pue_update()
948
+	{
949
+		// load PUE client
950
+		require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
951
+		// cycle thru settings
952
+		foreach (self::$_settings as $settings) {
953
+			if (! empty($settings['pue_options'])) {
954
+				// initiate the class and start the plugin update engine!
955
+				new PluginUpdateEngineChecker(
956
+				// host file URL
957
+					'https://eventespresso.com',
958
+					// plugin slug(s)
959
+					array(
960
+						'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
961
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
962
+					),
963
+					// options
964
+					array(
965
+						'apikey'            => EE_Registry::instance()->NET_CFG->core->site_license_key,
966
+						'lang_domain'       => 'event_espresso',
967
+						'checkPeriod'       => $settings['pue_options']['checkPeriod'],
968
+						'option_key'        => 'site_license_key',
969
+						'options_page_slug' => 'event_espresso',
970
+						'plugin_basename'   => $settings['pue_options']['plugin_basename'],
971
+						// if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP
972
+						'use_wp_update'     => $settings['pue_options']['use_wp_update'],
973
+					)
974
+				);
975
+			}
976
+		}
977
+	}
978 978
 
979 979
 
980
-    /**
981
-     * Callback for EE_Brewing_Regular__messages_caf hook used to register message types.
982
-     *
983
-     * @since 4.4.0
984
-     * @return void
985
-     * @throws \EE_Error
986
-     */
987
-    public static function register_message_types()
988
-    {
989
-        foreach (self::$_settings as $addon_name => $settings) {
990
-            if (! empty($settings['message_types'])) {
991
-                foreach ((array)$settings['message_types'] as $message_type => $message_type_settings) {
992
-                    EE_Register_Message_Type::register($message_type, $message_type_settings);
993
-                }
994
-            }
995
-        }
996
-    }
980
+	/**
981
+	 * Callback for EE_Brewing_Regular__messages_caf hook used to register message types.
982
+	 *
983
+	 * @since 4.4.0
984
+	 * @return void
985
+	 * @throws \EE_Error
986
+	 */
987
+	public static function register_message_types()
988
+	{
989
+		foreach (self::$_settings as $addon_name => $settings) {
990
+			if (! empty($settings['message_types'])) {
991
+				foreach ((array)$settings['message_types'] as $message_type => $message_type_settings) {
992
+					EE_Register_Message_Type::register($message_type, $message_type_settings);
993
+				}
994
+			}
995
+		}
996
+	}
997 997
 
998 998
 
999
-    /**
1000
-     * This deregisters an addon that was previously registered with a specific addon_name.
1001
-     *
1002
-     * @since    4.3.0
1003
-     * @param string $addon_name the name for the addon that was previously registered
1004
-     * @throws EE_Error
1005
-     * @return void
1006
-     */
1007
-    public static function deregister($addon_name = null)
1008
-    {
1009
-        if (isset(self::$_settings[$addon_name], self::$_settings[$addon_name]['class_name'])) {
1010
-            do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
1011
-            $class_name = self::$_settings[$addon_name]['class_name'];
1012
-            if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
1013
-                // setup DMS
1014
-                EE_Register_Data_Migration_Scripts::deregister($addon_name);
1015
-            }
1016
-            if (! empty(self::$_settings[$addon_name]['admin_path'])) {
1017
-                // register admin page
1018
-                EE_Register_Admin_Page::deregister($addon_name);
1019
-            }
1020
-            if (! empty(self::$_settings[$addon_name]['module_paths'])) {
1021
-                // add to list of modules to be registered
1022
-                EE_Register_Module::deregister($addon_name);
1023
-            }
1024
-            if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
1025
-                || ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
1026
-            ) {
1027
-                // add to list of shortcodes to be registered
1028
-                EE_Register_Shortcode::deregister($addon_name);
1029
-            }
1030
-            if (! empty(self::$_settings[$addon_name]['config_class'])) {
1031
-                // if config_class present let's register config.
1032
-                EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
1033
-            }
1034
-            if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
1035
-                // add to list of widgets to be registered
1036
-                EE_Register_Widget::deregister($addon_name);
1037
-            }
1038
-            if (! empty(self::$_settings[$addon_name]['model_paths'])
1039
-                ||
1040
-                ! empty(self::$_settings[$addon_name]['class_paths'])
1041
-            ) {
1042
-                // add to list of shortcodes to be registered
1043
-                EE_Register_Model::deregister($addon_name);
1044
-            }
1045
-            if (! empty(self::$_settings[$addon_name]['model_extension_paths'])
1046
-                ||
1047
-                ! empty(self::$_settings[$addon_name]['class_extension_paths'])
1048
-            ) {
1049
-                // add to list of shortcodes to be registered
1050
-                EE_Register_Model_Extensions::deregister($addon_name);
1051
-            }
1052
-            if (! empty(self::$_settings[$addon_name]['message_types'])) {
1053
-                foreach ((array)self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1054
-                    EE_Register_Message_Type::deregister($message_type);
1055
-                }
1056
-            }
1057
-            //deregister capabilities for addon
1058
-            if (
1059
-                ! empty(self::$_settings[$addon_name]['capabilities'])
1060
-                || ! empty(self::$_settings[$addon_name]['capability_maps'])
1061
-            ) {
1062
-                EE_Register_Capabilities::deregister($addon_name);
1063
-            }
1064
-            //deregister custom_post_types for addon
1065
-            if (! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1066
-                EE_Register_CPT::deregister($addon_name);
1067
-            }
1068
-            if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
1069
-                EE_Register_Payment_Method::deregister($addon_name);
1070
-            }
1071
-            remove_action(
1072
-                'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1073
-                array(EE_Registry::instance()->addons->{$class_name}, 'deactivation')
1074
-            );
1075
-            remove_action(
1076
-                'AHEE__EE_System__perform_activations_upgrades_and_migrations',
1077
-                array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required')
1078
-            );
1079
-            //remove `after_registration` call
1080
-            remove_action(
1081
-                'AHEE__EE_System__load_espresso_addons__complete',
1082
-                array(EE_Registry::instance()->addons->{$class_name}, 'after_registration'),
1083
-                999
1084
-            );
1085
-            unset(EE_Registry::instance()->addons->{$class_name}, self::$_settings[$addon_name]);
999
+	/**
1000
+	 * This deregisters an addon that was previously registered with a specific addon_name.
1001
+	 *
1002
+	 * @since    4.3.0
1003
+	 * @param string $addon_name the name for the addon that was previously registered
1004
+	 * @throws EE_Error
1005
+	 * @return void
1006
+	 */
1007
+	public static function deregister($addon_name = null)
1008
+	{
1009
+		if (isset(self::$_settings[$addon_name], self::$_settings[$addon_name]['class_name'])) {
1010
+			do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
1011
+			$class_name = self::$_settings[$addon_name]['class_name'];
1012
+			if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
1013
+				// setup DMS
1014
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
1015
+			}
1016
+			if (! empty(self::$_settings[$addon_name]['admin_path'])) {
1017
+				// register admin page
1018
+				EE_Register_Admin_Page::deregister($addon_name);
1019
+			}
1020
+			if (! empty(self::$_settings[$addon_name]['module_paths'])) {
1021
+				// add to list of modules to be registered
1022
+				EE_Register_Module::deregister($addon_name);
1023
+			}
1024
+			if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
1025
+				|| ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
1026
+			) {
1027
+				// add to list of shortcodes to be registered
1028
+				EE_Register_Shortcode::deregister($addon_name);
1029
+			}
1030
+			if (! empty(self::$_settings[$addon_name]['config_class'])) {
1031
+				// if config_class present let's register config.
1032
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
1033
+			}
1034
+			if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
1035
+				// add to list of widgets to be registered
1036
+				EE_Register_Widget::deregister($addon_name);
1037
+			}
1038
+			if (! empty(self::$_settings[$addon_name]['model_paths'])
1039
+				||
1040
+				! empty(self::$_settings[$addon_name]['class_paths'])
1041
+			) {
1042
+				// add to list of shortcodes to be registered
1043
+				EE_Register_Model::deregister($addon_name);
1044
+			}
1045
+			if (! empty(self::$_settings[$addon_name]['model_extension_paths'])
1046
+				||
1047
+				! empty(self::$_settings[$addon_name]['class_extension_paths'])
1048
+			) {
1049
+				// add to list of shortcodes to be registered
1050
+				EE_Register_Model_Extensions::deregister($addon_name);
1051
+			}
1052
+			if (! empty(self::$_settings[$addon_name]['message_types'])) {
1053
+				foreach ((array)self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1054
+					EE_Register_Message_Type::deregister($message_type);
1055
+				}
1056
+			}
1057
+			//deregister capabilities for addon
1058
+			if (
1059
+				! empty(self::$_settings[$addon_name]['capabilities'])
1060
+				|| ! empty(self::$_settings[$addon_name]['capability_maps'])
1061
+			) {
1062
+				EE_Register_Capabilities::deregister($addon_name);
1063
+			}
1064
+			//deregister custom_post_types for addon
1065
+			if (! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1066
+				EE_Register_CPT::deregister($addon_name);
1067
+			}
1068
+			if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
1069
+				EE_Register_Payment_Method::deregister($addon_name);
1070
+			}
1071
+			remove_action(
1072
+				'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1073
+				array(EE_Registry::instance()->addons->{$class_name}, 'deactivation')
1074
+			);
1075
+			remove_action(
1076
+				'AHEE__EE_System__perform_activations_upgrades_and_migrations',
1077
+				array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required')
1078
+			);
1079
+			//remove `after_registration` call
1080
+			remove_action(
1081
+				'AHEE__EE_System__load_espresso_addons__complete',
1082
+				array(EE_Registry::instance()->addons->{$class_name}, 'after_registration'),
1083
+				999
1084
+			);
1085
+			unset(EE_Registry::instance()->addons->{$class_name}, self::$_settings[$addon_name]);
1086 1086
 
1087
-            do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name);
1088
-        }
1089
-    }
1087
+			do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name);
1088
+		}
1089
+	}
1090 1090
 
1091 1091
 
1092 1092
 }
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
         // offsets:    0 . 1 . 2 . 3 . 4
67 67
         $version_parts = explode('.', $min_core_version);
68 68
         //check they specified the micro version (after 2nd period)
69
-        if (! isset($version_parts[2])) {
69
+        if ( ! isset($version_parts[2])) {
70 70
             $version_parts[2] = '0';
71 71
         }
72 72
         //if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
73 73
         //soon we can assume that's 'rc', but this current version is 'alpha'
74
-        if (! isset($version_parts[3])) {
74
+        if ( ! isset($version_parts[3])) {
75 75
             $version_parts[3] = 'dev';
76 76
         }
77
-        if (! isset($version_parts[4])) {
77
+        if ( ! isset($version_parts[4])) {
78 78
             $version_parts[4] = '000';
79 79
         }
80 80
         return implode('.', $version_parts);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         // setup PUE
232 232
         \EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args);
233 233
         // does this addon work with this version of core or WordPress ?
234
-        if (! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
234
+        if ( ! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
235 235
             return;
236 236
         }
237 237
         // register namespaces
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 )
291 291
             );
292 292
         }
293
-        if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
293
+        if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
294 294
             throw new EE_Error(
295 295
                 sprintf(
296 296
                     __(
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         } else {
332 332
             $class_name = $setup_args['class_name'];
333 333
         }
334
-        return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
334
+        return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name;
335 335
     }
336 336
 
337 337
 
@@ -348,108 +348,108 @@  discard block
 block discarded – undo
348 348
             'class_name'            => $class_name,
349 349
             // the addon slug for use in URLs, etc
350 350
             'plugin_slug'           => isset($setup_args['plugin_slug'])
351
-                ? (string)$setup_args['plugin_slug']
351
+                ? (string) $setup_args['plugin_slug']
352 352
                 : '',
353 353
             // page slug to be used when generating the "Settings" link on the WP plugin page
354 354
             'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
355
-                ? (string)$setup_args['plugin_action_slug']
355
+                ? (string) $setup_args['plugin_action_slug']
356 356
                 : '',
357 357
             // the "software" version for the addon
358 358
             'version'               => isset($setup_args['version'])
359
-                ? (string)$setup_args['version']
359
+                ? (string) $setup_args['version']
360 360
                 : '',
361 361
             // the minimum version of EE Core that the addon will work with
362 362
             'min_core_version'      => isset($setup_args['min_core_version'])
363
-                ? (string)$setup_args['min_core_version']
363
+                ? (string) $setup_args['min_core_version']
364 364
                 : '',
365 365
             // the minimum version of WordPress that the addon will work with
366 366
             'min_wp_version'        => isset($setup_args['min_wp_version'])
367
-                ? (string)$setup_args['min_wp_version']
367
+                ? (string) $setup_args['min_wp_version']
368 368
                 : EE_MIN_WP_VER_REQUIRED,
369 369
             // full server path to main file (file loaded directly by WP)
370 370
             'main_file_path'        => isset($setup_args['main_file_path'])
371
-                ? (string)$setup_args['main_file_path']
371
+                ? (string) $setup_args['main_file_path']
372 372
                 : '',
373 373
             // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
374 374
             'admin_path'            => isset($setup_args['admin_path'])
375
-                ? (string)$setup_args['admin_path'] : '',
375
+                ? (string) $setup_args['admin_path'] : '',
376 376
             // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
377 377
             'admin_callback'        => isset($setup_args['admin_callback'])
378
-                ? (string)$setup_args['admin_callback']
378
+                ? (string) $setup_args['admin_callback']
379 379
                 : '',
380 380
             // the section name for this addon's configuration settings section (defaults to "addons")
381 381
             'config_section'        => isset($setup_args['config_section'])
382
-                ? (string)$setup_args['config_section']
382
+                ? (string) $setup_args['config_section']
383 383
                 : 'addons',
384 384
             // the class name for this addon's configuration settings object
385 385
             'config_class'          => isset($setup_args['config_class'])
386
-                ? (string)$setup_args['config_class'] : '',
386
+                ? (string) $setup_args['config_class'] : '',
387 387
             //the name given to the config for this addons' configuration settings object (optional)
388 388
             'config_name'           => isset($setup_args['config_name'])
389
-                ? (string)$setup_args['config_name'] : '',
389
+                ? (string) $setup_args['config_name'] : '',
390 390
             // an array of "class names" => "full server paths" for any classes that might be invoked by the addon
391 391
             'autoloader_paths'      => isset($setup_args['autoloader_paths'])
392
-                ? (array)$setup_args['autoloader_paths']
392
+                ? (array) $setup_args['autoloader_paths']
393 393
                 : array(),
394 394
             // an array of  "full server paths" for any folders containing classes that might be invoked by the addon
395 395
             'autoloader_folders'    => isset($setup_args['autoloader_folders'])
396
-                ? (array)$setup_args['autoloader_folders']
396
+                ? (array) $setup_args['autoloader_folders']
397 397
                 : array(),
398 398
             // array of full server paths to any EE_DMS data migration scripts used by the addon
399 399
             'dms_paths'             => isset($setup_args['dms_paths'])
400
-                ? (array)$setup_args['dms_paths']
400
+                ? (array) $setup_args['dms_paths']
401 401
                 : array(),
402 402
             // array of full server paths to any EED_Modules used by the addon
403 403
             'module_paths'          => isset($setup_args['module_paths'])
404
-                ? (array)$setup_args['module_paths']
404
+                ? (array) $setup_args['module_paths']
405 405
                 : array(),
406 406
             // array of full server paths to any EES_Shortcodes used by the addon
407 407
             'shortcode_paths'       => isset($setup_args['shortcode_paths'])
408
-                ? (array)$setup_args['shortcode_paths']
408
+                ? (array) $setup_args['shortcode_paths']
409 409
                 : array(),
410 410
             'shortcode_fqcns' => isset($setup_args['shortcode_fqcns'])
411 411
                 ? (array) $setup_args['shortcode_fqcns']
412 412
                 : array(),
413 413
             // array of full server paths to any WP_Widgets used by the addon
414 414
             'widget_paths'          => isset($setup_args['widget_paths'])
415
-                ? (array)$setup_args['widget_paths']
415
+                ? (array) $setup_args['widget_paths']
416 416
                 : array(),
417 417
             // array of PUE options used by the addon
418 418
             'pue_options'           => isset($setup_args['pue_options'])
419
-                ? (array)$setup_args['pue_options']
419
+                ? (array) $setup_args['pue_options']
420 420
                 : array(),
421 421
             'message_types'         => isset($setup_args['message_types'])
422
-                ? (array)$setup_args['message_types']
422
+                ? (array) $setup_args['message_types']
423 423
                 : array(),
424 424
             'capabilities'          => isset($setup_args['capabilities'])
425
-                ? (array)$setup_args['capabilities']
425
+                ? (array) $setup_args['capabilities']
426 426
                 : array(),
427 427
             'capability_maps'       => isset($setup_args['capability_maps'])
428
-                ? (array)$setup_args['capability_maps']
428
+                ? (array) $setup_args['capability_maps']
429 429
                 : array(),
430 430
             'model_paths'           => isset($setup_args['model_paths'])
431
-                ? (array)$setup_args['model_paths']
431
+                ? (array) $setup_args['model_paths']
432 432
                 : array(),
433 433
             'class_paths'           => isset($setup_args['class_paths'])
434
-                ? (array)$setup_args['class_paths']
434
+                ? (array) $setup_args['class_paths']
435 435
                 : array(),
436 436
             'model_extension_paths' => isset($setup_args['model_extension_paths'])
437
-                ? (array)$setup_args['model_extension_paths']
437
+                ? (array) $setup_args['model_extension_paths']
438 438
                 : array(),
439 439
             'class_extension_paths' => isset($setup_args['class_extension_paths'])
440
-                ? (array)$setup_args['class_extension_paths']
440
+                ? (array) $setup_args['class_extension_paths']
441 441
                 : array(),
442 442
             'custom_post_types'     => isset($setup_args['custom_post_types'])
443
-                ? (array)$setup_args['custom_post_types']
443
+                ? (array) $setup_args['custom_post_types']
444 444
                 : array(),
445 445
             'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
446
-                ? (array)$setup_args['custom_taxonomies']
446
+                ? (array) $setup_args['custom_taxonomies']
447 447
                 : array(),
448 448
             'payment_method_paths'  => isset($setup_args['payment_method_paths'])
449
-                ? (array)$setup_args['payment_method_paths']
449
+                ? (array) $setup_args['payment_method_paths']
450 450
                 : array(),
451 451
             'default_terms'         => isset($setup_args['default_terms'])
452
-                ? (array)$setup_args['default_terms']
452
+                ? (array) $setup_args['default_terms']
453 453
                 : array(),
454 454
             // if not empty, inserts a new table row after this plugin's row on the WP Plugins page
455 455
             // that can be used for adding upgrading/marketing info
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                 $setup_args['namespace']['FQNS'],
462 462
                 $setup_args['namespace']['DIR']
463 463
             )
464
-                ? (array)$setup_args['namespace']
464
+                ? (array) $setup_args['namespace']
465 465
                 : array(),
466 466
         );
467 467
         // if plugin_action_slug is NOT set, but an admin page path IS set,
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                 '</span><br />'
532 532
             );
533 533
         }
534
-        if (! empty($incompatibility_message)) {
534
+        if ( ! empty($incompatibility_message)) {
535 535
             // remove 'activate' from the REQUEST
536 536
             // so WP doesn't erroneously tell the user the plugin activated fine when it didn't
537 537
             unset($_GET['activate'], $_REQUEST['activate']);
@@ -559,19 +559,19 @@  discard block
 block discarded – undo
559 559
      */
560 560
     private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
561 561
     {
562
-        if (! empty($setup_args['pue_options'])) {
562
+        if ( ! empty($setup_args['pue_options'])) {
563 563
             self::$_settings[$addon_name]['pue_options'] = array(
564 564
                 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
565
-                    ? (string)$setup_args['pue_options']['pue_plugin_slug']
566
-                    : 'espresso_' . strtolower($class_name),
565
+                    ? (string) $setup_args['pue_options']['pue_plugin_slug']
566
+                    : 'espresso_'.strtolower($class_name),
567 567
                 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
568
-                    ? (string)$setup_args['pue_options']['plugin_basename']
568
+                    ? (string) $setup_args['pue_options']['plugin_basename']
569 569
                     : plugin_basename($setup_args['main_file_path']),
570 570
                 'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
571
-                    ? (string)$setup_args['pue_options']['checkPeriod']
571
+                    ? (string) $setup_args['pue_options']['checkPeriod']
572 572
                     : '24',
573 573
                 'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
574
-                    ? (string)$setup_args['pue_options']['use_wp_update']
574
+                    ? (string) $setup_args['pue_options']['use_wp_update']
575 575
                     : false,
576 576
             );
577 577
             add_action(
@@ -667,13 +667,13 @@  discard block
 block discarded – undo
667 667
      */
668 668
     private static function _setup_autoloaders($addon_name)
669 669
     {
670
-        if (! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
670
+        if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
671 671
             // setup autoloader for single file
672 672
             EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
673 673
         }
674 674
         // setup autoloaders for folders
675
-        if (! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
676
-            foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
675
+        if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
676
+            foreach ((array) self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
677 677
                 EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
678 678
             }
679 679
         }
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
     private static function _register_data_migration_scripts($addon_name)
727 727
     {
728 728
         // setup DMS
729
-        if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
729
+        if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
730 730
             EE_Register_Data_Migration_Scripts::register(
731 731
                 $addon_name,
732 732
                 array('dms_paths' => self::$_settings[$addon_name]['dms_paths'])
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
     private static function _register_config($addon_name)
744 744
     {
745 745
         // if config_class is present let's register config.
746
-        if (! empty(self::$_settings[$addon_name]['config_class'])) {
746
+        if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
747 747
             EE_Register_Config::register(
748 748
                 self::$_settings[$addon_name]['config_class'],
749 749
                 array(
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
      */
763 763
     private static function _register_admin_pages($addon_name)
764 764
     {
765
-        if (! empty(self::$_settings[$addon_name]['admin_path'])) {
765
+        if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
766 766
             EE_Register_Admin_Page::register(
767 767
                 $addon_name,
768 768
                 array('page_path' => self::$_settings[$addon_name]['admin_path'])
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
      */
779 779
     private static function _register_modules($addon_name)
780 780
     {
781
-        if (! empty(self::$_settings[$addon_name]['module_paths'])) {
781
+        if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
782 782
             EE_Register_Module::register(
783 783
                 $addon_name,
784 784
                 array('module_paths' => self::$_settings[$addon_name]['module_paths'])
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
      */
795 795
     private static function _register_shortcodes($addon_name)
796 796
     {
797
-        if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
797
+        if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])
798 798
             || ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
799 799
         ) {
800 800
             EE_Register_Shortcode::register(
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
      */
820 820
     private static function _register_widgets($addon_name)
821 821
     {
822
-        if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
822
+        if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
823 823
             EE_Register_Widget::register(
824 824
                 $addon_name,
825 825
                 array('widget_paths' => self::$_settings[$addon_name]['widget_paths'])
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
      */
836 836
     private static function _register_capabilities($addon_name)
837 837
     {
838
-        if (! empty(self::$_settings[$addon_name]['capabilities'])) {
838
+        if ( ! empty(self::$_settings[$addon_name]['capabilities'])) {
839 839
             EE_Register_Capabilities::register(
840 840
                 $addon_name,
841 841
                 array(
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
      */
855 855
     private static function _register_message_types($addon_name)
856 856
     {
857
-        if (! empty(self::$_settings[$addon_name]['message_types'])) {
857
+        if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
858 858
             add_action(
859 859
                 'EE_Brewing_Regular___messages_caf',
860 860
                 array('EE_Register_Addon', 'register_message_types')
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
      */
894 894
     private static function _register_payment_methods($addon_name)
895 895
     {
896
-        if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
896
+        if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
897 897
             EE_Register_Payment_Method::register(
898 898
                 $addon_name,
899 899
                 array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths'])
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
         //the plugin mainfile's path upon construction.
930 930
         register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
931 931
         // call any additional admin_callback functions during load_admin_controller hook
932
-        if (! empty(self::$_settings[$addon_name]['admin_callback'])) {
932
+        if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) {
933 933
             add_action(
934 934
                 'AHEE__EE_System__load_controllers__load_admin_controllers',
935 935
                 array($addon, self::$_settings[$addon_name]['admin_callback'])
@@ -947,10 +947,10 @@  discard block
 block discarded – undo
947 947
     public static function load_pue_update()
948 948
     {
949 949
         // load PUE client
950
-        require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
950
+        require_once EE_THIRD_PARTY.'pue'.DS.'pue-client.php';
951 951
         // cycle thru settings
952 952
         foreach (self::$_settings as $settings) {
953
-            if (! empty($settings['pue_options'])) {
953
+            if ( ! empty($settings['pue_options'])) {
954 954
                 // initiate the class and start the plugin update engine!
955 955
                 new PluginUpdateEngineChecker(
956 956
                 // host file URL
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
                     // plugin slug(s)
959 959
                     array(
960 960
                         'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
961
-                        'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
961
+                        'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr'),
962 962
                     ),
963 963
                     // options
964 964
                     array(
@@ -987,8 +987,8 @@  discard block
 block discarded – undo
987 987
     public static function register_message_types()
988 988
     {
989 989
         foreach (self::$_settings as $addon_name => $settings) {
990
-            if (! empty($settings['message_types'])) {
991
-                foreach ((array)$settings['message_types'] as $message_type => $message_type_settings) {
990
+            if ( ! empty($settings['message_types'])) {
991
+                foreach ((array) $settings['message_types'] as $message_type => $message_type_settings) {
992 992
                     EE_Register_Message_Type::register($message_type, $message_type_settings);
993 993
                 }
994 994
             }
@@ -1009,48 +1009,48 @@  discard block
 block discarded – undo
1009 1009
         if (isset(self::$_settings[$addon_name], self::$_settings[$addon_name]['class_name'])) {
1010 1010
             do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
1011 1011
             $class_name = self::$_settings[$addon_name]['class_name'];
1012
-            if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
1012
+            if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
1013 1013
                 // setup DMS
1014 1014
                 EE_Register_Data_Migration_Scripts::deregister($addon_name);
1015 1015
             }
1016
-            if (! empty(self::$_settings[$addon_name]['admin_path'])) {
1016
+            if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
1017 1017
                 // register admin page
1018 1018
                 EE_Register_Admin_Page::deregister($addon_name);
1019 1019
             }
1020
-            if (! empty(self::$_settings[$addon_name]['module_paths'])) {
1020
+            if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
1021 1021
                 // add to list of modules to be registered
1022 1022
                 EE_Register_Module::deregister($addon_name);
1023 1023
             }
1024
-            if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
1024
+            if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])
1025 1025
                 || ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
1026 1026
             ) {
1027 1027
                 // add to list of shortcodes to be registered
1028 1028
                 EE_Register_Shortcode::deregister($addon_name);
1029 1029
             }
1030
-            if (! empty(self::$_settings[$addon_name]['config_class'])) {
1030
+            if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
1031 1031
                 // if config_class present let's register config.
1032 1032
                 EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
1033 1033
             }
1034
-            if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
1034
+            if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
1035 1035
                 // add to list of widgets to be registered
1036 1036
                 EE_Register_Widget::deregister($addon_name);
1037 1037
             }
1038
-            if (! empty(self::$_settings[$addon_name]['model_paths'])
1038
+            if ( ! empty(self::$_settings[$addon_name]['model_paths'])
1039 1039
                 ||
1040 1040
                 ! empty(self::$_settings[$addon_name]['class_paths'])
1041 1041
             ) {
1042 1042
                 // add to list of shortcodes to be registered
1043 1043
                 EE_Register_Model::deregister($addon_name);
1044 1044
             }
1045
-            if (! empty(self::$_settings[$addon_name]['model_extension_paths'])
1045
+            if ( ! empty(self::$_settings[$addon_name]['model_extension_paths'])
1046 1046
                 ||
1047 1047
                 ! empty(self::$_settings[$addon_name]['class_extension_paths'])
1048 1048
             ) {
1049 1049
                 // add to list of shortcodes to be registered
1050 1050
                 EE_Register_Model_Extensions::deregister($addon_name);
1051 1051
             }
1052
-            if (! empty(self::$_settings[$addon_name]['message_types'])) {
1053
-                foreach ((array)self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1052
+            if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
1053
+                foreach ((array) self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1054 1054
                     EE_Register_Message_Type::deregister($message_type);
1055 1055
                 }
1056 1056
             }
@@ -1062,14 +1062,14 @@  discard block
 block discarded – undo
1062 1062
                 EE_Register_Capabilities::deregister($addon_name);
1063 1063
             }
1064 1064
             //deregister custom_post_types for addon
1065
-            if (! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1065
+            if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1066 1066
                 EE_Register_CPT::deregister($addon_name);
1067 1067
             }
1068
-            if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
1068
+            if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
1069 1069
                 EE_Register_Payment_Method::deregister($addon_name);
1070 1070
             }
1071 1071
             remove_action(
1072
-                'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1072
+                'deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1073 1073
                 array(EE_Registry::instance()->addons->{$class_name}, 'deactivation')
1074 1074
             );
1075 1075
             remove_action(
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('ABSPATH')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -40,245 +40,245 @@  discard block
 block discarded – undo
40 40
  * @since            4.0
41 41
  */
42 42
 if (function_exists('espresso_version')) {
43
-    /**
44
-     *    espresso_duplicate_plugin_error
45
-     *    displays if more than one version of EE is activated at the same time
46
-     */
47
-    function espresso_duplicate_plugin_error()
48
-    {
49
-        ?>
43
+	/**
44
+	 *    espresso_duplicate_plugin_error
45
+	 *    displays if more than one version of EE is activated at the same time
46
+	 */
47
+	function espresso_duplicate_plugin_error()
48
+	{
49
+		?>
50 50
         <div class="error">
51 51
             <p>
52 52
                 <?php echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                ); ?>
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+				); ?>
56 56
             </p>
57 57
         </div>
58 58
         <?php
59
-        espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-    }
59
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+	}
61 61
 
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
-    if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
+	if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                            esc_html__(
79
-                                    'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                                    'event_espresso'
81
-                            ),
82
-                            EE_MIN_PHP_VER_REQUIRED,
83
-                            PHP_VERSION,
84
-                            '<br/>',
85
-                            '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+							esc_html__(
79
+									'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+									'event_espresso'
81
+							),
82
+							EE_MIN_PHP_VER_REQUIRED,
83
+							PHP_VERSION,
84
+							'<br/>',
85
+							'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        /**
97
-         * espresso_version
98
-         * Returns the plugin version
99
-         *
100
-         * @return string
101
-         */
102
-        function espresso_version()
103
-        {
104
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.47.rc.007');
105
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		/**
97
+		 * espresso_version
98
+		 * Returns the plugin version
99
+		 *
100
+		 * @return string
101
+		 */
102
+		function espresso_version()
103
+		{
104
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.47.rc.007');
105
+		}
106 106
 
107
-        // define versions
108
-        define('EVENT_ESPRESSO_VERSION', espresso_version());
109
-        define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
-        define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
-        define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
-        //used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
-        if ( ! defined('DS')) {
115
-            define('DS', '/');
116
-        }
117
-        if ( ! defined('PS')) {
118
-            define('PS', PATH_SEPARATOR);
119
-        }
120
-        if ( ! defined('SP')) {
121
-            define('SP', ' ');
122
-        }
123
-        if ( ! defined('EENL')) {
124
-            define('EENL', "\n");
125
-        }
126
-        define('EE_SUPPORT_EMAIL', '[email protected]');
127
-        // define the plugin directory and URL
128
-        define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
-        define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
-        define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
-        // main root folder paths
132
-        define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
-        define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
-        define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
-        define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
-        define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
-        define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
-        define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
-        define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
-        // core system paths
141
-        define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
-        define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
-        define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
-        define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
-        define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
-        define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
-        define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
-        define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
-        define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
-        define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
-        define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
-        define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
-        // gateways
154
-        define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
-        define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
-        // asset URL paths
157
-        define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
-        define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
-        define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
-        define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
-        define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
-        define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
-        // define upload paths
164
-        $uploads = wp_upload_dir();
165
-        // define the uploads directory and URL
166
-        define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
-        define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
-        // define the templates directory and URL
169
-        define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
-        define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
-        // define the gateway directory and URL
172
-        define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
-        define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
-        // languages folder/path
175
-        define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
-        define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
-        //check for dompdf fonts in uploads
178
-        if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
-            define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
-        }
181
-        //ajax constants
182
-        define(
183
-                'EE_FRONT_AJAX',
184
-                isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
-        );
186
-        define(
187
-                'EE_ADMIN_AJAX',
188
-                isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
-        );
190
-        //just a handy constant occasionally needed for finding values representing infinity in the DB
191
-        //you're better to use this than its straight value (currently -1) in case you ever
192
-        //want to change its default value! or find when -1 means infinity
193
-        define('EE_INF_IN_DB', -1);
194
-        define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
-        define('EE_DEBUG', false);
196
-        // for older WP versions
197
-        if ( ! defined('MONTH_IN_SECONDS')) {
198
-            define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
-        }
200
-        /**
201
-         *    espresso_plugin_activation
202
-         *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
-         */
204
-        function espresso_plugin_activation()
205
-        {
206
-            update_option('ee_espresso_activation', true);
207
-        }
107
+		// define versions
108
+		define('EVENT_ESPRESSO_VERSION', espresso_version());
109
+		define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
+		define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
+		define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
+		//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
+		if ( ! defined('DS')) {
115
+			define('DS', '/');
116
+		}
117
+		if ( ! defined('PS')) {
118
+			define('PS', PATH_SEPARATOR);
119
+		}
120
+		if ( ! defined('SP')) {
121
+			define('SP', ' ');
122
+		}
123
+		if ( ! defined('EENL')) {
124
+			define('EENL', "\n");
125
+		}
126
+		define('EE_SUPPORT_EMAIL', '[email protected]');
127
+		// define the plugin directory and URL
128
+		define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
+		define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
+		define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
+		// main root folder paths
132
+		define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
+		define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
+		define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
+		define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
+		define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
+		define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
+		define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
+		define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
+		// core system paths
141
+		define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
+		define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
+		define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
+		define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
+		define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
+		define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
+		define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
+		define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
+		define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
+		define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
+		define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
+		define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
+		// gateways
154
+		define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
+		define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
+		// asset URL paths
157
+		define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
+		define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
+		define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
+		define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
+		define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
+		define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
+		// define upload paths
164
+		$uploads = wp_upload_dir();
165
+		// define the uploads directory and URL
166
+		define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
+		define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
+		// define the templates directory and URL
169
+		define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
+		define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
+		// define the gateway directory and URL
172
+		define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
+		define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
+		// languages folder/path
175
+		define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
+		define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
+		//check for dompdf fonts in uploads
178
+		if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
+			define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
+		}
181
+		//ajax constants
182
+		define(
183
+				'EE_FRONT_AJAX',
184
+				isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
+		);
186
+		define(
187
+				'EE_ADMIN_AJAX',
188
+				isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
+		);
190
+		//just a handy constant occasionally needed for finding values representing infinity in the DB
191
+		//you're better to use this than its straight value (currently -1) in case you ever
192
+		//want to change its default value! or find when -1 means infinity
193
+		define('EE_INF_IN_DB', -1);
194
+		define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
+		define('EE_DEBUG', false);
196
+		// for older WP versions
197
+		if ( ! defined('MONTH_IN_SECONDS')) {
198
+			define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
+		}
200
+		/**
201
+		 *    espresso_plugin_activation
202
+		 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
+		 */
204
+		function espresso_plugin_activation()
205
+		{
206
+			update_option('ee_espresso_activation', true);
207
+		}
208 208
 
209
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
-        /**
211
-         *    espresso_load_error_handling
212
-         *    this function loads EE's class for handling exceptions and errors
213
-         */
214
-        function espresso_load_error_handling()
215
-        {
216
-            // load debugging tools
217
-            if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
-                require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
-                EEH_Debug_Tools::instance();
220
-            }
221
-            // load error handling
222
-            if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
-                require_once(EE_CORE . 'EE_Error.core.php');
224
-            } else {
225
-                wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
-            }
227
-        }
209
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
+		/**
211
+		 *    espresso_load_error_handling
212
+		 *    this function loads EE's class for handling exceptions and errors
213
+		 */
214
+		function espresso_load_error_handling()
215
+		{
216
+			// load debugging tools
217
+			if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
+				require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
+				EEH_Debug_Tools::instance();
220
+			}
221
+			// load error handling
222
+			if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
+				require_once(EE_CORE . 'EE_Error.core.php');
224
+			} else {
225
+				wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
+			}
227
+		}
228 228
 
229
-        /**
230
-         *    espresso_load_required
231
-         *    given a class name and path, this function will load that file or throw an exception
232
-         *
233
-         * @param    string $classname
234
-         * @param    string $full_path_to_file
235
-         * @throws    EE_Error
236
-         */
237
-        function espresso_load_required($classname, $full_path_to_file)
238
-        {
239
-            static $error_handling_loaded = false;
240
-            if ( ! $error_handling_loaded) {
241
-                espresso_load_error_handling();
242
-                $error_handling_loaded = true;
243
-            }
244
-            if (is_readable($full_path_to_file)) {
245
-                require_once($full_path_to_file);
246
-            } else {
247
-                throw new EE_Error (
248
-                        sprintf(
249
-                                esc_html__(
250
-                                        'The %s class file could not be located or is not readable due to file permissions.',
251
-                                        'event_espresso'
252
-                                ),
253
-                                $classname
254
-                        )
255
-                );
256
-            }
257
-        }
229
+		/**
230
+		 *    espresso_load_required
231
+		 *    given a class name and path, this function will load that file or throw an exception
232
+		 *
233
+		 * @param    string $classname
234
+		 * @param    string $full_path_to_file
235
+		 * @throws    EE_Error
236
+		 */
237
+		function espresso_load_required($classname, $full_path_to_file)
238
+		{
239
+			static $error_handling_loaded = false;
240
+			if ( ! $error_handling_loaded) {
241
+				espresso_load_error_handling();
242
+				$error_handling_loaded = true;
243
+			}
244
+			if (is_readable($full_path_to_file)) {
245
+				require_once($full_path_to_file);
246
+			} else {
247
+				throw new EE_Error (
248
+						sprintf(
249
+								esc_html__(
250
+										'The %s class file could not be located or is not readable due to file permissions.',
251
+										'event_espresso'
252
+								),
253
+								$classname
254
+						)
255
+				);
256
+			}
257
+		}
258 258
 
259
-        espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
-        espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
-        espresso_load_required('EE_Psr4AutoloaderInit', EE_CORE . 'EE_Psr4AutoloaderInit.core.php');
262
-        new EE_Psr4AutoloaderInit();
263
-        espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
264
-        new EE_Bootstrap();
265
-    }
259
+		espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
+		espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
+		espresso_load_required('EE_Psr4AutoloaderInit', EE_CORE . 'EE_Psr4AutoloaderInit.core.php');
262
+		new EE_Psr4AutoloaderInit();
263
+		espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
264
+		new EE_Bootstrap();
265
+	}
266 266
 }
267 267
 if ( ! function_exists('espresso_deactivate_plugin')) {
268
-    /**
269
-     *    deactivate_plugin
270
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
271
-     *
272
-     * @access public
273
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
274
-     * @return    void
275
-     */
276
-    function espresso_deactivate_plugin($plugin_basename = '')
277
-    {
278
-        if ( ! function_exists('deactivate_plugins')) {
279
-            require_once(ABSPATH . 'wp-admin/includes/plugin.php');
280
-        }
281
-        unset($_GET['activate'], $_REQUEST['activate']);
282
-        deactivate_plugins($plugin_basename);
283
-    }
268
+	/**
269
+	 *    deactivate_plugin
270
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
271
+	 *
272
+	 * @access public
273
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
274
+	 * @return    void
275
+	 */
276
+	function espresso_deactivate_plugin($plugin_basename = '')
277
+	{
278
+		if ( ! function_exists('deactivate_plugins')) {
279
+			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
280
+		}
281
+		unset($_GET['activate'], $_REQUEST['activate']);
282
+		deactivate_plugins($plugin_basename);
283
+	}
284 284
 }
285 285
\ No newline at end of file
Please login to merge, or discard this patch.